diff --git a/src/browser/getCreateFFmpegCore.js b/src/browser/getCreateFFmpegCore.js index f31167e..b402348 100644 --- a/src/browser/getCreateFFmpegCore.js +++ b/src/browser/getCreateFFmpegCore.js @@ -19,7 +19,7 @@ const toBlobURL = async (url, mimeType) => { return blobURL; }; -module.exports = async ({ corePath: _corePath }) => { +module.exports = async ({ corePath: _corePath, workerPath: _workerPath, wasmPath: _wasmPath }) => { if (typeof _corePath !== 'string') { throw Error('corePath should be a string!'); } @@ -29,11 +29,11 @@ module.exports = async ({ corePath: _corePath }) => { 'application/javascript', ); const wasmPath = await toBlobURL( - coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'), + _wasmPath !== undefined ? _wasmPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'), 'application/wasm', ); const workerPath = await toBlobURL( - coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'), + _workerPath !== undefined ? _workerPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'), 'application/javascript', ); if (typeof createFFmpegCore === 'undefined') { diff --git a/src/index.d.ts b/src/index.d.ts index 5d0b749..6d79c45 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -14,6 +14,10 @@ type ProgressCallback = (progressParams: { ratio: number }) => any; export interface CreateFFmpegOptions { /** path for ffmpeg-core.js script */ corePath?: string; + /** path for ffmpeg-worker.js script */ + workerPath?: string; + /** path for ffmpeg-core.wasm script */ + wasmPath?: string; /** a boolean to turn on all logs, default is false */ log?: boolean; /** a function to get log messages, a quick example is ({ message }) => console.log(message) */