ffmpegwasm / ffmpegwasm/ffmpeg.wasm

Bug with WebWorker loading of 814.ffmpeg.js + solution

Open
#694 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
C
Stars
17.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

**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:
```js
new Worker(new URL(e.p + e.u(814), e.b),{ type: void 0 })
```
use:
```js
new Worker(getWorkerURL(new URL(e.p + e.u(814), e.b)),{ type: void 0 })
```

and `getWorkerURL` function:
```js
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.