Update locateFile to a fix critical bug in vite
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ffmpeg/ffmpeg",
|
||||
"version": "0.12.2",
|
||||
"version": "0.12.3",
|
||||
"description": "FFmpeg WebAssembly version for browser",
|
||||
"main": "./dist/umd/ffmpeg.js",
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
|
||||
@@ -70,12 +70,10 @@ const load = async ({
|
||||
|
||||
ffmpeg = await (self as WorkerGlobalScope).createFFmpegCore({
|
||||
// Fix `Overload resolution failed.` when using multi-threaded ffmpeg-core.
|
||||
mainScriptUrlOrBlob: coreURL,
|
||||
locateFile: (path: string, prefix: string): string => {
|
||||
if (path.endsWith(".wasm")) return wasmURL;
|
||||
if (path.endsWith(".worker.js")) return workerURL;
|
||||
return prefix + path;
|
||||
},
|
||||
// Encoded wasmURL and workerURL in the URL as a hack to fix locateFile issue.
|
||||
mainScriptUrlOrBlob: `${coreURL}#${btoa(
|
||||
JSON.stringify({ wasmURL, workerURL })
|
||||
)}`,
|
||||
});
|
||||
ffmpeg.setLogger((data) =>
|
||||
self.postMessage({ type: FFMessageType.LOG, data })
|
||||
|
||||
Reference in New Issue
Block a user