Skip to content

Commit a174d04

Browse files
committed
Proof of concept to let ffmpeg.wasm work in angular
1 parent 97ef9aa commit a174d04

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

packages/ffmpeg/src/classes.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,15 @@ export class FFmpeg {
163163
*/
164164
public load = (config: FFMessageLoadConfig = {}): Promise<IsFirst> => {
165165
if (!this.#worker) {
166-
this.#worker = new Worker(new URL("./worker.js", import.meta.url), {
167-
type: "module",
168-
});
166+
if (!config.workerLoadURL) {
167+
this.#worker = new Worker(new URL("./worker.js", import.meta.url), {
168+
type: "module",
169+
});
170+
} else {
171+
this.#worker = new Worker(config.workerLoadURL, {
172+
type: "module",
173+
});
174+
}
169175
this.#registerHandlers();
170176
}
171177
return this.#send({

packages/ffmpeg/src/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export interface FFMessageLoadConfig {
2222
* @defaultValue `https://unpkg.com/@ffmpeg/core-mt@${CORE_VERSION}/dist/umd/ffmpeg-core.worker.js`;
2323
*/
2424
workerURL?: string;
25+
/**
26+
* `worker.js` URL.
27+
*
28+
* @defaultValue `new URL('./worker.js')`;
29+
*/
30+
workerLoadURL?: string;
2531
}
2632

2733
export interface FFMessageExecData {

0 commit comments

Comments
 (0)