var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(f,g,l){f!=Array.prototype&&f!=Object.prototype&&(f[g]=l.value)};$jscomp.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var f=0;return function(g){return $jscomp.SYMBOL_PREFIX+(g||"")+f++}}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var f=$jscomp.global.Symbol.iterator;f||(f=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[f]&&$jscomp.defineProperty(Array.prototype,f,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(f){var g=0;return $jscomp.iteratorPrototype(function(){return g<f.length?{done:!1,value:f[g++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(f){$jscomp.initSymbolIterator();f={next:f};f[$jscomp.global.Symbol.iterator]=function(){return this};return f};$jscomp.iteratorFromArray=function(f,g){$jscomp.initSymbolIterator();f instanceof String&&(f+="");var l=0,k={next:function(){if(l<f.length){var e=l++;return{value:g(e,f[e]),done:!1}}k.next=function(){return{done:!0,value:void 0}};return k.next()}};k[Symbol.iterator]=function(){return k};return k};
$jscomp.polyfill=function(f,g,l,k){if(g){l=$jscomp.global;f=f.split(".");for(k=0;k<f.length-1;k++){var e=f[k];e in l||(l[e]={});l=l[e]}f=f[f.length-1];k=l[f];g=g(k);g!=k&&null!=g&&$jscomp.defineProperty(l,f,{configurable:!0,writable:!0,value:g})}};$jscomp.polyfill("Array.prototype.keys",function(f){return f?f:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6","es3");$jscomp.owns=function(f,g){return Object.prototype.hasOwnProperty.call(f,g)};
$jscomp.polyfill("Object.assign",function(f){return f?f:function(f,l){for(var g=1;g<arguments.length;g++){var e=arguments[g];if(e)for(var c in e)$jscomp.owns(e,c)&&(f[c]=e[c])}return f}},"es6","es3");$jscomp.makeIterator=function(f){$jscomp.initSymbolIterator();var g=f[Symbol.iterator];return g?g.call(f):$jscomp.arrayIterator(f)};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(f){function g(){this.batch_=null}function l(a){return a instanceof e?a:new e(function(b,h){b(a)})}if(f&&!$jscomp.FORCE_POLYFILL_PROMISE)return f;g.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};g.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var k=$jscomp.global.setTimeout;g.prototype.asyncExecuteFunction=function(a){k(a,
0)};g.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var h=a[b];delete a[b];try{h()}catch(q){this.asyncThrow_(q)}}}this.batch_=null};g.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var e=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(h){b.reject(h)}};e.prototype.createResolveAndReject_=
function(){function a(a){return function(c){h||(h=!0,a.call(b,c))}}var b=this,h=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};e.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof e)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};e.prototype.resolveToNonPromiseObj_=function(a){var b=
void 0;try{b=a.then}catch(h){this.reject_(h);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};e.prototype.reject_=function(a){this.settle_(2,a)};e.prototype.fulfill_=function(a){this.settle_(1,a)};e.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};e.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var c=new g;e.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};e.prototype.settleSameAsThenable_=function(a,b){var h=this.createResolveAndReject_();try{a.call(b,h.resolve,h.reject)}catch(q){h.reject(q)}};e.prototype.then=function(a,b){function h(a,d){return"function"==typeof a?function(d){try{c(a(d))}catch(m){f(m)}}:d}var c,f,p=new e(function(a,
d){c=a;f=d});this.callWhenSettled_(h(a,c),h(b,f));return p};e.prototype.catch=function(a){return this.then(void 0,a)};e.prototype.callWhenSettled_=function(a,b){function h(){switch(e.state_){case 1:a(e.result_);break;case 2:b(e.result_);break;default:throw Error("Unexpected state: "+e.state_);}}var e=this;null==this.onSettledCallbacks_?c.asyncExecute(h):this.onSettledCallbacks_.push(function(){c.asyncExecute(h)})};e.resolve=l;e.reject=function(a){return new e(function(b,h){h(a)})};e.race=function(a){return new e(function(b,
h){for(var c=$jscomp.makeIterator(a),e=c.next();!e.done;e=c.next())l(e.value).callWhenSettled_(b,h)})};e.all=function(a){var b=$jscomp.makeIterator(a),h=b.next();return h.done?l([]):new e(function(a,c){function e(b){return function(m){r[b]=m;d--;0==d&&a(r)}}var r=[],d=0;do r.push(void 0),d++,l(h.value).callWhenSettled_(e(r.length-1),c),h=b.next();while(!h.done)})};return e},"es6","es3");$jscomp.underscoreProtoCanBeSet=function(){var f={a:!0},g={};try{return g.__proto__=f,g.a}catch(l){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(f,g){f.__proto__=g;if(f.__proto__!==g)throw new TypeError(f+" is not extensible");return f}:null;$jscomp.polyfill("Object.setPrototypeOf",function(f){return f||$jscomp.setPrototypeOf},"es6","es5");
!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).flvjs=f()}(function(){return function(){function f(g,l,k){function e(a,h){if(!l[a]){if(!g[a]){var b="function"==typeof require&&require;if(!h&&b)return b(a,!0);if(c)return c(a,!0);h=Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h;}h=l[a]=
{exports:{}};g[a][0].call(h.exports,function(b){var h=g[a][1][b];return e(h?h:b)},h,h.exports,f,g,l,k)}return l[a].exports}for(var c="function"==typeof require&&require,a=0;a<k.length;a++)e(k[a]);return e}return f}()({1:[function(f,g,l){(function(k,e){!function(c,a){"object"==typeof l&&"undefined"!=typeof g?g.exports=a():c.ES6Promise=a()}(this,function(){function c(){return function(){return k.nextTick(g)}}function a(){return"undefined"!=typeof I?function(){I(g)}:q()}function b(){var a=0,d=new L(g),
m=document.createTextNode("");return d.observe(m,{characterData:!0}),function(){m.data=a=++a%2}}function h(){var a=new MessageChannel;return a.port1.onmessage=g,function(){return a.port2.postMessage(0)}}function q(){var a=setTimeout;return function(){return a(g,1)}}function g(){for(var a=0;B>a;a+=2)(0,O[a])(O[a+1]),O[a]=void 0,O[a+1]=void 0;B=0}function p(){try{var d=Function("return this")().require("vertx");return I=d.runOnLoop||d.runOnContext,a()}catch(X){return q()}}function r(a,d){var m=this,
b=new this.constructor(n);void 0===b[R]&&C(b);var h=m._state;if(h){var c=arguments[h-1];K(function(){return v(h,b,c,m._result)})}else w(m,b,a,d);return b}function d(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var d=new this(n);return l(d,a),d}function n(){}function m(a){try{return a.then}catch(X){return P.error=X,P}}function x(a,d,m,b){try{a.call(d,m,b)}catch(ea){return ea}}function A(a,d,m){K(function(a){var b=!1,h=x(m,d,function(m){b||(b=!0,d!==m?l(a,m):D(a,m))},function(d){b||(b=
!0,y(a,d))},"Settle: "+(a._label||" unknown promise"));!b&&h&&(b=!0,y(a,h))},a)}function u(a,d){d._state===S?D(a,d._result):d._state===T?y(a,d._result):w(d,void 0,function(d){return l(a,d)},function(d){return y(a,d)})}function F(a,m,b){m.constructor===a.constructor&&b===r&&m.constructor.resolve===d?u(a,m):b===P?(y(a,P.error),P.error=null):void 0===b?D(a,m):"function"==typeof b?A(a,m,b):D(a,m)}function l(a,d){if(a===d)y(a,new TypeError("You cannot resolve a promise with itself"));else{var b=typeof d;
null===d||"object"!==b&&"function"!==b?D(a,d):F(a,d,m(d))}}function E(a){a._onerror&&a._onerror(a._result);z(a)}function D(a,d){a._state===M&&(a._result=d,a._state=S,0!==a._subscribers.length&&K(z,a))}function y(a,d){a._state===M&&(a._state=T,a._result=d,K(E,a))}function w(a,d,m,b){var h=a._subscribers,n=h.length;a._onerror=null;h[n]=d;h[n+S]=m;h[n+T]=b;0===n&&a._state&&K(z,a)}function z(a){var d=a._subscribers,m=a._state;if(0!==d.length){for(var b,h,n=a._result,c=0;c<d.length;c+=3)b=d[c],h=d[c+m],
b?v(m,b,h,n):h(n);a._subscribers.length=0}}function v(a,d,m,b){var h="function"==typeof m,n=void 0,c=void 0,r=void 0,x=void 0;if(h){try{var e=m(b)}catch(ha){e=(P.error=ha,P)}if(n=e,n===P?(x=!0,c=n.error,n.error=null):r=!0,d===n)return void y(d,new TypeError("A promises callback cannot return that same promise."))}else n=b,r=!0;d._state!==M||(h&&r?l(d,n):x?y(d,c):a===S?D(d,n):a===T&&y(d,n))}function G(a,d){try{d(function(d){l(a,d)},function(d){y(a,d)})}catch(ca){y(a,ca)}}function C(a){a[R]=aa++;a._state=
void 0;a._result=void 0;a._subscribers=[]}var H=void 0,N=H=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},B=0,I=void 0,Q=void 0,K=function(a,d){O[B]=a;O[B+1]=d;B+=2;2===B&&(Q?Q(g):U())},V=(H="undefined"!=typeof window?window:void 0)||{},L=V.MutationObserver||V.WebKitMutationObserver;V="undefined"==typeof self&&"undefined"!=typeof k&&"[object process]"==={}.toString.call(k);var W="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&
"undefined"!=typeof MessageChannel,O=Array(1E3),U=void 0;U=V?c():L?b():W?h():void 0===H&&"function"==typeof f?p():q();var R=Math.random().toString(36).substring(2),M=void 0,S=1,T=2,P={error:null},aa=0,Z=function(){function a(a,d){this._instanceConstructor=a;this.promise=new a(n);this.promise[R]||C(this.promise);N(d)?(this.length=d.length,this._remaining=d.length,this._result=Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(d),0===this._remaining&&
D(this.promise,this._result))):y(this.promise,Error("Array Methods must be provided an Array"))}return a.prototype._enumerate=function(a){for(var d=0;this._state===M&&d<a.length;d++)this._eachEntry(a[d],d)},a.prototype._eachEntry=function(a,b){var h=this._instanceConstructor,c=h.resolve;c===d?(c=m(a),c===r&&a._state!==M?this._settledAt(a._state,b,a._result):"function"!=typeof c?(this._remaining--,this._result[b]=a):h===J?(h=new h(n),F(h,a,c),this._willSettleAt(h,b)):this._willSettleAt(new h(function(d){return d(a)}),
b)):this._willSettleAt(c(a),b)},a.prototype._settledAt=function(a,d,m){var b=this.promise;b._state===M&&(this._remaining--,a===T?y(b,m):this._result[d]=m);0===this._remaining&&D(b,this._result)},a.prototype._willSettleAt=function(a,d){var m=this;w(a,void 0,function(a){return m._settledAt(S,d,a)},function(a){return m._settledAt(T,d,a)})},a}(),J=function(){function a(d){this[R]=aa++;this._result=this._state=void 0;this._subscribers=[];if(n!==d){if("function"!=typeof d)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
if(this instanceof a)G(this,d);else throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");}}return a.prototype["catch"]=function(a){return this.then(null,a)},a.prototype["finally"]=function(a){var d=this.constructor;return this.then(function(m){return d.resolve(a()).then(function(){return m})},function(m){return d.resolve(a()).then(function(){throw m;})})},a}();return J.prototype.then=r,J.all=function(a){return(new Z(this,
a)).promise},J.race=function(a){var d=this;return new d(N(a)?function(m,b){for(var h=a.length,n=0;h>n;n++)d.resolve(a[n]).then(m,b)}:function(a,d){return d(new TypeError("You must pass an array to race."))})},J.resolve=d,J.reject=function(a){var d=new this(n);return y(d,a),d},J._setScheduler=function(a){Q=a},J._setAsap=function(a){K=a},J._asap=K,J.polyfill=function(){var a=void 0;if("undefined"!=typeof e)a=e;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(da){throw Error("polyfill failed because global object is unavailable in this environment");
}var d=a.Promise;if(d){var m=null;try{m=Object.prototype.toString.call(d.resolve())}catch(da){}if("[object Promise]"===m&&!d.cast)return}a.Promise=J},J.Promise=J,J})}).call(this,f("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],2:[function(f,g,l){function k(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function c(a){return"object"==typeof a&&null!==
a}g.exports=k;k.EventEmitter=k;k.prototype._events=void 0;k.prototype._maxListeners=void 0;k.defaultMaxListeners=10;k.prototype.setMaxListeners=function(a){if("number"!=typeof a||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this};k.prototype.emit=function(a){var b,h;if(this._events||(this._events={}),"error"===a&&(!this._events.error||c(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;var f=Error('Uncaught, unspecified "error" event. ('+
b+")");throw f.context=b,f;}if(f=this._events[a],void 0===f)return!1;if(e(f))switch(arguments.length){case 1:f.call(this);break;case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:b=Array.prototype.slice.call(arguments,1),f.apply(this,b)}else if(c(f)){b=Array.prototype.slice.call(arguments,1);var g=f.slice();f=g.length;for(h=0;f>h;h++)g[h].apply(this,b)}return!0};k.prototype.addListener=function(a,b){var h;if(!e(b))throw TypeError("listener must be a function");
return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?c(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,c(this._events[a])&&!this._events[a].warned&&(h=void 0===this._maxListeners?k.defaultMaxListeners:this._maxListeners,h&&0<h&&this._events[a].length>h&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",
this._events[a].length),"function"==typeof console.trace&&console.trace())),this};k.prototype.on=k.prototype.addListener;k.prototype.once=function(a,b){function h(){this.removeListener(a,h);c||(c=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var c=!1;return h.listener=b,this.on(a,h),this};k.prototype.removeListener=function(a,b){var h,f,g;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(h=this._events[a],
g=h.length,f=-1,h===b||e(h.listener)&&h.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(c(h)){for(;0<g--;)if(h[g]===b||h[g].listener&&h[g].listener===b){f=g;break}if(0>f)return this;1===h.length?(h.length=0,delete this._events[a]):h.splice(f,1);this._events.removeListener&&this.emit("removeListener",a,b)}return this};k.prototype.removeAllListeners=function(a){var b,h;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?
this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(h=this._events[a],e(h))this.removeListener(a,h);else if(h)for(;h.length;)this.removeListener(a,h[h.length-1]);return delete this._events[a],this};k.prototype.listeners=function(a){return this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():
[]};k.prototype.listenerCount=function(a){if(this._events){a=this._events[a];if(e(a))return 1;if(a)return a.length}return 0};k.listenerCount=function(a,b){return a.listenerCount(b)}},{}],3:[function(f,g,l){function k(){throw Error("setTimeout has not been defined");}function e(){throw Error("clearTimeout has not been defined");}function c(a){if(p===setTimeout)return setTimeout(a,0);if((p===k||!p)&&setTimeout)return p=setTimeout,setTimeout(a,0);try{return p(a,0)}catch(u){try{return p.call(null,a,0)}catch(F){return p.call(this,
a,0)}}}function a(a){if(r===clearTimeout)return clearTimeout(a);if((r===e||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(a);try{return r(a)}catch(u){try{return r.call(null,a)}catch(F){return r.call(this,a)}}}function b(){m&&d&&(m=!1,d.length?n=d.concat(n):x=-1,n.length&&h())}function h(){if(!m){var h=c(b);m=!0;for(var r=n.length;r;){d=n;for(n=[];++x<r;)d&&d[x].run();x=-1;r=n.length}d=null;m=!1;a(h)}}function q(a,d){this.fun=a;this.array=d}function t(){}f=g.exports={};try{var p="function"==
typeof setTimeout?setTimeout:k}catch(A){p=k}try{var r="function"==typeof clearTimeout?clearTimeout:e}catch(A){r=e}!0;var d,n=[],m=!1,x=-1;f.nextTick=function(a){var d=Array(arguments.length-1);if(1<arguments.length)for(var b=1;b<arguments.length;b++)d[b-1]=arguments[b];n.push(new q(a,d));1!==n.length||m||c(h)};q.prototype.run=function(){this.fun.apply(null,this.array)};f.title="browser";f.browser=!0;f.env={};f.argv=[];f.version="";f.versions={};f.on=t;f.addListener=t;f.once=t;f.off=t;f.removeListener=
t;f.removeAllListeners=t;f.emit=t;f.prependListener=t;f.prependOnceListener=t;f.listeners=function(a){return[]};f.binding=function(a){throw Error("process.binding is not supported");};f.cwd=function(){return"/"};f.chdir=function(a){throw Error("process.chdir is not supported");};f.umask=function(){return 0}},{}],4:[function(f,g,l,k,e,c){var a=JSON.stringify;g.exports=function(b,h){function f(a){x[a]=!0;for(var d in e[a][1]){var m=e[a][1][d];x[m]||f(m)}}for(var g,p=Object.keys(c),r=0,d=p.length;d>
r;r++){var n=p[r],m=c[n].exports;if(m===b||m&&m["default"]===b){g=n;break}}if(!g){g=Math.floor(Math.pow(16,8)*Math.random()).toString(16);m={};r=0;for(d=p.length;d>r;r++)n=p[r],m[n]=n;e[g]=["function(require,module,exports){"+b+"(self); }",m]}b=Math.floor(Math.pow(16,8)*Math.random()).toString(16);p={};p[g]=g;e[b]=["function(require,module,exports){var f = require("+a(g)+");(f.default ? f.default : f)(self);}",p];var x={};f(b);b="("+k+")({"+Object.keys(x).map(function(d){return a(d)+":["+e[d][0]+
","+a(e[d][1])+"]"}).join(",")+"},{},["+a(b)+"])";g=window.URL||window.webkitURL||window.mozURL||window.msURL;b=new Blob([b],{type:"text/javascript"});if(h&&h.bare)return b;h=g.createObjectURL(b);g=new Worker(h);return g.objectURL=h,g}},{}],5:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});l.createDefaultConfig=function(){return Object.assign({},k)};var k=l.defaultConfig={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,fixDelayMode:"none"}},{}],6:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function a(a,h){for(var b=0;b<h.length;b++){var c=h[b];c.enumerable=c.enumerable||!1;c.configurable=
!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,h,c){return h&&a(b.prototype,h),c&&a(b,c),b}}(),e=(g=f("../io/io-controller.js"))&&g.__esModule?g:{"default":g},c=f("../config.js");f=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}return k(a,null,[{key:"supportMSEH264Playback",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"supportNetworkStreamIO",
value:function(){var a=new e["default"]({},(0,c.createDefaultConfig)()),h=a.loaderType;return a.destroy(),"fetch-stream-loader"==h||"xhr-moz-chunked-loader"==h}},{key:"getNetworkLoaderTypeName",value:function(){var a=new e["default"]({},(0,c.createDefaultConfig)()),h=a.loaderType;return a.destroy(),h}},{key:"supportNativeMediaPlayback",value:function(b){void 0==a.videoElement&&(a.videoElement=window.document.createElement("video"));b=a.videoElement.canPlayType(b);return"probably"===b||"maybe"==b}},
{key:"getFeatureList",value:function(){var b={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return b.mseFlvPlayback=a.supportMSEH264Playback(),b.networkStreamIO=a.supportNetworkStreamIO(),b.networkLoaderName=a.getNetworkLoaderTypeName(),b.mseLiveFlvPlayback=b.mseFlvPlayback&&b.networkStreamIO,b.nativeMP4H264Playback=a.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),
b.nativeWebmVP8Playback=a.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),b.nativeWebmVP9Playback=a.supportNativeMediaPlayback('video/webm; codecs="vp9"'),b}}]),a}();l["default"]=f},{"../config.js":5,"../io/io-controller.js":23}],7:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var h=a[b];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(c,h.key,h)}}return function(c,
a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.keyframesIndex=this.hasKeyframesIndex=this.segmentCount=this.segments=this.metadata=this.sarDen=this.sarNum=this.chromaFormat=this.refFrames=this.level=this.profile=this.fps=this.height=this.width=this.audioChannelCount=this.audioSampleRate=this.videoDataRate=this.audioDataRate=this.videoCodec=this.audioCodec=this.hasVideo=this.hasAudio=this.duration=
this.mimeType=null}return k(e,[{key:"isComplete",value:function(){var c=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,a=!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&&c&&a}},{key:"isSeekable",value:function(){return!0===this.hasKeyframesIndex}},{key:"getNearestKeyframe",value:function(c){if(null==this.keyframesIndex)return null;var a=this.keyframesIndex;c=this._search(a.times,c);return{index:c,milliseconds:a.times[c],fileposition:a.filepositions[c]}}},{key:"_search",value:function(c,a){var b=0,h=c.length-1,e=0,f=0,g=h;for(a<c[0]&&(b=0,f=g+1);g>=f;){if(e=f+Math.floor((g-f)/2),e===h||a>=c[e]&&a<c[e+1]){b=e;break}c[e]<a?f=e+1:g=e-1}return b}}]),
e}();l["default"]=f},{}],8:[function(f,g,l){function k(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function");}Object.defineProperty(l,"__esModule",{value:!0});var e=function(){function c(a,b){for(var h=0;h<b.length;h++){var c=b[h];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(a,b,h){return b&&c(a.prototype,b),h&&c(a,h),a}}();l.SampleInfo=function p(a,b,h,e,f){k(this,p);this.dts=a;this.pts=
b;this.duration=h;this.originalDts=e;this.isSyncPoint=f;this.fileposition=null};l.MediaSegmentInfo=function(){function a(){k(this,a);this.originalEndDts=this.originalBeginDts=this.endPts=this.beginPts=this.endDts=this.beginDts=0;this.syncPoints=[];this.lastSample=this.firstSample=null}return e(a,[{key:"appendSyncPoint",value:function(a){a.isSyncPoint=!0;this.syncPoints.push(a)}}]),a}();l.IDRSampleList=function(){function a(){k(this,a);this._list=[]}return e(a,[{key:"clear",value:function(){this._list=
[]}},{key:"appendArray",value:function(a){var b=this._list;0!==a.length&&(0<b.length&&a[0].originalDts<b[b.length-1].originalDts&&this.clear(),Array.prototype.push.apply(b,a))}},{key:"getLastSyncPointBeforeDts",value:function(a){if(0==this._list.length)return null;var b=this._list,e=0,f=b.length-1,g=0,r=0,d=f;for(a<b[0].dts&&(e=0,r=d+1);d>=r;){if(g=r+Math.floor((d-r)/2),g===f||a>=b[g].dts&&a<b[g+1].dts){e=g;break}b[g].dts<a?r=g+1:d=g-1}return this._list[e]}}]),a}();l.MediaSegmentInfoList=function(){function a(b){k(this,
a);this._type=b;this._list=[];this._lastAppendLocation=-1}return e(a,[{key:"isEmpty",value:function(){return 0===this._list.length}},{key:"clear",value:function(){this._list=[];this._lastAppendLocation=-1}},{key:"_searchNearestSegmentBefore",value:function(a){var b=this._list;if(0===b.length)return-2;var e=b.length-1,f=0,g=0,r=e,d=0;if(a<b[0].originalBeginDts)return-1;for(;r>=g;){if(f=g+Math.floor((r-g)/2),f===e||a>b[f].lastSample.originalDts&&a<b[f+1].originalBeginDts){d=f;break}b[f].originalBeginDts<
a?g=f+1:r=f-1}return d}},{key:"_searchNearestSegmentAfter",value:function(a){return this._searchNearestSegmentBefore(a)+1}},{key:"append",value:function(a){var b=this._list,e=this._lastAppendLocation,f=0;-1!==e&&e<b.length&&a.originalBeginDts>=b[e].lastSample.originalDts&&(e===b.length-1||e<b.length-1&&a.originalBeginDts<b[e+1].originalBeginDts)?f=e+1:0<b.length&&(f=this._searchNearestSegmentBefore(a.originalBeginDts)+1);this._lastAppendLocation=f;this._list.splice(f,0,a)}},{key:"getLastSegmentBefore",
value:function(a){a=this._searchNearestSegmentBefore(a);return 0<=a?this._list[a]:null}},{key:"getLastSampleBefore",value:function(a){a=this.getLastSegmentBefore(a);return null!=a?a.lastSample:null}},{key:"getLastSyncPointBefore",value:function(a){a=this._searchNearestSegmentBefore(a);for(var b=this._list[a].syncPoints;0===b.length&&0<a;)a--,b=this._list[a].syncPoints;return 0<b.length?b[b.length-1]:null}},{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._list.length}}]),
a}()},{}],9:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});var e=function(){function a(a,d){for(var b=0;b<d.length;b++){var m=d[b];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(a,m.key,m)}}return function(b,d,n){return d&&a(b.prototype,d),n&&a(b,n),b}}();g=f("events");var c=k(g);g=f("../utils/logger.js");var a=k(g);g=f("../utils/browser.js");var b=k(g);g=f("./mse-events.js");
var h=k(g),q=f("./media-segment-info.js"),t=f("../utils/exception.js");f=function(){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.TAG="MSEController";this._config=a;this._emitter=new c["default"];this._config.isLive&&void 0==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._mediaElement=this._mediaSourceObjectURL=this._mediaSource=null;this._requireSetMediaDuration=this._hasPendingEos=this._isBufferFull=!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 q.IDRSampleList}return e(f,[{key:"destroy",value:function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement();this.e=null;this._emitter.removeAllListeners();this._emitter=null}},{key:"on",value:function(a,d){this._emitter.addListener(a,d)}},{key:"off",value:function(a,d){this._emitter.removeListener(a,d)}},{key:"attachMediaElement",value:function(a){if(this._mediaSource)throw new t.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var d=this._mediaSource=
new window.MediaSource;d.addEventListener("sourceopen",this.e.onSourceOpen);d.addEventListener("sourceended",this.e.onSourceEnded);d.addEventListener("sourceclose",this.e.onSourceClose);this._mediaElement=a;this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource);a.src=this._mediaSourceObjectURL}},{key:"detachMediaElement",value:function(){if(this._mediaSource){var b=this._mediaSource,d;for(d in this._sourceBuffers){var n=this._pendingSegments[d];n.splice(0,n.length);this._pendingSegments[d]=
null;this._pendingRemoveRanges[d]=null;this._lastInitSegments[d]=null;(n=this._sourceBuffers[d])&&("closed"!==b.readyState&&(b.removeSourceBuffer(n),n.removeEventListener("error",this.e.onSourceBufferError),n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)),this._mimeTypes[d]=null,this._sourceBuffers[d]=null)}if("open"===b.readyState)try{b.endOfStream()}catch(m){a["default"].e(this.TAG,m.message)}b.removeEventListener("sourceopen",this.e.onSourceOpen);b.removeEventListener("sourceended",
this.e.onSourceEnded);b.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)}},{key:"appendInitSegment",value:function(c,d){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(c),
void this._pendingSegments[c.type].push(c);var n=""+c.container;c.codec&&0<c.codec.length&&(n+=";codecs="+c.codec);var m=!1;if(a["default"].v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[c.type]=c,n!==this._mimeTypes[c.type]){if(this._mimeTypes[c.type])a["default"].v(this.TAG,"Notice: "+c.type+" mimeType changed, origin: "+this._mimeTypes[c.type]+", target: "+n);else{m=!0;try{var x=this._sourceBuffers[c.type]=this._mediaSource.addSourceBuffer(n);x.addEventListener("error",
this.e.onSourceBufferError);x.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(A){return a["default"].e(this.TAG,A.message),void this._emitter.emit(h["default"].ERROR,{code:A.code,msg:A.message})}}this._mimeTypes[c.type]=n}d||this._pendingSegments[c.type].push(c);m||this._sourceBuffers[c.type]&&!this._sourceBuffers[c.type].updating&&this._doAppendSegments();b["default"].safari&&"audio/mpeg"===c.container&&0<c.mediaDuration&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=
c.mediaDuration/1E3,this._updateMediaSourceDuration())}},{key:"appendMediaSegment",value:function(a){this._pendingSegments[a.type].push(a);this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();a=this._sourceBuffers[a.type];!a||a.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},{key:"seek",value:function(c){for(var d in this._sourceBuffers)if(this._sourceBuffers[d]){c=this._sourceBuffers[d];if("open"===this._mediaSource.readyState)try{c.abort()}catch(A){a["default"].e(this.TAG,
A.message)}this._idrList.clear();var n=this._pendingSegments[d];if(n.splice(0,n.length),"closed"!==this._mediaSource.readyState){for(n=0;n<c.buffered.length;n++){var m=c.buffered.start(n),h=c.buffered.end(n);this._pendingRemoveRanges[d].push({start:m,end:h})}(c.updating||this._doRemoveRanges(),b["default"].safari)&&(n=this._lastInitSegments[d])&&(this._pendingSegments[d].push(n),c.updating||this._doAppendSegments())}}}},{key:"endOfStream",value:function(){var a=this._mediaSource,d=this._sourceBuffers;
return a&&"open"===a.readyState?void(d.video&&d.video.updating||d.audio&&d.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,a.endOfStream())):void(a&&"closed"===a.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0))}},{key:"getNearestKeyframe",value:function(a){return this._idrList.getLastSyncPointBeforeDts(a)}},{key:"_needCleanupSourceBuffer",value:function(){if(!this._config.autoCleanupSourceBuffer)return!1;var a=this._mediaElement.currentTime,d;for(d in this._sourceBuffers){var b=
this._sourceBuffers[d];if(b&&(b=b.buffered,1<=b.length&&a-b.start(0)>=this._config.autoCleanupMaxBackwardDuration))return!0}return!1}},{key:"_doCleanupSourceBuffer",value:function(){var a=this._mediaElement.currentTime,d;for(d in this._sourceBuffers){var b=this._sourceBuffers[d];if(b){for(var m=b.buffered,c=!1,h=0;h<m.length;h++){var e=m.start(h),f=m.end(h);a>=e&&f+3>a?a-e>=this._config.autoCleanupMaxBackwardDuration&&(c=!0,this._pendingRemoveRanges[d].push({start:e,end:a-this._config.autoCleanupMinBackwardDuration})):
a>f&&(c=!0,this._pendingRemoveRanges[d].push({start:e,end:f}))}c&&!b.updating&&this._doRemoveRanges()}}}},{key:"_updateMediaSourceDuration",value:function(){var b=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(b.video&&b.video.updating||b.audio&&b.audio.updating)){b=this._mediaSource.duration;var d=this._pendingMediaDuration;0<d&&(isNaN(b)||d>b)&&(a["default"].v(this.TAG,"Update MediaSource duration from "+b+" to "+d),this._mediaSource.duration=
d);this._requireSetMediaDuration=!1;this._pendingMediaDuration=0}}},{key:"_doRemoveRanges",value:function(){for(var a in this._pendingRemoveRanges)if(this._sourceBuffers[a]&&!this._sourceBuffers[a].updating)for(var d=this._sourceBuffers[a],b=this._pendingRemoveRanges[a];b.length&&!d.updating;){var m=b.shift();d.remove(m.start,m.end)}}},{key:"_doAppendSegments",value:function(){var b=this._pendingSegments,d;for(d in b)if(this._sourceBuffers[d]&&!this._sourceBuffers[d].updating&&0<b[d].length){var c=
b[d].shift();if(c.timestampOffset){var m=this._sourceBuffers[d].timestampOffset,e=c.timestampOffset/1E3;.1<Math.abs(m-e)&&(a["default"].v(this.TAG,"Update MPEG audio timestampOffset from "+m+" to "+e),this._sourceBuffers[d].timestampOffset=e);delete c.timestampOffset}if(c.data&&0!==c.data.byteLength)try{this._sourceBuffers[d].appendBuffer(c.data),this._isBufferFull=!1,"video"===d&&c.hasOwnProperty("info")&&this._idrList.appendArray(c.info.syncPoints)}catch(A){this._pendingSegments[d].unshift(c),22===
A.code?(this._isBufferFull||this._emitter.emit(h["default"].BUFFER_FULL),this._isBufferFull=!0):(a["default"].e(this.TAG,A.message),this._emitter.emit(h["default"].ERROR,{code:A.code,msg:A.message}))}}}},{key:"_onSourceOpen",value:function(){if(a["default"].v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),0<this._pendingSourceBufferInit.length)for(var b=this._pendingSourceBufferInit;b.length;){var d=b.shift();this.appendInitSegment(d,!0)}this._hasPendingSegments()&&
this._doAppendSegments();this._emitter.emit(h["default"].SOURCE_OPEN)}},{key:"_onSourceEnded",value:function(){a["default"].v(this.TAG,"MediaSource onSourceEnded")}},{key:"_onSourceClose",value:function(){a["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))}},
{key:"_hasPendingSegments",value:function(){var a=this._pendingSegments;return 0<a.video.length||0<a.audio.length}},{key:"_hasPendingRemoveRanges",value:function(){var a=this._pendingRemoveRanges;return 0<a.video.length||0<a.audio.length}},{key:"_onSourceBufferUpdateEnd",value:function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream();this._emitter.emit(h["default"].UPDATE_END)}},
{key:"_onSourceBufferError",value:function(b){a["default"].e(this.TAG,"SourceBuffer Error: "+b)}}]),f}();l["default"]=f},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./media-segment-info.js":8,"./mse-events.js":10,events:2}],10:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});l["default"]={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},{}],11:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}
Object.defineProperty(l,"__esModule",{value:!0});var e=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,m){return b&&a(d.prototype,b),m&&a(d,m),d}}();g=f("events");var c=k(g);g=f("../utils/logger.js");var a=k(g);g=f("../utils/logging-control.js");var b=k(g);g=f("./transmuxing-controller.js");var h=k(g);g=f("./transmuxing-events.js");var q=k(g);g=f("./transmuxing-worker.js");
var t=k(g);g=f("./media-info.js");var p=k(g);g=function(){function g(d,n){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");if(this.TAG="Transmuxer",this._emitter=new c["default"],n.enableWorker&&"undefined"!=typeof Worker)try{this._worker=f("webworkify")(t["default"]),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[d,n]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},
b["default"].registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:b["default"].getConfig()})}catch(m){a["default"].e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new h["default"](d,n)}else this._controller=new h["default"](d,n);this._controller&&(d=this._controller,d.on(q["default"].IO_ERROR,this._onIOError.bind(this)),d.on(q["default"].DEMUX_ERROR,this._onDemuxError.bind(this)),
d.on(q["default"].INIT_SEGMENT,this._onInitSegment.bind(this)),d.on(q["default"].MEDIA_SEGMENT,this._onMediaSegment.bind(this)),d.on(q["default"].LOADING_COMPLETE,this._onLoadingComplete.bind(this)),d.on(q["default"].RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),d.on(q["default"].MEDIA_INFO,this._onMediaInfo.bind(this)),d.on(q["default"].STATISTICS_INFO,this._onStatisticsInfo.bind(this)),d.on(q["default"].RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this)))}return e(g,[{key:"destroy",
value:function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),b["default"].removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null);this._emitter.removeAllListeners();this._emitter=null}},{key:"on",value:function(a,b){this._emitter.addListener(a,b)}},{key:"off",value:function(a,b){this._emitter.removeListener(a,b)}},{key:"hasWorker",value:function(){return null!=this._worker}},{key:"block",
value:function(){this._worker?this._worker.postMessage({cmd:"block"}):this._controller.block()}},{key:"unblock",value:function(){this._worker?this._worker.postMessage({cmd:"unblock"}):this._controller.unblock()}},{key:"open",value:function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}},{key:"close",value:function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}},{key:"seek",value:function(a){this._worker?this._worker.postMessage({cmd:"seek",
param:a}):this._controller.seek(a)}},{key:"pause",value:function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}},{key:"resume",value:function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}},{key:"_onInitSegment",value:function(a,b){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].INIT_SEGMENT,a,b)})}},{key:"_onMediaSegment",value:function(a,b){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].MEDIA_SEGMENT,
a,b)})}},{key:"_onLoadingComplete",value:function(){var a=this;Promise.resolve().then(function(){a._emitter.emit(q["default"].LOADING_COMPLETE)})}},{key:"_onRecoveredEarlyEof",value:function(){var a=this;Promise.resolve().then(function(){a._emitter.emit(q["default"].RECOVERED_EARLY_EOF)})}},{key:"_onMediaInfo",value:function(a){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].MEDIA_INFO,a)})}},{key:"_onStatisticsInfo",value:function(a){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].STATISTICS_INFO,
a)})}},{key:"_onIOError",value:function(a,b){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].IO_ERROR,a,b)})}},{key:"_onDemuxError",value:function(a,b){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].DEMUX_ERROR,a,b)})}},{key:"_onRecommendSeekpoint",value:function(a){var d=this;Promise.resolve().then(function(){d._emitter.emit(q["default"].RECOMMEND_SEEKPOINT,a)})}},{key:"_onLoggingConfigChanged",value:function(a){this._worker&&this._worker.postMessage({cmd:"logging_config",
param:a})}},{key:"_onWorkerMessage",value:function(d){d=d.data;var b=d.data;if("destroyed"===d.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(d.msg){case q["default"].INIT_SEGMENT:case q["default"].MEDIA_SEGMENT:this._emitter.emit(d.msg,b.type,b.data);break;case q["default"].LOADING_COMPLETE:case q["default"].RECOVERED_EARLY_EOF:this._emitter.emit(d.msg);break;case q["default"].MEDIA_INFO:Object.setPrototypeOf(b,p["default"].prototype);
this._emitter.emit(d.msg,b);break;case q["default"].STATISTICS_INFO:this._emitter.emit(d.msg,b);break;case q["default"].IO_ERROR:case q["default"].DEMUX_ERROR:this._emitter.emit(d.msg,b.type,b.info);break;case q["default"].RECOMMEND_SEEKPOINT:this._emitter.emit(d.msg,b);break;case "logcat_callback":a["default"].emitter.emit("log",b.type,b.logcat)}}}]),g}();l["default"]=g},{"../utils/logger.js":41,"../utils/logging-control.js":42,"./media-info.js":7,"./transmuxing-controller.js":12,"./transmuxing-events.js":13,
"./transmuxing-worker.js":14,events:2,webworkify:4}],12:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});var e=function(){function a(a,d){for(var b=0;b<d.length;b++){var m=d[b];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(a,m.key,m)}}return function(d,b,c){return b&&a(d.prototype,b),c&&a(d,c),d}}();g=f("events");var c=k(g);g=f("../utils/logger.js");var a=k(g);g=f("../utils/browser.js");
var b=k(g);g=f("./media-info.js");var h=k(g);g=f("../demux/flv-demuxer.js");var q=k(g);g=f("../remux/mp4-remuxer.js");var t=k(g);g=f("../demux/demux-errors.js");var p=k(g);g=f("../io/io-controller.js");var r=k(g);g=f("./transmuxing-events.js");var d=k(g);f=(f("../io/loader.js"),function(){function n(a,d){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.TAG="TransmuxingController";this._emitter=new c["default"];this._config=d;this._demuxer=null;a.segments||(a.segments=
[{duration:a.duration,filesize:a.filesize,url:a.url}]);"boolean"!=typeof a.cors&&(a.cors=!0);"boolean"!=typeof a.withCredentials&&(a.withCredentials=!1);this._mediaDataSource=a;var b=this._currentSegmentIndex=0;this._mediaDataSource.segments.forEach(function(m){m.timestampBase=b;b+=m.duration;m.cors=a.cors;m.withCredentials=a.withCredentials;d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy)});isNaN(b)||this._mediaDataSource.duration===b||(this._mediaDataSource.duration=b);this._statisticsReporter=
this._pendingResolveSeekPoint=this._pendingSeekTime=this._ioctl=this._remuxer=this._mediaInfo=null}return e(n,[{key:"destroy",value:function(){this._mediaDataSource=this._mediaInfo=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}},{key:"on",value:function(a,
d){this._emitter.addListener(a,d)}},{key:"off",value:function(a,d){this._emitter.removeListener(a,d)}},{key:"block",value:function(){this._demuxer?this._demuxer.block():a["default"].w(this.TAG,"this._demuxer = null")}},{key:"unblock",value:function(){this._demuxer?this._demuxer.unblock():a["default"].w(this.TAG,"this._demuxer = null")}},{key:"start",value:function(){this._loadSegment(0);this._enableStatisticsReporter()}},{key:"_loadSegment",value:function(a,d){this._currentSegmentIndex=a;a=this._ioctl=
new r["default"](this._mediaDataSource.segments[a],this._config,a);a.onError=this._onIOException.bind(this);a.onSeeked=this._onIOSeeked.bind(this);a.onComplete=this._onIOComplete.bind(this);a.onRedirect=this._onIORedirect.bind(this);a.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this);d?this._demuxer.bindDataSource(this._ioctl):a.onDataArrival=this._onInitChunkArrival.bind(this);a.open(d)}},{key:"stop",value:function(){this._internalAbort();this._disableStatisticsReporter()}},{key:"_internalAbort",
value:function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}},{key:"pause",value:function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}},{key:"resume",value:function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}},{key:"seek",value:function(a){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var d=this._searchSegmentIndexContains(a);if(d===this._currentSegmentIndex)d=this._mediaInfo.segments[d],
void 0==d?this._pendingSeekTime=a:(a=d.getNearestKeyframe(a),this._remuxer.seek(a.milliseconds),this._ioctl.seek(a.fileposition),this._pendingResolveSeekPoint=a.milliseconds);else{var b=this._mediaInfo.segments[d];void 0==b?(this._pendingSeekTime=a,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(d)):(b=b.getNearestKeyframe(a),this._internalAbort(),this._remuxer.seek(a),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=
this._mediaDataSource.segments[d].timestampBase,this._loadSegment(d,b.fileposition),this._pendingResolveSeekPoint=b.milliseconds,this._reportSegmentMediaInfo(d))}this._enableStatisticsReporter()}}},{key:"_searchSegmentIndexContains",value:function(a){for(var d=this._mediaDataSource.segments,b=d.length-1,c=0;c<d.length;c++)if(a<d[c].timestampBase){b=c-1;break}return b}},{key:"_onInitChunkArrival",value:function(b,c){var m=this,h=null;h=0;0<c?(this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=
this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,h=this._demuxer.parseChunks(b,c)):(h=q["default"].probe(b)).match?(this._demuxer=new q["default"](h,this._config),this._remuxer||(this._remuxer=new t["default"](this._config)),h=this._mediaDataSource,void 0==h.duration||isNaN(h.duration)||(this._demuxer.overridedDuration=h.duration),"boolean"==typeof h.hasAudio&&(this._demuxer.overridedHasAudio=h.hasAudio),"boolean"==typeof h.hasVideo&&(this._demuxer.overridedHasVideo=h.hasVideo),
this._demuxer.timestampBase=h.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),h=this._demuxer.parseChunks(b,c)):(h=null,a["default"].e(this.TAG,"Non-FLV, Unsupported media type!"),
Promise.resolve().then(function(){m._internalAbort()}),this._emitter.emit(d["default"].DEMUX_ERROR,p["default"].FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),h=0);return h}},{key:"_onMediaInfo",value:function(a){var d=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},a),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,h["default"].prototype));a=Object.assign({},
a);Object.setPrototypeOf(a,h["default"].prototype);this._mediaInfo.segments[this._currentSegmentIndex]=a;this._reportSegmentMediaInfo(this._currentSegmentIndex);null!=this._pendingSeekTime&&Promise.resolve().then(function(){var a=d._pendingSeekTime;d._pendingSeekTime=null;d.seek(a)})}},{key:"_onIOSeeked",value:function(){this._remuxer.insertDiscontinuity()}},{key:"_onIOComplete",value:function(a){a+=1;a<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),
this._loadSegment(a)):(this._remuxer.flushStashedSamples(),this._emitter.emit(d["default"].LOADING_COMPLETE),this._disableStatisticsReporter())}},{key:"_onIORedirect",value:function(a){this._mediaDataSource.segments[this._ioctl.extraData].redirectedURL=a}},{key:"_onIORecoveredEarlyEof",value:function(){this._emitter.emit(d["default"].RECOVERED_EARLY_EOF)}},{key:"_onIOException",value:function(b,c){a["default"].e(this.TAG,"IOException: type = "+b+", code = "+c.code+", msg = "+c.msg);this._emitter.emit(d["default"].IO_ERROR,
b,c);this._disableStatisticsReporter()}},{key:"_onDemuxException",value:function(b,c){a["default"].e(this.TAG,"DemuxException: type = "+b+", info = "+c);this._emitter.emit(d["default"].DEMUX_ERROR,b,c)}},{key:"_onRemuxerInitSegmentArrival",value:function(a,b){this._emitter.emit(d["default"].INIT_SEGMENT,a,b)}},{key:"_onRemuxerMediaSegmentArrival",value:function(a,c){null==this._pendingSeekTime&&(this._emitter.emit(d["default"].MEDIA_SEGMENT,a,c),null!=this._pendingResolveSeekPoint&&"video"===a)&&
(a=c.info.syncPoints,c=this._pendingResolveSeekPoint,this._pendingResolveSeekPoint=null,b["default"].safari&&0<a.length&&a[0].originalDts===c&&(c=a[0].pts),this._emitter.emit(d["default"].RECOMMEND_SEEKPOINT,c))}},{key:"_enableStatisticsReporter",value:function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}},{key:"_disableStatisticsReporter",value:function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),
this._statisticsReporter=null)}},{key:"_reportSegmentMediaInfo",value:function(a){a=Object.assign({},this._mediaInfo.segments[a]);a.duration=this._mediaInfo.duration;a.segmentCount=this._mediaInfo.segmentCount;delete a.segments;delete a.keyframesIndex;this._emitter.emit(d["default"].MEDIA_INFO,a)}},{key:"_reportStatisticsInfo",value:function(){var a={};a.url=this._ioctl.currentURL;a.hasRedirect=this._ioctl.hasRedirect;a.hasRedirect&&(a.redirectedURL=this._ioctl.currentRedirectedURL);a.speed=this._ioctl.currentSpeed;
a.loaderType=this._ioctl.loaderType;a.currentSegmentIndex=this._currentSegmentIndex;a.totalSegmentCount=this._mediaDataSource.segments.length;this._emitter.emit(d["default"].STATISTICS_INFO,a)}}]),n}());l["default"]=f},{"../demux/demux-errors.js":16,"../demux/flv-demuxer.js":18,"../io/io-controller.js":23,"../io/loader.js":24,"../remux/mp4-remuxer.js":38,"../utils/browser.js":39,"../utils/logger.js":41,"./media-info.js":7,"./transmuxing-events.js":13,events:2}],13:[function(f,g,l){Object.defineProperty(l,
"__esModule",{value:!0});l["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",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},{}],14:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});g=f("../utils/logger.js");g=(k(g),f("../utils/logging-control.js"));
var e=k(g);g=f("../utils/polyfill.js");var c=k(g);g=f("./transmuxing-controller.js");var a=k(g);f=f("./transmuxing-events.js");var b=k(f);l["default"]=function(h){function f(a,d){h.postMessage({msg:b["default"].INIT_SEGMENT,data:{type:a,data:d}},[d.data])}function g(a,d){h.postMessage({msg:b["default"].MEDIA_SEGMENT,data:{type:a,data:d}},[d.data])}function p(){h.postMessage({msg:b["default"].LOADING_COMPLETE})}function r(){h.postMessage({msg:b["default"].RECOVERED_EARLY_EOF})}function d(a){h.postMessage({msg:b["default"].MEDIA_INFO,
data:a})}function n(a){h.postMessage({msg:b["default"].STATISTICS_INFO,data:a})}function m(a,d){h.postMessage({msg:b["default"].IO_ERROR,data:{type:a,info:d}})}function x(a,d){h.postMessage({msg:b["default"].DEMUX_ERROR,data:{type:a,info:d}})}function A(a){h.postMessage({msg:b["default"].RECOMMEND_SEEKPOINT,data:a})}var u=null,F=function(a,d){h.postMessage({msg:"logcat_callback",data:{type:a,logcat:d}})}.bind(this);c["default"].install();h.addEventListener("message",function(c){switch(c.data.cmd){case "init":u=
new a["default"](c.data.param[0],c.data.param[1]);u.on(b["default"].IO_ERROR,m.bind(this));u.on(b["default"].DEMUX_ERROR,x.bind(this));u.on(b["default"].INIT_SEGMENT,f.bind(this));u.on(b["default"].MEDIA_SEGMENT,g.bind(this));u.on(b["default"].LOADING_COMPLETE,p.bind(this));u.on(b["default"].RECOVERED_EARLY_EOF,r.bind(this));u.on(b["default"].MEDIA_INFO,d.bind(this));u.on(b["default"].STATISTICS_INFO,n.bind(this));u.on(b["default"].RECOMMEND_SEEKPOINT,A.bind(this));break;case "destroy":u&&(u.destroy(),
u=null);h.postMessage({msg:"destroyed"});break;case "start":u.start();break;case "stop":u.stop();break;case "seek":u.seek(c.data.param);break;case "pause":u.pause();break;case "block":u.block();break;case "unblock":u.unblock();break;case "resume":u.resume();break;case "logging_config":c=c.data.param,e["default"].applyConfig(c),!0===c.enableCallback?e["default"].addLogListener(F):e["default"].removeLogListener(F)}})}},{"../utils/logger.js":41,"../utils/logging-control.js":42,"../utils/polyfill.js":43,
"./transmuxing-controller.js":12,"./transmuxing-events.js":13}],15:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function a(a,b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,h){return c&&a(b.prototype,c),h&&a(b,h),b}}(),e=(g=f("../utils/logger.js"))&&g.__esModule?g:{"default":g},c=(g=f("../utils/utf8-conv.js"))&&g.__esModule?g:{"default":g},
a=f("../utils/exception.js"),b=function(){var a=new ArrayBuffer(2);return(new DataView(a)).setInt16(0,256,!0),256===(new Int16Array(a))[0]}();f=function(){function h(){if(!(this instanceof h))throw new TypeError("Cannot call a class as a function");}return k(h,null,[{key:"parseScriptData",value:function(a,b,c){var f={};try{var d=h.parseValue(a,b,c),n=h.parseValue(a,b+d.size,c-d.size);f[d.data]=n.data}catch(m){e["default"].e("AMF",m.toString())}return f}},{key:"parseObject",value:function(b,c,e){if(3>
e)throw new a.IllegalStateException("Data not enough when parse ScriptDataObject");var f=h.parseString(b,c,e);b=h.parseValue(b,c+f.size,e-f.size);return{data:{name:f.data,value:b.data},size:f.size+b.size,objectEnd:b.objectEnd}}},{key:"parseVariable",value:function(a,b,c){return h.parseObject(a,b,c)}},{key:"parseString",value:function(h,e,f){if(2>f)throw new a.IllegalStateException("Data not enough when parse String");f=(new DataView(h,e,f)).getUint16(0,!b);var g=void 0;return g=0<f?(0,c["default"])(new Uint8Array(h,
e+2,f)):"",{data:g,size:2+f}}},{key:"parseLongString",value:function(h,e,f){if(4>f)throw new a.IllegalStateException("Data not enough when parse LongString");f=(new DataView(h,e,f)).getUint32(0,!b);var g=void 0;return g=0<f?(0,c["default"])(new Uint8Array(h,e+4,f)):"",{data:g,size:4+f}}},{key:"parseDate",value:function(c,h,e){if(10>e)throw new a.IllegalStateException("Data size invalid when parse Date");h=new DataView(c,h,e);c=h.getFloat64(0,!b);h=h.getInt16(8,!b);return c+=6E4*h,{data:new Date(c),
size:10}}},{key:"parseValue",value:function(c,f,g){if(1>g)throw new a.IllegalStateException("Data not enough when parse Value");var r=new DataView(c,f,g),d=1,n=r.getUint8(0),m=void 0,x=!1;try{switch(n){case 0:m=r.getFloat64(1,!b);d+=8;break;case 1:m=r.getUint8(1)?!0:!1;d+=1;break;case 2:var p=h.parseString(c,f+1,g-1);m=p.data;d+=p.size;break;case 3:m={};var u=0;for(9===(16777215&r.getUint32(g-4,!b))&&(u=3);g-4>d;){var F=h.parseObject(c,f+d,g-d-u);if(F.objectEnd)break;m[F.data.name]=F.data.value;d+=
F.size}g-3>=d&&9===(16777215&r.getUint32(d-1,!b))&&(d+=3);break;case 8:m={};d+=4;F=0;for(9===(16777215&r.getUint32(g-4,!b))&&(F=3);g-8>d;){u=h.parseVariable(c,f+d,g-d-F);if(u.objectEnd)break;m[u.data.name]=u.data.value;d+=u.size}g-3>=d&&9===(16777215&r.getUint32(d-1,!b))&&(d+=3);break;case 9:m=void 0;d=1;x=!0;break;case 10:m=[];var q=r.getUint32(1,!b);d+=4;for(r=0;q>r;r++){var t=h.parseValue(c,f+d,g-d);m.push(t.data);d+=t.size}break;case 11:var k=h.parseDate(c,f+1,g-1);m=k.data;d+=k.size;break;case 12:var l=
h.parseString(c,f+1,g-1);m=l.data;d+=l.size;break;default:d=g,e["default"].w("AMF","Unsupported AMF value type "+n)}}catch(w){e["default"].e("AMF",w.toString())}return{data:m,size:d,objectEnd:x}}}]),h}();l["default"]=f},{"../utils/exception.js":40,"../utils/logger.js":41,"../utils/utf8-conv.js":44}],16:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});l["default"]={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},{}],
17:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function c(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(a,b,h){return b&&c(a.prototype,b),h&&c(a,h),a}}(),e=f("../utils/exception.js");f=function(){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.TAG="ExpGolomb";this._buffer=a;this._buffer_index=
0;this._total_bytes=a.byteLength;this._total_bits=8*a.byteLength;this._current_word_bits_left=this._current_word=0}return k(c,[{key:"destroy",value:function(){this._buffer=null}},{key:"_fillCurrentWord",value:function(){var a=this._total_bytes-this._buffer_index;if(0>=a)throw new e.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");a=Math.min(4,a);var b=new Uint8Array(4);b.set(this._buffer.subarray(this._buffer_index,this._buffer_index+a));this._current_word=(new DataView(b.buffer)).getUint32(0,
!1);this._buffer_index+=a;this._current_word_bits_left=8*a}},{key:"readBits",value:function(a){if(32<a)throw new e.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(a<=this._current_word_bits_left){var b=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,b}b=this._current_word_bits_left?this._current_word:0;b>>>=32-this._current_word_bits_left;a-=this._current_word_bits_left;this._fillCurrentWord();a=Math.min(a,this._current_word_bits_left);
var c=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,b<<a|c}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readByte",value:function(){return this.readBits(8)}},{key:"_skipLeadingZero",value:function(){var a;for(a=0;a<this._current_word_bits_left;a++)if(0!==(this._current_word&2147483648>>>a))return this._current_word<<=a,this._current_word_bits_left-=a,a;return this._fillCurrentWord(),a+this._skipLeadingZero()}},{key:"readUEG",value:function(){var a=
this._skipLeadingZero();return this.readBits(a+1)-1}},{key:"readSEG",value:function(){var a=this.readUEG();return 1&a?a+1>>>1:-1*(a>>>1)}}]),c}();l["default"]=f},{"../utils/exception.js":40}],18:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?
"symbol":typeof a},c=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){return b&&a(d.prototype,b),c&&a(d,c),d}}();g=f("../utils/logger.js");var a=k(g);g=f("./amf-parser.js");var b=k(g);g=f("./sps-parser.js");var h=k(g);g=f("./demux-errors.js");var q=k(g);g=f("../core/media-info.js");var t=k(g),p=f("../utils/exception.js");f=function(){function f(a,b){if(!(this instanceof
f))throw new TypeError("Cannot call a class as a function");this.TAG="FLVDemuxer";this._config=b;this._onDataAvailable=this._onTrackMetadata=this._onMediaInfo=this._onError=null;this._dataOffset=a.dataOffset;this._firstParse=!0;this._dispatch=!1;this._hasAudio=a.hasAudioTrack;this._hasVideo=a.hasVideoTrack;this._videoInitialMetadataDispatched=this._audioInitialMetadataDispatched=this._hasVideoFlagOverrided=this._hasAudioFlagOverrided=!1;this._mediaInfo=new t["default"];this._mediaInfo.hasAudio=this._hasAudio;
this._mediaInfo.hasVideo=this._hasVideo;this._videoMetadata=this._audioMetadata=this._metadata=null;this._naluLengthSize=4;this._timestampBase=0;this._timescale=1E3;this._duration=this.block_status=this._tagCount=0;this._durationOverrided=!1;this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1E3};this._flvSoundRateTable=[5500,11025,22050,44100,48E3];this._mpegSamplingRates=[96E3,88200,64E3,48E3,44100,32E3,24E3,22050,16E3,12E3,11025,8E3,7350];this._mpegAudioV10SampleRateTable=[44100,
48E3,32E3,0];this._mpegAudioV20SampleRateTable=[22050,24E3,16E3,0];this._mpegAudioV25SampleRateTable=[11025,12E3,8E3,0];this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1];this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1];this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0};this._audioTrack={type:"audio",id:2,sequenceNumber:0,
samples:[],length:0};a=new ArrayBuffer(2);this._littleEndian=((new DataView(a)).setInt16(0,256,!0),256===(new Int16Array(a))[0])}return c(f,[{key:"destroy",value:function(){this._onDataAvailable=this._onTrackMetadata=this._onMediaInfo=this._onError=this._audioTrack=this._videoTrack=this._videoMetadata=this._audioMetadata=this._metadata=this._mediaInfo=null}},{key:"bindDataSource",value:function(a){return a.onDataArrival=this.parseChunks.bind(this),this}},{key:"resetMediaInfo",value:function(){this._mediaInfo=
new t["default"]}},{key:"block",value:function(){a["default"].e(this.TAG,"recveve block cmd!!!");0==this.block_status&&(this.block_status=1)}},{key:"unblock",value:function(){a["default"].e(this.TAG,"recveve unblock cmd!!!");this.block_status=3}},{key:"_isInitialMetadataDispatched",value:function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?
this._videoInitialMetadataDispatched:!1}},{key:"parseChunks",value:function(d,b){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new p.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var c=0,h=this._littleEndian;if(0===b){if(!(13<d.byteLength))return 0;c=f.probe(d).dataOffset}this._firstParse&&(this._firstParse=!1,b+c!==this._dataOffset&&a["default"].w(this.TAG,"First time parsing but chunk byteStart invalid!"),
0!==(new DataView(d,c)).getUint32(0,!h)&&a["default"].w(this.TAG,"PrevTagSize0 !== 0 !!!"),c+=4);for(;c<d.byteLength;){this._dispatch=!0;var e=new DataView(d,c);if(c+11+4>d.byteLength)break;var n=e.getUint8(0),g=16777215&e.getUint32(0,!h);if(c+11+g+4>d.byteLength)break;if(8===n||9===n||18===n){var r=e.getUint8(4),q=e.getUint8(5),t=e.getUint8(6),k=e.getUint8(7);r=t|q<<8|r<<16|k<<24;0!==(16777215&e.getUint32(7,!h))&&a["default"].w(this.TAG,"Meet tag which has StreamID != 0!");q=c+11;switch(n){case 8:this._tagCount++;
this._parseAudioData(d,q,g,r);break;case 9:this._tagCount++;this._parseVideoData(d,q,g,r,b+c);break;case 18:this._parseScriptData(d,q,g)}e=e.getUint32(11+g,!h);e!==11+g&&a["default"].w(this.TAG,"Invalid PrevTagSize "+e)}else a["default"].w(this.TAG,"Unsupported tag type "+n+", skipped");c+=11+g+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),c}},{key:"_parseScriptData",value:function(d,
c,h){d=b["default"].parseScriptData(d,c,h);if(d.hasOwnProperty("onMetaData")){if(null==d.onMetaData||"object"!==e(d.onMetaData))return void a["default"].w(this.TAG,"Invalid onMetaData structure!");if(this._metadata&&125<this._tagCount)return void this._onError(q["default"].FORMAT_ERROR,"another onMetaData when playing!");this._metadata&&a["default"].w(this.TAG,"Found another onMetaData tag!");this._metadata=d;d=this._metadata.onMetaData;("boolean"==typeof d.hasAudio?(a["default"].v(this.TAG,"onMetaData.hasAudio = "+
d.hasAudio),!1===this._hasAudioFlagOverrided&&(this._hasAudio=d.hasAudio,this._mediaInfo.hasAudio=this._hasAudio)):(!1===this._hasVideoFlagOverrided&&(this._hasAudio=!1,this._mediaInfo.hasAudio=this._hasAudio),a["default"].v(this.TAG,"onMetaData.hasAudio = none")),"boolean"==typeof d.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=d.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof d.audiodatarate&&(this._mediaInfo.audioDataRate=d.audiodatarate),"number"==typeof d.videodatarate&&
(this._mediaInfo.videoDataRate=d.videodatarate),"number"==typeof d.width&&(this._mediaInfo.width=d.width),"number"==typeof d.height&&(this._mediaInfo.height=d.height),"number"==typeof d.duration)?this._durationOverrided||(this._duration=c=Math.floor(d.duration*this._timescale),this._mediaInfo.duration=c):this._mediaInfo.duration=0;"number"==typeof d.framerate&&(c=Math.floor(1E3*d.framerate),0<c&&(h=c/1E3,this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=h,this._referenceFrameRate.fps_num=
c,this._referenceFrameRate.fps_den=1E3,this._mediaInfo.fps=h));"object"===e(d.keyframes)?(this._mediaInfo.hasKeyframesIndex=!0,this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(d.keyframes),d.keyframes=null):this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1;this._mediaInfo.metadata=d;a["default"].v(this.TAG,"Parsed onMetaData");this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}}},{key:"_parseKeyframesIndex",value:function(a){for(var d=[],b=[],c=1;c<a.times.length;c++)d.push(this._timestampBase+
Math.floor(1E3*a.times[c])),b.push(a.filepositions[c]);return{times:d,filepositions:b}}},{key:"_parseAudioData",value:function(d,b,c,h){if(1>=c)return void a["default"].w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){var e=(this._littleEndian,new DataView(d,b,c)).getUint8(0),m=e>>>4;if(2!==m&&10!==m)return void this._onError(q["default"].CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+m);var f=(12&e)>>>2;if(!(0<=
f&&4>=f))return void this._onError(q["default"].FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+f);var n=this._flvSoundRateTable[f];var g=this._audioMetadata;f=this._audioTrack;if(g||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),g=this._audioMetadata={},g.type="audio",g.id=f.id,g.timescale=this._timescale,g.duration=this._duration,g.audioSampleRate=n,g.channelCount=0===(1&e)?1:2),10===m)d=this._parseAACAudioData(d,b+1,c-1),void 0!=d&&(0===
d.packetType?(g.config&&a["default"].w(this.TAG,"Found another AudioSpecificConfig!"),f=d.data,g.audioSampleRate=f.samplingRate,g.channelCount=f.channelCount,g.codec=f.codec,g.originalCodec=f.originalCodec,g.config=f.config,g.refSampleDuration=1024/g.audioSampleRate*g.timescale,a["default"].v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=
!0,this._dispatch=!1,this._onTrackMetadata("audio",g),f=this._mediaInfo,f.audioCodec=g.originalCodec,f.audioSampleRate=g.audioSampleRate,f.audioChannelCount=g.channelCount,f.hasVideo?null!=f.videoCodec&&(f.mimeType='video/x-flv; codecs="'+f.videoCodec+","+f.audioCodec+'"'):f.mimeType='video/x-flv; codecs="'+f.audioCodec+'"',f.isComplete()&&this._onMediaInfo(f)):1===d.packetType?(h=this._timestampBase+h,f.samples.push({unit:d.data,length:d.data.byteLength,dts:h,pts:h}),f.length+=d.data.length):a["default"].e(this.TAG,
"Flv: Unsupported AAC data type "+d.packetType));else if(2===m){if(!g.codec){e=this._parseMP3AudioData(d,b+1,c-1,!0);if(void 0==e)return;g.audioSampleRate=e.samplingRate;g.channelCount=e.channelCount;g.codec=e.codec;g.originalCodec=e.originalCodec;g.refSampleDuration=1152/g.audioSampleRate*g.timescale;a["default"].v(this.TAG,"Parsed MPEG Audio Frame Header");this._audioInitialMetadataDispatched=!0;this._onTrackMetadata("audio",g);m=this._mediaInfo;m.audioCodec=g.codec;m.audioSampleRate=g.audioSampleRate;
m.audioChannelCount=g.channelCount;m.audioDataRate=e.bitRate;m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"';m.isComplete()&&this._onMediaInfo(m)}g=this._parseMP3AudioData(d,b+1,c-1,!1);void 0!=g&&(h=this._timestampBase+h,f.samples.push({unit:g,length:g.byteLength,dts:h,pts:h}),f.length+=g.length)}}}},{key:"_parseAACAudioData",value:function(d,b,c){if(1>=c)return void a["default"].w(this.TAG,
"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");var h={},e=new Uint8Array(d,b,c);return h.packetType=e[0],0===e[0]?h.data=this._parseAACAudioSpecificConfig(d,b+1,c-1):h.data=e.subarray(1),h}},{key:"_parseAACAudioSpecificConfig",value:function(a,b,c){var d=new Uint8Array(a,b,c);a=null;var h=0,e=null;if(b=c=d[0]>>>3,h=(7&d[0])<<1|d[1]>>>7,0>h||h>=this._mpegSamplingRates.length)return void this._onError(q["default"].FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");var f=this._mpegSamplingRates[h],
m=(120&d[1])>>>3;if(0>m||8<=m)return void this._onError(q["default"].FORMAT_ERROR,"Flv: AAC invalid channel configuration");5===b&&(e=(7&d[1])<<1|d[2]>>>7);d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?6<=h?(b=5,a=Array(4),e=h-3):(b=2,a=Array(2),e=h):-1!==d.indexOf("android")?(b=2,a=Array(2),e=h):(b=5,e=h,a=Array(4),6<=h?e=h-3:1===m&&(b=2,a=Array(2),e=h)),a[0]=b<<3,a[0]|=(15&h)>>>1,a[1]=(15&h)<<7,a[1]|=(15&m)<<3,5===b&&(a[1]|=(15&e)>>>1,a[2]=(1&e)<<7,a[2]|=8,a[3]=0),{config:a,
samplingRate:f,channelCount:m,codec:"mp4a.40."+b,originalCodec:"mp4a.40."+c}}},{key:"_parseMP3AudioData",value:function(d,b,c,h){if(4>c)return void a["default"].w(this.TAG,"Flv: Invalid MP3 packet, header missing!");d=(this._littleEndian,new Uint8Array(d,b,c));if(h){if(255!==d[0])return;h=(6&d[1])>>1;b=(240&d[2])>>>4;c=(12&d[2])>>>2;var e=d[3]>>>6&3,f=0,m=0;switch(d[1]>>>3&3){case 0:f=this._mpegAudioV25SampleRateTable[c];break;case 2:f=this._mpegAudioV20SampleRateTable[c];break;case 3:f=this._mpegAudioV10SampleRateTable[c]}switch(h){case 1:b<
this._mpegAudioL3BitRateTable.length&&(m=this._mpegAudioL3BitRateTable[b]);break;case 2:b<this._mpegAudioL2BitRateTable.length&&(m=this._mpegAudioL2BitRateTable[b]);break;case 3:b<this._mpegAudioL1BitRateTable.length&&(m=this._mpegAudioL1BitRateTable[b])}d={bitRate:m,samplingRate:f,channelCount:3!==e?2:1,codec:"mp3",originalCodec:"mp3"}}return d}},{key:"_parseVideoData",value:function(d,b,c,h,e){if(1>=c)return void a["default"].w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");if(!0!==
this._hasVideoFlagOverrided||!1!==this._hasVideo){var f=(new Uint8Array(d,b,c))[0],m=(240&f)>>>4;f&=15;return 7!==f?void this._onError(q["default"].CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+f):void this._parseAVCVideoPacket(d,b+1,c-1,h,e,m)}}},{key:"_parseAVCVideoPacket",value:function(d,b,c,h,e,f){if(4>c)return void a["default"].w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");var m=this._littleEndian,g=new DataView(d,b,c),n=g.getUint8(0);m=(16777215&
g.getUint32(0,!m))<<8>>8;if(0===n)this._parseAVCDecoderConfigurationRecord(d,b+4,c-4);else if(1===n)this._parseAVCVideoData(d,b+4,c-4,h,e,f,m);else if(2!==n)return void this._onError(q["default"].FORMAT_ERROR,"Flv: Invalid video packet type "+n)}},{key:"_parseAVCDecoderConfigurationRecord",value:function(d,b,c){if(7>c)return void a["default"].w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");var e=this._videoMetadata,f=this._videoTrack,m=this._littleEndian,g=new DataView(d,b,
c);e?"undefined"!=typeof e.avcc&&a["default"].w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),e=this._videoMetadata={},e.type="video",e.id=f.id,e.timescale=this._timescale,e.duration=this._duration);f=g.getUint8(0);var n=g.getUint8(1);g.getUint8(2);g.getUint8(3);if(1!==f||0===n)return void this._onError(q["default"].FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");if(this._naluLengthSize=
(3&g.getUint8(4))+1,3!==this._naluLengthSize&&4!==this._naluLengthSize)return void this._onError(q["default"].FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));n=31&g.getUint8(5);if(0===n)return void this._onError(q["default"].FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");1<n&&a["default"].w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+n);f=6;for(var r=0;n>r;r++){var p=g.getUint16(f,!m);if(f+=2,0!==p){var t=new Uint8Array(d,
b+f,p);f+=p;p=h["default"].parseSPS(t);if(0===r){e.codecWidth=p.codec_size.width;e.codecHeight=p.codec_size.height;e.presentWidth=p.present_size.width;e.presentHeight=p.present_size.height;e.profile=p.profile_string;e.level=p.level_string;e.bitDepth=p.bit_depth;e.chromaFormat=p.chroma_format;e.sarRatio=p.sar_ratio;e.frameRate=p.frame_rate;!1!==p.frame_rate.fixed&&0!==p.frame_rate.fps_num&&0!==p.frame_rate.fps_den||(e.frameRate=this._referenceFrameRate);e.refSampleDuration=e.frameRate.fps_den/e.frameRate.fps_num*
e.timescale;var k=t.subarray(1,4);t="avc1.";for(var l=0;3>l;l++){var v=k[l].toString(16);2>v.length&&(v="0"+v);t+=v}e.codec=t;k=this._mediaInfo;k.width=e.codecWidth;k.height=e.codecHeight;k.fps=e.frameRate.fps;k.profile=e.profile;k.level=e.level;k.refFrames=p.ref_frames;k.chromaFormat=p.chroma_format_string;k.sarNum=e.sarRatio.width;k.sarDen=e.sarRatio.height;k.videoCodec=t;k.hasAudio?null!=k.audioCodec&&(k.mimeType='video/x-flv; codecs="'+k.videoCodec+","+k.audioCodec+'"'):k.mimeType='video/x-flv; codecs="'+
k.videoCodec+'"';k.isComplete()&&this._onMediaInfo(k)}}}n=g.getUint8(f);if(0===n)return void this._onError(q["default"].FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");1<n&&a["default"].w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+n);f++;for(r=0;n>r;r++)p=g.getUint16(f,!m),f+=2,0!==p&&(f+=p);e.avcc=new Uint8Array(c);e.avcc.set(new Uint8Array(d,b,c),0);a["default"].v(this.TAG,"Parsed AVCDecoderConfigurationRecord");this._isInitialMetadataDispatched()?this._dispatch&&
(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0;this._dispatch=!1;this._onTrackMetadata("video",e)}},{key:"_parseAVCVideoData",value:function(d,b,c,h,e,f,g){var m=this._littleEndian,n=new DataView(d,b,c),r=[],x=0,p=0,u=this._naluLengthSize;h=this._timestampBase+h;for(f=1===f;c>p;){if(p+4>=c){a["default"].w(this.TAG,"Malformed Nalu near timestamp "+h+", offset = "+p+", dataSize = "+c);break}var q=n.getUint32(p,
!m);if(3===u&&(q>>>=8),q>c-u)return void a["default"].w(this.TAG,"Malformed Nalus near timestamp "+h+", NaluSize > DataSize!");var k=n.getUint8(p+u),t=31&n.getUint8(p+u);switch(k){case 103:break;case 104:break;case 101:break;case 97:break;case 65:break;case 1:break;case 6:break;case 9:break;default:a["default"].v(this.TAG,"unknow frame:"+k)}5===t&&(f=!0);k=new Uint8Array(d,b+p,u+q);r.push({type:t,data:k});x+=k.byteLength;p+=u+q}r.length&&(d=this._videoTrack,g={units:r,length:x,isKeyframe:f,dts:h,
cts:g,pts:h+g},f&&(g.fileposition=e),d.samples.push(g),d.length+=x)}},{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(a){this._onTrackMetadata=a}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(a){this._onMediaInfo=a}},{key:"onError",get:function(){return this._onError},set:function(a){this._onError=a}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(a){this._onDataAvailable=a}},{key:"timestampBase",get:function(){return this._timestampBase},
set:function(a){this._timestampBase=a}},{key:"overridedDuration",get:function(){return this._duration},set:function(a){this._durationOverrided=!0;this._duration=a;this._mediaInfo.duration=a}},{key:"overridedHasAudio",set:function(a){this._hasAudioFlagOverrided=!0;this._hasAudio=a;this._mediaInfo.hasAudio=a}},{key:"overridedHasVideo",set:function(a){this._hasVideoFlagOverrided=!0;this._hasVideo=a;this._mediaInfo.hasVideo=a}}],[{key:"probe",value:function(d){var b=new Uint8Array(d);d={match:!1};if(70!==
b[0]||76!==b[1]||86!==b[2]||1!==b[3])return d;var c=0!==(4&b[4])>>>2,h=0!==(1&b[4]);b=b[5]<<24|b[6]<<16|b[7]<<8|b[8];return 9>b?d:(a["default"].v(this.TAG,"flv header hasAudio = "+c),{match:!0,consumed:b,dataOffset:b,hasAudioTrack:c,hasVideoTrack:h})}}]),f}();l["default"]=f},{"../core/media-info.js":7,"../utils/exception.js":40,"../utils/logger.js":41,"./amf-parser.js":15,"./demux-errors.js":16,"./sps-parser.js":19}],19:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function c(a,
b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(a,b,h){return b&&c(a.prototype,b),h&&c(a,h),a}}(),e=(f=f("./exp-golomb.js"))&&f.__esModule?f:{"default":f};f=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}return k(c,null,[{key:"_ebsp2rbsp",value:function(a){for(var b=a.byteLength,c=new Uint8Array(b),e=0,f=0;b>f;f++)2<=f&&
3===a[f]&&0===a[f-1]&&0===a[f-2]||(c[e]=a[f],e++);return new Uint8Array(c.buffer,0,e)}},{key:"parseSPS",value:function(a){a=c._ebsp2rbsp(a);a=new e["default"](a);a.readByte();var b=a.readByte();a.readByte();var h=a.readByte();a.readUEG();var f=c.getProfileString(b);h=c.getLevelString(h);var g=1,p=420,r=[0,420,422,444],d=8;if((100===b||110===b||122===b||244===b||44===b||83===b||86===b||118===b||128===b||138===b||144===b)&&(g=a.readUEG(),3===g&&a.readBits(1),3>=g&&(p=r[g]),d=a.readUEG()+8,a.readUEG(),
a.readBits(1),a.readBool()))for(b=3!==g?8:12,r=0;b>r;r++)a.readBool()&&(6>r?c._skipScalingList(a,16):c._skipScalingList(a,64));a.readUEG();b=a.readUEG();if(0===b)a.readUEG();else if(1===b)for(a.readBits(1),a.readSEG(),a.readSEG(),b=a.readUEG(),r=0;b>r;r++)a.readSEG();b=a.readUEG();a.readBits(1);var n=a.readUEG(),m=a.readUEG(),x=a.readBits(1);0===x&&a.readBits(1);a.readBits(1);var k=0,u=0,F=0,l=0;a.readBool()&&(k=a.readUEG(),u=a.readUEG(),F=a.readUEG(),l=a.readUEG());var E=r=1,D=0,y=!0,w=0,z=0;if(a.readBool()){if(a.readBool()){var v=
a.readByte(),G=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];0<v&&16>v?(r=G[v-1],E=C[v-1]):255===v&&(r=a.readByte()<<8|a.readByte(),E=a.readByte()<<8|a.readByte())}if(a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(4),a.readBool()&&a.readBits(24)),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool())D=a.readBits(32),w=a.readBits(32),y=a.readBool(),z=2*D,D=w/z}v=1;1===r&&1===E||(v=r/E);0===g?(G=1,g=2-x):(G=3===g?1:2,g=(1===g?2:1)*(2-x));n=16*(n+
1)-(k+u)*G;g=16*(2-x)*(m+1)-(F+l)*g;m=Math.ceil(n*v);return a.destroy(),{profile_string:f,level_string:h,bit_depth:d,ref_frames:b,chroma_format:p,chroma_format_string:c.getChromaFormatString(p),frame_rate:{fixed:y,fps:D,fps_den:z,fps_num:w},sar_ratio:{width:r,height:E},codec_size:{width:n,height:g},present_size:{width:m,height:g}}}},{key:"_skipScalingList",value:function(a,b){for(var c=8,e=8,f=0,g=0;b>g;g++)0!==e&&(f=a.readSEG(),e=(c+f+256)%256),c=0===e?c:e}},{key:"getProfileString",value:function(a){switch(a){case 66:return"Baseline";
case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}},{key:"getLevelString",value:function(a){return(a/10).toFixed(1)}},{key:"getChromaFormatString",value:function(a){switch(a){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}]),c}();l["default"]=f},{"./exp-golomb.js":17}],20:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}
Object.defineProperty(l,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};g=f("./utils/polyfill.js");g=k(g);var c=f("./core/features.js"),a=k(c);c=f("./player/flv-player.js");var b=k(c);c=f("./player/native-player.js");var h=k(c);c=f("./player/player-events.js");c=k(c);var q=f("./player/player-errors.js"),t=f("./utils/logging-control.js");
t=k(t);var p=f("./utils/exception.js");g["default"].install();f={g_delay:0,createPlayer:function(a,d){if(null==a||"object"!==("undefined"==typeof a?"undefined":e(a)))throw new p.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!a.hasOwnProperty("type"))throw new p.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(a.type){case "flv":return new b["default"](a,d);default:return new h["default"](a,d)}},isSupported:function(){return a["default"].supportMSEH264Playback()},
getFeatureList:function(){return a["default"].getFeatureList()}};f.Events=c["default"];f.ErrorTypes=q.ErrorTypes;f.ErrorDetails=q.ErrorDetails;f.FlvPlayer=b["default"];f.NativePlayer=h["default"];f.LoggingControl=t["default"];Object.defineProperty(f,"version",{enumerable:!0,get:function(){return"1.4.2"}});l["default"]=f},{"./core/features.js":6,"./player/flv-player.js":32,"./player/native-player.js":33,"./player/player-errors.js":34,"./player/player-events.js":35,"./utils/exception.js":40,"./utils/logging-control.js":42,
"./utils/polyfill.js":43}],21:[function(f,g,l){g.exports=f("./flv.js")["default"]},{"./flv.js":20}],22:[function(f,g,l){function k(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(l,"__esModule",{value:!0});var e="function"==
typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},c=function n(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c)return a=Object.getPrototypeOf(a),null===a?void 0:n(a,b,d);if("value"in c)return c.value;b=c.get;if(void 0!==b)return b.call(d)},a=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=
c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){return d&&a(b.prototype,d),c&&a(b,c),b}}();f("../utils/logger.js");var b=(g=f("../utils/browser.js"))&&g.__esModule?g:{"default":g},h=f("./loader.js"),q=f("../utils/exception.js");f=function(f){function g(a,b){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var d=(g.__proto__||Object.getPrototypeOf(g)).call(this,"fetch-stream-loader");if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
d=!d||"object"!=typeof d&&"function"!=typeof d?this:d;return d.TAG="FetchStreamLoader",d._seekHandler=a,d._config=b,d._needStash=!0,d._requestAbort=!1,d._contentLength=null,d._receivedLength=0,d}return k(g,f),a(g,null,[{key:"isSupported",value:function(){try{var a=b["default"].msedge&&15048<=b["default"].version.minor,c=b["default"].msedge?a:!0;return self.fetch&&self.ReadableStream&&c}catch(m){return!1}}}]),a(g,[{key:"destroy",value:function(){this.isWorking()&&this.abort();c(g.prototype.__proto__||
Object.getPrototypeOf(g.prototype),"destroy",this).call(this)}},{key:"open",value:function(a,b){var d=this;this._dataSource=a;this._range=b;var c=a.url;this._config.reuseRedirectedURL&&void 0!=a.redirectedURL&&(c=a.redirectedURL);var f=this._seekHandler.getConfig(c,b);b=new self.Headers;if("object"===e(f.headers)){c=f.headers;for(var g in c)c.hasOwnProperty(g)&&b.append(g,c[g])}g={method:"GET",headers:b,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};!1===a.cors&&(g.mode=
"same-origin");a.withCredentials&&(g.credentials="include");a.referrerPolicy&&(g.referrerPolicy=a.referrerPolicy);this._status=h.LoaderStatus.kConnecting;self.fetch(f.url,g).then(function(a){if(d._requestAbort)return d._requestAbort=!1,void(d._status=h.LoaderStatus.kIdle);if(a.ok&&200<=a.status&&299>=a.status){if(a.url!==f.url&&d._onURLRedirect){var b=d._seekHandler.removeURLParameters(a.url);d._onURLRedirect(b)}b=a.headers.get("Content-Length");return null!=b&&(d._contentLength=parseInt(b),0!==d._contentLength&&
d._onContentLengthKnown&&d._onContentLengthKnown(d._contentLength)),d._pump.call(d,a.body.getReader())}if(d._status=h.LoaderStatus.kError,!d._onError)throw new q.RuntimeException("FetchStreamLoader: Http code invalid, "+a.status+" "+a.statusText);d._onError(h.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:a.status,msg:a.statusText})})["catch"](function(a){if(d._status=h.LoaderStatus.kError,!d._onError)throw a;d._onError(h.LoaderErrors.EXCEPTION,{code:-1,msg:a.message})})}},{key:"abort",value:function(){this._requestAbort=
!0}},{key:"_pump",value:function(a){var d=this;return a.read().then(function(b){if(b.done)if(null!==d._contentLength&&d._receivedLength<d._contentLength){d._status=h.LoaderStatus.kError;b=h.LoaderErrors.EARLY_EOF;var c={code:-1,msg:"Fetch stream meet Early-EOF"};if(!d._onError)throw new q.RuntimeException(c.msg);d._onError(b,c)}else d._status=h.LoaderStatus.kComplete,d._onComplete&&d._onComplete(d._range.from,d._range.from+d._receivedLength-1);else{if(!0===d._requestAbort)return d._requestAbort=!1,
d._status=h.LoaderStatus.kComplete,a.cancel();d._status=h.LoaderStatus.kBuffering;b=b.value.buffer;c=d._range.from+d._receivedLength;d._receivedLength+=b.byteLength;d._onDataArrival&&d._onDataArrival(b,c,d._receivedLength);d._pump(a)}})["catch"](function(a){if(11!==a.code||!b["default"].msedge){d._status=h.LoaderStatus.kError;var c=0,e=null;if(19!==a.code&&"network error"!==a.message||!(null===d._contentLength||null!==d._contentLength&&d._receivedLength<d._contentLength)?(c=h.LoaderErrors.EXCEPTION,
e={code:a.code,msg:a.message}):(c=h.LoaderErrors.EARLY_EOF,e={code:a.code,msg:"Fetch stream meet Early-EOF"}),!d._onError)throw new q.RuntimeException(e.msg);d._onError(c,e)}})}}]),g}(h.BaseLoader);l["default"]=f},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],23:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});var e=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];
c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){return b&&a(d.prototype,b),c&&a(d,c),d}}();g=f("../utils/logger.js");var c=k(g);g=f("./speed-sampler.js");var a=k(g),b=f("./loader.js");g=f("./fetch-stream-loader.js");var h=k(g);g=f("./xhr-moz-chunked-loader.js");var q=k(g);g=f("./xhr-msstream-loader.js");g=(k(g),f("./xhr-range-loader.js"));var t=k(g);g=f("./websocket-loader.js");var p=k(g);g=f("./range-seek-handler.js");
var r=k(g);g=f("./param-seek-handler.js");var d=k(g),n=f("../utils/exception.js");f=function(){function f(d,b,c){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.TAG="IOController";this._config=b;this._extraData=c;this._stashInitialSize=393216;void 0!=b.stashInitialSize&&0<b.stashInitialSize&&(this._stashInitialSize=b.stashInitialSize);this._stashUsed=0;this._stashSize=this._stashInitialSize;this._bufferSize=3145728;this._stashBuffer=new ArrayBuffer(this._bufferSize);
this._stashByteStart=0;this._enableStash=!0;!1===b.enableStashBuffer&&(this._enableStash=!1);this._seekHandler=this._loaderClass=this._loader=null;this._dataSource=d;this._isWebSocketURL=/wss?:\/\/(.+?)/.test(d.url);this._totalLength=this._refTotalLength=d.filesize?d.filesize:null;this._fullRequestFlag=!1;this._redirectedURL=this._currentRange=null;this._speedNormalized=0;this._speedSampler=new a["default"];this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096];this._paused=this._isEarlyEofReconnecting=
!1;this._resumeFrom=0;this._onRecoveredEarlyEof=this._onRedirect=this._onComplete=this._onError=this._onSeeked=this._onDataArrival=null;this._selectSeekHandler();this._selectLoader();this._createLoader()}return e(f,[{key:"destroy",value:function(){this._loader.isWorking()&&this._loader.abort();this._loader.destroy();this._stashBuffer=this._dataSource=this._loaderClass=this._loader=null;this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0;this._speedSampler=this._currentRange=null;
this._isEarlyEofReconnecting=!1;this._extraData=this._onRecoveredEarlyEof=this._onRedirect=this._onComplete=this._onError=this._onSeeked=this._onDataArrival=null}},{key:"isWorking",value:function(){return this._loader&&this._loader.isWorking()&&!this._paused}},{key:"isPaused",value:function(){return this._paused}},{key:"_selectSeekHandler",value:function(){var a=this._config;if("range"===a.seekType)this._seekHandler=new r["default"](this._config.rangeLoadZeroStart);else if("param"===a.seekType)this._seekHandler=
new d["default"](a.seekParamStart||"bstart",a.seekParamEnd||"bend");else{if("custom"!==a.seekType)throw new n.InvalidArgumentException("Invalid seekType in config: "+a.seekType);if("function"!=typeof a.customSeekHandler)throw new n.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new a.customSeekHandler}}},{key:"_selectLoader",value:function(){if(this._isWebSocketURL)this._loaderClass=p["default"];else if(h["default"].isSupported())this._loaderClass=
h["default"];else if(q["default"].isSupported())this._loaderClass=q["default"];else{if(!t["default"].isSupported())throw new n.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=t["default"]}}},{key:"_createLoader",value:function(){this._loader=new this._loaderClass(this._seekHandler,this._config);!1===this._loader.needStashBuffer&&(this._enableStash=!1);this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this);this._loader.onURLRedirect=
this._onURLRedirect.bind(this);this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this);this._loader.onComplete=this._onLoaderComplete.bind(this);this._loader.onError=this._onLoaderError.bind(this)}},{key:"open",value:function(a){this._currentRange={from:0,to:-1};a&&(this._currentRange.from=a);this._speedSampler.reset();a||(this._fullRequestFlag=!0);this._loader.open(this._dataSource,Object.assign({},this._currentRange))}},{key:"abort",value:function(){this._loader.abort();this._paused&&(this._paused=
!1,this._resumeFrom=0)}},{key:"pause",value:function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}},{key:"resume",value:function(){if(this._paused){this._paused=!1;var a=this._resumeFrom;this._resumeFrom=0;this._internalSeek(a,!0)}}},{key:"seek",value:function(a){this._paused=!1;this._stashByteStart=
this._stashUsed=0;this._internalSeek(a,!0)}},{key:"_internalSeek",value:function(a,d){this._loader.isWorking()&&this._loader.abort();this._flushStashBuffer(d);this._loader.destroy();this._loader=null;a={from:a,to:-1};this._currentRange={from:a.from,to:-1};this._speedSampler.reset();this._stashSize=this._stashInitialSize;this._createLoader();this._loader.open(this._dataSource,a);this._onSeeked&&this._onSeeked()}},{key:"updateUrl",value:function(a){if(!a||"string"!=typeof a||0===a.length)throw new n.InvalidArgumentException("Url must be a non-empty string!");
this._dataSource.url=a}},{key:"_expandBuffer",value:function(a){for(var d=this._stashSize;a>d+1048576;)d*=2;if(d+=1048576,d!==this._bufferSize){a=new ArrayBuffer(d);if(0<this._stashUsed){var b=new Uint8Array(this._stashBuffer,0,this._stashUsed);(new Uint8Array(a,0,d)).set(b,0)}this._stashBuffer=a;this._bufferSize=d}}},{key:"_normalizeSpeed",value:function(a){var d=this._speedNormalizeList,b=d.length-1,c=0,e=0,h=b;if(a<d[0])return d[0];for(;h>=e;){if(c=e+Math.floor((h-e)/2),c===b||a>=d[c]&&a<d[c+1])return d[c];
d[c]<a?e=c+1:h=c-1}}},{key:"_adjustStashSize",value:function(a){a=this._config.isLive?a:512>a?a:512<=a&&1024>=a?Math.floor(1.5*a):2*a;8192<a&&(a=8192);var d=1024*a+1048576;this._bufferSize<d&&this._expandBuffer(d);this._stashSize=1024*a}},{key:"_dispatchChunks",value:function(a,d){return this._currentRange.to=d+a.byteLength-1,this._onDataArrival(a,d)}},{key:"_onURLRedirect",value:function(a){this._redirectedURL=a;this._onRedirect&&this._onRedirect(a)}},{key:"_onContentLengthKnown",value:function(a){a&&
this._fullRequestFlag&&(this._totalLength=a,this._fullRequestFlag=!1)}},{key:"_onLoaderChunkArrival",value:function(a,d,b){if(!this._onDataArrival)throw new n.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused)if(this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(a.byteLength),b=this._speedSampler.lastSecondKBps,0!==b&&(b=this._normalizeSpeed(b),this._speedNormalized!==
b&&(this._speedNormalized=b,this._adjustStashSize(b))),this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=d),this._stashUsed+a.byteLength<=this._stashSize)(new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(a),this._stashUsed),this._stashUsed+=a.byteLength;else if(b=new Uint8Array(this._stashBuffer,0,this._bufferSize),0<this._stashUsed){var c=this._stashBuffer.slice(0,this._stashUsed);d=this._dispatchChunks(c,this._stashByteStart);d<c.byteLength?
0<d&&(c=new Uint8Array(c,d),b.set(c,0),this._stashUsed=c.byteLength,this._stashByteStart+=d):(this._stashUsed=0,this._stashByteStart+=d);this._stashUsed+a.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+a.byteLength),b=new Uint8Array(this._stashBuffer,0,this._bufferSize));b.set(new Uint8Array(a),this._stashUsed);this._stashUsed+=a.byteLength}else{if(c=this._dispatchChunks(a,d),c<a.byteLength){var e=a.byteLength-c;e>this._bufferSize&&(this._expandBuffer(e),b=new Uint8Array(this._stashBuffer,
0,this._bufferSize));b.set(new Uint8Array(a,c),0);this._stashUsed+=e;this._stashByteStart=d+c}}else 0===this._stashUsed?(b=this._dispatchChunks(a,d),b<a.byteLength&&(c=a.byteLength-b,c>this._bufferSize&&this._expandBuffer(c),(new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(a,b),0),this._stashUsed+=c,this._stashByteStart=d+b)):(this._stashUsed+a.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+a.byteLength),d=new Uint8Array(this._stashBuffer,0,this._bufferSize),
d.set(new Uint8Array(a),this._stashUsed),this._stashUsed+=a.byteLength,a=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart),a<this._stashUsed&&0<a&&(b=new Uint8Array(this._stashBuffer,a),d.set(b,0)),this._stashUsed-=a,this._stashByteStart+=a)}},{key:"_flushStashBuffer",value:function(a){if(0<this._stashUsed){var d=this._stashBuffer.slice(0,this._stashUsed),b=this._dispatchChunks(d,this._stashByteStart),e=d.byteLength-b;if(b<d.byteLength){if(!a)return 0<b&&(a=new Uint8Array(this._stashBuffer,
0,this._bufferSize),d=new Uint8Array(d,b),a.set(d,0),this._stashUsed=d.byteLength,this._stashByteStart+=b),0;c["default"].w(this.TAG,e+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,e}return 0}},{key:"_onLoaderComplete",value:function(a,d){this._flushStashBuffer(!0);this._onComplete&&this._onComplete(this._extraData)}},{key:"_onLoaderError",value:function(a,d){switch(c["default"].e(this.TAG,"Loader error, code = "+d.code+", msg = "+d.msg),
this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,a=b.LoaderErrors.UNRECOVERABLE_EARLY_EOF),a){case b.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength)return a=this._currentRange.to+1,void(a<this._totalLength&&(c["default"].w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(a,!1)));a=b.LoaderErrors.UNRECOVERABLE_EARLY_EOF}if(!this._onError)throw new n.RuntimeException("IOException: "+d.msg);
this._onError(a,d)}},{key:"status",get:function(){return this._loader.status}},{key:"extraData",get:function(){return this._extraData},set:function(a){this._extraData=a}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(a){this._onDataArrival=a}},{key:"onSeeked",get:function(){return this._onSeeked},set:function(a){this._onSeeked=a}},{key:"onError",get:function(){return this._onError},set:function(a){this._onError=a}},{key:"onComplete",get:function(){return this._onComplete},
set:function(a){this._onComplete=a}},{key:"onRedirect",get:function(){return this._onRedirect},set:function(a){this._onRedirect=a}},{key:"onRecoveredEarlyEof",get:function(){return this._onRecoveredEarlyEof},set:function(a){this._onRecoveredEarlyEof=a}},{key:"currentURL",get:function(){return this._dataSource.url}},{key:"hasRedirect",get:function(){return null!=this._redirectedURL||void 0!=this._dataSource.redirectedURL}},{key:"currentRedirectedURL",get:function(){return this._redirectedURL||this._dataSource.redirectedURL}},
{key:"currentSpeed",get:function(){return this._loaderClass===t["default"]?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"loaderType",get:function(){return this._loader.type}}]),f}();l["default"]=f},{"../utils/exception.js":40,"../utils/logger.js":41,"./fetch-stream-loader.js":22,"./loader.js":24,"./param-seek-handler.js":25,"./range-seek-handler.js":26,"./speed-sampler.js":27,"./websocket-loader.js":28,"./xhr-moz-chunked-loader.js":29,"./xhr-msstream-loader.js":30,"./xhr-range-loader.js":31}],
24:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});l.BaseLoader=l.LoaderErrors=l.LoaderStatus=void 0;var k=function(){function a(a,c){for(var b=0;b<c.length;b++){var e=c[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){return c&&a(b.prototype,c),e&&a(b,e),b}}(),e=f("../utils/exception.js"),c=l.LoaderStatus={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4};l.LoaderErrors={OK:"OK",EXCEPTION:"Exception",
HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};l.BaseLoader=function(){function a(b){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this._type=b||"undefined";this._status=c.kIdle;this._needStash=!1;this._onComplete=this._onError=this._onDataArrival=this._onURLRedirect=this._onContentLengthKnown=null}return k(a,[{key:"destroy",value:function(){this._status=
c.kIdle;this._onComplete=this._onError=this._onDataArrival=this._onURLRedirect=this._onContentLengthKnown=null}},{key:"isWorking",value:function(){return this._status===c.kConnecting||this._status===c.kBuffering}},{key:"open",value:function(a,c){throw new e.NotImplementedException("Unimplemented abstract function!");}},{key:"abort",value:function(){throw new e.NotImplementedException("Unimplemented abstract function!");}},{key:"type",get:function(){return this._type}},{key:"status",get:function(){return this._status}},
{key:"needStashBuffer",get:function(){return this._needStash}},{key:"onContentLengthKnown",get:function(){return this._onContentLengthKnown},set:function(a){this._onContentLengthKnown=a}},{key:"onURLRedirect",get:function(){return this._onURLRedirect},set:function(a){this._onURLRedirect=a}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(a){this._onDataArrival=a}},{key:"onError",get:function(){return this._onError},set:function(a){this._onError=a}},{key:"onComplete",get:function(){return this._onComplete},
set:function(a){this._onComplete=a}}]),a}()},{"../utils/exception.js":40}],25:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();f=function(){function e(c,a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
this._startName=c;this._endName=a}return k(e,[{key:"getConfig",value:function(c,a){if(0!==a.from||-1!==a.to){var b=!0;-1===c.indexOf("?")&&(c+="?",b=!1);b&&(c+="&");c+=this._startName+"="+a.from.toString();-1!==a.to&&(c+="&"+this._endName+"="+a.to.toString())}return{url:c,headers:{}}}},{key:"removeURLParameters",value:function(c){var a=c.split("?")[0],b=void 0,e=c.indexOf("?");-1!==e&&(b=c.substring(e+1));c="";if(void 0!=b&&0<b.length)for(b=b.split("&"),e=0;e<b.length;e++){var f=b[e].split("="),g=
0<e;f[0]!==this._startName&&f[0]!==this._endName&&(g&&(c+="&"),c+=b[e])}return 0===c.length?a:a+"?"+c}}]),e}();l["default"]=f},{}],26:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();f=function(){function e(c){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
this._zeroStart=c||!1}return k(e,[{key:"getConfig",value:function(c,a){var b={};0!==a.from||-1!==a.to?b.Range=-1!==a.to?"bytes="+a.from.toString()+"-"+a.to.toString():"bytes="+a.from.toString()+"-":this._zeroStart&&(b.Range="bytes=0-");return{url:c,headers:b}}},{key:"removeURLParameters",value:function(c){return c}}]),e}();l["default"]=f},{}],27:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||
!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._lastSecondBytes=this._totalBytes=this._intervalBytes=this._lastCheckpoint=this._firstCheckpoint=0;self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return k(e,[{key:"reset",value:function(){this._lastSecondBytes=
this._totalBytes=this._intervalBytes=this._firstCheckpoint=this._lastCheckpoint=0}},{key:"addBytes",value:function(c){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=c,this._totalBytes+=c):1E3>this._now()-this._lastCheckpoint?(this._intervalBytes+=c,this._totalBytes+=c):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=c,this._totalBytes+=c,this._lastCheckpoint=this._now())}},{key:"currentKBps",get:function(){this.addBytes(0);
var c=(this._now()-this._lastCheckpoint)/1E3;return 0==c&&(c=1),this._intervalBytes/c/1024}},{key:"lastSecondKBps",get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:500<=this._now()-this._lastCheckpoint?this.currentKBps:0}},{key:"averageKBps",get:function(){var c=(this._now()-this._firstCheckpoint)/1E3;return this._totalBytes/c/1024}}]),e}();l["default"]=f},{}],28:[function(f,g,l){function k(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(l,"__esModule",{value:!0});var e=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d)return a=Object.getPrototypeOf(a),null===a?void 0:r(a,b,c);if("value"in d)return d.value;b=d.get;if(void 0!==b)return b.call(c)},c=function(){function a(a,
b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){return c&&a(b.prototype,c),e&&a(b,e),b}}();f("../utils/logger.js");var a=f("./loader.js"),b=f("../utils/exception.js");f=function(f){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var a=(g.__proto__||Object.getPrototypeOf(g)).call(this,"websocket-loader");if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
a=!a||"object"!=typeof a&&"function"!=typeof a?this:a;return a.TAG="WebSocketLoader",a._needStash=!0,a._ws=null,a._requestAbort=!1,a._receivedLength=0,a}return k(g,f),c(g,null,[{key:"isSupported",value:function(){try{return"undefined"!=typeof self.WebSocket}catch(p){return!1}}}]),c(g,[{key:"destroy",value:function(){this._ws&&this.abort();e(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"destroy",this).call(this)}},{key:"open",value:function(c){try{var e=this._ws=new self.WebSocket(c.url);
e.binaryType="arraybuffer";e.onopen=this._onWebSocketOpen.bind(this);e.onclose=this._onWebSocketClose.bind(this);e.onmessage=this._onWebSocketMessage.bind(this);e.onerror=this._onWebSocketError.bind(this);this._status=a.LoaderStatus.kConnecting}catch(d){this._status=a.LoaderStatus.kError;c={code:d.code,msg:d.message};if(!this._onError)throw new b.RuntimeException(c.msg);this._onError(a.LoaderErrors.EXCEPTION,c)}}},{key:"abort",value:function(){var b=this._ws;!b||0!==b.readyState&&1!==b.readyState||
(this._requestAbort=!0,b.close());this._ws=null;this._status=a.LoaderStatus.kComplete}},{key:"_onWebSocketOpen",value:function(b){this._status=a.LoaderStatus.kBuffering}},{key:"_onWebSocketClose",value:function(b){return!0===this._requestAbort?void(this._requestAbort=!1):(this._status=a.LoaderStatus.kComplete,void(this._onComplete&&this._onComplete(0,this._receivedLength-1)))}},{key:"_onWebSocketMessage",value:function(c){var e=this;if(c.data instanceof ArrayBuffer)this._dispatchArrayBuffer(c.data);
else if(c.data instanceof Blob){var d=new FileReader;d.onload=function(){e._dispatchArrayBuffer(d.result)};d.readAsArrayBuffer(c.data)}else{this._status=a.LoaderStatus.kError;c={code:-1,msg:"Unsupported WebSocket message type: "+c.data.constructor.name};if(!this._onError)throw new b.RuntimeException(c.msg);this._onError(a.LoaderErrors.EXCEPTION,c)}}},{key:"_dispatchArrayBuffer",value:function(a){var b=this._receivedLength;this._receivedLength+=a.byteLength;this._onDataArrival&&this._onDataArrival(a,
b,this._receivedLength)}},{key:"_onWebSocketError",value:function(c){this._status=a.LoaderStatus.kError;c={code:c.code,msg:c.message};if(!this._onError)throw new b.RuntimeException(c.msg);this._onError(a.LoaderErrors.EXCEPTION,c)}}]),g}(a.BaseLoader);l["default"]=f},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],29:[function(f,g,l){function k(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(l,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},c=function n(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,
b);if(void 0===c)return a=Object.getPrototypeOf(a),null===a?void 0:n(a,b,d);if("value"in c)return c.value;b=c.get;if(void 0!==b)return b.call(d)},a=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){return d&&a(b.prototype,d),c&&a(b,c),b}}(),b=(g=f("../utils/logger.js"))&&g.__esModule?g:{"default":g},h=f("./loader.js"),q=f("../utils/exception.js");f=
function(f){function g(a,b){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var d=(g.__proto__||Object.getPrototypeOf(g)).call(this,"xhr-moz-chunked-loader");if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!=typeof d&&"function"!=typeof d?this:d;return d.TAG="MozChunkedLoader",d._seekHandler=a,d._config=b,d._needStash=!0,d._xhr=null,d._requestAbort=!1,d._contentLength=null,d._receivedLength=0,d}return k(g,
f),a(g,null,[{key:"isSupported",value:function(){try{var a=new XMLHttpRequest;return a.open("GET","https://example.com",!0),a.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===a.responseType}catch(n){return b["default"].w("MozChunkedLoader",n.message),!1}}}]),a(g,[{key:"destroy",value:function(){this.isWorking()&&this.abort();this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null);c(g.prototype.__proto__||
Object.getPrototypeOf(g.prototype),"destroy",this).call(this)}},{key:"open",value:function(a,b){this._dataSource=a;this._range=b;var d=a.url;this._config.reuseRedirectedURL&&void 0!=a.redirectedURL&&(d=a.redirectedURL);d=this._seekHandler.getConfig(d,b);this._requestURL=d.url;b=this._xhr=new XMLHttpRequest;if(b.open("GET",d.url,!0),b.responseType="moz-chunked-arraybuffer",b.onreadystatechange=this._onReadyStateChange.bind(this),b.onprogress=this._onProgress.bind(this),b.onloadend=this._onLoadEnd.bind(this),
b.onerror=this._onXhrError.bind(this),a.withCredentials&&(b.withCredentials=!0),"object"===e(d.headers)){a=d.headers;for(var c in a)a.hasOwnProperty(c)&&b.setRequestHeader(c,a[c])}this._status=h.LoaderStatus.kConnecting;b.send()}},{key:"abort",value:function(){this._requestAbort=!0;this._xhr&&this._xhr.abort();this._status=h.LoaderStatus.kComplete}},{key:"_onReadyStateChange",value:function(a){a=a.target;if(2===a.readyState){if(void 0!=a.responseURL&&a.responseURL!==this._requestURL&&this._onURLRedirect){var b=
this._seekHandler.removeURLParameters(a.responseURL);this._onURLRedirect(b)}if(0!==a.status&&(200>a.status||299<a.status)){if(this._status=h.LoaderStatus.kError,!this._onError)throw new q.RuntimeException("MozChunkedLoader: Http code invalid, "+a.status+" "+a.statusText);this._onError(h.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:a.status,msg:a.statusText})}else this._status=h.LoaderStatus.kBuffering}}},{key:"_onProgress",value:function(a){if(this._status!==h.LoaderStatus.kError){null===this._contentLength&&
null!==a.total&&0!==a.total&&(this._contentLength=a.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));a=a.target.response;var b=this._range.from+this._receivedLength;this._receivedLength+=a.byteLength;this._onDataArrival&&this._onDataArrival(a,b,this._receivedLength)}}},{key:"_onLoadEnd",value:function(a){return!0===this._requestAbort?void(this._requestAbort=!1):void(this._status!==h.LoaderStatus.kError&&(this._status=h.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,
this._range.from+this._receivedLength-1)))}},{key:"_onXhrError",value:function(a){this._status=h.LoaderStatus.kError;var b=0,d=null;if(this._contentLength&&a.loaded<this._contentLength?(b=h.LoaderErrors.EARLY_EOF,d={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(b=h.LoaderErrors.EXCEPTION,d={code:-1,msg:a.constructor.name+" "+a.type}),!this._onError)throw new q.RuntimeException(d.msg);this._onError(b,d)}}]),g}(h.BaseLoader);l["default"]=f},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],
30:[function(f,g,l){function k(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(l,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&
"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},c=function n(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c)return a=Object.getPrototypeOf(a),null===a?void 0:n(a,b,d);if("value"in c)return c.value;b=c.get;if(void 0!==b)return b.call(d)},a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,
d)}}return function(b,d,c){return d&&a(b.prototype,d),c&&a(b,c),b}}(),b=(g=f("../utils/logger.js"))&&g.__esModule?g:{"default":g},h=f("./loader.js"),q=f("../utils/exception.js");f=function(f){function g(a,b){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var c=(g.__proto__||Object.getPrototypeOf(g)).call(this,"xhr-msstream-loader");if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!=typeof c&&"function"!=
typeof c?this:c;return c.TAG="MSStreamLoader",c._seekHandler=a,c._config=b,c._needStash=!0,c._xhr=null,c._reader=null,c._totalRange=null,c._currentRange=null,c._currentRequestURL=null,c._currentRedirectedURL=null,c._contentLength=null,c._receivedLength=0,c._bufferLimit=16777216,c._lastTimeBufferSize=0,c._isReconnecting=!1,c}return k(g,f),a(g,null,[{key:"isSupported",value:function(){try{if("undefined"==typeof self.MSStream||"undefined"==typeof self.MSStreamReader)return!1;var a=new XMLHttpRequest;
return a.open("GET","https://example.com",!0),a.responseType="ms-stream","ms-stream"===a.responseType}catch(n){return b["default"].w("MSStreamLoader",n.message),!1}}}]),a(g,[{key:"destroy",value:function(){this.isWorking()&&this.abort();this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null);this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null);c(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"destroy",this).call(this)}},
{key:"open",value:function(a,b){this._internalOpen(a,b,!1)}},{key:"_internalOpen",value:function(a,b,c){this._dataSource=a;c?this._currentRange=b:this._totalRange=b;c=a.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?c=this._currentRedirectedURL:void 0!=a.redirectedURL&&(c=a.redirectedURL));b=this._seekHandler.getConfig(c,b);this._currentRequestURL=b.url;c=this._reader=new self.MSStreamReader;c.onprogress=this._msrOnProgress.bind(this);c.onload=this._msrOnLoad.bind(this);
c.onerror=this._msrOnError.bind(this);c=this._xhr=new XMLHttpRequest;if(c.open("GET",b.url,!0),c.responseType="ms-stream",c.onreadystatechange=this._xhrOnReadyStateChange.bind(this),c.onerror=this._xhrOnError.bind(this),a.withCredentials&&(c.withCredentials=!0),"object"===e(b.headers)){a=b.headers;for(var d in a)a.hasOwnProperty(d)&&c.setRequestHeader(d,a[d])}this._isReconnecting?this._isReconnecting=!1:this._status=h.LoaderStatus.kConnecting;c.send()}},{key:"abort",value:function(){this._internalAbort();
this._status=h.LoaderStatus.kComplete}},{key:"_internalAbort",value:function(){this._reader&&(1===this._reader.readyState&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null);this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)}},{key:"_xhrOnReadyStateChange",value:function(a){a=a.target;if(2===a.readyState)if(200<=a.status&&299>=a.status){if(this._status=h.LoaderStatus.kBuffering,void 0!=a.responseURL){var b=
this._seekHandler.removeURLParameters(a.responseURL);a.responseURL!==this._currentRequestURL&&b!==this._currentRedirectedURL&&(this._currentRedirectedURL=b,this._onURLRedirect&&this._onURLRedirect(b))}a=a.getResponseHeader("Content-Length");null!=a&&null==this._contentLength&&(a=parseInt(a),0<a&&(this._contentLength=a,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)))}else{if(this._status=h.LoaderStatus.kError,!this._onError)throw new q.RuntimeException("MSStreamLoader: Http code invalid, "+
a.status+" "+a.statusText);this._onError(h.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:a.status,msg:a.statusText})}else 3===a.readyState&&200<=a.status&&299>=a.status&&(this._status=h.LoaderStatus.kBuffering,this._reader.readAsArrayBuffer(a.response))}},{key:"_xhrOnError",value:function(a){this._status=h.LoaderStatus.kError;var b=h.LoaderErrors.EXCEPTION;a={code:-1,msg:a.constructor.name+" "+a.type};if(!this._onError)throw new q.RuntimeException(a.msg);this._onError(b,a)}},{key:"_msrOnProgress",value:function(a){a=
a.target.result;if(null==a)return void this._doReconnectIfNeeded();var c=a.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=a.byteLength;var d=this._totalRange.from+this._receivedLength;this._receivedLength+=c.byteLength;this._onDataArrival&&this._onDataArrival(c,d,this._receivedLength);a.byteLength>=this._bufferLimit&&(b["default"].v(this.TAG,"MSStream buffer exceeded max size near "+(d+c.byteLength)+", reconnecting..."),this._doReconnectIfNeeded())}},{key:"_doReconnectIfNeeded",value:function(){if(null==
this._contentLength||this._receivedLength<this._contentLength)this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort(),this._internalOpen(this._dataSource,{from:this._totalRange.from+this._receivedLength,to:-1},!0)}},{key:"_msrOnLoad",value:function(a){this._status=h.LoaderStatus.kComplete;this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}},{key:"_msrOnError",value:function(a){this._status=h.LoaderStatus.kError;var b=0,c=null;if(this._contentLength&&
this._receivedLength<this._contentLength?(b=h.LoaderErrors.EARLY_EOF,c={code:-1,msg:"MSStream meet Early-Eof"}):(b=h.LoaderErrors.EARLY_EOF,c={code:-1,msg:a.constructor.name+" "+a.type}),!this._onError)throw new q.RuntimeException(c.msg);this._onError(b,c)}}]),g}(h.BaseLoader);l["default"]=f},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],31:[function(f,g,l){function k(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(l,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},c=function m(a,b,c){null===a&&(a=Function.prototype);var d=
Object.getOwnPropertyDescriptor(a,b);if(void 0===d)return a=Object.getPrototypeOf(a),null===a?void 0:m(a,b,c);if("value"in d)return d.value;b=d.get;if(void 0!==b)return b.call(c)},a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){return c&&a(b.prototype,c),e&&a(b,e),b}}(),b=(g=f("../utils/logger.js"))&&g.__esModule?g:{"default":g},h=(g=f("./speed-sampler.js"))&&
g.__esModule?g:{"default":g},q=f("./loader.js"),t=f("../utils/exception.js");f=function(f){function d(a,b){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var c=(d.__proto__||Object.getPrototypeOf(d)).call(this,"xhr-range-loader");if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!=typeof c&&"function"!=typeof c?this:c;return c.TAG="RangeLoader",c._seekHandler=a,c._config=b,c._needStash=!1,c._chunkSizeKBList=
[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],c._currentChunkSizeKB=384,c._currentSpeedNormalized=0,c._zeroSpeedChunkCount=0,c._xhr=null,c._speedSampler=new h["default"],c._requestAbort=!1,c._waitForTotalLength=!1,c._totalLengthReceived=!1,c._currentRequestURL=null,c._currentRedirectedURL=null,c._currentRequestRange=null,c._totalLength=null,c._contentLength=null,c._receivedLength=0,c._lastTimeLoaded=0,c}return k(d,f),a(d,null,[{key:"isSupported",value:function(){try{var a=new XMLHttpRequest;
return a.open("GET","https://example.com",!0),a.responseType="arraybuffer","arraybuffer"===a.responseType}catch(m){return b["default"].w("RangeLoader",m.message),!1}}}]),a(d,[{key:"destroy",value:function(){this.isWorking()&&this.abort();this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null);c(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"destroy",this).call(this)}},{key:"open",value:function(a,b){this._dataSource=
a;this._range=b;this._status=q.LoaderStatus.kConnecting;a=!1;void 0!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(a=!0,this._totalLength=this._dataSource.filesize);this._totalLengthReceived||a?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))}},{key:"_openSubRange",value:function(){var a=this._range.from+this._receivedLength,b=a+1024*this._currentChunkSizeKB;null!=this._contentLength&&b-this._range.from>=this._contentLength&&(b=this._range.from+
this._contentLength-1);this._currentRequestRange={from:a,to:b};this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function(a,b){this._lastTimeLoaded=0;var c=a.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?c=this._currentRedirectedURL:void 0!=a.redirectedURL&&(c=a.redirectedURL));c=this._seekHandler.getConfig(c,b);this._currentRequestURL=c.url;b=this._xhr=new XMLHttpRequest;if(b.open("GET",c.url,!0),b.responseType="arraybuffer",b.onreadystatechange=
this._onReadyStateChange.bind(this),b.onprogress=this._onProgress.bind(this),b.onload=this._onLoad.bind(this),b.onerror=this._onXhrError.bind(this),a.withCredentials&&(b.withCredentials=!0),"object"===e(c.headers)){a=c.headers;for(var d in a)a.hasOwnProperty(d)&&b.setRequestHeader(d,a[d])}b.send()}},{key:"abort",value:function(){this._requestAbort=!0;this._internalAbort();this._status=q.LoaderStatus.kComplete}},{key:"_internalAbort",value:function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=
null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}},{key:"_onReadyStateChange",value:function(a){a=a.target;if(2===a.readyState){if(void 0!=a.responseURL){var b=this._seekHandler.removeURLParameters(a.responseURL);a.responseURL!==this._currentRequestURL&&b!==this._currentRedirectedURL&&(this._currentRedirectedURL=b,this._onURLRedirect&&this._onURLRedirect(b))}if(200<=a.status&&299>=a.status)this._waitForTotalLength||(this._status=q.LoaderStatus.kBuffering);else{if(this._status=
q.LoaderStatus.kError,!this._onError)throw new t.RuntimeException("RangeLoader: Http code invalid, "+a.status+" "+a.statusText);this._onError(q.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:a.status,msg:a.statusText})}}}},{key:"_onProgress",value:function(a){if(this._status!==q.LoaderStatus.kError){if(null===this._contentLength){var b=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1;b=this._totalLengthReceived=!0;var c=a.total;this._internalAbort();null!=c&0!==c&&(this._totalLength=c)}if(-1===
this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,b)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}b=a.loaded-this._lastTimeLoaded;this._lastTimeLoaded=a.loaded;this._speedSampler.addBytes(b)}}},{key:"_normalizeSpeed",value:function(a){var b=this._chunkSizeKBList,c=b.length-1,d=0,e=0,f=c;if(a<b[0])return b[0];for(;f>=e;){if(d=e+Math.floor((f-e)/2),d===c||a>=b[d]&&
a<b[d+1])return b[d];b[d]<a?e=d+1:f=d-1}}},{key:"_onLoad",value:function(a){if(this._status!==q.LoaderStatus.kError){if(this._waitForTotalLength)return void(this._waitForTotalLength=!1);this._lastTimeLoaded=0;var b=this._speedSampler.lastSecondKBps;if(0===b&&(this._zeroSpeedChunkCount++,3<=this._zeroSpeedChunkCount&&(b=this._speedSampler.currentKBps)),0!==b)b=this._normalizeSpeed(b),this._currentSpeedNormalized!==b&&(this._currentSpeedNormalized=b,this._currentChunkSizeKB=b);a=a.target.response;b=
this._range.from+this._receivedLength;this._receivedLength+=a.byteLength;var c=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():c=!0;this._onDataArrival&&this._onDataArrival(a,b,this._receivedLength);c&&(this._status=q.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}}},{key:"_onXhrError",value:function(a){this._status=q.LoaderStatus.kError;var b=0,c=null;if(this._contentLength&&0<this._receivedLength&&
this._receivedLength<this._contentLength?(b=q.LoaderErrors.EARLY_EOF,c={code:-1,msg:"RangeLoader meet Early-Eof"}):(b=q.LoaderErrors.EXCEPTION,c={code:-1,msg:a.constructor.name+" "+a.type}),!this._onError)throw new t.RuntimeException(c.msg);this._onError(b,c)}},{key:"currentSpeed",get:function(){return this._speedSampler.lastSecondKBps}}]),d}(q.BaseLoader);l["default"]=f},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24,"./speed-sampler.js":27}],32:[function(f,g,l){function k(a){return a&&
a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,
c),d&&a(b,d),b}}();g=f("events");var a=k(g);g=f("../utils/logger.js");var b=k(g);g=f("../utils/browser.js");var h=k(g);g=f("./player-events.js");var q=k(g);g=f("../core/transmuxer.js");var t=k(g);g=f("../core/transmuxing-events.js");var p=k(g);g=f("../core/mse-controller.js");var r=k(g);g=f("../core/mse-events.js");var d=k(g),n=f("./player-errors.js"),m=f("../config.js"),x=f("../utils/exception.js");f=function(){function f(b,c){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new a["default"],this._config=(0,m.createDefaultConfig)(),"object"===("undefined"==typeof c?"undefined":e(c))&&Object.assign(this._config,c),"flv"!==b.type.toLowerCase())throw new x.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");!0===b.isLive&&(this._config.isLive=!0);this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),
onvProgress:this._onvProgress.bind(this)};self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now;this._pendingSeekTime=null;this._requestSetTime=!1;this._progressChecker=this._seekpointRecord=null;this._mediaDataSource=b;this._transmuxer=this._msectl=this._mediaElement=null;this.blocking=this._receivedCanPlay=this._hasPendingLoad=this._mseSourceOpened=!1;this._statisticsInfo=this._mediaInfo=null;(this._alwaysSeekKeyframe=h["default"].chrome&&
(50>h["default"].version.major||50===h["default"].version.major&&2661>h["default"].version.build)||h["default"].msedge||h["default"].msie?!0:!1)&&(this._config.accurateSeek=!1)}return c(f,[{key:"destroy",value:function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null);this._transmuxer&&this.unload();this._mediaElement&&this.detachMediaElement();this._mediaDataSource=this.e=null;this._emitter.removeAllListeners();this._emitter=null}},{key:"on",
value:function(a,b){var c=this;a===q["default"].MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then(function(){c._emitter.emit(q["default"].MEDIA_INFO,c.mediaInfo)}):a===q["default"].STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then(function(){c._emitter.emit(q["default"].STATISTICS_INFO,c.statisticsInfo)});this._emitter.addListener(a,b)}},{key:"off",value:function(a,b){this._emitter.removeListener(a,b)}},{key:"attachMediaElement",value:function(a){var b=this;if(this._mediaElement=
a,a.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),a.addEventListener("seeking",this.e.onvSeeking),a.addEventListener("canplay",this.e.onvCanPlay),a.addEventListener("stalled",this.e.onvStalled),a.addEventListener("progress",this.e.onvProgress),this._msectl=new r["default"](this._config),this._msectl.on(d["default"].UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(d["default"].BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(d["default"].SOURCE_OPEN,function(){b._mseSourceOpened=
!0;b._hasPendingLoad&&(b._hasPendingLoad=!1,b.load())}),this._msectl.on(d["default"].ERROR,function(a){b._emitter.emit(q["default"].ERROR,n.ErrorTypes.MEDIA_ERROR,n.ErrorDetails.MEDIA_MSE_ERROR,a)}),this._msectl.attachMediaElement(a),null!=this._pendingSeekTime)try{a.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(Y){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),
this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null);this._msectl&&(this._msectl.destroy(),this._msectl=null)}},{key:"load",value:function(){var a=this;if(!this._mediaElement)throw new x.IllegalStateException("HTMLMediaElement must be attached before load()!");
if(this._transmuxer)throw new x.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");if(!this._hasPendingLoad){if(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened)return void(this._hasPendingLoad=!0);0<this._mediaElement.readyState&&(this._requestSetTime=!0,this._mediaElement.currentTime=0);this._transmuxer=new t["default"](this._mediaDataSource,this._config);this._transmuxer.on(p["default"].INIT_SEGMENT,function(b,c){a._msectl.appendInitSegment(c)});
this._transmuxer.on(p["default"].MEDIA_SEGMENT,function(c,d){(a._msectl.appendMediaSegment(d),a._config.lazyLoad&&!a._config.isLive)&&d.info.endDts>=1E3*(a._mediaElement.currentTime+a._config.lazyLoadMaxDuration)&&null==a._progressChecker&&(b["default"].v(a.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),a._suspendTransmuxer())});this._transmuxer.on(p["default"].LOADING_COMPLETE,function(){a._msectl.endOfStream();a._emitter.emit(q["default"].LOADING_COMPLETE)});this._transmuxer.on(p["default"].RECOVERED_EARLY_EOF,
function(){a._emitter.emit(q["default"].RECOVERED_EARLY_EOF)});this._transmuxer.on(p["default"].IO_ERROR,function(b,c){a._emitter.emit(q["default"].ERROR,n.ErrorTypes.NETWORK_ERROR,b,c)});this._transmuxer.on(p["default"].DEMUX_ERROR,function(b,c){a._emitter.emit(q["default"].ERROR,n.ErrorTypes.MEDIA_ERROR,b,{code:-1,msg:c})});this._transmuxer.on(p["default"].MEDIA_INFO,function(b){a._mediaInfo=b;a._emitter.emit(q["default"].MEDIA_INFO,Object.assign({},b))});this._transmuxer.on(p["default"].STATISTICS_INFO,
function(b){a._statisticsInfo=a._fillStatisticsInfo(b);a._emitter.emit(q["default"].STATISTICS_INFO,Object.assign({},a._statisticsInfo))});this._transmuxer.on(p["default"].RECOMMEND_SEEKPOINT,function(b){a._mediaElement&&!a._config.accurateSeek&&(a._requestSetTime=!0,a._mediaElement.currentTime=b/1E3)});"live"===this._config.fixDelayMode&&this.on(q["default"].STATISTICS_INFO,this.fixLiveDelay.bind(this));this._transmuxer.open()}}},{key:"unload",value:function(){"live"===this._config.fixDelayMode&&
this.off(q["default"].STATISTICS_INFO,this.fixLiveDelay.bind(this));this._mediaElement&&this._mediaElement.pause();this._msectl&&this._msectl.seek(0);this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"fixVodDelay",value:function(){if(this._mediaElement&&this._msectl){var a=this.currentTime,b=this._msectl._sourceBuffers,c=-99,
d=-99,e;for(e in b)null!=b[e]&&"undefined"!=typeof b[e].buffered&&null!=b[e].buffered&&("video"==e.toLowerCase()?1<=b[e].buffered.length&&(c=b[e].buffered.end(0)-a):"audio"==e.toLowerCase()&&1<=b[e].buffered.length&&(d=b[e].buffered.end(0)-a));.8>(-99==d?c:Math.min(c,d))&&.8!=this._mediaElement.playbackRate?this._mediaElement.playbackRate=.8:1!=this._mediaElement.playbackRate&&(this._mediaElement.playbackRate=1)}}},{key:"fixLiveDelay",value:function(){if(this._mediaElement&&this._msectl){var a=this.currentTime,
c=this._msectl._sourceBuffers,d=-99,e=-99,f;for(f in c)null!=c[f]&&"undefined"!=typeof c[f].buffered&&null!=c[f].buffered&&("video"==f.toLowerCase()?1<=c[f].buffered.length&&(d=c[f].buffered.end(0)-a):"audio"==f.toLowerCase()&&1<=c[f].buffered.length&&(e=c[f].buffered.end(0)-a));if(-99==e)a=d,2<a&&(this._mediaElement.currentTime+=a-1);else{if(0>e||0>d?(b["default"].e(this.TAG,"videoDelay = "+d+" audioDelay = "+e),this._error_times+=1):5<Math.abs(d-e)?(b["default"].e(this.TAG,"videoDelay = "+d+" audioDelay = "+
e),this._error_times+=1):this._error_times=0,a=Math.min(d,e),6<=this._error_times)return void this._emitter.emit(q["default"].ERROR,n.ErrorTypes.MEDIA_ERROR);3<a&&(this._mediaElement.currentTime+=a-1.5)}}}},{key:"_fillStatisticsInfo",value:function(a){if(a.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return a;var b=!0,c=0,d=0;this._mediaElement.getVideoPlaybackQuality?(d=this._mediaElement.getVideoPlaybackQuality(),c=d.totalVideoFrames,d=d.droppedVideoFrames):void 0!=this._mediaElement.webkitDecodedFrameCount?
(c=this._mediaElement.webkitDecodedFrameCount,d=this._mediaElement.webkitDroppedFrameCount):b=!1;return b&&(a.decodedFrames=c,a.droppedFrames=d),a}},{key:"_onmseUpdateEnd",value:function(){if(this._config.lazyLoad&&!this._config.isLive){for(var a=this._mediaElement.buffered,c=this._mediaElement.currentTime,d=0,e=0;e<a.length;e++){var f=a.start(e),h=a.end(e);if(c>=f&&h>c){d=h;break}}d>=c+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(b["default"].v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),
this._suspendTransmuxer())}}},{key:"_onmseBufferFull",value:function(){b["default"].v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task");null==this._progressChecker&&this._suspendTransmuxer()}},{key:"_suspendTransmuxer",value:function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1E3)))}},{key:"_checkProgressAndResume",value:function(){for(var a=this._mediaElement.currentTime,
c=this._mediaElement.buffered,d=!1,e=0;e<c.length;e++){var f=c.start(e),h=c.end(e);if(a>=f&&h>a){a>=h-this._config.lazyLoadRecoverDuration&&(d=!0);break}}d&&(window.clearInterval(this._progressChecker),this._progressChecker=null,d&&(b["default"].v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function(a){for(var b=this._mediaElement.buffered,c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(a>=d&&e>a)return!0}return!1}},{key:"_internalSeek",
value:function(a){var b=this._isTimepointBuffered(a),c=!1,d=0;if(1>a&&0<this._mediaElement.buffered.length){var e=this._mediaElement.buffered.start(0);(1>e&&e>a||h["default"].safari)&&(c=!0,d=h["default"].safari?.1:e)}c?(this._requestSetTime=!0,this._mediaElement.currentTime=d):b?(this._alwaysSeekKeyframe?(b=this._msectl.getNearestKeyframe(Math.floor(1E3*a)),this._requestSetTime=!0,null!=b?this._mediaElement.currentTime=b.dts/1E3:this._mediaElement.currentTime=a):(this._requestSetTime=!0,this._mediaElement.currentTime=
a),null!=this._progressChecker&&this._checkProgressAndResume()):(null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(a),this._transmuxer.seek(Math.floor(1E3*a)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=a))}},{key:"_checkAndApplyUnbufferedSeekpoint",value:function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var a=this._mediaElement.currentTime;this._seekpointRecord=
null;this._isTimepointBuffered(a)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(a),this._transmuxer.seek(Math.floor(1E3*a)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=a))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},{key:"_checkAndResumeStuckPlayback",value:function(a){var c=this._mediaElement;a||!this._receivedCanPlay||2>c.readyState?(a=c.buffered,0<
a.length&&c.currentTime<a.start(0)&&(b["default"].w(this.TAG,"Playback seems stuck at "+c.currentTime+", seek to "+a.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=a.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))):this._mediaElement.removeEventListener("progress",this.e.onvProgress)}},{key:"_onvLoadedMetadata",value:function(a){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}},{key:"_onvSeeking",
value:function(a){a=this._mediaElement.currentTime;var b=this._mediaElement.buffered;if(this._requestSetTime)return void(this._requestSetTime=!1);if(1>a&&0<b.length&&(b=b.start(0),1>b&&b>a||h["default"].safari))return this._requestSetTime=!0,void(this._mediaElement.currentTime=h["default"].safari?.1:b);if(this._isTimepointBuffered(a))return this._alwaysSeekKeyframe&&(a=this._msectl.getNearestKeyframe(Math.floor(1E3*a)),null!=a&&(this._requestSetTime=!0,this._mediaElement.currentTime=a.dts/1E3)),void(null!=
this._progressChecker&&this._checkProgressAndResume());this._seekpointRecord={seekPoint:a,recordTime:this._now()};window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},{key:"_onvCanPlay",value:function(a){this._receivedCanPlay=!0;this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}},{key:"_onvStalled",value:function(a){this._checkAndResumeStuckPlayback(!0)}},{key:"_onvProgress",value:function(a){this._checkAndResumeStuckPlayback()}},{key:"type",get:function(){return this._type}},
{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(a){this._mediaElement.volume=a}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(a){this._mediaElement.muted=a}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(a){this._mediaElement?this._internalSeek(a):
this._pendingSeekTime=a}},{key:"mediaInfo",get:function(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}}]),f}();l["default"]=f},{"../config.js":5,"../core/mse-controller.js":9,"../core/mse-events.js":10,"../core/transmuxer.js":11,"../core/transmuxing-events.js":13,"../utils/browser.js":39,"../utils/exception.js":40,
"../utils/logger.js":41,"./player-errors.js":34,"./player-events.js":35,events:2}],33:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=
!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){return c&&a(b.prototype,c),e&&a(b,e),b}}(),c=(g=f("events"))&&g.__esModule?g:{"default":g},a=(g=f("./player-events.js"))&&g.__esModule?g:{"default":g},b=f("../config.js"),h=f("../utils/exception.js");f=function(){function f(a,e){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new c["default"],this._config=(0,b.createDefaultConfig)(),"object"===
("undefined"==typeof e?"undefined":k(e))&&Object.assign(this._config,e),"flv"===a.type.toLowerCase())throw new h.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(a.hasOwnProperty("segments"))throw new h.InvalidArgumentException("NativePlayer("+a.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)};this._statisticsReporter=this._pendingSeekTime=null;this._mediaDataSource=a;this._mediaElement=null}return e(f,
[{key:"destroy",value:function(){this._mediaElement&&(this.unload(),this.detachMediaElement());this._mediaDataSource=this.e=null;this._emitter.removeAllListeners();this._emitter=null}},{key:"on",value:function(b,c){var e=this;b===a["default"].MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){e._emitter.emit(a["default"].MEDIA_INFO,e.mediaInfo)}):b===a["default"].STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){e._emitter.emit(a["default"].STATISTICS_INFO,
e.statisticsInfo)});this._emitter.addListener(b,c)}},{key:"off",value:function(a,b){this._emitter.removeListener(a,b)}},{key:"attachMediaElement",value:function(a){if(this._mediaElement=a,a.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{a.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(p){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",
this.e.onvLoadedMetadata),this._mediaElement=null);null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"load",value:function(){if(!this._mediaElement)throw new h.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url;0<this._mediaElement.readyState&&(this._mediaElement.currentTime=0);this._mediaElement.preload="auto";this._mediaElement.load();this._statisticsReporter=
window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}},{key:"unload",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"));null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"_onvLoadedMetadata",value:function(b){null!=
this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null);this._emitter.emit(a["default"].MEDIA_INFO,this.mediaInfo)}},{key:"_reportStatisticsInfo",value:function(){this._emitter.emit(a["default"].STATISTICS_INFO,this.statisticsInfo)}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},
set:function(a){this._mediaElement.volume=a}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(a){this._mediaElement.muted=a}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(a){this._mediaElement?this._mediaElement.currentTime=a:this._pendingSeekTime=a}},{key:"mediaInfo",get:function(){var a={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&
(a.duration=Math.floor(1E3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(a.width=this._mediaElement.videoWidth,a.height=this._mediaElement.videoHeight)),a}},{key:"statisticsInfo",get:function(){var a={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return a;var b=!0,c=0,d=0;this._mediaElement.getVideoPlaybackQuality?(d=this._mediaElement.getVideoPlaybackQuality(),c=d.totalVideoFrames,d=d.droppedVideoFrames):
void 0!=this._mediaElement.webkitDecodedFrameCount?(c=this._mediaElement.webkitDecodedFrameCount,d=this._mediaElement.webkitDroppedFrameCount):b=!1;return b&&(a.decodedFrames=c,a.droppedFrames=d),a}}]),f}();l["default"]=f},{"../config.js":5,"../utils/exception.js":40,"./player-events.js":35,events:2}],34:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});l.ErrorDetails=l.ErrorTypes=void 0;g=f("../io/loader.js");f=(f=f("../demux/demux-errors.js"))&&f.__esModule?f:{"default":f};l.ErrorTypes=
{NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"};l.ErrorDetails={NETWORK_EXCEPTION:g.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:g.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:g.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:g.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:f["default"].FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:f["default"].FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:f["default"].CODEC_UNSUPPORTED}},
{"../demux/demux-errors.js":16,"../io/loader.js":24}],35:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});l["default"]={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",STATISTICS_INFO:"statistics_info"}},{}],36:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=
!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");}return k(e,null,[{key:"getSilentFrame",value:function(c,a){if("mp4a.40.2"===c){if(1===a)return new Uint8Array([0,200,0,128,35,128]);if(2===a)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===a)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===a)return new Uint8Array([0,
200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===a)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===a)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===a)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===a||3===a)return new Uint8Array([1,
64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}]),e}();l["default"]=f},{}],37:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&
e(c.prototype,a),b&&e(c,b),c}}();f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");}return k(e,null,[{key:"init",value:function(){e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]};for(var c in e.types)e.types.hasOwnProperty(c)&&
(e.types[c]=[c.charCodeAt(0),c.charCodeAt(1),c.charCodeAt(2),c.charCodeAt(3)]);c=e.constants={};c.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]);c.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]);c.STTS=new Uint8Array([0,0,0,0,0,0,0,0]);c.STSC=c.STCO=c.STTS;c.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);c.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);c.HDLR_AUDIO=new Uint8Array([0,0,0,
0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);c.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);c.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]);c.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(c){var a=8,b,e=Array.prototype.slice.call(arguments,1),f=e.length;for(b=0;f>b;b++)a+=e[b].byteLength;b=new Uint8Array(a);b[0]=a>>>24&255;b[1]=a>>>16&255;b[2]=a>>>8&255;b[3]=255&a;b.set(c,4);a=8;for(var g=0;f>g;g++)b.set(e[g],
a),a+=e[g].byteLength;return b}},{key:"generateInitSegment",value:function(c){var a=e.box(e.types.ftyp,e.constants.FTYP);c=e.moov(c);var b=new Uint8Array(a.byteLength+c.byteLength);return b.set(a,0),b.set(c,a.byteLength),b}},{key:"moov",value:function(c){var a=e.mvhd(c.timescale,c.duration),b=e.trak(c);c=e.mvex(c);return e.box(e.types.moov,a,b,c)}},{key:"mvhd",value:function(c,a){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,255&c,a>>>24&255,a>>>
16&255,a>>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(c){return e.box(e.types.trak,e.tkhd(c),e.mdia(c))}},{key:"tkhd",value:function(c){var a=c.id,b=c.duration,f=c.presentWidth;c=c.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,0,0,0,0,b>>>24&255,b>>>16&255,b>>>
8&255,255&b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,f>>>8&255,255&f,0,0,c>>>8&255,255&c,0,0]))}},{key:"mdia",value:function(c){return e.box(e.types.mdia,e.mdhd(c),e.hdlr(c),e.minf(c))}},{key:"mdhd",value:function(c){var a=c.timescale;c=c.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,c>>>24&255,c>>>16&255,c>>>8&255,255&c,85,196,0,0]))}},{key:"hdlr",value:function(c){var a=
null;return a="audio"===c.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,a)}},{key:"minf",value:function(c){var a=null;return a="audio"===c.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,a,e.dinf(),e.stbl(c))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(c){return e.box(e.types.stbl,e.stsd(c),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,
e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))}},{key:"stsd",value:function(c){return"audio"===c.type?"mp3"===c.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(c)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(c)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(c))}},{key:"mp3",value:function(c){var a=c.audioSampleRate;c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,c.channelCount,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types[".mp3"],
c)}},{key:"mp4a",value:function(c){var a=c.audioSampleRate;a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,c.channelCount,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.mp4a,a,e.esds(c))}},{key:"esds",value:function(c){c=c.config||[];var a=c.length;c=new Uint8Array([0,0,0,0,3,23+a,0,1,0,4,15+a,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([a]).concat(c).concat([6,1,2]));return e.box(e.types.esds,c)}},{key:"avc1",value:function(c){var a=c.avcc,b=c.codecWidth;c=c.codecHeight;b=new Uint8Array([0,
0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b>>>8&255,255&b,c>>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,b,e.box(e.types.avcC,a))}},{key:"mvex",value:function(c){return e.box(e.types.mvex,e.trex(c))}},{key:"trex",value:function(c){c=c.id;c=new Uint8Array([0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,255&c,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,c)}},{key:"moof",
value:function(c,a){return e.box(e.types.moof,e.mfhd(c.sequenceNumber),e.traf(c,a))}},{key:"mfhd",value:function(c){c=new Uint8Array([0,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,255&c]);return e.box(e.types.mfhd,c)}},{key:"traf",value:function(c,a){var b=c.id;b=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,b>>>24&255,b>>>16&255,b>>>8&255,255&b]));a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a]));var f=e.sdtp(c);c=e.trun(c,f.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,
b,a,c,f)}},{key:"sdtp",value:function(c){c=c.samples||[];for(var a=c.length,b=new Uint8Array(4+a),f=0;a>f;f++){var g=c[f].flags;b[f+4]=g.isLeading<<6|g.dependsOn<<4|g.isDependedOn<<2|g.hasRedundancy}return e.box(e.types.sdtp,b)}},{key:"trun",value:function(c,a){c=c.samples||[];var b=c.length,f=12+16*b,g=new Uint8Array(f);a+=8+f;g.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,255&b,a>>>24&255,a>>>16&255,a>>>8&255,255&a],0);for(a=0;b>a;a++){f=c[a].duration;var k=c[a].size,l=c[a].flags,r=c[a].cts;g.set([f>>>
24&255,f>>>16&255,f>>>8&255,255&f,k>>>24&255,k>>>16&255,k>>>8&255,255&k,l.isLeading<<2|l.dependsOn,l.isDependedOn<<6|l.hasRedundancy<<4|l.isNonSync,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r],12+16*a)}return e.box(e.types.trun,g)}},{key:"mdat",value:function(c){return e.box(e.types.mdat,c)}}]),e}();f.init();l["default"]=f},{}],38:[function(f,g,l){function k(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(l,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=
b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){return c&&a(b.prototype,c),e&&a(b,e),b}}();g=f("../utils/logger.js");var c=k(g);g=f("./mp4-generator.js");var a=k(g);g=f("./aac-silent.js");var b=k(g);g=f("../utils/browser.js");var h=k(g),q=f("../core/media-segment-info.js"),t=f("../utils/exception.js");f=function(){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
this.TAG="MP4Remuxer";this._config=a;this._isLive=!0===a.isLive?!0:!1;this._dtsBase=-1;this._dtsBaseInited=!1;this._audioDtsBase=1/0;this._videoDtsBase=1/0;this._videoNextDts=this._audioNextDts=void 0;this._videoMeta=this._audioMeta=this._videoStashedLastSample=this._audioStashedLastSample=null;this._audioSegmentInfoList=new q.MediaSegmentInfoList("audio");this._videoSegmentInfoList=new q.MediaSegmentInfoList("video");this._onMediaSegment=this._onInitSegment=null;this._forceFirstIDR=h["default"].chrome&&
(50>h["default"].version.major||50===h["default"].version.major&&2661>h["default"].version.build)?!0:!1;this._fillSilentAfterSeek=h["default"].msedge||h["default"].msie;this._mp3UseMpegAudio=!h["default"].firefox;this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e(f,[{key:"destroy",value:function(){this._dtsBase=-1;this._dtsBaseInited=!1;this._videoMeta=this._audioMeta=null;this._audioSegmentInfoList.clear();this._audioSegmentInfoList=null;this._videoSegmentInfoList.clear();this._onMediaSegment=
this._onInitSegment=this._videoSegmentInfoList=null}},{key:"bindDataSource",value:function(a){return a.onDataAvailable=this.remux.bind(this),a.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}},{key:"insertDiscontinuity",value:function(){this._audioNextDts=this._videoNextDts=void 0}},{key:"seek",value:function(a){this._videoStashedLastSample=this._audioStashedLastSample=null;this._videoSegmentInfoList.clear();this._audioSegmentInfoList.clear()}},{key:"remux",value:function(a,b){if(!this._onMediaSegment)throw new t.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");
this._dtsBaseInited||this._calculateDtsBase(a,b);this._remuxVideo(b);this._remuxAudio(a)}},{key:"_onTrackMetadataReceived",value:function(b,c){var d=null,e="mp4",f=c.codec;if("audio"===b)this._audioMeta=c,"mp3"===c.codec&&this._mp3UseMpegAudio?(e="mpeg",f="",d=new Uint8Array):d=a["default"].generateInitSegment(c);else{if("video"!==b)return;this._videoMeta=c;d=a["default"].generateInitSegment(c)}if(!this._onInitSegment)throw new t.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");
this._onInitSegment(b,{type:b,data:d.buffer,codec:f,container:b+"/"+e,mediaDuration:c.duration})}},{key:"_calculateDtsBase",value:function(a,b){this._dtsBaseInited||(a.samples&&a.samples.length&&(this._audioDtsBase=a.samples[0].dts),b.samples&&b.samples.length&&(this._videoDtsBase=b.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}},{key:"flushStashedSamples",value:function(){var a=this._videoStashedLastSample,b=this._audioStashedLastSample,c={type:"video",
id:1,sequenceNumber:0,samples:[],length:0};null!=a&&(c.samples.push(a),c.length=a.length);a={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=b&&(a.samples.push(b),a.length=b.length);this._audioStashedLastSample=this._videoStashedLastSample=null;this._remuxVideo(c,!0);this._remuxAudio(a,!0)}},{key:"_remuxAudio",value:function(e,d){if(null!=this._audioMeta){var f=e.samples,g=-1,k=this._audioMeta.refSampleDuration,l="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,r=this._dtsBaseInited&&
void 0===this._audioNextDts,p=!1;if(f&&0!==f.length&&(1!==f.length||d)){var t=0;d=null;var E=0;l?(t=0,E=e.length):(t=8,E=8+e.length);var D=null;if(1<f.length&&(D=f.pop(),E-=D.length),null!=this._audioStashedLastSample){var y=this._audioStashedLastSample;this._audioStashedLastSample=null;f.unshift(y);E+=y.length}null!=D&&(this._audioStashedLastSample=D);var w=f[0].dts-this._dtsBase;if(this._audioNextDts)y=w-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())y=0,this._fillSilentAfterSeek&&
!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(p=!0);else if(y=this._audioSegmentInfoList.getLastSampleBefore(w),null!=y){var z=w-(y.originalDts+y.duration);3>=z&&(z=0);y=w-(y.dts+y.duration+z)}else y=0;if(p&&(p=w-y,w=this._videoSegmentInfoList.getLastSegmentBefore(w),null!=w&&w.beginDts<p&&(z=b["default"].getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)))){var v=w.beginDts;c["default"].v(this.TAG,"InsertPrefixSilentAudio: dts: "+v+", duration: "+
(p-w.beginDts));f.unshift({unit:z,dts:v,pts:v});E+=z.byteLength}p=[];for(w=0;w<f.length;w++){z=f[w];var G=z.unit;v=z.dts-this._dtsBase;var C=v-y;-1===g&&(g=C);var H=w!==f.length-1?f[w+1].dts-this._dtsBase-y-C:null!=D?D.dts-this._dtsBase-y-C:1<=p.length?p[p.length-1].duration:Math.floor(k);var N=!1,B=null;if(H>1.5*k&&"mp3"!==this._audioMeta.codec&&this._fillAudioTimestampGap&&!h["default"].safari){N=!0;B=Math.abs(H-k);var I=Math.ceil(B/k),Q=C+k;c["default"].w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n"+
("dts: "+(C+H)+" ms, expected: "+(C+Math.round(k))+" ms, ")+("delta: "+Math.round(B)+" ms, generate: "+I+" frames"));var K=b["default"].getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);null==K&&(c["default"].w(this.TAG,"Unable to generate silent frame for "+(this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame")),K=G);B=[];for(var V=0;I>V;V++){var L=Math.round(Q);if(0<B.length){var W=B[B.length-1];W.duration=L-W.dts}B.push({dts:L,
pts:L,cts:0,unit:K,size:K.byteLength,duration:0,originalDts:v,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}});E+=G.byteLength;Q+=k}G=B[B.length-1];G.duration=C+H-G.dts;H=Math.round(k)}p.push({dts:C,pts:C,cts:0,unit:z.unit,size:z.unit.byteLength,duration:H,originalDts:v,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}});N&&p.push.apply(p,B)}l?d=new Uint8Array(E):(d=new Uint8Array(E),d[0]=E>>>24&255,d[1]=E>>>16&255,d[2]=E>>>8&255,d[3]=255&E,d.set(a["default"].types.mdat,
4));for(f=0;f<p.length;f++)k=p[f].unit,d.set(k,t),t+=k.byteLength;k=p[p.length-1];this._audioNextDts=f=k.dts+k.duration;t=new q.MediaSegmentInfo;t.beginDts=g;t.endDts=f;t.beginPts=g;t.endPts=f;t.originalBeginDts=p[0].originalDts;t.originalEndDts=k.originalDts+k.duration;t.firstSample=new q.SampleInfo(p[0].dts,p[0].pts,p[0].duration,p[0].originalDts,!1);t.lastSample=new q.SampleInfo(k.dts,k.pts,k.duration,k.originalDts,!1);this._isLive||this._audioSegmentInfoList.append(t);e.samples=p;e.sequenceNumber++;
f=l?new Uint8Array:a["default"].moof(e,g);e.samples=[];e.length=0;e={type:"audio",data:this._mergeBoxes(f,d).buffer,sampleCount:p.length,info:t};l&&r&&(e.timestampOffset=g);this._onMediaSegment("audio",e)}}}},{key:"_remuxVideo",value:function(b,c){if(null!=this._videoMeta){var d=b.samples,e=-1,f=-1,g=-1,h=-1;if(d&&0!==d.length&&(1!==d.length||c)){c=8;var k=8+b.length,l=null;if(1<d.length&&(l=d.pop(),k-=l.length),null!=this._videoStashedLastSample){var p=this._videoStashedLastSample;this._videoStashedLastSample=
null;d.unshift(p);k+=p.length}null!=l&&(this._videoStashedLastSample=l);p=d[0].dts-this._dtsBase;if(this._videoNextDts)var r=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())r=0;else{var t=this._videoSegmentInfoList.getLastSampleBefore(p);null!=t?(r=p-(t.originalDts+t.duration),3>=r&&(r=0),r=p-(t.dts+t.duration+r)):r=0}p=new q.MediaSegmentInfo;t=[];for(var w=0;w<d.length;w++){var z=d[w],v=z.dts-this._dtsBase,G=z.isKeyframe,C=v-r,H=z.cts,N=C+H;-1===e&&(e=C,g=N);var B=w!==d.length-
1?d[w+1].dts-this._dtsBase-r-C:null!=l?l.dts-this._dtsBase-r-C:1<=t.length?t[t.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(G){var I=new q.SampleInfo(C,N,B,z.dts,!0);I.fileposition=z.fileposition;p.appendSyncPoint(I)}t.push({dts:C,pts:N,cts:H,units:z.units,size:z.length,isKeyframe:G,duration:B,originalDts:v,flags:{isLeading:0,dependsOn:G?2:1,isDependedOn:G?1:0,hasRedundancy:0,isNonSync:G?0:1}})}d=new Uint8Array(k);d[0]=k>>>24&255;d[1]=k>>>16&255;d[2]=k>>>8&255;d[3]=255&k;d.set(a["default"].types.mdat,
4);for(k=0;k<t.length;k++)for(l=t[k].units;l.length;)r=l.shift().data,d.set(r,c),c+=r.byteLength;c=t[t.length-1];if(f=c.dts+c.duration,h=c.pts+c.duration,this._videoNextDts=f,p.beginDts=e,p.endDts=f,p.beginPts=g,p.endPts=h,p.originalBeginDts=t[0].originalDts,p.originalEndDts=c.originalDts+c.duration,p.firstSample=new q.SampleInfo(t[0].dts,t[0].pts,t[0].duration,t[0].originalDts,t[0].isKeyframe),p.lastSample=new q.SampleInfo(c.dts,c.pts,c.duration,c.originalDts,c.isKeyframe),this._isLive||this._videoSegmentInfoList.append(p),
b.samples=t,b.sequenceNumber++,this._forceFirstIDR)f=t[0].flags,f.dependsOn=2,f.isNonSync=0;e=a["default"].moof(b,e);b.samples=[];b.length=0;this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(e,d).buffer,sampleCount:t.length,info:p})}}}},{key:"_mergeBoxes",value:function(a,b){var c=new Uint8Array(a.byteLength+b.byteLength);return c.set(a,0),c.set(b,a.byteLength),c}},{key:"onInitSegment",get:function(){return this._onInitSegment},set:function(a){this._onInitSegment=a}},{key:"onMediaSegment",
get:function(){return this._onMediaSegment},set:function(a){this._onMediaSegment=a}}]),f}();l["default"]=f},{"../core/media-segment-info.js":8,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./aac-silent.js":36,"./mp4-generator.js":37}],39:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});f={};g=self.navigator.userAgent.toLowerCase();var k=/(edge)\/([\w.]+)/.exec(g)||/(opr)[\/]([\w.]+)/.exec(g)||/(chrome)[ \/]([\w.]+)/.exec(g)||/(iemobile)[\/]([\w.]+)/.exec(g)||
/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(g)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(g)||/(webkit)[ \/]([\w.]+)/.exec(g)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(g)||/(msie) ([\w.]+)/.exec(g)||0<=g.indexOf("trident")&&/(rv)(?::| )([\w.]+)/.exec(g)||0>g.indexOf("compatible")&&/(firefox)[ \/]([\w.]+)/.exec(g)||[],e=/(ipad)/.exec(g)||/(ipod)/.exec(g)||/(windows phone)/.exec(g)||/(iphone)/.exec(g)||/(kindle)/.exec(g)||/(android)/.exec(g)||
/(windows)/.exec(g)||/(mac)/.exec(g)||/(linux)/.exec(g)||/(cros)/.exec(g)||[];g=k[5]||k[3]||k[1]||"";var c=k[2]||k[4]||"0";k=k[4]||k[2]||"0";e=e[0]||"";var a={};if(g){a[g]=!0;var b=k.split(".");a.version={major:parseInt(k,10),string:c};1<b.length&&(a.version.minor=parseInt(b[1],10));2<b.length&&(a.version.build=parseInt(b[2],10))}if(e&&(a[e]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),a.rv||a.iemobile)a.rv&&delete a.rv,g="msie",a.msie=!0;a.edge&&(delete a.edge,g="msedge",a.msedge=!0);a.opr&&(g=
"opera",a.opera=!0);a.safari&&a.android&&(g="android",a.android=!0);a.name=g;a.platform=e;for(var h in f)f.hasOwnProperty(h)&&delete f[h];Object.assign(f,a);l["default"]=f},{}],40:[function(f,g,l){function k(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!=typeof c&&"function"!=typeof c?a:c}function e(a,c){if("function"!=typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=
Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function c(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}Object.defineProperty(l,"__esModule",{value:!0});var a=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,
c,e){return c&&a(b.prototype,c),e&&a(b,e),b}}();f=l.RuntimeException=function(){function b(a){c(this,b);this._message=a}return a(b,[{key:"toString",value:function(){return this.name+": "+this.message}},{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}}]),b}();l.IllegalStateException=function(b){function f(a){return c(this,f),k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a))}return e(f,b),a(f,[{key:"name",get:function(){return"IllegalStateException"}}]),
f}(f);l.InvalidArgumentException=function(b){function f(a){return c(this,f),k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a))}return e(f,b),a(f,[{key:"name",get:function(){return"InvalidArgumentException"}}]),f}(f);l.NotImplementedException=function(b){function f(a){return c(this,f),k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a))}return e(f,b),a(f,[{key:"name",get:function(){return"NotImplementedException"}}]),f}(f)},{}],41:[function(f,g,l){Object.defineProperty(l,"__esModule",
{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();f=(f=f("events"))&&f.__esModule?f:{"default":f};g=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");}return k(e,null,[{key:"e",value:function(c,a){c&&!e.FORCE_GLOBAL_TAG||(c=e.GLOBAL_TAG);
c="["+c+"] > "+a;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",c);e.ENABLE_ERROR&&(console.error?console.error(c):console.warn?console.warn(c):console.log(c))}},{key:"i",value:function(c,a){c&&!e.FORCE_GLOBAL_TAG||(c=e.GLOBAL_TAG);c="["+c+"] > "+a;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",c);e.ENABLE_INFO&&(console.info?console.info(c):console.log(c))}},{key:"w",value:function(c,a){c&&!e.FORCE_GLOBAL_TAG||(c=e.GLOBAL_TAG);c="["+c+"] > "+a;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",c);e.ENABLE_WARN&&
(console.warn?console.warn(c):console.log(c))}},{key:"d",value:function(c,a){c&&!e.FORCE_GLOBAL_TAG||(c=e.GLOBAL_TAG);c="["+c+"] > "+a;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",c);e.ENABLE_DEBUG&&(console.debug?console.debug(c):console.log(c))}},{key:"v",value:function(c,a){c&&!e.FORCE_GLOBAL_TAG||(c=e.GLOBAL_TAG);c="["+c+"] > "+a;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",c);e.ENABLE_VERBOSE&&console.log(c)}}]),e}();g.GLOBAL_TAG="flv.js";g.FORCE_GLOBAL_TAG=!1;g.ENABLE_ERROR=!0;g.ENABLE_INFO=
!0;g.ENABLE_WARN=!0;g.ENABLE_DEBUG=!0;g.ENABLE_VERBOSE=!0;g.ENABLE_CALLBACK=!1;g.emitter=new f["default"];l["default"]=g},{events:2}],42:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function c(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(a,b,e){return b&&c(a.prototype,b),e&&c(a,e),a}}();g=(g=f("events"))&&g.__esModule?g:{"default":g};var e=
(f=f("./logger.js"))&&f.__esModule?f:{"default":f};f=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}return k(c,null,[{key:"getConfig",value:function(){return{globalTag:e["default"].GLOBAL_TAG,forceGlobalTag:e["default"].FORCE_GLOBAL_TAG,enableVerbose:e["default"].ENABLE_VERBOSE,enableDebug:e["default"].ENABLE_DEBUG,enableInfo:e["default"].ENABLE_INFO,enableWarn:e["default"].ENABLE_WARN,enableError:e["default"].ENABLE_ERROR,enableCallback:e["default"].ENABLE_CALLBACK}}},
{key:"applyConfig",value:function(a){e["default"].GLOBAL_TAG=a.globalTag;e["default"].FORCE_GLOBAL_TAG=a.forceGlobalTag;e["default"].ENABLE_VERBOSE=a.enableVerbose;e["default"].ENABLE_DEBUG=a.enableDebug;e["default"].ENABLE_INFO=a.enableInfo;e["default"].ENABLE_WARN=a.enableWarn;e["default"].ENABLE_ERROR=a.enableError;e["default"].ENABLE_CALLBACK=a.enableCallback}},{key:"_notifyChange",value:function(){var a=c.emitter;if(0<a.listenerCount("change")){var b=c.getConfig();a.emit("change",b)}}},{key:"registerListener",
value:function(a){c.emitter.addListener("change",a)}},{key:"removeListener",value:function(a){c.emitter.removeListener("change",a)}},{key:"addLogListener",value:function(a){e["default"].emitter.addListener("log",a);0<e["default"].emitter.listenerCount("log")&&(e["default"].ENABLE_CALLBACK=!0,c._notifyChange())}},{key:"removeLogListener",value:function(a){e["default"].emitter.removeListener("log",a);0===e["default"].emitter.listenerCount("log")&&(e["default"].ENABLE_CALLBACK=!1,c._notifyChange())}},
{key:"forceGlobalTag",get:function(){return e["default"].FORCE_GLOBAL_TAG},set:function(a){e["default"].FORCE_GLOBAL_TAG=a;c._notifyChange()}},{key:"globalTag",get:function(){return e["default"].GLOBAL_TAG},set:function(a){e["default"].GLOBAL_TAG=a;c._notifyChange()}},{key:"enableAll",get:function(){return e["default"].ENABLE_VERBOSE&&e["default"].ENABLE_DEBUG&&e["default"].ENABLE_INFO&&e["default"].ENABLE_WARN&&e["default"].ENABLE_ERROR},set:function(a){e["default"].ENABLE_VERBOSE=a;e["default"].ENABLE_DEBUG=
a;e["default"].ENABLE_INFO=a;e["default"].ENABLE_WARN=a;e["default"].ENABLE_ERROR=a;c._notifyChange()}},{key:"enableDebug",get:function(){return e["default"].ENABLE_DEBUG},set:function(a){e["default"].ENABLE_DEBUG=a;c._notifyChange()}},{key:"enableVerbose",get:function(){return e["default"].ENABLE_VERBOSE},set:function(a){e["default"].ENABLE_VERBOSE=a;c._notifyChange()}},{key:"enableInfo",get:function(){return e["default"].ENABLE_INFO},set:function(a){e["default"].ENABLE_INFO=a;c._notifyChange()}},
{key:"enableWarn",get:function(){return e["default"].ENABLE_WARN},set:function(a){e["default"].ENABLE_WARN=a;c._notifyChange()}},{key:"enableError",get:function(){return e["default"].ENABLE_ERROR},set:function(a){e["default"].ENABLE_ERROR=a;c._notifyChange()}}]),c}();f.emitter=new g["default"];l["default"]=f},{"./logger.js":41,events:2}],43:[function(f,g,l){Object.defineProperty(l,"__esModule",{value:!0});var k=function(){function e(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||
!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(c,a,b){return a&&e(c.prototype,a),b&&e(c,b),c}}();g=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");}return k(e,null,[{key:"install",value:function(){Object.setPrototypeOf=Object.setPrototypeOf||function(c,a){return c.__proto__=a,c};Object.assign=Object.assign||function(c){if(void 0===c||null===c)throw new TypeError("Cannot convert undefined or null to object");
for(var a=Object(c),b=1;b<arguments.length;b++){var e=arguments[b];if(void 0!==e&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(a[f]=e[f])}return a};"function"!=typeof self.Promise&&f("es6-promise").polyfill()}}]),e}();g.install();l["default"]=g},{"es6-promise":1}],44:[function(f,g,l){function k(e,c,a){if(c+a<e.length){for(;a--;)if(128!==(192&e[++c]))return!1;return!0}return!1}Object.defineProperty(l,"__esModule",{value:!0});l["default"]=function(e){for(var c=[],a=0,b=e.length;b>a;){if(128>e[a])c.push(String.fromCharCode(e[a]));
else{if(!(192>e[a]))if(224>e[a]){if(k(e,a,1)){var f=(31&e[a])<<6|63&e[a+1];if(128<=f){c.push(String.fromCharCode(65535&f));a+=2;continue}}}else if(240>e[a]){if(k(e,a,2)&&(f=(15&e[a])<<12|(63&e[a+1])<<6|63&e[a+2],2048<=f&&55296!==(63488&f))){c.push(String.fromCharCode(65535&f));a+=3;continue}}else if(248>e[a]&&k(e,a,3)&&(f=(7&e[a])<<18|(63&e[a+1])<<12|(63&e[a+2])<<6|63&e[a+3],65536<f&&1114112>f)){f-=65536;c.push(String.fromCharCode(f>>>10|55296));c.push(String.fromCharCode(1023&f|56320));a+=4;continue}c.push(String.fromCharCode(65533))}++a}return c.join("")}},
{}]},{},[21])(21)});
!function(f,g){"object"==typeof exports&&"undefined"!=typeof module?module.exports=g():"function"==typeof define&&define.amd?define(g):f.ES6Promise=g()}(this,function(){function f(){return function(){return process.nextTick(c)}}function g(){return"undefined"!=typeof N?function(){N(c)}:e()}function l(){var a=0,b=new K(c),d=document.createTextNode("");return b.observe(d,{characterData:!0}),function(){d.data=a=++a%2}}function k(){var a=new MessageChannel;return a.port1.onmessage=c,function(){return a.port2.postMessage(0)}}
function e(){var a=setTimeout;return function(){return a(c,1)}}function c(){for(var a=0;H>a;a+=2)(0,L[a])(L[a+1]),L[a]=void 0,L[a+1]=void 0;H=0}function a(){try{var a=require("vertx");return N=a.runOnLoop||a.runOnContext,g()}catch(Z){return e()}}function b(a,b){var c=arguments,d=this,e=new this.constructor(q);void 0===e[O]&&w(e);var f=d._state;return f?!function(){var a=c[f-1];I(function(){return D(f,e,a,d._result)})}():F(d,e,a,b),e}function h(a){if(a&&"object"==typeof a&&a.constructor===this)return a;
var b=new this(q);return m(b,a),b}function q(){}function t(a){try{return a.then}catch(Z){return S.error=Z,S}}function p(a,b,c,d){try{a.call(b,c,d)}catch(X){return X}}function r(a,b,c){I(function(a){var d=!1,e=p(c,b,function(c){d||(d=!0,b!==c?m(a,c):A(a,c))},function(b){d||(d=!0,u(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,u(a,e))},a)}function d(a,b){b._state===R?A(a,b._result):b._state===M?u(a,b._result):F(b,void 0,function(b){return m(a,b)},function(b){return u(a,b)})}function n(a,
c,e){c.constructor===a.constructor&&e===b&&c.constructor.resolve===h?d(a,c):e===S?u(a,S.error):void 0===e?A(a,c):"function"==typeof e?r(a,c,e):A(a,c)}function m(a,b){a===b?u(a,new TypeError("You cannot resolve a promise with itself")):"function"==typeof b||"object"==typeof b&&null!==b?n(a,b,t(b)):A(a,b)}function x(a){a._onerror&&a._onerror(a._result);Y(a)}function A(a,b){a._state===U&&(a._result=b,a._state=R,0!==a._subscribers.length&&I(Y,a))}function u(a,b){a._state===U&&(a._state=M,a._result=b,
I(x,a))}function F(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null;e[f]=b;e[f+R]=c;e[f+M]=d;0===f&&a._state&&I(Y,a)}function Y(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?D(c,d,e,f):e(f);a._subscribers.length=0}}function E(){this.error=null}function D(a,b,c,d){var e="function"==typeof c,f=void 0,g=void 0,h=void 0,k=void 0;if(e){try{var l=c(d)}catch(fa){l=(T.error=fa,T)}if(f=l,f===T?(k=!0,g=f.error,f=null):h=!0,b===f)return void u(b,
new TypeError("A promises callback cannot return that same promise."))}else f=d,h=!0;b._state!==U||(e&&h?m(b,f):k?u(b,g):a===R?A(b,f):a===M&&u(b,f))}function y(a,b){try{b(function(b){m(a,b)},function(b){u(a,b)})}catch(J){u(a,J)}}function w(a){a[O]=P++;a._state=void 0;a._result=void 0;a._subscribers=[]}function z(a,b){this._instanceConstructor=a;this.promise=new a(q);this.promise[O]||w(this.promise);C(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._result=Array(this.length),0===
this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&A(this.promise,this._result))):u(this.promise,Error("Array Methods must be provided an Array"))}function v(a){this[O]=P++;this._result=this._state=void 0;this._subscribers=[];if(q!==a){if("function"!=typeof a)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(this instanceof v)y(this,a);else throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}}var G=void 0,C=G=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},H=0,N=void 0,B=void 0,I=function(a,b){L[H]=a;L[H+1]=b;H+=2;2===H&&(B?B(c):W())},Q=(G="undefined"!=typeof window?window:void 0)||{},K=Q.MutationObserver||Q.WebKitMutationObserver;Q="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process);var V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,
L=Array(1E3),W=void 0;W=Q?f():K?l():V?k():void 0===G&&"function"==typeof require?a():e();var O=Math.random().toString(36).substring(16),U=void 0,R=1,M=2,S=new E,T=new E,P=0;return z.prototype._enumerate=function(){for(var a=this.length,b=this._input,c=0;this._state===U&&a>c;c++)this._eachEntry(b[c],c)},z.prototype._eachEntry=function(a,c){var d=this._instanceConstructor,e=d.resolve;e===h?(e=t(a),e===b&&a._state!==U?this._settledAt(a._state,c,a._result):"function"!=typeof e?(this._remaining--,this._result[c]=
a):d===v?(d=new d(q),n(d,a,e),this._willSettleAt(d,c)):this._willSettleAt(new d(function(b){return b(a)}),c)):this._willSettleAt(e(a),c)},z.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===U&&(this._remaining--,a===M?u(d,c):this._result[b]=c);0===this._remaining&&A(d,this._result)},z.prototype._willSettleAt=function(a,b){var c=this;F(a,void 0,function(a){return c._settledAt(R,b,a)},function(a){return c._settledAt(M,b,a)})},v.all=function(a){return(new z(this,a)).promise},v.race=
function(a){var b=this;return new b(C(a)?function(c,d){for(var e=a.length,f=0;e>f;f++)b.resolve(a[f]).then(c,d)}:function(a,b){return b(new TypeError("You must pass an array to race."))})},v.resolve=h,v.reject=function(a){var b=new this(q);return u(b,a),b},v._setScheduler=function(a){B=a},v._setAsap=function(a){I=a},v._asap=I,v.prototype={constructor:v,then:b,"catch":function(a){return this.then(null,a)}},v.polyfill=function(){var a=void 0;if("undefined"!=typeof global)a=global;else if("undefined"!=
typeof self)a=self;else try{a=Function("return this")()}catch(ba){throw Error("polyfill failed because global object is unavailable in this environment");}var b=a.Promise;if("undefined"!=typeof egret_native&&egret_native.capability&&!egret_native.capability("Promise")&&(b=void 0),b){var c=null;try{c=Object.prototype.toString.call(b.resolve())}catch(ba){}if("[object Promise]"===c&&!b.cast)return}a.Promise=v},v.Promise=v,v});ES6Promise.polyfill();
