ffmpeg.wasm
ffmpeg.wasm copied to clipboard
Bug with WebWorker loading of 814.ffmpeg.js + solution
Describe the bug
There are two errors I get NS_ERROR_BLOCKED_BY_POLICY
or something like incorrect origin. This bug when creating new Worker()
from multithreaded 814.ffmpeg.js
URL
To Reproduce Idk, just upload to server and try to use
Expected behavior WebWorker starting without problems
- Browser Firefox
Additional context
So I found solution, in ffmpeg/package/dist/umd/ffmpeg.js
instead of:
new Worker(new URL(e.p + e.u(814), e.b),{ type: void 0 })
use:
new Worker(getWorkerURL(new URL(e.p + e.u(814), e.b)),{ type: void 0 })
and getWorkerURL
function:
function getWorkerURL(e) {
const t = `importScripts( "${e}" );`;
return URL.createObjectURL(new Blob([t], { type: "text/javascript" }));
}
Don't know where I can fix this in whole source code, so leave this as issue. Think that can help someone.
hi May I ask how you solved this problem locally?
hi
May I ask how you solved this problem locally?
hi, put ffmpeg.js into prettifier, then found line of code where worker starts from remote url, then convert remote url to Blob object