()
| 111 | }; |
| 112 | |
| 113 | const processVideo = async () => { |
| 114 | if (!file) return; |
| 115 | |
| 116 | setIsProcessing(true); |
| 117 | setError(null); |
| 118 | setProgress(0); |
| 119 | |
| 120 | const action = selectedSpeed < 1 ? "slowing_down" : "speeding_up"; |
| 121 | trackEvent(`speed_controller_${action}_started`, { |
| 122 | fileSize: file.size, |
| 123 | fileName: file.name, |
| 124 | speedFactor: selectedSpeed, |
| 125 | }); |
| 126 | |
| 127 | try { |
| 128 | console.log(`Starting video speed adjustment: ${selectedSpeed}x`); |
| 129 | console.log(`Input file: ${file.name}, size: ${file.size} bytes`); |
| 130 | |
| 131 | const fileUrl = URL.createObjectURL(file); |
| 132 | await adjustVideoSpeed(fileUrl); |
| 133 | URL.revokeObjectURL(fileUrl); |
| 134 | } catch (err: any) { |
| 135 | console.error("Detailed processing error:", err); |
| 136 | |
| 137 | let errorMessage = "Processing failed: "; |
| 138 | if (err.message) { |
| 139 | errorMessage += err.message; |
| 140 | } else if (typeof err === "string") { |
| 141 | errorMessage += err; |
| 142 | } else { |
| 143 | errorMessage += "Unknown error occurred during processing"; |
| 144 | } |
| 145 | |
| 146 | setError(errorMessage); |
| 147 | |
| 148 | trackEvent(`speed_controller_${action}_failed`, { |
| 149 | fileSize: file.size, |
| 150 | fileName: file.name, |
| 151 | error: err.message || "Unknown error", |
| 152 | speedFactor: selectedSpeed, |
| 153 | }); |
| 154 | } finally { |
| 155 | setIsProcessing(false); |
| 156 | } |
| 157 | }; |
| 158 | |
| 159 | const adjustVideoSpeed = async (videoUrl: string): Promise<void> => { |
| 160 | return new Promise((resolve, reject) => { |
nothing calls this directly
no test coverage detected