1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpeg=t():e.FFmpeg=t()}(self,(function(){return(()=>{var e={725:(e,t,r)=>{"use strict";e.exports=r.p+"046d0074eee1d99a674a.js"},839:(e,t,r)=>{"use strict";r.r(t),r.d(t,{defaultOptions:()=>o,fetchFile:()=>m,getCreateFFmpegCore:()=>u});var n=r(306);const o={corePath:"https://unpkg.com/@ffmpeg/core@".concat(n.devDependencies["@ffmpeg/core"].substring(1),"/dist/ffmpeg-core.js")};var a=r(185),i=r(835);function c(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,s,"next",e)}function s(e){c(a,n,o,i,s,"throw",e)}i(void 0)}))}}var f=function(){var e=s(regeneratorRuntime.mark((function e(t,r){var n,o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.log)("info","fetch ".concat(t)),e.next=3,fetch(t);case 3:return e.next=5,e.sent.arrayBuffer();case 5:return n=e.sent,(0,a.log)("info","".concat(t," file size = ").concat(n.byteLength," bytes")),o=new Blob([n],{type:r}),i=URL.createObjectURL(o),(0,a.log)("info","".concat(t," blob URL = ").concat(i)),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),u=function(){var e=s(regeneratorRuntime.mark((function e(t){var r,n,o,c,s,u,l,p,m,h,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.corePath,n=t.workerPath,o=t.wasmPath,!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)){e.next=18;break}if("string"==typeof r){e.next=4;break}throw Error("corePath should be a string!");case 4:return c=new URL(r,"file:///home/jeromewu/repos/ffmpeg.wasm/src/browser/getCreateFFmpegCore.js").href,e.next=7,f(c,"application/javascript");case 7:return s=e.sent,e.next=10,f(void 0!==o?o:c.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm");case 10:return u=e.sent,e.next=13,f(void 0!==n?n:c.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");case 13:if(l=e.sent,"undefined"!=typeof createFFmpegCore){e.next=16;break}return e.abrupt("return",new Promise((function(e){if(globalThis.importScripts(s),"undefined"==typeof createFFmpegCore)throw Error((0,i.CREATE_FFMPEG_CORE_IS_NOT_DEFINED)(c));(0,a.log)("info","ffmpeg-core.js script loaded"),e({createFFmpegCore,corePath:s,wasmPath:u,workerPath:l})})));case 16:return(0,a.log)("info","ffmpeg-core.js script is loaded already"),e.abrupt("return",Promise.resolve({createFFmpegCore,corePath:s,wasmPath:u,workerPath:l}));case 18:if("string"==typeof r){e.next=20;break}throw Error("corePath should be a string!");case 20:return p=new URL(r,"file:///home/jeromewu/repos/ffmpeg.wasm/src/browser/getCreateFFmpegCore.js").href,e.next=23,f(p,"application/javascript");case 23:return m=e.sent,e.next=26,f(void 0!==o?o:p.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm");case 26:return h=e.sent,e.next=29,f(void 0!==n?n:p.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");case 29:if(g=e.sent,"undefined"!=typeof createFFmpegCore){e.next=32;break}return e.abrupt("return",new Promise((function(e){var t=document.createElement("script");t.src=m,t.type="text/javascript",t.addEventListener("load",(function r(){if(t.removeEventListener("load",r),"undefined"==typeof createFFmpegCore)throw Error((0,i.CREATE_FFMPEG_CORE_IS_NOT_DEFINED)(p));(0,a.log)("info","ffmpeg-core.js script loaded"),e({createFFmpegCore,corePath:m,wasmPath:h,workerPath:g})})),document.getElementsByTagName("head")[0].appendChild(t)})));case 32:return(0,a.log)("info","ffmpeg-core.js script is loaded already"),e.abrupt("return",Promise.resolve({createFFmpegCore,corePath:m,wasmPath:h,workerPath:g}));case 34:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function l(e,t,r,n,o,a,i){try{var c=e[a](i),s=
|