Refactor to import createFFmpegCore using importScripts in worker context

This commit is contained in:
Nathan Johnson 2022-04-04 22:14:45 -05:00
parent 6e99e5f96f
commit 74ca423df2

View File

@ -39,10 +39,10 @@ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScop
); );
if (typeof createFFmpegCore === 'undefined') { if (typeof createFFmpegCore === 'undefined') {
return new Promise((resolve) => { return new Promise((resolve) => {
globalThis.importScripts(corePath);
if (typeof createFFmpegCore === 'undefined') { if (typeof createFFmpegCore === 'undefined') {
throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath)); throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath));
} }
importScripts(corePath);
log('info', 'ffmpeg-core.js script loaded'); log('info', 'ffmpeg-core.js script loaded');
resolve({ resolve({
createFFmpegCore, createFFmpegCore,