Skip to content

Commit 2a645b6

Browse files
committed
add wasmPath & workerPath as browser options
1 parent 2d6fae8 commit 2a645b6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/browser/getCreateFFmpegCore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const toBlobURL = async (url, mimeType) => {
1919
return blobURL;
2020
};
2121

22-
module.exports = async ({ corePath: _corePath }) => {
22+
module.exports = async ({ corePath: _corePath, workerPath: _workerPath, wasmPath: _wasmPath }) => {
2323
if (typeof _corePath !== 'string') {
2424
throw Error('corePath should be a string!');
2525
}
@@ -29,11 +29,11 @@ module.exports = async ({ corePath: _corePath }) => {
2929
'application/javascript',
3030
);
3131
const wasmPath = await toBlobURL(
32-
coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),
32+
_wasmPath !== undefined ? _wasmPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),
3333
'application/wasm',
3434
);
3535
const workerPath = await toBlobURL(
36-
coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),
36+
_workerPath !== undefined ? _workerPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),
3737
'application/javascript',
3838
);
3939
if (typeof createFFmpegCore === 'undefined') {

src/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ type ProgressCallback = (progressParams: { ratio: number }) => any;
1414
export interface CreateFFmpegOptions {
1515
/** path for ffmpeg-core.js script */
1616
corePath?: string;
17+
/** path for ffmpeg-worker.js script */
18+
workerPath?: string;
19+
/** path for ffmpeg-core.wasm script */
20+
wasmPath?: string;
1721
/** a boolean to turn on all logs, default is false */
1822
log?: boolean;
1923
/** a function to get log messages, a quick example is ({ message }) => console.log(message) */

0 commit comments

Comments
 (0)