Same
This commit is contained in:
parent
37f1a7b630
commit
b1e9f863d7
1 changed files with 10 additions and 6 deletions
|
@ -12,7 +12,7 @@ import { type DedicatedFFmpegWorker } from "worker/ffmpeg.worker";
|
|||
|
||||
/** Called during upload */
|
||||
export async function generateVideoThumbnail(
|
||||
file: File | ElectronFile,
|
||||
fileOrPath: File | ElectronFile | string,
|
||||
): Promise<File | ElectronFile> {
|
||||
let seekTime = 1;
|
||||
while (seekTime >= 0) {
|
||||
|
@ -161,20 +161,24 @@ export async function convertToMP4(file: File) {
|
|||
* 10-20x faster than the wasm one currently. See: [Note: ffmpeg in Electron].
|
||||
*/
|
||||
const ffmpegExec = async (
|
||||
cmd: string[],
|
||||
command: string[],
|
||||
inputFile: File | ElectronFile,
|
||||
outputFilename: string,
|
||||
outputFileName: string,
|
||||
timeoutMS: number = 0,
|
||||
): Promise<File | ElectronFile> => {
|
||||
const electron = globalThis.electron;
|
||||
if (electron || false) {
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
// return electron.runFFmpegCmd(cmd, inputFile, outputFilename, timeoutMS);
|
||||
return electron.ffmpegExec(
|
||||
command,
|
||||
inputDataOrPath,
|
||||
outputFileName,
|
||||
timeoutMS
|
||||
)
|
||||
} else {
|
||||
return workerFactory
|
||||
.instance()
|
||||
.then((worker) =>
|
||||
worker.run(cmd, inputFile, outputFilename, timeoutMS),
|
||||
worker.execute(command, inputFile, outputFileName, timeoutMS),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue