-
-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export ffmpeg-core.worker.js for core package #767
Comments
Hey I'm struggling a lot to get this working (using However, once I start giving my own URLs and converting to blob URLs, both dev and prod start crashing for errors that are hard to understand. For example, ffmpeg.wasm/packages/ffmpeg/src/worker.ts Line 66 in ae1cdac
it just throws this error, but it would be nice if it returned the exception itself. I've no way to know why it's crashing, and DevTools don't let me go there either, since it's a module. The -- Anyway - reading your Issue above, are you saying that I was looking at the code, and it seems that only But I was setting And the code references it as being bundled by webpack: ffmpeg.wasm/packages/ffmpeg/src/classes.ts Lines 191 to 199 in ae1cdac
I'm so confused!! |
Alright... it was very hard to get this working when you want to host all the files, but I was able in the end. There are indeed issues with the way the worker loads and gets bundled, so I had to create some patches in the gulpfile. And it's not easy at all to debug errors happening in the ffmpeg modules, especially due to a Here's how I have it, for now... const loadFFmpeg = async () => {
const coreURL = await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript');
const workerURL = await toBlobURL(`${baseURL}/ffmpeg-worker.js`, 'text/javascript');
const wasmURL = await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm');
const ffmpeg = new FFmpeg();
await ffmpeg.load({
coreURL,
wasmURL,
workerURL
});
return ffmpeg;
}; Then these replaces in the gulpfile, against the main bundle... .replace('r?new Worker(new URL(r,"."),{type:"module"}):new Worker(new URL(t.p+t.u(138),t.b),{type:void 0})', 'new Worker(r,{type:void 0})')
.replace('classWorkerURL:r', 'workerURL:r') |
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:but since the
core
package does not produce thisffmpeg-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 affmpeg-core.worker.js
artifact for the single threadedcore
package.Describe alternatives you've considered
worker.js
,const.js
anderrors.js
files 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!
The text was updated successfully, but these errors were encountered: