Merge pull request #375 from astraldigital/more-path-options
add `wasmPath` & `workerPath` as browser options
This commit is contained in:
		
						commit
						733e3582a8
					
				| @ -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') { | ||||
|  | ||||
							
								
								
									
										4
									
								
								src/index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								src/index.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -17,6 +17,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) */ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 jeromewu
						jeromewu