Skip to content

Commit cad55a0

Browse files
authored
Merge pull request #375 from astraldigital/more-path-options
add `wasmPath` & `workerPath` as browser options
2 parents c12099a + 2a645b6 commit cad55a0

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
@@ -17,6 +17,10 @@ type ProgressCallback = (progressParams: { ratio: number }) => any;
1717
export interface CreateFFmpegOptions {
1818
/** path for ffmpeg-core.js script */
1919
corePath?: string;
20+
/** path for ffmpeg-worker.js script */
21+
workerPath?: string;
22+
/** path for ffmpeg-core.wasm script */
23+
wasmPath?: string;
2024
/** a boolean to turn on all logs, default is false */
2125
log?: boolean;
2226
/** a function to get log messages, a quick example is ({ message }) => console.log(message) */

0 commit comments

Comments
 (0)