In order to run the single threaded worker, we need to either serve the built worker.js file and its dependencies on the domain where the worker will be instantiated OR blobify (via toBlobURL()) a compiled worker asset.
The core-mt package makes this possible via:
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm'
ffmpeg = new FFmpeg();
const [coreURL, wasmURL, workerURL] = await Promise.all([
toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm'),
toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, 'text/javascript'),
]);
await ffmpeg.load({ coreURL, wasmURL, workerURL, classWorkerURL: workerURL });
but since the core package does not produce this ffmpeg-core.worker.js artifact, we have to create our own (basically a concatenation of worker.js + const.js + errors.js -> ffmpeg-core.worker.js)
Describe the solution you'd like
Like you're already doing with the core-mt package, create and publish a ffmpeg-core.worker.js artifact for the single threaded core package.
Describe alternatives you've considered
- We're not ready to try the multithreaded solution
- The workaround noted here about hosting the
worker.js, const.js and errors.js files on the our domain is error prone
Additional context
We think this is a reasonable alternative to perhaps bigger refactors proposed elsewhere: #617
Thank you for this great library and for your time and attention!
In order to run the single threaded worker, we need to either serve the built worker.js file and its dependencies on the domain where the worker will be instantiated OR blobify (via
toBlobURL()) a compiled worker asset.The
core-mtpackage makes this possible via:but since the
corepackage does not produce thisffmpeg-core.worker.jsartifact, we have to create our own (basically a concatenation of worker.js + const.js + errors.js -> ffmpeg-core.worker.js)Describe the solution you'd like
Like you're already doing with the
core-mtpackage, create and publish affmpeg-core.worker.jsartifact for the single threadedcorepackage.Describe alternatives you've considered
worker.js,const.jsanderrors.jsfiles on the our domain is error proneAdditional context
We think this is a reasonable alternative to perhaps bigger refactors proposed elsewhere: #617
Thank you for this great library and for your time and attention!