UNPKG

filecat

Version:
2 lines 155 kB
/*! For license information please see 257.1770f70d42f4e03056ce.js.LICENSE.txt */ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[257],{8257:e=>{var t;self,t=function(){return function(){var e={"./node_modules/es6-promise/dist/es6-promise.js":function(e,t,i){e.exports=function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,s=void 0,o=void 0,a=function(e,t){E[n]=e,E[n+1]=t,2===(n+=2)&&(o?o(b):L())};function u(e){o=e}function l(e){a=e}var d="undefined"!=typeof window?window:void 0,h=d||{},c=h.MutationObserver||h.WebKitMutationObserver,f="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),_="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(b)}}function m(){return void 0!==s?function(){s(b)}:y()}function g(){var e=0,t=new c(b),i=document.createTextNode("");return t.observe(i,{characterData:!0}),function(){i.data=e=++e%2}}function v(){var e=new MessageChannel;return e.port1.onmessage=b,function(){return e.port2.postMessage(0)}}function y(){var e=setTimeout;return function(){return e(b,1)}}var E=new Array(1e3);function b(){for(var e=0;e<n;e+=2)(0,E[e])(E[e+1]),E[e]=void 0,E[e+1]=void 0;n=0}function S(){try{var e=Function("return this")().require("vertx");return s=e.runOnLoop||e.runOnContext,m()}catch(e){return y()}}var L=void 0;function A(e,t){var i=this,r=new this.constructor(T);void 0===r[w]&&q(r);var n=i._state;if(n){var s=arguments[n-1];a(function(){return z(n,r,s,i._result)})}else G(i,r,e,t);return r}function R(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var i=new t(T);return j(i,e),i}L=f?p():c?g():_?v():void 0===d?S():y();var w=Math.random().toString(36).substring(2);function T(){}var O=void 0,C=1,k=2;function I(){return new TypeError("You cannot resolve a promise with itself")}function D(){return new TypeError("A promises callback cannot return that same promise.")}function x(e,t,i,r){try{e.call(t,i,r)}catch(e){return e}}function M(e,t,i){a(function(e){var r=!1,n=x(i,t,function(i){r||(r=!0,t!==i?j(e,i):N(e,i))},function(t){r||(r=!0,F(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&n&&(r=!0,F(e,n))},e)}function B(e,t){t._state===C?N(e,t._result):t._state===k?F(e,t._result):G(t,void 0,function(t){return j(e,t)},function(t){return F(e,t)})}function P(e,i,r){i.constructor===e.constructor&&r===A&&i.constructor.resolve===R?B(e,i):void 0===r?N(e,i):t(r)?M(e,i,r):N(e,i)}function j(t,i){if(t===i)F(t,I());else if(e(i)){var r=void 0;try{r=i.then}catch(e){return void F(t,e)}P(t,i,r)}else N(t,i)}function U(e){e._onerror&&e._onerror(e._result),V(e)}function N(e,t){e._state===O&&(e._result=t,e._state=C,0!==e._subscribers.length&&a(V,e))}function F(e,t){e._state===O&&(e._state=k,e._result=t,a(U,e))}function G(e,t,i,r){var n=e._subscribers,s=n.length;e._onerror=null,n[s]=t,n[s+C]=i,n[s+k]=r,0===s&&e._state&&a(V,e)}function V(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var r=void 0,n=void 0,s=e._result,o=0;o<t.length;o+=3)r=t[o],n=t[o+i],r?z(i,r,n,s):n(s);e._subscribers.length=0}}function z(e,i,r,n){var s=t(r),o=void 0,a=void 0,u=!0;if(s){try{o=r(n)}catch(e){u=!1,a=e}if(i===o)return void F(i,D())}else o=n;i._state!==O||(s&&u?j(i,o):!1===u?F(i,a):e===C?N(i,o):e===k&&F(i,o))}function K(e,t){try{t(function(t){j(e,t)},function(t){F(e,t)})}catch(t){F(e,t)}}var H=0;function W(){return H++}function q(e){e[w]=H++,e._state=void 0,e._result=void 0,e._subscribers=[]}function X(){return new Error("Array Methods must be provided an Array")}var Y=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(T),this.promise[w]||q(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?N(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&N(this.promise,this._result))):F(this.promise,X())}return e.prototype._enumerate=function(e){for(var t=0;this._state===O&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,r=i.resolve;if(r===R){var n=void 0,s=void 0,o=!1;try{n=e.then}catch(e){o=!0,s=e}if(n===A&&e._state!==O)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(i===te){var a=new i(T);o?F(a,s):P(a,e,n),this._willSettleAt(a,t)}else this._willSettleAt(new i(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,i){var r=this.promise;r._state===O&&(this._remaining--,e===k?F(r,i):this._result[t]=i),0===this._remaining&&N(r,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;G(e,void 0,function(e){return i._settledAt(C,t,e)},function(e){return i._settledAt(k,t,e)})},e}();function Z(e){return new Y(this,e).promise}function J(e){var t=this;return r(e)?new t(function(i,r){for(var n=e.length,s=0;s<n;s++)t.resolve(e[s]).then(i,r)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})}function Q(e){var t=new this(T);return F(t,e),t}function $(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ee(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var te=function(){function e(t){this[w]=W(),this._result=this._state=void 0,this._subscribers=[],T!==t&&("function"!=typeof t&&$(),this instanceof e?K(this,t):ee())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var i=this,r=i.constructor;return t(e)?i.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})}):i.then(e,e)},e}();function ie(){var e=void 0;if(void 0!==i.g)e=i.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=te}return te.prototype.then=A,te.all=Z,te.race=J,te.resolve=R,te.reject=Q,te._setScheduler=u,te._setAsap=l,te._asap=a,te.polyfill=ie,te.Promise=te,te}()},"./node_modules/events/events.js":function(e){"use strict";var t,i="object"==typeof Reflect?Reflect:null,r=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(i,r){function n(i){e.removeListener(t,s),r(i)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}p(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&p(e,"error",t,i)}(e,n,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,i,r){var n,s,o,l;if(a(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),o=s[t]),void 0===o)o=s[t]=i,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[i,o]:[o,i]:r?o.unshift(i):o.push(i),(n=u(e))>0&&o.length>n&&!o.warned){o.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=o.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=d.bind(r);return n.listener=i,r.wrapFn=n,n}function c(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):_(n,n.length)}function f(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function _(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function p(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function n(s){r.once&&e.removeEventListener(t,n),i(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(void 0===u)return!1;if("function"==typeof u)r(u,this,t);else{var l=u.length,d=_(u,l);for(i=0;i<l;++i)r(d[i],this,t)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var i,r,n,s,o;if(a(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){o=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,s=Object.keys(i);for(r=0;r<s.length;++r)"removeListener"!==(n=s[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return c(this,e,!0)},s.prototype.rawListeners=function(e){return c(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/webworkify-webpack/index.js":function(e,t,i){function r(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var r=i(i.s=ENTRY_MODULE);return r.default||r}var n="[\\.|\\-|\\+|\\w|/|@]+",s="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e){return!isNaN(1*e)}function u(e,t,r){var u={};u[r]=[];var l=t.toString(),d=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return u;for(var h,c=d[1],f=new RegExp("(\\\\n|\\W)"+o(c)+s,"g");h=f.exec(l);)"dll-reference"!==h[3]&&u[r].push(h[3]);for(f=new RegExp("\\("+o(c)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+s,"g");h=f.exec(l);)e[h[2]]||(u[r].push(h[1]),e[h[2]]=i(h[1]).m),u[h[2]]=u[h[2]]||[],u[h[2]].push(h[4]);for(var _=Object.keys(u),p=0;p<_.length;p++)for(var m=0;m<u[_[p]].length;m++)a(u[_[p]][m])&&(u[_[p]][m]=1*u[_[p]][m]);return u}function l(e){return Object.keys(e).reduce(function(t,i){return t||e[i].length>0},!1)}e.exports=function(e,t){t=t||{};var n={main:i.m},s=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},r={main:[]},n={main:{}};l(i);)for(var s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],d=i[a].pop();if(n[a]=n[a]||{},!n[a][d]&&e[a][d]){n[a][d]=!0,r[a]=r[a]||[],r[a].push(d);for(var h=u(e,e[a][d],a),c=Object.keys(h),f=0;f<c.length;f++)i[c[f]]=i[c[f]]||[],i[c[f]]=i[c[f]].concat(h[c[f]])}}return r}(n,e),o="";Object.keys(s).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;s[e][t];)t++;s[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s[e].map(function(t){return JSON.stringify(t)+": "+n[e][t].toString()}).join(",")+"});\n"}),o=o+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s.main.map(function(e){return JSON.stringify(e)+": "+n.main[e].toString()}).join(",")+"}))(self);";var a=new window.Blob([o],{type:"text/javascript"});if(t.bare)return a;var d=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(a),h=new window.Worker(d);return h.objectURL=d,h}},"./src/config.js":function(e,t,i){"use strict";i.r(t),i.d(t,{defaultConfig:function(){return r},createDefaultConfig:function(){return n}});var r={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function n(){return Object.assign({},r)}},"./src/core/features.js":function(e,t,i){"use strict";i.r(t);var r=i("./src/io/io-controller.js"),n=i("./src/config.js"),s=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new r.default({},(0,n.createDefaultConfig)()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new r.default({},(0,n.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}();t.default=s},"./src/core/media-info.js":function(e,t,i){"use strict";i.r(t);var r=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,r=e.length-1,n=0,s=0,o=r;for(t<e[0]&&(i=0,s=o+1);s<=o;){if((n=s+Math.floor((o-s)/2))===r||t>=e[n]&&t<e[n+1]){i=n;break}e[n]<t?s=n+1:o=n-1}return i},e}();t.default=r},"./src/core/media-segment-info.js":function(e,t,i){"use strict";i.r(t),i.d(t,{SampleInfo:function(){return r},MediaSegmentInfo:function(){return n},IDRSampleList:function(){return s},MediaSegmentInfoList:function(){return o}});var r=function(e,t,i,r,n){this.dts=e,this.pts=t,this.duration=i,this.originalDts=r,this.isSyncPoint=n,this.fileposition=null},n=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),s=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,r=t.length-1,n=0,s=0,o=r;for(e<t[0].dts&&(i=0,s=o+1);s<=o;){if((n=s+Math.floor((o-s)/2))===r||e>=t[n].dts&&e<t[n+1].dts){i=n;break}t[n].dts<e?s=n+1:o=n-1}return this._list[i]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,r=0,n=0,s=i,o=0;if(e<t[0].originalBeginDts)return o=-1;for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){o=r;break}t[r].originalBeginDts<e?n=r+1:s=r-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,r=this._lastAppendLocation,n=0;-1!==r&&r<t.length&&i.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&i.originalBeginDts<t[r+1].originalBeginDts)?n=r+1:t.length>0&&(n=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},"./src/core/mse-controller.js":function(e,t,i){"use strict";i.r(t);var r=i("./node_modules/events/events.js"),n=i.n(r),s=i("./src/utils/logger.js"),o=i("./src/utils/browser.js"),a=i("./src/core/mse-events.js"),u=i("./src/core/media-segment-info.js"),l=i("./src/utils/exception.js"),d=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new(n()),this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new u.IDRSampleList}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new l.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var r=this._sourceBuffers[t];if(r){if("closed"!==e.readyState){try{e.removeSourceBuffer(r)}catch(e){s.default.e(this.TAG,e.message)}r.removeEventListener("error",this.e.onSourceBufferError),r.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){s.default.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,r=""+i.container;i.codec&&i.codec.length>0&&(r+=";codecs="+i.codec);var n=!1;if(s.default.v(this.TAG,"Received Initialization Segment, mimeType: "+r),this._lastInitSegments[i.type]=i,r!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])s.default.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+r);else{n=!0;try{var u=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(r);u.addEventListener("error",this.e.onSourceBufferError),u.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return s.default.e(this.TAG,e.message),void this._emitter.emit(a.default.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=r}t||this._pendingSegments[i.type].push(i),n||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),o.default.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){s.default.e(this.TAG,e.message)}this._idrList.clear();var r=this._pendingSegments[t];if(r.splice(0,r.length),"closed"!==this._mediaSource.readyState){for(var n=0;n<i.buffered.length;n++){var a=i.buffered.start(n),u=i.buffered.end(n);this._pendingRemoveRanges[t].push({start:a,end:u})}if(i.updating||this._doRemoveRanges(),o.default.safari){var l=this._lastInitSegments[t];l&&(this._pendingSegments[t].push(l),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var r=i.buffered;if(r.length>=1&&e-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var r=i.buffered,n=!1,s=0;s<r.length;s++){var o=r.start(s),a=r.end(s);if(o<=e&&e<a+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){n=!0;var u=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:u})}}else a<e&&(n=!0,this._pendingRemoveRanges[t].push({start:o,end:a}))}n&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(s.default.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var r=i.shift();t.remove(r.start,r.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var r=this._sourceBuffers[t].timestampOffset,n=i.timestampOffset/1e3;Math.abs(r-n)>.1&&(s.default.v(this.TAG,"Update MPEG audio timestampOffset from "+r+" to "+n),this._sourceBuffers[t].timestampOffset=n),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(a.default.BUFFER_FULL),this._isBufferFull=!0):(s.default.e(this.TAG,e.message),this._emitter.emit(a.default.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(s.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(a.default.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){s.default.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){s.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(a.default.UPDATE_END)},e.prototype._onSourceBufferError=function(e){s.default.e(this.TAG,"SourceBuffer Error: "+e)},e}();t.default=d},"./src/core/mse-events.js":function(e,t,i){"use strict";i.r(t),t.default={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},"./src/core/transmuxer.js":function(e,t,i){"use strict";i.r(t);var r=i("./node_modules/events/events.js"),n=i.n(r),s=i("./node_modules/webworkify-webpack/index.js"),o=i.n(s),a=i("./src/utils/logger.js"),u=i("./src/utils/logging-control.js"),l=i("./src/core/transmuxing-controller.js"),d=i("./src/core/transmuxing-events.js"),h=i("./src/core/media-info.js"),c=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new(n()),t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=o()("./src/core/transmuxing-worker.js"),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},u.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:u.default.getConfig()})}catch(i){a.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new l.default(e,t)}else this._controller=new l.default(e,t);if(this._controller){var i=this._controller;i.on(d.default.IO_ERROR,this._onIOError.bind(this)),i.on(d.default.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(d.default.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(d.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(d.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(d.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(d.default.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(d.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(d.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(d.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(d.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),u.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(d.default.INIT_SEGMENT,e,t)})},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(d.default.MEDIA_SEGMENT,e,t)})},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(d.default.LOADING_COMPLETE)})},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(d.default.RECOVERED_EARLY_EOF)})},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(d.default.MEDIA_INFO,e)})},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(d.default.METADATA_ARRIVED,e)})},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(d.default.SCRIPTDATA_ARRIVED,e)})},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(d.default.STATISTICS_INFO,e)})},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(d.default.IO_ERROR,e,t)})},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(d.default.DEMUX_ERROR,e,t)})},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(d.default.RECOMMEND_SEEKPOINT,e)})},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case d.default.INIT_SEGMENT:case d.default.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case d.default.LOADING_COMPLETE:case d.default.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case d.default.MEDIA_INFO:Object.setPrototypeOf(i,h.default.prototype),this._emitter.emit(t.msg,i);break;case d.default.METADATA_ARRIVED:case d.default.SCRIPTDATA_ARRIVED:case d.default.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case d.default.IO_ERROR:case d.default.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case d.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":a.default.emitter.emit("log",i.type,i.logcat)}},e}();t.default=c},"./src/core/transmuxing-controller.js":function(e,t,i){"use strict";i.r(t);var r=i("./node_modules/events/events.js"),n=i.n(r),s=i("./src/utils/logger.js"),o=i("./src/utils/browser.js"),a=i("./src/core/media-info.js"),u=i("./src/demux/flv-demuxer.js"),l=i("./src/remux/mp4-remuxer.js"),d=i("./src/demux/demux-errors.js"),h=i("./src/io/io-controller.js"),c=i("./src/core/transmuxing-events.js"),f=function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new(n()),this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach(function(r){r.timestampBase=i,i+=r.duration,r.cors=e.cors,r.withCredentials=e.withCredentials,t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy)}),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],r=this._ioctl=new h.default(i,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var r=i.getNearestKeyframe(e);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var n=this._mediaInfo.segments[t];null==n?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(r=n.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,r.fileposition),this._pendingResolveSeekPoint=r.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,r=0;r<t.length;r++)if(e<t[r].timestampBase){i=r-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,r=null,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else if((r=u.default.probe(e)).match){this._demuxer=new u.default(r,this._config),this._remuxer||(this._remuxer=new l.default(this._config));var o=this._mediaDataSource;null==o.duration||isNaN(o.duration)||(this._demuxer.overridedDuration=o.duration),"boolean"==typeof o.hasAudio&&(this._demuxer.overridedHasAudio=o.hasAudio),"boolean"==typeof o.hasVideo&&(this._demuxer.overridedHasVideo=o.hasVideo),this._demuxer.timestampBase=o.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),n=this._demuxer.parseChunks(e,t)}else r=null,s.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){i._internalAbort()}),this._emitter.emit(c.default.DEMUX_ERROR,d.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),n=0;return n},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,a.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,a.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)})},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(c.default.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(c.default.SCRIPTDATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer.flushStashedSamples(),this._emitter.emit(c.default.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(c.default.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){s.default.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(c.default.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){s.default.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(c.default.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(c.default.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(c.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.default.safari&&i.length>0&&i[0].originalDts===r&&(r=i[0].pts),this._emitter.emit(c.default.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(c.default.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(c.default.STATISTICS_INFO,e)},e}();t.default=f},"./src/core/transmuxing-events.js":function(e,t,i){"use strict";i.r(t),t.default={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},"./src/core/transmuxing-worker.js":function(e,t,i){"use strict";i.r(t);var r=i("./src/utils/logging-control.js"),n=i("./src/utils/polyfill.js"),s=i("./src/core/transmuxing-controller.js"),o=i("./src/core/transmuxing-events.js");t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function a(t,i){var r={msg:o.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}function u(t,i){var r={msg:o.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}function l(){var t={msg:o.default.LOADING_COMPLETE};e.postMessage(t)}function d(){var t={msg:o.default.RECOVERED_EARLY_EOF};e.postMessage(t)}function h(t){var i={msg:o.default.MEDIA_INFO,data:t};e.postMessage(i)}function c(t){var i={msg:o.default.METADATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:o.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function _(t){var i={msg:o.default.STATISTICS_INFO,data:t};e.postMessage(i)}function p(t,i){e.postMessage({msg:o.default.IO_ERROR,data:{type:t,info:i}})}function m(t,i){e.postMessage({msg:o.default.DEMUX_ERROR,data:{type:t,info:i}})}function g(t){e.postMessage({msg:o.default.RECOMMEND_SEEKPOINT,data:t})}n.default.install(),e.addEventListener("message",function(n){switch(n.data.cmd){case"init":(t=new s.default(n.data.param[0],n.data.param[1])).on(o.default.IO_ERROR,p.bind(this)),t.on(o.default.DEMUX_ERROR,m.bind(this)),t.on(o.default.INIT_SEGMENT,a.bind(this)),t.on(o.default.MEDIA_SEGMENT,u.bind(this)),t.on(o.default.LOADING_COMPLETE,l.bind(this)),t.on(o.default.RECOVERED_EARLY_EOF,d.bind(this)),t.on(o.default.MEDIA_INFO,h.bind(this)),t.on(o.default.METADATA_ARRIVED,c.bind(this)),t.on(o.default.SCRIPTDATA_ARRIVED,f.bind(this)),t.on(o.default.STATISTICS_INFO,_.bind(this)),t.on(o.default.RECOMMEND_SEEKPOINT,g.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var v=n.data.param;r.default.applyConfig(v),!0===v.enableCallback?r.default.addLogListener(i):r.default.removeLogListener(i)}})}},"./src/demux/amf-parser.js":function(e,t,i){"use strict";i.r(t);var r,n=i("./src/utils/logger.js"),s=i("./src/utils/utf8-conv.js"),o=i("./src/utils/exception.js"),a=(r=new ArrayBuffer(2),new DataView(r).setInt16(0,256,!0),256===new Int16Array(r)[0]),u=function(){function e(){}return e.parseScriptData=function(t,i,r){var s={};try{var o=e.parseValue(t,i,r),a=e.parseValue(t,i+o.size,r-o.size);s[o.data]=a.data}catch(e){n.default.e("AMF",e.toString())}return s},e.parseObject=function(t,i,r){if(r<3)throw new o.IllegalStateException("Data not enough when parse ScriptDataObject");var n=e.parseString(t,i,r),s=e.parseValue(t,i+n.size,r-n.size),a=s.objectEnd;return{data:{name:n.data,value:s.data},size:n.size+s.size,objectEnd:a}},e.parseVariable=function(t,i,r){return e.parseObject(t,i,r)},e.parseString=function(e,t,i){if(i<2)throw new o.IllegalStateException("Data not enough when parse String");var r=new DataView(e,t,i).getUint16(0,!a);return{data:r>0?(0,s.default)(new Uint8Array(e,t+2,r)):"",size:2+r}},e.parseLongString=function(e,t,i){if(i<4)throw new o.IllegalStateException("Data not enough when parse LongString");var r=new DataView(e,t,i).getUint32(0,!a);return{data:r>0?(0,s.default)(new Uint8Array(e,t+4,r)):"",size:4+r}},e.parseDate=function(e,t,i){if(i<10)throw new o.IllegalStateException("Data size invalid when parse Date");var r=new DataView(e,t,i),n=r.getFloat64(0,!a),s=r.getInt16(8,!a);return{data:new Date(n+=60*s*1e3),size:10}},e.parseValue=function(t,i,r){if(r<1)throw new o.IllegalStateException("Data not enough when parse Value");var s,u=new DataView(t,i,r),l=1,d=u.getUint8(0),h=!1;try{switch(d){case 0:s=u.getFloat64(1,!a),l+=8;break;case 1:s=!!u.getUint8(1),l+=1;break;case 2:var c=e.parseString(t,i+1,r-1);s=c.data,l+=c.size;break;