Update locateFile to a fix critical bug in vite

This commit is contained in:
Jerome Wu
2023-08-09 17:19:44 +08:00
parent 716a229ecb
commit f0fda4cd9b
7 changed files with 52 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@ffmpeg/core-mt",
"version": "0.12.1",
"version": "0.12.2",
"description": "FFmpeg WebAssembly version (multi thread)",
"main": "./dist/umd/ffmpeg-core.js",
"exports": {

View File

@@ -1,6 +1,6 @@
{
"name": "@ffmpeg/core",
"version": "0.12.1",
"version": "0.12.2",
"description": "FFmpeg WebAssembly version (single thread)",
"main": "./dist/umd/ffmpeg-core.js",
"exports": {

View File

@@ -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",

View File

@@ -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 })