10 lines
199 KiB
JavaScript
10 lines
199 KiB
JavaScript
import{O as Ct}from"./index.741f95d2.js";function Bt(He,at){return at.forEach(function(le){le&&typeof le!="string"&&!Array.isArray(le)&&Object.keys(le).forEach(function(Q){if(Q!=="default"&&!(Q in He)){var I=Object.getOwnPropertyDescriptor(le,Q);Object.defineProperty(He,Q,I.get?I:{enumerable:!0,get:function(){return le[Q]}})}})}),Object.freeze(Object.defineProperty(He,Symbol.toStringTag,{value:"Module"}))}var nt={exports:{}};(function(He,at){(function(le,Q){He.exports=Q()})(window,function(){return function(le){var Q={};function I(G){if(Q[G])return Q[G].exports;var B=Q[G]={i:G,l:!1,exports:{}};return le[G].call(B.exports,B,B.exports,I),B.l=!0,B.exports}return I.m=le,I.c=Q,I.d=function(G,B,g){I.o(G,B)||Object.defineProperty(G,B,{enumerable:!0,get:g})},I.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},I.t=function(G,B){if(1&B&&(G=I(G)),8&B||4&B&&typeof G=="object"&&G&&G.__esModule)return G;var g=Object.create(null);if(I.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:G}),2&B&&typeof G!="string")for(var v in G)I.d(g,v,function(p){return G[p]}.bind(null,v));return g},I.n=function(G){var B=G&&G.__esModule?function(){return G.default}:function(){return G};return I.d(B,"a",B),B},I.o=function(G,B){return Object.prototype.hasOwnProperty.call(G,B)},I.p="",I(I.s=14)}([function(le,Q,I){var G=I(6),B=I.n(G),g=function(){function v(){}return v.e=function(p,f){p&&!v.FORCE_GLOBAL_TAG||(p=v.GLOBAL_TAG);var R="["+p+"] > "+f;v.ENABLE_CALLBACK&&v.emitter.emit("log","error",R),v.ENABLE_ERROR&&(console.error?console.error(R):console.warn?console.warn(R):console.log(R))},v.i=function(p,f){p&&!v.FORCE_GLOBAL_TAG||(p=v.GLOBAL_TAG);var R="["+p+"] > "+f;v.ENABLE_CALLBACK&&v.emitter.emit("log","info",R),v.ENABLE_INFO&&(console.info?console.info(R):console.log(R))},v.w=function(p,f){p&&!v.FORCE_GLOBAL_TAG||(p=v.GLOBAL_TAG);var R="["+p+"] > "+f;v.ENABLE_CALLBACK&&v.emitter.emit("log","warn",R),v.ENABLE_WARN&&(console.warn?console.warn(R):console.log(R))},v.d=function(p,f){p&&!v.FORCE_GLOBAL_TAG||(p=v.GLOBAL_TAG);var R="["+p+"] > "+f;v.ENABLE_CALLBACK&&v.emitter.emit("log","debug",R),v.ENABLE_DEBUG&&(console.debug?console.debug(R):console.log(R))},v.v=function(p,f){p&&!v.FORCE_GLOBAL_TAG||(p=v.GLOBAL_TAG);var R="["+p+"] > "+f;v.ENABLE_CALLBACK&&v.emitter.emit("log","verbose",R),v.ENABLE_VERBOSE&&console.log(R)},v}();g.GLOBAL_TAG="mpegts.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 B.a,Q.a=g},function(le,Q,I){Q.a={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},function(le,Q,I){I.d(Q,"c",function(){return B}),I.d(Q,"b",function(){return g}),I.d(Q,"a",function(){return v});var G=I(3),B={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},g={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},v=function(){function p(f){this._type=f||"undefined",this._status=B.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return p.prototype.destroy=function(){this._status=B.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},p.prototype.isWorking=function(){return this._status===B.kConnecting||this._status===B.kBuffering},Object.defineProperty(p.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(f){this._onContentLengthKnown=f},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(f){this._onURLRedirect=f},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(f){this._onDataArrival=f},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onError",{get:function(){return this._onError},set:function(f){this._onError=f},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onComplete",{get:function(){return this._onComplete},set:function(f){this._onComplete=f},enumerable:!1,configurable:!0}),p.prototype.open=function(f,R){throw new G.c("Unimplemented abstract function!")},p.prototype.abort=function(){throw new G.c("Unimplemented abstract function!")},p}()},function(le,Q,I){I.d(Q,"d",function(){return g}),I.d(Q,"a",function(){return v}),I.d(Q,"b",function(){return p}),I.d(Q,"c",function(){return f});var G,B=(G=function(R,x){return(G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,j){C.__proto__=j}||function(C,j){for(var z in j)j.hasOwnProperty(z)&&(C[z]=j[z])})(R,x)},function(R,x){function C(){this.constructor=R}G(R,x),R.prototype=x===null?Object.create(x):(C.prototype=x.prototype,new C)}),g=function(){function R(x){this._message=x}return Object.defineProperty(R.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),R.prototype.toString=function(){return this.name+": "+this.message},R}(),v=function(R){function x(C){return R.call(this,C)||this}return B(x,R),Object.defineProperty(x.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),x}(g),p=function(R){function x(C){return R.call(this,C)||this}return B(x,R),Object.defineProperty(x.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),x}(g),f=function(R){function x(C){return R.call(this,C)||this}return B(x,R),Object.defineProperty(x.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),x}(g)},function(le,Q,I){var G={};(function(){var B=self.navigator.userAgent.toLowerCase(),g=/(edge)\/([\w.]+)/.exec(B)||/(opr)[\/]([\w.]+)/.exec(B)||/(chrome)[ \/]([\w.]+)/.exec(B)||/(iemobile)[\/]([\w.]+)/.exec(B)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(B)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(B)||/(webkit)[ \/]([\w.]+)/.exec(B)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(B)||/(msie) ([\w.]+)/.exec(B)||B.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(B)||B.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(B)||[],v=/(ipad)/.exec(B)||/(ipod)/.exec(B)||/(windows phone)/.exec(B)||/(iphone)/.exec(B)||/(kindle)/.exec(B)||/(android)/.exec(B)||/(windows)/.exec(B)||/(mac)/.exec(B)||/(linux)/.exec(B)||/(cros)/.exec(B)||[],p={browser:g[5]||g[3]||g[1]||"",version:g[2]||g[4]||"0",majorVersion:g[4]||g[2]||"0",platform:v[0]||""},f={};if(p.browser){f[p.browser]=!0;var R=p.majorVersion.split(".");f.version={major:parseInt(p.majorVersion,10),string:p.version},R.length>1&&(f.version.minor=parseInt(R[1],10)),R.length>2&&(f.version.build=parseInt(R[2],10))}p.platform&&(f[p.platform]=!0),(f.chrome||f.opr||f.safari)&&(f.webkit=!0),(f.rv||f.iemobile)&&(f.rv&&delete f.rv,p.browser="msie",f.msie=!0),f.edge&&(delete f.edge,p.browser="msedge",f.msedge=!0),f.opr&&(p.browser="opera",f.opera=!0),f.safari&&f.android&&(p.browser="android",f.android=!0);for(var x in f.name=p.browser,f.platform=p.platform,G)G.hasOwnProperty(x)&&delete G[x];Object.assign(G,f)})(),Q.a=G},function(le,Q,I){Q.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(le,Q,I){var G,B=typeof Reflect=="object"?Reflect:null,g=B&&typeof B.apply=="function"?B.apply:function(m,N,b){return Function.prototype.apply.call(m,N,b)};G=B&&typeof B.ownKeys=="function"?B.ownKeys:Object.getOwnPropertySymbols?function(m){return Object.getOwnPropertyNames(m).concat(Object.getOwnPropertySymbols(m))}:function(m){return Object.getOwnPropertyNames(m)};var v=Number.isNaN||function(m){return m!=m};function p(){p.init.call(this)}le.exports=p,le.exports.once=function(m,N){return new Promise(function(b,_){function h(c){m.removeListener(N,u),_(c)}function u(){typeof m.removeListener=="function"&&m.removeListener("error",h),b([].slice.call(arguments))}ne(m,N,u,{once:!0}),N!=="error"&&function(c,P,D){typeof c.on=="function"&&ne(c,"error",P,D)}(m,h,{once:!0})})},p.EventEmitter=p,p.prototype._events=void 0,p.prototype._eventsCount=0,p.prototype._maxListeners=void 0;var f=10;function R(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}function x(m){return m._maxListeners===void 0?p.defaultMaxListeners:m._maxListeners}function C(m,N,b,_){var h,u,c,P;if(R(b),(u=m._events)===void 0?(u=m._events=Object.create(null),m._eventsCount=0):(u.newListener!==void 0&&(m.emit("newListener",N,b.listener?b.listener:b),u=m._events),c=u[N]),c===void 0)c=u[N]=b,++m._eventsCount;else if(typeof c=="function"?c=u[N]=_?[b,c]:[c,b]:_?c.unshift(b):c.push(b),(h=x(m))>0&&c.length>h&&!c.warned){c.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(N)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=m,D.type=N,D.count=c.length,P=D,console&&console.warn&&console.warn(P)}return m}function j(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function z(m,N,b){var _={fired:!1,wrapFn:void 0,target:m,type:N,listener:b},h=j.bind(_);return h.listener=b,_.wrapFn=h,h}function ue(m,N,b){var _=m._events;if(_===void 0)return[];var h=_[N];return h===void 0?[]:typeof h=="function"?b?[h.listener||h]:[h]:b?function(u){for(var c=new Array(u.length),P=0;P<c.length;++P)c[P]=u[P].listener||u[P];return c}(h):$(h,h.length)}function se(m){var N=this._events;if(N!==void 0){var b=N[m];if(typeof b=="function")return 1;if(b!==void 0)return b.length}return 0}function $(m,N){for(var b=new Array(N),_=0;_<N;++_)b[_]=m[_];return b}function ne(m,N,b,_){if(typeof m.on=="function")_.once?m.once(N,b):m.on(N,b);else{if(typeof m.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m);m.addEventListener(N,function h(u){_.once&&m.removeEventListener(N,h),b(u)})}}Object.defineProperty(p,"defaultMaxListeners",{enumerable:!0,get:function(){return f},set:function(m){if(typeof m!="number"||m<0||v(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");f=m}}),p.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},p.prototype.setMaxListeners=function(m){if(typeof m!="number"||m<0||v(m))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+m+".");return this._maxListeners=m,this},p.prototype.getMaxListeners=function(){return x(this)},p.prototype.emit=function(m){for(var N=[],b=1;b<arguments.length;b++)N.push(arguments[b]);var _=m==="error",h=this._events;if(h!==void 0)_=_&&h.error===void 0;else if(!_)return!1;if(_){var u;if(N.length>0&&(u=N[0]),u instanceof Error)throw u;var c=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw c.context=u,c}var P=h[m];if(P===void 0)return!1;if(typeof P=="function")g(P,this,N);else{var D=P.length,V=$(P,D);for(b=0;b<D;++b)g(V[b],this,N)}return!0},p.prototype.addListener=function(m,N){return C(this,m,N,!1)},p.prototype.on=p.prototype.addListener,p.prototype.prependListener=function(m,N){return C(this,m,N,!0)},p.prototype.once=function(m,N){return R(N),this.on(m,z(this,m,N)),this},p.prototype.prependOnceListener=function(m,N){return R(N),this.prependListener(m,z(this,m,N)),this},p.prototype.removeListener=function(m,N){var b,_,h,u,c;if(R(N),(_=this._events)===void 0)return this;if((b=_[m])===void 0)return this;if(b===N||b.listener===N)--this._eventsCount==0?this._events=Object.create(null):(delete _[m],_.removeListener&&this.emit("removeListener",m,b.listener||N));else if(typeof b!="function"){for(h=-1,u=b.length-1;u>=0;u--)if(b[u]===N||b[u].listener===N){c=b[u].listener,h=u;break}if(h<0)return this;h===0?b.shift():function(P,D){for(;D+1<P.length;D++)P[D]=P[D+1];P.pop()}(b,h),b.length===1&&(_[m]=b[0]),_.removeListener!==void 0&&this.emit("removeListener",m,c||N)}return this},p.prototype.off=p.prototype.removeListener,p.prototype.removeAllListeners=function(m){var N,b,_;if((b=this._events)===void 0)return this;if(b.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):b[m]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete b[m]),this;if(arguments.length===0){var h,u=Object.keys(b);for(_=0;_<u.length;++_)(h=u[_])!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(N=b[m])=="function")this.removeListener(m,N);else if(N!==void 0)for(_=N.length-1;_>=0;_--)this.removeListener(m,N[_]);return this},p.prototype.listeners=function(m){return ue(this,m,!0)},p.prototype.rawListeners=function(m){return ue(this,m,!1)},p.listenerCount=function(m,N){return typeof m.listenerCount=="function"?m.listenerCount(N):se.call(m,N)},p.prototype.listenerCount=se,p.prototype.eventNames=function(){return this._eventsCount>0?G(this._events):[]}},function(le,Q,I){I.d(Q,"d",function(){return G}),I.d(Q,"b",function(){return B}),I.d(Q,"a",function(){return g}),I.d(Q,"c",function(){return v});var G=function(p,f,R,x,C){this.dts=p,this.pts=f,this.duration=R,this.originalDts=x,this.isSyncPoint=C,this.fileposition=null},B=function(){function p(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return p.prototype.appendSyncPoint=function(f){f.isSyncPoint=!0,this.syncPoints.push(f)},p}(),g=function(){function p(){this._list=[]}return p.prototype.clear=function(){this._list=[]},p.prototype.appendArray=function(f){var R=this._list;f.length!==0&&(R.length>0&&f[0].originalDts<R[R.length-1].originalDts&&this.clear(),Array.prototype.push.apply(R,f))},p.prototype.getLastSyncPointBeforeDts=function(f){if(this._list.length==0)return null;var R=this._list,x=0,C=R.length-1,j=0,z=0,ue=C;for(f<R[0].dts&&(x=0,z=ue+1);z<=ue;){if((j=z+Math.floor((ue-z)/2))===C||f>=R[j].dts&&f<R[j+1].dts){x=j;break}R[j].dts<f?z=j+1:ue=j-1}return this._list[x]},p}(),v=function(){function p(f){this._type=f,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(p.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),p.prototype.isEmpty=function(){return this._list.length===0},p.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},p.prototype._searchNearestSegmentBefore=function(f){var R=this._list;if(R.length===0)return-2;var x=R.length-1,C=0,j=0,z=x,ue=0;if(f<R[0].originalBeginDts)return ue=-1;for(;j<=z;){if((C=j+Math.floor((z-j)/2))===x||f>R[C].lastSample.originalDts&&f<R[C+1].originalBeginDts){ue=C;break}R[C].originalBeginDts<f?j=C+1:z=C-1}return ue},p.prototype._searchNearestSegmentAfter=function(f){return this._searchNearestSegmentBefore(f)+1},p.prototype.append=function(f){var R=this._list,x=f,C=this._lastAppendLocation,j=0;C!==-1&&C<R.length&&x.originalBeginDts>=R[C].lastSample.originalDts&&(C===R.length-1||C<R.length-1&&x.originalBeginDts<R[C+1].originalBeginDts)?j=C+1:R.length>0&&(j=this._searchNearestSegmentBefore(x.originalBeginDts)+1),this._lastAppendLocation=j,this._list.splice(j,0,x)},p.prototype.getLastSegmentBefore=function(f){var R=this._searchNearestSegmentBefore(f);return R>=0?this._list[R]:null},p.prototype.getLastSampleBefore=function(f){var R=this.getLastSegmentBefore(f);return R!=null?R.lastSample:null},p.prototype.getLastSyncPointBefore=function(f){for(var R=this._searchNearestSegmentBefore(f),x=this._list[R].syncPoints;x.length===0&&R>0;)R--,x=this._list[R].syncPoints;return x.length>0?x[x.length-1]:null},p}()},function(le,Q,I){var G=function(){function B(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return B.prototype.isComplete=function(){var g=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,v=this.hasVideo===!1||this.hasVideo===!0&&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!=null;return this.mimeType!=null&&g&&v},B.prototype.isSeekable=function(){return this.hasKeyframesIndex===!0},B.prototype.getNearestKeyframe=function(g){if(this.keyframesIndex==null)return null;var v=this.keyframesIndex,p=this._search(v.times,g);return{index:p,milliseconds:v.times[p],fileposition:v.filepositions[p]}},B.prototype._search=function(g,v){var p=0,f=g.length-1,R=0,x=0,C=f;for(v<g[0]&&(p=0,x=C+1);x<=C;){if((R=x+Math.floor((C-x)/2))===f||v>=g[R]&&v<g[R+1]){p=R;break}g[R]<v?x=R+1:C=R-1}return p},B}();Q.a=G},function(le,Q,I){var G=I(6),B=I.n(G),g=I(0),v=function(){function p(){}return Object.defineProperty(p,"forceGlobalTag",{get:function(){return g.a.FORCE_GLOBAL_TAG},set:function(f){g.a.FORCE_GLOBAL_TAG=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"globalTag",{get:function(){return g.a.GLOBAL_TAG},set:function(f){g.a.GLOBAL_TAG=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"enableAll",{get:function(){return g.a.ENABLE_VERBOSE&&g.a.ENABLE_DEBUG&&g.a.ENABLE_INFO&&g.a.ENABLE_WARN&&g.a.ENABLE_ERROR},set:function(f){g.a.ENABLE_VERBOSE=f,g.a.ENABLE_DEBUG=f,g.a.ENABLE_INFO=f,g.a.ENABLE_WARN=f,g.a.ENABLE_ERROR=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"enableDebug",{get:function(){return g.a.ENABLE_DEBUG},set:function(f){g.a.ENABLE_DEBUG=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"enableVerbose",{get:function(){return g.a.ENABLE_VERBOSE},set:function(f){g.a.ENABLE_VERBOSE=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"enableInfo",{get:function(){return g.a.ENABLE_INFO},set:function(f){g.a.ENABLE_INFO=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"enableWarn",{get:function(){return g.a.ENABLE_WARN},set:function(f){g.a.ENABLE_WARN=f,p._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(p,"enableError",{get:function(){return g.a.ENABLE_ERROR},set:function(f){g.a.ENABLE_ERROR=f,p._notifyChange()},enumerable:!1,configurable:!0}),p.getConfig=function(){return{globalTag:g.a.GLOBAL_TAG,forceGlobalTag:g.a.FORCE_GLOBAL_TAG,enableVerbose:g.a.ENABLE_VERBOSE,enableDebug:g.a.ENABLE_DEBUG,enableInfo:g.a.ENABLE_INFO,enableWarn:g.a.ENABLE_WARN,enableError:g.a.ENABLE_ERROR,enableCallback:g.a.ENABLE_CALLBACK}},p.applyConfig=function(f){g.a.GLOBAL_TAG=f.globalTag,g.a.FORCE_GLOBAL_TAG=f.forceGlobalTag,g.a.ENABLE_VERBOSE=f.enableVerbose,g.a.ENABLE_DEBUG=f.enableDebug,g.a.ENABLE_INFO=f.enableInfo,g.a.ENABLE_WARN=f.enableWarn,g.a.ENABLE_ERROR=f.enableError,g.a.ENABLE_CALLBACK=f.enableCallback},p._notifyChange=function(){var f=p.emitter;if(f.listenerCount("change")>0){var R=p.getConfig();f.emit("change",R)}},p.registerListener=function(f){p.emitter.addListener("change",f)},p.removeListener=function(f){p.emitter.removeListener("change",f)},p.addLogListener=function(f){g.a.emitter.addListener("log",f),g.a.emitter.listenerCount("log")>0&&(g.a.ENABLE_CALLBACK=!0,p._notifyChange())},p.removeLogListener=function(f){g.a.emitter.removeListener("log",f),g.a.emitter.listenerCount("log")===0&&(g.a.ENABLE_CALLBACK=!1,p._notifyChange())},p}();v.emitter=new B.a,Q.a=v},function(le,Q,I){var G=I(6),B=I.n(G),g=I(0),v=I(4),p=I(8);function f(r,t,i){var e=r;if(t+i<e.length){for(;i--;)if((192&e[++t])!=128)return!1;return!0}return!1}var R,x=function(r){for(var t=[],i=r,e=0,n=r.length;e<n;)if(i[e]<128)t.push(String.fromCharCode(i[e])),++e;else{if(!(i[e]<192)){if(i[e]<224){if(f(i,e,1)&&(s=(31&i[e])<<6|63&i[e+1])>=128){t.push(String.fromCharCode(65535&s)),e+=2;continue}}else if(i[e]<240){if(f(i,e,2)&&(s=(15&i[e])<<12|(63&i[e+1])<<6|63&i[e+2])>=2048&&(63488&s)!=55296){t.push(String.fromCharCode(65535&s)),e+=3;continue}}else if(i[e]<248){var s;if(f(i,e,3)&&(s=(7&i[e])<<18|(63&i[e+1])<<12|(63&i[e+2])<<6|63&i[e+3])>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),e+=4;continue}}}t.push(String.fromCharCode(65533)),++e}return t.join("")},C=I(3),j=(R=new ArrayBuffer(2),new DataView(R).setInt16(0,256,!0),new Int16Array(R)[0]===256),z=function(){function r(){}return r.parseScriptData=function(t,i,e){var n={};try{var s=r.parseValue(t,i,e),a=r.parseValue(t,i+s.size,e-s.size);n[s.data]=a.data}catch(o){g.a.e("AMF",o.toString())}return n},r.parseObject=function(t,i,e){if(e<3)throw new C.a("Data not enough when parse ScriptDataObject");var n=r.parseString(t,i,e),s=r.parseValue(t,i+n.size,e-n.size),a=s.objectEnd;return{data:{name:n.data,value:s.data},size:n.size+s.size,objectEnd:a}},r.parseVariable=function(t,i,e){return r.parseObject(t,i,e)},r.parseString=function(t,i,e){if(e<2)throw new C.a("Data not enough when parse String");var n=new DataView(t,i,e).getUint16(0,!j);return{data:n>0?x(new Uint8Array(t,i+2,n)):"",size:2+n}},r.parseLongString=function(t,i,e){if(e<4)throw new C.a("Data not enough when parse LongString");var n=new DataView(t,i,e).getUint32(0,!j);return{data:n>0?x(new Uint8Array(t,i+4,n)):"",size:4+n}},r.parseDate=function(t,i,e){if(e<10)throw new C.a("Data size invalid when parse Date");var n=new DataView(t,i,e),s=n.getFloat64(0,!j),a=n.getInt16(8,!j);return{data:new Date(s+=60*a*1e3),size:10}},r.parseValue=function(t,i,e){if(e<1)throw new C.a("Data not enough when parse Value");var n,s=new DataView(t,i,e),a=1,o=s.getUint8(0),E=!1;try{switch(o){case 0:n=s.getFloat64(1,!j),a+=8;break;case 1:n=!!s.getUint8(1),a+=1;break;case 2:var y=r.parseString(t,i+1,e-1);n=y.data,a+=y.size;break;case 3:n={};var T=0;for((16777215&s.getUint32(e-4,!j))==9&&(T=3);a<e-4;){var k=r.parseObject(t,i+a,e-a-T);if(k.objectEnd)break;n[k.data.name]=k.data.value,a+=k.size}a<=e-3&&(16777215&s.getUint32(a-1,!j))===9&&(a+=3);break;case 8:for(n={},a+=4,T=0,(16777215&s.getUint32(e-4,!j))==9&&(T=3);a<e-8;){var A=r.parseVariable(t,i+a,e-a-T);if(A.objectEnd)break;n[A.data.name]=A.data.value,a+=A.size}a<=e-3&&(16777215&s.getUint32(a-1,!j))===9&&(a+=3);break;case 9:n=void 0,a=1,E=!0;break;case 10:n=[];var w=s.getUint32(1,!j);a+=4;for(var O=0;O<w;O++){var q=r.parseValue(t,i+a,e-a);n.push(q.data),a+=q.size}break;case 11:var U=r.parseDate(t,i+1,e-1);n=U.data,a+=U.size;break;case 12:var Y=r.parseString(t,i+1,e-1);n=Y.data,a+=Y.size;break;default:a=e,g.a.w("AMF","Unsupported AMF value type "+o)}}catch(Z){g.a.e("AMF",Z.toString())}return{data:n,size:a,objectEnd:E}},r}(),ue=function(){function r(t){this.TAG="ExpGolomb",this._buffer=t,this._buffer_index=0,this._total_bytes=t.byteLength,this._total_bits=8*t.byteLength,this._current_word=0,this._current_word_bits_left=0}return r.prototype.destroy=function(){this._buffer=null},r.prototype._fillCurrentWord=function(){var t=this._total_bytes-this._buffer_index;if(t<=0)throw new C.a("ExpGolomb: _fillCurrentWord() but no bytes available");var i=Math.min(4,t),e=new Uint8Array(4);e.set(this._buffer.subarray(this._buffer_index,this._buffer_index+i)),this._current_word=new DataView(e.buffer).getUint32(0,!1),this._buffer_index+=i,this._current_word_bits_left=8*i},r.prototype.readBits=function(t){if(t>32)throw new C.b("ExpGolomb: readBits() bits exceeded max 32bits!");if(t<=this._current_word_bits_left){var i=this._current_word>>>32-t;return this._current_word<<=t,this._current_word_bits_left-=t,i}var e=this._current_word_bits_left?this._current_word:0;e>>>=32-this._current_word_bits_left;var n=t-this._current_word_bits_left;this._fillCurrentWord();var s=Math.min(n,this._current_word_bits_left),a=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,e=e<<s|a},r.prototype.readBool=function(){return this.readBits(1)===1},r.prototype.readByte=function(){return this.readBits(8)},r.prototype._skipLeadingZero=function(){var t;for(t=0;t<this._current_word_bits_left;t++)if((this._current_word&2147483648>>>t)!=0)return this._current_word<<=t,this._current_word_bits_left-=t,t;return this._fillCurrentWord(),t+this._skipLeadingZero()},r.prototype.readUEG=function(){var t=this._skipLeadingZero();return this.readBits(t+1)-1},r.prototype.readSEG=function(){var t=this.readUEG();return 1&t?t+1>>>1:-1*(t>>>1)},r}(),se=function(){function r(){}return r._ebsp2rbsp=function(t){for(var i=t,e=i.byteLength,n=new Uint8Array(e),s=0,a=0;a<e;a++)a>=2&&i[a]===3&&i[a-1]===0&&i[a-2]===0||(n[s]=i[a],s++);return new Uint8Array(n.buffer,0,s)},r.parseSPS=function(t){for(var i=t.subarray(1,4),e="avc1.",n=0;n<3;n++){var s=i[n].toString(16);s.length<2&&(s="0"+s),e+=s}var a=r._ebsp2rbsp(t),o=new ue(a);o.readByte();var E=o.readByte();o.readByte();var y=o.readByte();o.readUEG();var T=r.getProfileString(E),k=r.getLevelString(y),A=1,w=420,O=8,q=8;if((E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128||E===138||E===144)&&((A=o.readUEG())===3&&o.readBits(1),A<=3&&(w=[0,420,422,444][A]),O=o.readUEG()+8,q=o.readUEG()+8,o.readBits(1),o.readBool()))for(var U=A!==3?8:12,Y=0;Y<U;Y++)o.readBool()&&(Y<6?r._skipScalingList(o,16):r._skipScalingList(o,64));o.readUEG();var Z=o.readUEG();if(Z===0)o.readUEG();else if(Z===1){o.readBits(1),o.readSEG(),o.readSEG();var K=o.readUEG();for(Y=0;Y<K;Y++)o.readSEG()}var de=o.readUEG();o.readBits(1);var X=o.readUEG(),H=o.readUEG(),re=o.readBits(1);re===0&&o.readBits(1),o.readBits(1);var pe=0,Se=0,_e=0,ve=0;o.readBool()&&(pe=o.readUEG(),Se=o.readUEG(),_e=o.readUEG(),ve=o.readUEG());var ye=1,oe=1,ge=0,be=!0,De=0,Ue=0;if(o.readBool()){if(o.readBool()){var Pe=o.readByte();Pe>0&&Pe<16?(ye=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][Pe-1],oe=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][Pe-1]):Pe===255&&(ye=o.readByte()<<8|o.readByte(),oe=o.readByte()<<8|o.readByte())}if(o.readBool()&&o.readBool(),o.readBool()&&(o.readBits(4),o.readBool()&&o.readBits(24)),o.readBool()&&(o.readUEG(),o.readUEG()),o.readBool()){var Ee=o.readBits(32),ze=o.readBits(32);be=o.readBool(),ge=(De=ze)/(Ue=2*Ee)}}var Ne=1;ye===1&&oe===1||(Ne=ye/oe);var Ce=0,we=0;A===0?(Ce=1,we=2-re):(Ce=A===3?1:2,we=(A===1?2:1)*(2-re));var Ge=16*(X+1),xe=16*(H+1)*(2-re);Ge-=(pe+Se)*Ce,xe-=(_e+ve)*we;var Fe=Math.ceil(Ge*Ne);return o.destroy(),o=null,{codec_mimetype:e,profile_idc:E,level_idc:y,profile_string:T,level_string:k,chroma_format_idc:A,bit_depth:O,bit_depth_luma:O,bit_depth_chroma:q,ref_frames:de,chroma_format:w,chroma_format_string:r.getChromaFormatString(w),frame_rate:{fixed:be,fps:ge,fps_den:Ue,fps_num:De},sar_ratio:{width:ye,height:oe},codec_size:{width:Ge,height:xe},present_size:{width:Fe,height:xe}}},r._skipScalingList=function(t,i){for(var e=8,n=8,s=0;s<i;s++)n!==0&&(n=(e+t.readSEG()+256)%256),e=n===0?e:n},r.getProfileString=function(t){switch(t){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"}},r.getLevelString=function(t){return(t/10).toFixed(1)},r.getChromaFormatString=function(t){switch(t){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},r}(),$=I(5),ne=function(){function r(){}return r._ebsp2rbsp=function(t){for(var i=t,e=i.byteLength,n=new Uint8Array(e),s=0,a=0;a<e;a++)a>=2&&i[a]===3&&i[a-1]===0&&i[a-2]===0||(n[s]=i[a],s++);return new Uint8Array(n.buffer,0,s)},r.parseVPS=function(t){var i=r._ebsp2rbsp(t),e=new ue(i);return e.readByte(),e.readByte(),e.readBits(4),e.readBits(2),e.readBits(6),{num_temporal_layers:e.readBits(3)+1,temporal_id_nested:e.readBool()}},r.parseSPS=function(t){var i=r._ebsp2rbsp(t),e=new ue(i);e.readByte(),e.readByte(),e.readBits(4);for(var n=e.readBits(3),s=(e.readBool(),e.readBits(2)),a=e.readBool(),o=e.readBits(5),E=e.readByte(),y=e.readByte(),T=e.readByte(),k=e.readByte(),A=e.readByte(),w=e.readByte(),O=e.readByte(),q=e.readByte(),U=e.readByte(),Y=e.readByte(),Z=e.readByte(),K=[],de=[],X=0;X<n;X++)K.push(e.readBool()),de.push(e.readBool());if(n>0)for(X=n;X<8;X++)e.readBits(2);for(X=0;X<n;X++)K[X]&&(e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte()),de[X]&&e.readByte();e.readUEG();var H=e.readUEG();H==3&&e.readBits(1);var re=e.readUEG(),pe=e.readUEG();e.readBool()&&(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG());var Se=e.readUEG(),_e=e.readUEG(),ve=e.readUEG();for(X=e.readBool()?0:n;X<=n;X++)e.readUEG(),e.readUEG(),e.readUEG();if(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readBool()&&e.readBool())for(var ye=0;ye<4;ye++)for(var oe=0;oe<(ye===3?2:6);oe++)if(e.readBool()){var ge=Math.min(64,1<<4+(ye<<1));for(ye>1&&e.readSEG(),X=0;X<ge;X++)e.readSEG()}else e.readUEG();e.readBool(),e.readBool(),e.readBool()&&(e.readByte(),e.readUEG(),e.readUEG(),e.readBool());var be=e.readUEG(),De=0;for(X=0;X<be;X++){var Ue=!1;if(X!==0&&(Ue=e.readBool()),Ue){X===be&&e.readUEG(),e.readBool(),e.readUEG();for(var Pe=0,Ee=0;Ee<=De;Ee++){var ze=e.readBool(),Ne=!1;ze||(Ne=e.readBool()),(ze||Ne)&&Pe++}De=Pe}else{var Ce=e.readUEG(),we=e.readUEG();for(De=Ce+we,Ee=0;Ee<Ce;Ee++)e.readUEG(),e.readBool();for(Ee=0;Ee<we;Ee++)e.readUEG(),e.readBool()}}if(e.readBool()){var Ge=e.readUEG();for(X=0;X<Ge;X++){for(Ee=0;Ee<ve+4;Ee++)e.readBits(1);e.readBits(1)}}var xe=0,Fe=1,qe=1,_t=!1,$e=1,et=1;if(e.readBool(),e.readBool(),e.readBool()){if(e.readBool()){var Ke=e.readByte();Ke>0&&Ke<16?(Fe=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][Ke-1],qe=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][Ke-1]):Ke===255&&(Fe=e.readBits(16),qe=e.readBits(16))}if(e.readBool()&&e.readBool(),e.readBool()&&(e.readBits(3),e.readBool(),e.readBool()&&(e.readByte(),e.readByte(),e.readByte())),e.readBool()&&(e.readUEG(),e.readUEG()),e.readBool(),e.readBool(),e.readBool(),e.readBool()&&(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG()),e.readBool()&&($e=e.readBits(32),et=e.readBits(32),e.readBool()&&(e.readUEG(),e.readBool()))){var tt=!1,it=!1,We=!1;for(tt=e.readBool(),it=e.readBool(),(tt||it)&&((We=e.readBool())&&(e.readByte(),e.readBits(5),e.readBool(),e.readBits(5)),e.readBits(4),e.readBits(4),We&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)),X=0;X<=n;X++){var ut=e.readBool();_t=ut;var lt=!1,rt=1;ut||(lt=e.readBool());var ct=!1;if(lt?e.readSEG():ct=e.readBool(),ct||(rt=e.readUEG()+1),tt)for(Ee=0;Ee<rt;Ee++)e.readUEG(),e.readUEG(),We&&(e.readUEG(),e.readUEG());if(it)for(Ee=0;Ee<rt;Ee++)e.readUEG(),e.readUEG(),We&&(e.readUEG(),e.readUEG())}}e.readBool()&&(e.readBool(),e.readBool(),e.readBool(),xe=e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG())}e.readBool();var kt="hvc1."+o+".1.L"+Z+".B0",ft=re,pt=pe,mt=1;return Fe!==1&&qe!==1&&(mt=Fe/qe),e.destroy(),e=null,{codec_mimetype:kt,level_string:r.getLevelString(Z),profile_idc:o,bit_depth:Se+8,ref_frames:1,chroma_format:H,chroma_format_string:r.getChromaFormatString(H),general_level_idc:Z,general_profile_space:s,general_tier_flag:a,general_profile_idc:o,general_profile_compatibility_flags_1:E,general_profile_compatibility_flags_2:y,general_profile_compatibility_flags_3:T,general_profile_compatibility_flags_4:k,general_constraint_indicator_flags_1:A,general_constraint_indicator_flags_2:w,general_constraint_indicator_flags_3:O,general_constraint_indicator_flags_4:q,general_constraint_indicator_flags_5:U,general_constraint_indicator_flags_6:Y,min_spatial_segmentation_idc:xe,constant_frame_rate:0,chroma_format_idc:H,bit_depth_luma_minus8:Se,bit_depth_chroma_minus8:_e,frame_rate:{fixed:_t,fps:et/$e,fps_den:$e,fps_num:et},sar_ratio:{width:Fe,height:qe},codec_size:{width:ft,height:pt},present_size:{width:ft*mt,height:pt}}},r.parsePPS=function(t){var i=r._ebsp2rbsp(t),e=new ue(i);e.readByte(),e.readByte(),e.readUEG(),e.readUEG(),e.readBool(),e.readBool(),e.readBits(3),e.readBool(),e.readBool(),e.readUEG(),e.readUEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool()&&e.readUEG(),e.readSEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool(),e.readBool();var n=e.readBool(),s=e.readBool(),a=1;return s&&n?a=0:s?a=3:n&&(a=2),{parallelismType:a}},r.getChromaFormatString=function(t){switch(t){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},r.getProfileString=function(t){switch(t){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}},r.getLevelString=function(t){return(t/30).toFixed(1)},r}();function m(r){return r.byteOffset%2==0&&r.byteLength%2==0}function N(r){return r.byteOffset%4==0&&r.byteLength%4==0}function b(r,t){for(var i=0;i<r.length;i++)if(r[i]!==t[i])return!1;return!0}var _=function(r,t){return r.byteLength===t.byteLength&&(N(r)&&N(t)?function(i,e){return b(new Uint32Array(i.buffer,i.byteOffset,i.byteLength/4),new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4))}(r,t):m(r)&&m(t)?function(i,e){return b(new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2))}(r,t):function(i,e){return b(i,e)}(r,t))},h,u=function(){function r(t,i){this.TAG="FLVDemuxer",this._config=i,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=t.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=t.hasAudioTrack,this._hasVideo=t.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new p.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=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},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256}()}return r.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},r.probe=function(t){var i=new Uint8Array(t);if(i.byteLength<9)return{needMoreData:!0};var e={match:!1};if(i[0]!==70||i[1]!==76||i[2]!==86||i[3]!==1)return e;var n,s,a=(4&i[4])>>>2!=0,o=(1&i[4])!=0,E=(n=i)[s=5]<<24|n[s+1]<<16|n[s+2]<<8|n[s+3];return E<9?e:{match:!0,consumed:E,dataOffset:E,hasAudioTrack:a,hasVideoTrack:o}},r.prototype.bindDataSource=function(t){return t.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(r.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(t){this._onTrackMetadata=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(t){this._onMediaInfo=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(t){this._onMetaDataArrived=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(t){this._onScriptDataArrived=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onError",{get:function(){return this._onError},set:function(t){this._onError=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(t){this._onDataAvailable=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(t){this._timestampBase=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"overridedDuration",{get:function(){return this._duration},set:function(t){this._durationOverrided=!0,this._duration=t,this._mediaInfo.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"overridedHasAudio",{set:function(t){this._hasAudioFlagOverrided=!0,this._hasAudio=t,this._mediaInfo.hasAudio=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"overridedHasVideo",{set:function(t){this._hasVideoFlagOverrided=!0,this._hasVideo=t,this._mediaInfo.hasVideo=t},enumerable:!1,configurable:!0}),r.prototype.resetMediaInfo=function(){this._mediaInfo=new p.a},r.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},r.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new C.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var e=0,n=this._littleEndian;if(i===0){if(!(t.byteLength>13))return 0;e=r.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+e!==this._dataOffset&&g.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),(s=new DataView(t,e)).getUint32(0,!n)!==0&&g.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),e+=4);e<t.byteLength;){this._dispatch=!0;var s=new DataView(t,e);if(e+11+4>t.byteLength)break;var a=s.getUint8(0),o=16777215&s.getUint32(0,!n);if(e+11+o+4>t.byteLength)break;if(a===8||a===9||a===18){var E=s.getUint8(4),y=s.getUint8(5),T=s.getUint8(6)|y<<8|E<<16|s.getUint8(7)<<24;(16777215&s.getUint32(7,!n))!==0&&g.a.w(this.TAG,"Meet tag which has StreamID != 0!");var k=e+11;switch(a){case 8:this._parseAudioData(t,k,o,T);break;case 9:this._parseVideoData(t,k,o,T,i+e);break;case 18:this._parseScriptData(t,k,o)}var A=s.getUint32(11+o,!n);A!==11+o&&g.a.w(this.TAG,"Invalid PrevTagSize "+A),e+=11+o+4}else g.a.w(this.TAG,"Unsupported tag type "+a+", skipped"),e+=11+o+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),e},r.prototype._parseScriptData=function(t,i,e){var n=z.parseScriptData(t,i,e);if(n.hasOwnProperty("onMetaData")){if(n.onMetaData==null||typeof n.onMetaData!="object")return void g.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&g.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=n;var s=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},s)),typeof s.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=s.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof s.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=s.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof s.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=s.audiodatarate),typeof s.videodatarate=="number"&&(this._mediaInfo.videoDataRate=s.videodatarate),typeof s.width=="number"&&(this._mediaInfo.width=s.width),typeof s.height=="number"&&(this._mediaInfo.height=s.height),typeof s.duration=="number"){if(!this._durationOverrided){var a=Math.floor(s.duration*this._timescale);this._duration=a,this._mediaInfo.duration=a}}else this._mediaInfo.duration=0;if(typeof s.framerate=="number"){var o=Math.floor(1e3*s.framerate);if(o>0){var E=o/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=E,this._referenceFrameRate.fps_num=o,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=E}}if(typeof s.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;var y=s.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(y),s.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=s,g.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(n).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},n))},r.prototype._parseKeyframesIndex=function(t){for(var i=[],e=[],n=1;n<t.times.length;n++){var s=this._timestampBase+Math.floor(1e3*t.times[n]);i.push(s),e.push(t.filepositions[n])}return{times:i,filepositions:e}},r.prototype._parseAudioData=function(t,i,e,n){if(e<=1)g.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(this._hasAudioFlagOverrided!==!0||this._hasAudio!==!1){this._littleEndian;var s=new DataView(t,i,e).getUint8(0),a=s>>>4;if(a===2||a===10){var o=0,E=(12&s)>>>2;if(E>=0&&E<=4){o=this._flvSoundRateTable[E];var y=1&s,T=this._audioMetadata,k=this._audioTrack;if(T||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(T=this._audioMetadata={}).type="audio",T.id=k.id,T.timescale=this._timescale,T.duration=this._duration,T.audioSampleRate=o,T.channelCount=y===0?1:2),a===10){var A=this._parseAACAudioData(t,i+1,e-1);if(A==null)return;if(A.packetType===0){if(T.config){if(_(A.data.config,T.config))return;g.a.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var w=A.data;T.audioSampleRate=w.samplingRate,T.channelCount=w.channelCount,T.codec=w.codec,T.originalCodec=w.originalCodec,T.config=w.config,T.refSampleDuration=1024/T.audioSampleRate*T.timescale,g.a.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",T),(U=this._mediaInfo).audioCodec=T.originalCodec,U.audioSampleRate=T.audioSampleRate,U.audioChannelCount=T.channelCount,U.hasVideo?U.videoCodec!=null&&(U.mimeType='video/x-flv; codecs="'+U.videoCodec+","+U.audioCodec+'"'):U.mimeType='video/x-flv; codecs="'+U.audioCodec+'"',U.isComplete()&&this._onMediaInfo(U)}else if(A.packetType===1){var O=this._timestampBase+n,q={unit:A.data,length:A.data.byteLength,dts:O,pts:O};k.samples.push(q),k.length+=A.data.length}else g.a.e(this.TAG,"Flv: Unsupported AAC data type "+A.packetType)}else if(a===2){if(!T.codec){var U;if((w=this._parseMP3AudioData(t,i+1,e-1,!0))==null)return;T.audioSampleRate=w.samplingRate,T.channelCount=w.channelCount,T.codec=w.codec,T.originalCodec=w.originalCodec,T.refSampleDuration=1152/T.audioSampleRate*T.timescale,g.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",T),(U=this._mediaInfo).audioCodec=T.codec,U.audioSampleRate=T.audioSampleRate,U.audioChannelCount=T.channelCount,U.audioDataRate=w.bitRate,U.hasVideo?U.videoCodec!=null&&(U.mimeType='video/x-flv; codecs="'+U.videoCodec+","+U.audioCodec+'"'):U.mimeType='video/x-flv; codecs="'+U.audioCodec+'"',U.isComplete()&&this._onMediaInfo(U)}var Y=this._parseMP3AudioData(t,i+1,e-1,!1);if(Y==null)return;O=this._timestampBase+n;var Z={unit:Y,length:Y.byteLength,dts:O,pts:O};k.samples.push(Z),k.length+=Y.length}}else this._onError($.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+E)}else this._onError($.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+a)}},r.prototype._parseAACAudioData=function(t,i,e){if(!(e<=1)){var n={},s=new Uint8Array(t,i,e);return n.packetType=s[0],s[0]===0?n.data=this._parseAACAudioSpecificConfig(t,i+1,e-1):n.data=s.subarray(1),n}g.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},r.prototype._parseAACAudioSpecificConfig=function(t,i,e){var n,s,a=new Uint8Array(t,i,e),o=null,E=0,y=null;if(E=n=a[0]>>>3,(s=(7&a[0])<<1|a[1]>>>7)<0||s>=this._mpegSamplingRates.length)this._onError($.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var T=this._mpegSamplingRates[s],k=(120&a[1])>>>3;if(!(k<0||k>=8)){E===5&&(y=(7&a[1])<<1|a[2]>>>7,(124&a[2])>>>2);var A=self.navigator.userAgent.toLowerCase();return A.indexOf("firefox")!==-1?s>=6?(E=5,o=new Array(4),y=s-3):(E=2,o=new Array(2),y=s):A.indexOf("android")!==-1?(E=2,o=new Array(2),y=s):(E=5,y=s,o=new Array(4),s>=6?y=s-3:k===1&&(E=2,o=new Array(2),y=s)),o[0]=E<<3,o[0]|=(15&s)>>>1,o[1]=(15&s)<<7,o[1]|=(15&k)<<3,E===5&&(o[1]|=(15&y)>>>1,o[2]=(1&y)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:T,channelCount:k,codec:"mp4a.40."+E,originalCodec:"mp4a.40."+n}}this._onError($.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},r.prototype._parseMP3AudioData=function(t,i,e,n){if(!(e<4)){this._littleEndian;var s=new Uint8Array(t,i,e),a=null;if(n){if(s[0]!==255)return;var o=s[1]>>>3&3,E=(6&s[1])>>1,y=(240&s[2])>>>4,T=(12&s[2])>>>2,k=(s[3]>>>6&3)!==3?2:1,A=0,w=0;switch(o){case 0:A=this._mpegAudioV25SampleRateTable[T];break;case 2:A=this._mpegAudioV20SampleRateTable[T];break;case 3:A=this._mpegAudioV10SampleRateTable[T]}switch(E){case 1:y<this._mpegAudioL3BitRateTable.length&&(w=this._mpegAudioL3BitRateTable[y]);break;case 2:y<this._mpegAudioL2BitRateTable.length&&(w=this._mpegAudioL2BitRateTable[y]);break;case 3:y<this._mpegAudioL1BitRateTable.length&&(w=this._mpegAudioL1BitRateTable[y])}a={bitRate:w,samplingRate:A,channelCount:k,codec:"mp3",originalCodec:"mp3"}}else a=s;return a}g.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},r.prototype._parseVideoData=function(t,i,e,n,s){if(e<=1)g.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(this._hasVideoFlagOverrided!==!0||this._hasVideo!==!1){var a=new Uint8Array(t,i,e)[0],o=(240&a)>>>4,E=15&a;if(E===7)this._parseAVCVideoPacket(t,i+1,e-1,n,s,o);else{if(E!==12)return void this._onError($.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+E);this._parseHEVCVideoPacket(t,i+1,e-1,n,s,o)}}},r.prototype._parseAVCVideoPacket=function(t,i,e,n,s,a){if(e<4)g.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,E=new DataView(t,i,e),y=E.getUint8(0),T=(16777215&E.getUint32(0,!o))<<8>>8;if(y===0)this._parseAVCDecoderConfigurationRecord(t,i+4,e-4);else if(y===1)this._parseAVCVideoData(t,i+4,e-4,n,s,a,T);else if(y!==2)return void this._onError($.a.FORMAT_ERROR,"Flv: Invalid video packet type "+y)}},r.prototype._parseHEVCVideoPacket=function(t,i,e,n,s,a){if(e<4)g.a.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var o=this._littleEndian,E=new DataView(t,i,e),y=E.getUint8(0),T=(16777215&E.getUint32(0,!o))<<8>>8;if(y===0)this._parseHEVCDecoderConfigurationRecord(t,i+4,e-4);else if(y===1)this._parseHEVCVideoData(t,i+4,e-4,n,s,a,T);else if(y!==2)return void this._onError($.a.FORMAT_ERROR,"Flv: Invalid video packet type "+y)}},r.prototype._parseAVCDecoderConfigurationRecord=function(t,i,e){if(e<7)g.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,s=this._videoTrack,a=this._littleEndian,o=new DataView(t,i,e);if(n){if(n.avcc!==void 0){var E=new Uint8Array(t,i,e);if(_(E,n.avcc))return;g.a.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=s.id,n.timescale=this._timescale,n.duration=this._duration;var y=o.getUint8(0),T=o.getUint8(1);if(o.getUint8(2),o.getUint8(3),y===1&&T!==0)if(this._naluLengthSize=1+(3&o.getUint8(4)),this._naluLengthSize===3||this._naluLengthSize===4){var k=31&o.getUint8(5);if(k!==0){k>1&&g.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+k);for(var A=6,w=0;w<k;w++){var O=o.getUint16(A,!a);if(A+=2,O!==0){var q=new Uint8Array(t,i+A,O);A+=O;var U=se.parseSPS(q);if(w===0){n.codecWidth=U.codec_size.width,n.codecHeight=U.codec_size.height,n.presentWidth=U.present_size.width,n.presentHeight=U.present_size.height,n.profile=U.profile_string,n.level=U.level_string,n.bitDepth=U.bit_depth,n.chromaFormat=U.chroma_format,n.sarRatio=U.sar_ratio,n.frameRate=U.frame_rate,U.frame_rate.fixed!==!1&&U.frame_rate.fps_num!==0&&U.frame_rate.fps_den!==0||(n.frameRate=this._referenceFrameRate);var Y=n.frameRate.fps_den,Z=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(Y/Z);for(var K=q.subarray(1,4),de="avc1.",X=0;X<3;X++){var H=K[X].toString(16);H.length<2&&(H="0"+H),de+=H}n.codec=de;var re=this._mediaInfo;re.width=n.codecWidth,re.height=n.codecHeight,re.fps=n.frameRate.fps,re.profile=n.profile,re.level=n.level,re.refFrames=U.ref_frames,re.chromaFormat=U.chroma_format_string,re.sarNum=n.sarRatio.width,re.sarDen=n.sarRatio.height,re.videoCodec=de,re.hasAudio?re.audioCodec!=null&&(re.mimeType='video/x-flv; codecs="'+re.videoCodec+","+re.audioCodec+'"'):re.mimeType='video/x-flv; codecs="'+re.videoCodec+'"',re.isComplete()&&this._onMediaInfo(re)}}}var pe=o.getUint8(A);if(pe!==0){for(pe>1&&g.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+pe),A++,w=0;w<pe;w++)O=o.getUint16(A,!a),A+=2,O!==0&&(A+=O);n.avcc=new Uint8Array(e),n.avcc.set(new Uint8Array(t,i,e),0),g.a.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",n)}else this._onError($.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError($.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError($.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError($.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},r.prototype._parseHEVCDecoderConfigurationRecord=function(t,i,e){if(e<22)g.a.w(this.TAG,"Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,s=this._videoTrack,a=this._littleEndian,o=new DataView(t,i,e);if(n){if(n.hvcc!==void 0){var E=new Uint8Array(t,i,e);if(_(E,n.hvcc))return;g.a.w(this.TAG,"HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=s.id,n.timescale=this._timescale,n.duration=this._duration;var y=o.getUint8(0),T=31&o.getUint8(1);if(y===1&&T!==0)if(this._naluLengthSize=1+(3&o.getUint8(21)),this._naluLengthSize===3||this._naluLengthSize===4){for(var k=o.getUint8(22),A=0,w=23;A<k;A++){var O=63&o.getUint8(w+0),q=o.getUint16(w+1,!a);w+=3;for(var U=0;U<q;U++){var Y=o.getUint16(w+0,!a);if(U===0)if(O===33){w+=2;var Z=new Uint8Array(t,i+w,Y),K=ne.parseSPS(Z);n.codecWidth=K.codec_size.width,n.codecHeight=K.codec_size.height,n.presentWidth=K.present_size.width,n.presentHeight=K.present_size.height,n.profile=K.profile_string,n.level=K.level_string,n.bitDepth=K.bit_depth,n.chromaFormat=K.chroma_format,n.sarRatio=K.sar_ratio,n.frameRate=K.frame_rate,K.frame_rate.fixed!==!1&&K.frame_rate.fps_num!==0&&K.frame_rate.fps_den!==0||(n.frameRate=this._referenceFrameRate);var de=n.frameRate.fps_den,X=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(de/X),n.codec=K.codec_mimetype;var H=this._mediaInfo;H.width=n.codecWidth,H.height=n.codecHeight,H.fps=n.frameRate.fps,H.profile=n.profile,H.level=n.level,H.refFrames=K.ref_frames,H.chromaFormat=K.chroma_format_string,H.sarNum=n.sarRatio.width,H.sarDen=n.sarRatio.height,H.videoCodec=K.codec_mimetype,H.hasAudio?H.audioCodec!=null&&(H.mimeType='video/x-flv; codecs="'+H.videoCodec+","+H.audioCodec+'"'):H.mimeType='video/x-flv; codecs="'+H.videoCodec+'"',H.isComplete()&&this._onMediaInfo(H),w+=Y}else w+=2+Y;else w+=2+Y}}n.hvcc=new Uint8Array(e),n.hvcc.set(new Uint8Array(t,i,e),0),g.a.v(this.TAG,"Parsed HEVCDecoderConfigurationRecord"),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",n)}else this._onError($.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError($.a.FORMAT_ERROR,"Flv: Invalid HEVCDecoderConfigurationRecord")}},r.prototype._parseAVCVideoData=function(t,i,e,n,s,a,o){for(var E=this._littleEndian,y=new DataView(t,i,e),T=[],k=0,A=0,w=this._naluLengthSize,O=this._timestampBase+n,q=a===1;A<e;){if(A+4>=e){g.a.w(this.TAG,"Malformed Nalu near timestamp "+O+", offset = "+A+", dataSize = "+e);break}var U=y.getUint32(A,!E);if(w===3&&(U>>>=8),U>e-w)return void g.a.w(this.TAG,"Malformed Nalus near timestamp "+O+", NaluSize > DataSize!");var Y=31&y.getUint8(A+w);Y===5&&(q=!0);var Z=new Uint8Array(t,i+A,w+U),K={type:Y,data:Z};T.push(K),k+=Z.byteLength,A+=w+U}if(T.length){var de=this._videoTrack,X={units:T,length:k,isKeyframe:q,dts:O,cts:o,pts:O+o};q&&(X.fileposition=s),de.samples.push(X),de.length+=k}},r.prototype._parseHEVCVideoData=function(t,i,e,n,s,a,o){for(var E=this._littleEndian,y=new DataView(t,i,e),T=[],k=0,A=0,w=this._naluLengthSize,O=this._timestampBase+n,q=a===1;A<e;){if(A+4>=e){g.a.w(this.TAG,"Malformed Nalu near timestamp "+O+", offset = "+A+", dataSize = "+e);break}var U=y.getUint32(A,!E);if(w===3&&(U>>>=8),U>e-w)return void g.a.w(this.TAG,"Malformed Nalus near timestamp "+O+", NaluSize > DataSize!");var Y=31&y.getUint8(A+w);Y!==19&&Y!==20||(q=!0);var Z=new Uint8Array(t,i+A,w+U),K={type:Y,data:Z};T.push(K),k+=Z.byteLength,A+=w+U}if(T.length){var de=this._videoTrack,X={units:T,length:k,isKeyframe:q,dts:O,cts:o,pts:O+o};q&&(X.fileposition=s),de.samples.push(X),de.length+=k}},r}(),c=function(){function r(){}return r.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},r}(),P=function(){this.program_pmt_pid={}};(function(r){r[r.kMPEG1Audio=3]="kMPEG1Audio",r[r.kMPEG2Audio=4]="kMPEG2Audio",r[r.kPESPrivateData=6]="kPESPrivateData",r[r.kADTSAAC=15]="kADTSAAC",r[r.kID3=21]="kID3",r[r.kSCTE35=134]="kSCTE35",r[r.kH264=27]="kH264",r[r.kH265=36]="kH265"})(h||(h={}));var D,V=function(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,adts_aac:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.scte_35_pids={},this.smpte2038_pids={}},te=function(){},fe=function(){},me=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};(function(r){r[r.kUnspecified=0]="kUnspecified",r[r.kSliceNonIDR=1]="kSliceNonIDR",r[r.kSliceDPA=2]="kSliceDPA",r[r.kSliceDPB=3]="kSliceDPB",r[r.kSliceDPC=4]="kSliceDPC",r[r.kSliceIDR=5]="kSliceIDR",r[r.kSliceSEI=6]="kSliceSEI",r[r.kSliceSPS=7]="kSliceSPS",r[r.kSlicePPS=8]="kSlicePPS",r[r.kSliceAUD=9]="kSliceAUD",r[r.kEndOfSequence=10]="kEndOfSequence",r[r.kEndOfStream=11]="kEndOfStream",r[r.kFiller=12]="kFiller",r[r.kSPSExt=13]="kSPSExt",r[r.kReserved0=14]="kReserved0"})(D||(D={}));var L,d,l=function(){},S=function(r){var t=r.data.byteLength;this.type=r.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(r.data,4)},W=function(){function r(t){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=t,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&g.a.e(this.TAG,"Could not find H264 startcode until payload end!")}return r.prototype.findNextStartCodeOffset=function(t){for(var i=t,e=this.data_;;){if(i+3>=e.byteLength)return this.eof_flag_=!0,e.byteLength;var n=e[i+0]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],s=e[i+0]<<16|e[i+1]<<8|e[i+2];if(n===1||s===1)return i;i++}},r.prototype.readNextNaluPayload=function(){for(var t=this.data_,i=null;i==null&&!this.eof_flag_;){var e=this.current_startcode_offset_,n=31&t[e+=(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])===1?4:3],s=(128&t[e])>>>7,a=this.findNextStartCodeOffset(e);if(this.current_startcode_offset_=a,!(n>=D.kReserved0)&&s===0){var o=t.subarray(e,a);(i=new l).type=n,i.data=o}}return i},r}(),ae=function(){function r(t,i,e){var n=8+t.byteLength+1+2+i.byteLength,s=!1;t[3]!==66&&t[3]!==77&&t[3]!==88&&(s=!0,n+=4);var a=this.data=new Uint8Array(n);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;var o=t.byteLength;a[6]=o>>>8,a[7]=255&o;var E=8;a.set(t,8),a[E+=o]=1;var y=i.byteLength;a[E+1]=y>>>8,a[E+2]=255&y,a.set(i,E+3),E+=3+y,s&&(a[E]=252|e.chroma_format_idc,a[E+1]=248|e.bit_depth_luma-8,a[E+2]=248|e.bit_depth_chroma-8,a[E+3]=0,E+=4)}return r.prototype.getData=function(){return this.data},r}();(function(r){r[r.kNull=0]="kNull",r[r.kAACMain=1]="kAACMain",r[r.kAAC_LC=2]="kAAC_LC",r[r.kAAC_SSR=3]="kAAC_SSR",r[r.kAAC_LTP=4]="kAAC_LTP",r[r.kAAC_SBR=5]="kAAC_SBR",r[r.kAAC_Scalable=6]="kAAC_Scalable",r[r.kLayer1=32]="kLayer1",r[r.kLayer2=33]="kLayer2",r[r.kLayer3=34]="kLayer3"})(L||(L={})),function(r){r[r.k96000Hz=0]="k96000Hz",r[r.k88200Hz=1]="k88200Hz",r[r.k64000Hz=2]="k64000Hz",r[r.k48000Hz=3]="k48000Hz",r[r.k44100Hz=4]="k44100Hz",r[r.k32000Hz=5]="k32000Hz",r[r.k24000Hz=6]="k24000Hz",r[r.k22050Hz=7]="k22050Hz",r[r.k16000Hz=8]="k16000Hz",r[r.k12000Hz=9]="k12000Hz",r[r.k11025Hz=10]="k11025Hz",r[r.k8000Hz=11]="k8000Hz",r[r.k7350Hz=12]="k7350Hz"}(d||(d={}));var he,Re=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Be=function(){},Ae=function(){function r(t){this.TAG="AACADTSParser",this.data_=t,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&g.a.e(this.TAG,"Could not found ADTS syncword until payload end")}return r.prototype.findNextSyncwordOffset=function(t){for(var i=t,e=this.data_;;){if(i+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[i+0]<<8|e[i+1])>>>4===4095)return i;i++}},r.prototype.readNextAACFrame=function(){for(var t=this.data_,i=null;i==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,n=(8&t[e+1])>>>3,s=(6&t[e+1])>>>1,a=1&t[e+1],o=(192&t[e+2])>>>6,E=(60&t[e+2])>>>2,y=(1&t[e+2])<<2|(192&t[e+3])>>>6,T=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5;if(t[e+6],e+T>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var k=a===1?7:9,A=T-k;e+=k;var w=this.findNextSyncwordOffset(e+A);if(this.current_syncword_offset_=w,(n===0||n===1)&&s===0){var O=t.subarray(e,e+A);(i=new Be).audio_object_type=o+1,i.sampling_freq_index=E,i.sampling_frequency=Re[E],i.channel_config=y,i.data=O}}return i},r.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},r.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},r}(),M=function(r){var t=null,i=r.audio_object_type,e=r.audio_object_type,n=r.sampling_freq_index,s=r.channel_config,a=0,o=navigator.userAgent.toLowerCase();o.indexOf("firefox")!==-1?n>=6?(e=5,t=new Array(4),a=n-3):(e=2,t=new Array(2),a=n):o.indexOf("android")!==-1?(e=2,t=new Array(2),a=n):(e=5,a=n,t=new Array(4),n>=6?a=n-3:s===1&&(e=2,t=new Array(2),a=n)),t[0]=e<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,e===5&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Re[n],this.channel_count=s,this.codec_mimetype="mp4a.40."+e,this.original_codec_mimetype="mp4a.40."+i},F=function(){},ee=function(){};(function(r){r[r.kSpliceNull=0]="kSpliceNull",r[r.kSpliceSchedule=4]="kSpliceSchedule",r[r.kSpliceInsert=5]="kSpliceInsert",r[r.kTimeSignal=6]="kTimeSignal",r[r.kBandwidthReservation=7]="kBandwidthReservation",r[r.kPrivateCommand=255]="kPrivateCommand"})(he||(he={}));var J,ie=function(r){var t=r.readBool();return t?(r.readBits(6),{time_specified_flag:t,pts_time:4*r.readBits(31)+r.readBits(2)}):(r.readBits(7),{time_specified_flag:t})},ce=function(r){var t=r.readBool();return r.readBits(6),{auto_return:t,duration:4*r.readBits(31)+r.readBits(2)}},Te=function(r,t){var i=t.readBits(8);return r?{component_tag:i}:{component_tag:i,splice_time:ie(t)}},ke=function(r){return{component_tag:r.readBits(8),utc_splice_time:r.readBits(32)}},Oe=function(r){var t=r.readBits(32),i=r.readBool();r.readBits(7);var e={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return e;if(e.out_of_network_indicator=r.readBool(),e.program_splice_flag=r.readBool(),e.duration_flag=r.readBool(),r.readBits(5),e.program_splice_flag)e.utc_splice_time=r.readBits(32);else{e.component_count=r.readBits(8),e.components=[];for(var n=0;n<e.component_count;n++)e.components.push(ke(r))}return e.duration_flag&&(e.break_duration=ce(r)),e.unique_program_id=r.readBits(16),e.avail_num=r.readBits(8),e.avails_expected=r.readBits(8),e},Ie=function(r,t,i,e){return{descriptor_tag:r,descriptor_length:t,identifier:i,provider_avail_id:e.readBits(32)}},Xe=function(r,t,i,e){var n=e.readBits(8),s=e.readBits(3);e.readBits(5);for(var a="",o=0;o<s;o++)a+=String.fromCharCode(e.readBits(8));return{descriptor_tag:r,descriptor_length:t,identifier:i,preroll:n,dtmf_count:s,DTMF_char:a}},Ye=function(r){var t=r.readBits(8);return r.readBits(7),{component_tag:t,pts_offset:4*r.readBits(31)+r.readBits(2)}},Ze=function(r,t,i,e){var n=e.readBits(32),s=e.readBool();e.readBits(7);var a={descriptor_tag:r,descriptor_length:t,identifier:i,segmentation_event_id:n,segmentation_event_cancel_indicator:s};if(s)return a;if(a.program_segmentation_flag=e.readBool(),a.segmentation_duration_flag=e.readBool(),a.delivery_not_restricted_flag=e.readBool(),a.delivery_not_restricted_flag?e.readBits(5):(a.web_delivery_allowed_flag=e.readBool(),a.no_regional_blackout_flag=e.readBool(),a.archive_allowed_flag=e.readBool(),a.device_restrictions=e.readBits(2)),!a.program_segmentation_flag){a.component_count=e.readBits(8),a.components=[];for(var o=0;o<a.component_count;o++)a.components.push(Ye(e))}a.segmentation_duration_flag&&(a.segmentation_duration=e.readBits(40)),a.segmentation_upid_type=e.readBits(8),a.segmentation_upid_length=e.readBits(8);var E=new Uint8Array(a.segmentation_upid_length);for(o=0;o<a.segmentation_upid_length;o++)E[o]=e.readBits(8);return a.segmentation_upid=E.buffer,a.segmentation_type_id=e.readBits(8),a.segment_num=e.readBits(8),a.segments_expected=e.readBits(8),a.segmentation_type_id!==52&&a.segmentation_type_id!==54&&a.segmentation_type_id!==56&&a.segmentation_type_id!==58||(a.sub_segment_num=e.readBits(8),a.sub_segments_expected=e.readBits(8)),a},Je=function(r,t,i,e){return{descriptor_tag:r,descriptor_length:t,identifier:i,TAI_seconds:e.readBits(48),TAI_ns:e.readBits(32),UTC_offset:e.readBits(16)}},gt=function(r){return{component_tag:r.readBits(8),ISO_code:String.fromCharCode(r.readBits(8),r.readBits(8),r.readBits(8)),Bit_Stream_Mode:r.readBits(3),Num_Channels:r.readBits(4),Full_Srvc_Audio:r.readBool()}},vt=function(r,t,i,e){for(var n=e.readBits(4),s=[],a=0;a<n;a++)s.push(gt(e));return{descriptor_tag:r,descriptor_length:t,identifier:i,audio_count:n,components:s}},yt=function(r){var t=new ue(r),i=t.readBits(8),e=t.readBool(),n=t.readBool();t.readBits(2);var s=t.readBits(12),a=t.readBits(8),o=t.readBool(),E=t.readBits(6),y=4*t.readBits(31)+t.readBits(2),T=t.readBits(8),k=t.readBits(12),A=t.readBits(12),w=t.readBits(8),O=null;w===he.kSpliceNull?O={}:w===he.kSpliceSchedule?O=function(_e){for(var ve=_e.readBits(8),ye=[],oe=0;oe<ve;oe++)ye.push(Oe(_e));return{splice_count:ve,events:ye}}(t):w===he.kSpliceInsert?O=function(_e){var ve=_e.readBits(32),ye=_e.readBool();_e.readBits(7);var oe={splice_event_id:ve,splice_event_cancel_indicator:ye};if(ye)return oe;if(oe.out_of_network_indicator=_e.readBool(),oe.program_splice_flag=_e.readBool(),oe.duration_flag=_e.readBool(),oe.splice_immediate_flag=_e.readBool(),_e.readBits(4),oe.program_splice_flag&&!oe.splice_immediate_flag&&(oe.splice_time=ie(_e)),!oe.program_splice_flag){oe.component_count=_e.readBits(8),oe.components=[];for(var ge=0;ge<oe.component_count;ge++)oe.components.push(Te(oe.splice_immediate_flag,_e))}return oe.duration_flag&&(oe.break_duration=ce(_e)),oe.unique_program_id=_e.readBits(16),oe.avail_num=_e.readBits(8),oe.avails_expected=_e.readBits(8),oe}(t):w===he.kTimeSignal?O=function(_e){return{splice_time:ie(_e)}}(t):w===he.kBandwidthReservation?O={}:w===he.kPrivateCommand?O=function(_e,ve){for(var ye=String.fromCharCode(ve.readBits(8),ve.readBits(8),ve.readBits(8),ve.readBits(8)),oe=new Uint8Array(_e-4),ge=0;ge<_e-4;ge++)oe[ge]=ve.readBits(8);return{identifier:ye,private_data:oe.buffer}}(A,t):t.readBits(8*A);for(var q=[],U=t.readBits(16),Y=0;Y<U;){var Z=t.readBits(8),K=t.readBits(8),de=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8));Z===0?q.push(Ie(Z,K,de,t)):Z===1?q.push(Xe(Z,K,de,t)):Z===2?q.push(Ze(Z,K,de,t)):Z===3?q.push(Je(Z,K,de,t)):Z===4?q.push(vt(Z,K,de,t)):t.readBits(8*(K-4)),Y+=2+K}var X={table_id:i,section_syntax_indicator:e,private_indicator:n,section_length:s,protocol_version:a,encrypted_packet:o,encryption_algorithm:E,pts_adjustment:y,cw_index:T,tier:k,splice_command_length:A,splice_command_type:w,splice_command:O,descriptor_loop_length:U,splice_descriptors:q,E_CRC32:o?t.readBits(32):void 0,CRC32:t.readBits(32)};if(w===he.kSpliceInsert){var H=O;if(H.splice_event_cancel_indicator)return{splice_command_type:w,detail:X,data:r};if(H.program_splice_flag&&!H.splice_immediate_flag){var re=H.duration_flag?H.break_duration.auto_return:void 0,pe=H.duration_flag?H.break_duration.duration/90:void 0;return H.splice_time.time_specified_flag?{splice_command_type:w,pts:(y+H.splice_time.pts_time)%Math.pow(2,33),auto_return:re,duraiton:pe,detail:X,data:r}:{splice_command_type:w,auto_return:re,duraiton:pe,detail:X,data:r}}return{splice_command_type:w,auto_return:re=H.duration_flag?H.break_duration.auto_return:void 0,duraiton:pe=H.duration_flag?H.break_duration.duration/90:void 0,detail:X,data:r}}if(w===he.kTimeSignal){var Se=O;return Se.splice_time.time_specified_flag?{splice_command_type:w,pts:(y+Se.splice_time.pts_time)%Math.pow(2,33),detail:X,data:r}:{splice_command_type:w,detail:X,data:r}}return{splice_command_type:w,detail:X,data:r}};(function(r){r[r.kSliceIDR_W_RADL=19]="kSliceIDR_W_RADL",r[r.kSliceIDR_N_LP=20]="kSliceIDR_N_LP",r[r.kSliceCRA_NUT=21]="kSliceCRA_NUT",r[r.kSliceVPS=32]="kSliceVPS",r[r.kSliceSPS=33]="kSliceSPS",r[r.kSlicePPS=34]="kSlicePPS",r[r.kSliceAUD=35]="kSliceAUD"})(J||(J={}));var Qe,Et=function(){},St=function(r){var t=r.data.byteLength;this.type=r.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(r.data,4)},bt=function(){function r(t){this.TAG="H265AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=t,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&g.a.e(this.TAG,"Could not find H265 startcode until payload end!")}return r.prototype.findNextStartCodeOffset=function(t){for(var i=t,e=this.data_;;){if(i+3>=e.byteLength)return this.eof_flag_=!0,e.byteLength;var n=e[i+0]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],s=e[i+0]<<16|e[i+1]<<8|e[i+2];if(n===1||s===1)return i;i++}},r.prototype.readNextNaluPayload=function(){for(var t=this.data_,i=null;i==null&&!this.eof_flag_;){var e=this.current_startcode_offset_,n=t[e+=(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])===1?4:3]>>1&63,s=(128&t[e])>>>7,a=this.findNextStartCodeOffset(e);if(this.current_startcode_offset_=a,s===0){var o=t.subarray(e,a);(i=new Et).type=n,i.data=o}}return i},r}(),At=function(){function r(t,i,e,n){var s=23+(5+t.byteLength)+(5+i.byteLength)+(5+e.byteLength),a=this.data=new Uint8Array(s);a[0]=1,a[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,a[2]=n.general_profile_compatibility_flags_1,a[3]=n.general_profile_compatibility_flags_2,a[4]=n.general_profile_compatibility_flags_3,a[5]=n.general_profile_compatibility_flags_4,a[6]=n.general_constraint_indicator_flags_1,a[7]=n.general_constraint_indicator_flags_2,a[8]=n.general_constraint_indicator_flags_3,a[9]=n.general_constraint_indicator_flags_4,a[10]=n.general_constraint_indicator_flags_5,a[11]=n.general_constraint_indicator_flags_6,a[12]=60,a[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,a[14]=255&n.min_spatial_segmentation_idc,a[15]=252|3&n.parallelismType,a[16]=252|3&n.chroma_format_idc,a[17]=248|7&n.bit_depth_luma_minus8,a[18]=248|7&n.bit_depth_chroma_minus8,a[19]=0,a[20]=0,a[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,a[22]=3,a[23]=128|J.kSliceVPS,a[24]=0,a[25]=1,a[26]=(65280&t.byteLength)>>8,a[27]=(255&t.byteLength)>>0,a.set(t,28),a[23+(5+t.byteLength)+0]=128|J.kSliceSPS,a[23+(5+t.byteLength)+1]=0,a[23+(5+t.byteLength)+2]=1,a[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,a[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,a.set(i,23+(5+t.byteLength)+5),a[23+(5+t.byteLength+5+i.byteLength)+0]=128|J.kSlicePPS,a[23+(5+t.byteLength+5+i.byteLength)+1]=0,a[23+(5+t.byteLength+5+i.byteLength)+2]=1,a[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&e.byteLength)>>8,a[23+(5+t.byteLength+5+i.byteLength)+4]=(255&e.byteLength)>>0,a.set(e,23+(5+t.byteLength+5+i.byteLength)+5)}return r.prototype.getData=function(){return this.data},r}(),Rt=function(){},Tt=function(){},Lt=(Qe=function(r,t){return(Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,e){i.__proto__=e}||function(i,e){for(var n in e)e.hasOwnProperty(n)&&(i[n]=e[n])})(r,t)},function(r,t){function i(){this.constructor=r}Qe(r,t),r.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}),Ve=function(){return(Ve=Object.assign||function(r){for(var t,i=1,e=arguments.length;i<e;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}).apply(this,arguments)},st=function(r){function t(i,e){var n=r.call(this)||this;return n.TAG="TSDemuxer",n.first_parse_=!0,n.media_info_=new p.a,n.timescale_=90,n.duration_=0,n.current_pmt_pid_=-1,n.program_pmt_map_={},n.pes_slice_queues_={},n.section_slice_queues_={},n.video_metadata_={vps:void 0,sps:void 0,pps:void 0,details:void 0},n.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},n.aac_last_sample_pts_=void 0,n.aac_last_incomplete_data_=null,n.has_video_=!1,n.has_audio_=!1,n.video_init_segment_dispatched_=!1,n.audio_init_segment_dispatched_=!1,n.video_metadata_changed_=!1,n.audio_metadata_changed_=!1,n.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},n.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},n.ts_packet_size_=i.ts_packet_size,n.sync_offset_=i.sync_offset,n.config_=e,n}return Lt(t,r),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,r.prototype.destroy.call(this)},t.probe=function(i){var e=new Uint8Array(i),n=-1,s=188;if(e.byteLength<=3*s)return{needMoreData:!0};for(;n===-1;){for(var a=Math.min(1e3,e.byteLength-3*s),o=0;o<a;){if(e[o]===71&&e[o+s]===71&&e[o+2*s]===71){n=o;break}o++}if(n===-1)if(s===188)s=192;else{if(s!==192)break;s=204}}return n===-1?{match:!1}:(s===192&&n>=4?(g.a.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),n-=4):s===204&&g.a.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:s,sync_offset:n})},t.prototype.bindDataSource=function(i){return i.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new p.a},t.prototype.parseChunks=function(i,e){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new C.a("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0;for(this.first_parse_&&(this.first_parse_=!1,n=this.sync_offset_);n+this.ts_packet_size_<=i.byteLength;){var s=e+n;this.ts_packet_size_===192&&(n+=4);var a=new Uint8Array(i,n,188),o=a[0];if(o!==71){g.a.e(this.TAG,"sync_byte = "+o+", not 0x47");break}var E=(64&a[1])>>>6,y=(a[1],(31&a[1])<<8|a[2]),T=(48&a[3])>>>4,k=15&a[3],A={},w=4;if(T==2||T==3){var O=a[4];if(5+O===188){n+=188,this.ts_packet_size_===204&&(n+=16);continue}O>0&&(A=this.parseAdaptationField(i,n+4,1+O)),w=5+O}if(T==1||T==3){if(y===0||y===this.current_pmt_pid_||this.pmt_!=null&&this.pmt_.pid_stream_type[y]===h.kSCTE35){var q=188-w;this.handleSectionSlice(i,n+w,q,{pid:y,file_position:s,payload_unit_start_indicator:E,continuity_conunter:k,random_access_indicator:A.random_access_indicator})}else if(this.pmt_!=null&&this.pmt_.pid_stream_type[y]!=null){q=188-w;var U=this.pmt_.pid_stream_type[y];y!==this.pmt_.common_pids.h264&&y!==this.pmt_.common_pids.h265&&y!==this.pmt_.common_pids.adts_aac&&y!==this.pmt_.common_pids.mp3&&this.pmt_.pes_private_data_pids[y]!==!0&&this.pmt_.timed_id3_pids[y]!==!0||this.handlePESSlice(i,n+w,q,{pid:y,stream_type:U,file_position:s,payload_unit_start_indicator:E,continuity_conunter:k,random_access_indicator:A.random_access_indicator})}}n+=188,this.ts_packet_size_===204&&(n+=16)}return this.dispatchAudioVideoMediaSegment(),n},t.prototype.parseAdaptationField=function(i,e,n){var s=new Uint8Array(i,e,n),a=s[0];return a>0?a>183?(g.a.w(this.TAG,"Illegal adaptation_field_length: "+a),{}):{discontinuity_indicator:(128&s[1])>>>7,random_access_indicator:(64&s[1])>>>6,elementary_stream_priority_indicator:(32&s[1])>>>5}:{}},t.prototype.handleSectionSlice=function(i,e,n,s){var a=new Uint8Array(i,e,n),o=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){var E=a[0];if(o!=null&&o.total_length!==0){var y=new Uint8Array(i,e+1,Math.min(n,E));o.slices.push(y),o.total_length+=y.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):this.clearSlices(o,s)}for(var T=1+E;T<a.byteLength&&a[T+0]!==255;){var k=(15&a[T+1])<<8|a[T+2];this.section_slice_queues_[s.pid]=new me,(o=this.section_slice_queues_[s.pid]).expected_length=k+3,o.file_position=s.file_position,o.random_access_indicator=s.random_access_indicator,y=new Uint8Array(i,e+T,Math.min(n-T,o.expected_length-o.total_length)),o.slices.push(y),o.total_length+=y.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):o.total_length>=o.expected_length&&this.clearSlices(o,s),T+=y.byteLength}}else o!=null&&o.total_length!==0&&(y=new Uint8Array(i,e,Math.min(n,o.expected_length-o.total_length)),o.slices.push(y),o.total_length+=y.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):o.total_length>=o.expected_length&&this.clearSlices(o,s))},t.prototype.handlePESSlice=function(i,e,n,s){var a=new Uint8Array(i,e,n),o=a[0]<<16|a[1]<<8|a[2],E=(a[3],a[4]<<8|a[5]);if(s.payload_unit_start_indicator){if(o!==1)return void g.a.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value "+o);var y=this.pes_slice_queues_[s.pid];y&&(y.expected_length===0||y.expected_length===y.total_length?this.emitPESSlices(y,s):this.clearSlices(y,s)),this.pes_slice_queues_[s.pid]=new me,this.pes_slice_queues_[s.pid].file_position=s.file_position,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(this.pes_slice_queues_[s.pid]!=null){var T=this.pes_slice_queues_[s.pid];T.slices.push(a),s.payload_unit_start_indicator&&(T.expected_length=E===0?0:E+6),T.total_length+=a.byteLength,T.expected_length>0&&T.expected_length===T.total_length?this.emitPESSlices(T,s):T.expected_length>0&&T.expected_length<T.total_length&&this.clearSlices(T,s)}},t.prototype.emitSectionSlices=function(i,e){for(var n=new Uint8Array(i.total_length),s=0,a=0;s<i.slices.length;s++){var o=i.slices[s];n.set(o,a),a+=o.byteLength}i.slices=[],i.expected_length=-1,i.total_length=0;var E=new fe;E.pid=e.pid,E.data=n,E.file_position=i.file_position,E.random_access_indicator=i.random_access_indicator,this.parseSection(E)},t.prototype.emitPESSlices=function(i,e){for(var n=new Uint8Array(i.total_length),s=0,a=0;s<i.slices.length;s++){var o=i.slices[s];n.set(o,a),a+=o.byteLength}i.slices=[],i.expected_length=-1,i.total_length=0;var E=new te;E.pid=e.pid,E.data=n,E.stream_type=e.stream_type,E.file_position=i.file_position,E.random_access_indicator=i.random_access_indicator,this.parsePES(E)},t.prototype.clearSlices=function(i,e){i.slices=[],i.expected_length=-1,i.total_length=0},t.prototype.parseSection=function(i){var e=i.data,n=i.pid;n===0?this.parsePAT(e):n===this.current_pmt_pid_?this.parsePMT(e):this.pmt_!=null&&this.pmt_.scte_35_pids[n]&&this.parseSCTE35(e)},t.prototype.parsePES=function(i){var e=i.data,n=e[0]<<16|e[1]<<8|e[2],s=e[3],a=e[4]<<8|e[5];if(n===1)if(s!==188&&s!==190&&s!==191&&s!==240&&s!==241&&s!==255&&s!==242&&s!==248){e[6];var o=(192&e[7])>>>6,E=e[8],y=void 0,T=void 0;o!==2&&o!==3||(y=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,T=o===3?536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2:y);var k=9+E,A=void 0;if(a!==0){if(a<3+E)return void g.a.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");A=a-3-E}else A=e.byteLength-k;var w=e.subarray(k,k+A);switch(i.stream_type){case h.kMPEG1Audio:case h.kMPEG2Audio:this.parseMP3Payload(w,y);break;case h.kPESPrivateData:this.pmt_.smpte2038_pids[i.pid]?this.parseSMPTE2038MetadataPayload(w,y,T,i.pid,s):this.parsePESPrivateDataPayload(w,y,T,i.pid,s);break;case h.kADTSAAC:this.parseAACPayload(w,y);break;case h.kID3:this.parseTimedID3MetadataPayload(w,y,T,i.pid,s);break;case h.kH264:this.parseH264Payload(w,y,T,i.file_position,i.random_access_indicator);break;case h.kH265:this.parseH265Payload(w,y,T,i.file_position,i.random_access_indicator)}}else(s===188||s===191||s===240||s===241||s===255||s===242||s===248)&&i.stream_type===h.kPESPrivateData&&(k=6,A=void 0,A=a!==0?a:e.byteLength-k,w=e.subarray(k,k+A),this.parsePESPrivateDataPayload(w,void 0,void 0,i.pid,s));else g.a.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value "+n)},t.prototype.parsePAT=function(i){var e=i[0];if(e===0){var n=(15&i[1])<<8|i[2],s=(i[3],i[4],(62&i[5])>>>1),a=1&i[5],o=i[6],E=(i[7],null);if(a===1&&o===0)(E=new P).version_number=s;else if((E=this.pat_)==null)return;for(var y=n-5-4,T=-1,k=-1,A=8;A<8+y;A+=4){var w=i[A]<<8|i[A+1],O=(31&i[A+2])<<8|i[A+3];w===0?E.network_pid=O:(E.program_pmt_pid[w]=O,T===-1&&(T=w),k===-1&&(k=O))}a===1&&o===0&&(this.pat_==null&&g.a.v(this.TAG,"Parsed first PAT: "+JSON.stringify(E)),this.pat_=E,this.current_program_=T,this.current_pmt_pid_=k)}else g.a.e(this.TAG,"parsePAT: table_id "+e+" is not corresponded to PAT!")},t.prototype.parsePMT=function(i){var e=i[0];if(e===2){var n=(15&i[1])<<8|i[2],s=i[3]<<8|i[4],a=(62&i[5])>>>1,o=1&i[5],E=i[6],y=(i[7],null);if(o===1&&E===0)(y=new V).program_number=s,y.version_number=a,this.program_pmt_map_[s]=y;else if((y=this.program_pmt_map_[s])==null)return;i[8],i[9];for(var T=(15&i[10])<<8|i[11],k=12+T,A=n-9-T-4,w=k;w<k+A;){var O=i[w],q=(31&i[w+1])<<8|i[w+2],U=(15&i[w+3])<<8|i[w+4];if(y.pid_stream_type[q]=O,O!==h.kH264||y.common_pids.h264||y.common_pids.h265)if(O!==h.kH265||y.common_pids.h264||y.common_pids.h265)if(O!==h.kADTSAAC||y.common_pids.adts_aac)if(O!==h.kMPEG1Audio&&O!==h.kMPEG2Audio||y.common_pids.mp3)if(O===h.kPESPrivateData){if(y.pes_private_data_pids[q]=!0,U>0){for(var Y=w+5;Y<w+5+U;){var Z=i[Y+0],K=i[Y+1];Z===5&&String.fromCharCode.apply(String,Array.from(i.subarray(Y+2,Y+2+K)))==="VANC"&&(y.smpte2038_pids[q]=!0),Y+=2+K}var de=i.subarray(w+5,w+5+U);this.dispatchPESPrivateDataDescriptor(q,O,de)}}else O===h.kID3?y.timed_id3_pids[q]=!0:O===h.kSCTE35&&(y.scte_35_pids[q]=!0);else y.common_pids.mp3=q;else y.common_pids.adts_aac=q;else y.common_pids.h265=q;else y.common_pids.h264=q;w+=5+U}s===this.current_program_&&(this.pmt_==null&&g.a.v(this.TAG,"Parsed first PMT: "+JSON.stringify(y)),this.pmt_=y,(y.common_pids.h264||y.common_pids.h265)&&(this.has_video_=!0),(y.common_pids.adts_aac||y.common_pids.mp3)&&(this.has_audio_=!0))}else g.a.e(this.TAG,"parsePMT: table_id "+e+" is not corresponded to PMT!")},t.prototype.parseSCTE35=function(i){var e=yt(i);if(e.pts!=null){var n=Math.floor(e.pts/this.timescale_);e.pts=n}else e.nearest_pts=this.aac_last_sample_pts_;this.onSCTE35Metadata&&this.onSCTE35Metadata(e)},t.prototype.parseH264Payload=function(i,e,n,s,a){for(var o=new W(i),E=null,y=[],T=0,k=!1;(E=o.readNextNaluPayload())!=null;){var A=new S(E);if(A.type===D.kSliceSPS){var w=se.parseSPS(E.data);this.video_init_segment_dispatched_?this.detectVideoMetadataChange(A,w)===!0&&(g.a.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:A,pps:void 0,details:w}):(this.video_metadata_.sps=A,this.video_metadata_.details=w)}else A.type===D.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=A,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(A.type===D.kSliceIDR||A.type===D.kSliceNonIDR&&a===1)&&(k=!0);this.video_init_segment_dispatched_&&(y.push(A),T+=A.data.byteLength)}var O=Math.floor(e/this.timescale_),q=Math.floor(n/this.timescale_);if(y.length){var U=this.video_track_,Y={units:y,length:T,isKeyframe:k,dts:q,pts:O,cts:O-q,file_position:s};U.samples.push(Y),U.length+=T}},t.prototype.parseH265Payload=function(i,e,n,s,a){for(var o=new bt(i),E=null,y=[],T=0,k=!1;(E=o.readNextNaluPayload())!=null;){var A=new St(E);if(A.type===J.kSliceVPS){if(!this.video_init_segment_dispatched_){var w=ne.parseVPS(E.data);this.video_metadata_.vps=A,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),w)}}else A.type===J.kSliceSPS?(w=ne.parseSPS(E.data),this.video_init_segment_dispatched_?this.detectVideoMetadataChange(A,w)===!0&&(g.a.v(this.TAG,"H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:A,pps:void 0,details:w}):(this.video_metadata_.sps=A,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),w))):A.type===J.kSlicePPS?(!this.video_init_segment_dispatched_||this.video_metadata_changed_)&&(w=ne.parsePPS(E.data),this.video_metadata_.pps=A,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),w),this.video_metadata_.vps&&this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):A.type!==J.kSliceIDR_W_RADL&&A.type!==J.kSliceIDR_N_LP&&A.type!==J.kSliceCRA_NUT||(k=!0);this.video_init_segment_dispatched_&&(y.push(A),T+=A.data.byteLength)}var O=Math.floor(e/this.timescale_),q=Math.floor(n/this.timescale_);if(y.length){var U=this.video_track_,Y={units:y,length:T,isKeyframe:k,dts:q,pts:O,cts:O-q,file_position:s};U.samples.push(Y),U.length+=T}},t.prototype.detectVideoMetadataChange=function(i,e){if(e.codec_mimetype!==this.video_metadata_.details.codec_mimetype)return g.a.v(this.TAG,"Video: Codec mimeType changed from "+this.video_metadata_.details.codec_mimetype+" to "+e.codec_mimetype),!0;if(e.codec_size.width!==this.video_metadata_.details.codec_size.width||e.codec_size.height!==this.video_metadata_.details.codec_size.height){var n=this.video_metadata_.details.codec_size,s=e.codec_size;return g.a.v(this.TAG,"Video: Coded Resolution changed from "+n.width+"x"+n.height+" to "+s.width+"x"+s.height),!0}return e.present_size.width!==this.video_metadata_.details.present_size.width&&(g.a.v(this.TAG,"Video: Present resolution width changed from "+this.video_metadata_.details.present_size.width+" to "+e.present_size.width),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var i=this.video_metadata_.details,e={type:"video"};e.id=this.video_track_.id,e.timescale=1e3,e.duration=this.duration_,e.codecWidth=i.codec_size.width,e.codecHeight=i.codec_size.height,e.presentWidth=i.present_size.width,e.presentHeight=i.present_size.height,e.profile=i.profile_string,e.level=i.level_string,e.bitDepth=i.bit_depth,e.chromaFormat=i.chroma_format,e.sarRatio=i.sar_ratio,e.frameRate=i.frame_rate;var n=e.frameRate.fps_den,s=e.frameRate.fps_num;if(e.refSampleDuration=n/s*1e3,e.codec=i.codec_mimetype,this.video_metadata_.vps){var a=this.video_metadata_.vps.data.subarray(4),o=this.video_metadata_.sps.data.subarray(4),E=this.video_metadata_.pps.data.subarray(4),y=new At(a,o,E,i);e.hvcc=y.getData(),this.video_init_segment_dispatched_==0&&g.a.v(this.TAG,"Generated first HEVCDecoderConfigurationRecord for mimeType: "+e.codec)}else{o=this.video_metadata_.sps.data.subarray(4),E=this.video_metadata_.pps.data.subarray(4);var T=new ae(o,E,i);e.avcc=T.getData(),this.video_init_segment_dispatched_==0&&g.a.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: "+e.codec)}this.onTrackMetadata("video",e),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var k=this.media_info_;k.hasVideo=!0,k.width=e.codecWidth,k.height=e.codecHeight,k.fps=e.frameRate.fps,k.profile=e.profile,k.level=e.level,k.refFrames=i.ref_frames,k.chromaFormat=i.chroma_format_string,k.sarNum=e.sarRatio.width,k.sarDen=e.sarRatio.height,k.videoCodec=e.codec,k.hasAudio&&k.audioCodec?k.mimeType='video/mp2t; codecs="'+k.videoCodec+","+k.audioCodec+'"':k.mimeType='video/mp2t; codecs="'+k.videoCodec+'"',k.isComplete()&&this.onMediaInfo(k)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseAACPayload=function(i,e){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var n=new Uint8Array(i.byteLength+this.aac_last_incomplete_data_.byteLength);n.set(this.aac_last_incomplete_data_,0),n.set(i,this.aac_last_incomplete_data_.byteLength),i=n}var s,a;if(e!=null&&(a=e/this.timescale_),this.audio_metadata_.codec==="aac"){if(e==null&&this.aac_last_sample_pts_!=null)s=1024/this.audio_metadata_.sampling_frequency*1e3,a=this.aac_last_sample_pts_+s;else if(e==null)return void g.a.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){s=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.aac_last_sample_pts_+s;Math.abs(o-a)>1&&(g.a.w(this.TAG,"AAC: Detected pts overlapped, expected: "+o+"ms, PES pts: "+a+"ms"),a=o)}}for(var E,y=new Ae(i),T=null,k=a;(T=y.readNextAACFrame())!=null;){s=1024/T.sampling_frequency*1e3;var A={codec:"aac",data:T};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"aac",audio_object_type:T.audio_object_type,sampling_freq_index:T.sampling_freq_index,sampling_frequency:T.sampling_frequency,channel_config:T.channel_config},this.dispatchAudioInitSegment(A)):this.detectAudioMetadataChange(A)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(A)),E=k;var w=Math.floor(k),O={unit:T.data,length:T.data.byteLength,pts:w,dts:w};this.audio_track_.samples.push(O),this.audio_track_.length+=T.data.byteLength,k+=s}y.hasIncompleteData()&&(this.aac_last_incomplete_data_=y.getIncompleteData()),E&&(this.aac_last_sample_pts_=E)}},t.prototype.parseMP3Payload=function(i,e){if(!this.has_video_||this.video_init_segment_dispatched_){var n=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],s=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],a=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],o=i[1]>>>3&3,E=(6&i[1])>>1,y=(240&i[2])>>>4,T=(12&i[2])>>>2,k=(i[3]>>>6&3)!==3?2:1,A=0,w=34;switch(o){case 0:A=[11025,12e3,8e3,0][T];break;case 2:A=[22050,24e3,16e3,0][T];break;case 3:A=[44100,48e3,32e3,0][T]}switch(E){case 1:w=34,y<a.length&&a[y];break;case 2:w=33,y<s.length&&s[y];break;case 3:w=32,y<n.length&&n[y]}var O=new Tt;O.object_type=w,O.sample_rate=A,O.channel_count=k,O.data=i;var q={codec:"mp3",data:O};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"mp3",object_type:w,sample_rate:A,channel_count:k},this.dispatchAudioInitSegment(q)):this.detectAudioMetadataChange(q)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(q));var U={unit:i,length:i.byteLength,pts:e/this.timescale_,dts:e/this.timescale_};this.audio_track_.samples.push(U),this.audio_track_.length+=i.byteLength}},t.prototype.detectAudioMetadataChange=function(i){if(i.codec!==this.audio_metadata_.codec)return g.a.v(this.TAG,"Audio: Audio Codecs changed from "+this.audio_metadata_.codec+" to "+i.codec),!0;if(i.codec==="aac"&&this.audio_metadata_.codec==="aac"){var e=i.data;if(e.audio_object_type!==this.audio_metadata_.audio_object_type)return g.a.v(this.TAG,"AAC: AudioObjectType changed from "+this.audio_metadata_.audio_object_type+" to "+e.audio_object_type),!0;if(e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return g.a.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+this.audio_metadata_.sampling_freq_index+" to "+e.sampling_freq_index),!0;if(e.channel_config!==this.audio_metadata_.channel_config)return g.a.v(this.TAG,"AAC: Channel configuration changed from "+this.audio_metadata_.channel_config+" to "+e.channel_config),!0}else if(i.codec==="mp3"&&this.audio_metadata_.codec==="mp3"){var n=i.data;if(n.object_type!==this.audio_metadata_.object_type)return g.a.v(this.TAG,"MP3: AudioObjectType changed from "+this.audio_metadata_.object_type+" to "+n.object_type),!0;if(n.sample_rate!==this.audio_metadata_.sample_rate)return g.a.v(this.TAG,"MP3: SamplingFrequencyIndex changed from "+this.audio_metadata_.sample_rate+" to "+n.sample_rate),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return g.a.v(this.TAG,"MP3: Channel count changed from "+this.audio_metadata_.channel_count+" to "+n.channel_count),!0}return!1},t.prototype.dispatchAudioInitSegment=function(i){var e={type:"audio"};if(e.id=this.audio_track_.id,e.timescale=1e3,e.duration=this.duration_,this.audio_metadata_.codec==="aac"){var n=i.data,s=new M(n);e.audioSampleRate=s.sampling_rate,e.channelCount=s.channel_count,e.codec=s.codec_mimetype,e.originalCodec=s.original_codec_mimetype,e.config=s.config}else this.audio_metadata_.codec==="mp3"&&(e.audioSampleRate=this.audio_metadata_.sample_rate,e.channelCount=this.audio_metadata_.channel_count,e.codec="mp3",e.originalCodec="mp3",e.config=void 0);e.refSampleDuration=1024/e.audioSampleRate*e.timescale,this.audio_init_segment_dispatched_==0&&g.a.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: "+e.codec),this.onTrackMetadata("audio",e),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var a=this.media_info_;a.hasAudio=!0,a.audioCodec=e.originalCodec,a.audioSampleRate=e.audioSampleRate,a.audioChannelCount=e.channelCount,a.hasVideo&&a.videoCodec?a.mimeType='video/mp2t; codecs="'+a.videoCodec+","+a.audioCodec+'"':a.mimeType='video/mp2t; codecs="'+a.audioCodec+'"',a.isComplete()&&this.onMediaInfo(a)},t.prototype.dispatchPESPrivateDataDescriptor=function(i,e,n){var s=new ee;s.pid=i,s.stream_type=e,s.descriptor=n,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(s)},t.prototype.parsePESPrivateDataPayload=function(i,e,n,s,a){var o=new F;if(o.pid=s,o.stream_id=a,o.len=i.byteLength,o.data=i,e!=null){var E=Math.floor(e/this.timescale_);o.pts=E}else o.nearest_pts=this.aac_last_sample_pts_;if(n!=null){var y=Math.floor(n/this.timescale_);o.dts=y}this.onPESPrivateData&&this.onPESPrivateData(o)},t.prototype.parseTimedID3MetadataPayload=function(i,e,n,s,a){var o=new F;if(o.pid=s,o.stream_id=a,o.len=i.byteLength,o.data=i,e!=null){var E=Math.floor(e/this.timescale_);o.pts=E}if(n!=null){var y=Math.floor(n/this.timescale_);o.dts=y}this.onTimedID3Metadata&&this.onTimedID3Metadata(o)},t.prototype.parseSMPTE2038MetadataPayload=function(i,e,n,s,a){var o=new Rt;if(o.pid=s,o.stream_id=a,o.len=i.byteLength,o.data=i,e!=null){var E=Math.floor(e/this.timescale_);o.pts=E}if(o.nearest_pts=this.aac_last_sample_pts_,n!=null){var y=Math.floor(n/this.timescale_);o.dts=y}o.ancillaries=function(T){for(var k=new ue(T),A=0,w=[];A+=6,k.readBits(6)===0;){var O=k.readBool();A+=1;var q=k.readBits(11);A+=11;var U=k.readBits(12);A+=12;var Y=255&k.readBits(10);A+=10;var Z=255&k.readBits(10);A+=10;var K=255&k.readBits(10);A+=10;for(var de=new Uint8Array(K),X=0;X<K;X++){var H=255&k.readBits(10);A+=10,de[X]=H}k.readBits(10),A+=10;var re="User Defined";Y===65?Z===7&&(re="SCTE-104"):Y===95?Z===220?re="ARIB STD-B37 (1SEG)":Z===221?re="ARIB STD-B37 (ANALOG)":Z===222?re="ARIB STD-B37 (SD)":Z===223&&(re="ARIB STD-B37 (HD)"):Y===97&&(Z===1?re="EIA-708":Z===2&&(re="EIA-608")),w.push({yc_indicator:O,line_number:q,horizontal_offset:U,did:Y,sdid:Z,user_data:de,description:re,information:{}}),k.readBits(8-(A-Math.floor(A/8))%8),A+=(8-(A-Math.floor(A/8)))%8}return k.destroy(),k=null,w}(i),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(o)},t}(c),ot=function(){function r(){}return r.init=function(){for(var t in r.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],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":[]},r.types)r.types.hasOwnProperty(t)&&(r.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=r.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.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]),i.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]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},r.box=function(t){for(var i=8,e=null,n=Array.prototype.slice.call(arguments,1),s=n.length,a=0;a<s;a++)i+=n[a].byteLength;(e=new Uint8Array(i))[0]=i>>>24&255,e[1]=i>>>16&255,e[2]=i>>>8&255,e[3]=255&i,e.set(t,4);var o=8;for(a=0;a<s;a++)e.set(n[a],o),o+=n[a].byteLength;return e},r.generateInitSegment=function(t){var i=r.box(r.types.ftyp,r.constants.FTYP),e=r.moov(t),n=new Uint8Array(i.byteLength+e.byteLength);return n.set(i,0),n.set(e,i.byteLength),n},r.moov=function(t){var i=r.mvhd(t.timescale,t.duration),e=r.trak(t),n=r.mvex(t);return r.box(r.types.moov,i,e,n)},r.mvhd=function(t,i){return r.box(r.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,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]))},r.trak=function(t){return r.box(r.types.trak,r.tkhd(t),r.mdia(t))},r.tkhd=function(t){var i=t.id,e=t.duration,n=t.presentWidth,s=t.presentHeight;return r.box(r.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,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,n>>>8&255,255&n,0,0,s>>>8&255,255&s,0,0]))},r.mdia=function(t){return r.box(r.types.mdia,r.mdhd(t),r.hdlr(t),r.minf(t))},r.mdhd=function(t){var i=t.timescale,e=t.duration;return r.box(r.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))},r.hdlr=function(t){var i=null;return i=t.type==="audio"?r.constants.HDLR_AUDIO:r.constants.HDLR_VIDEO,r.box(r.types.hdlr,i)},r.minf=function(t){var i=null;return i=t.type==="audio"?r.box(r.types.smhd,r.constants.SMHD):r.box(r.types.vmhd,r.constants.VMHD),r.box(r.types.minf,i,r.dinf(),r.stbl(t))},r.dinf=function(){return r.box(r.types.dinf,r.box(r.types.dref,r.constants.DREF))},r.stbl=function(t){return r.box(r.types.stbl,r.stsd(t),r.box(r.types.stts,r.constants.STTS),r.box(r.types.stsc,r.constants.STSC),r.box(r.types.stsz,r.constants.STSZ),r.box(r.types.stco,r.constants.STCO))},r.stsd=function(t){return t.type==="audio"?t.codec==="mp3"?r.box(r.types.stsd,r.constants.STSD_PREFIX,r.mp3(t)):r.box(r.types.stsd,r.constants.STSD_PREFIX,r.mp4a(t)):t.type==="video"&&t.codec.startsWith("hvc1")?r.box(r.types.stsd,r.constants.STSD_PREFIX,r.hvc1(t)):r.box(r.types.stsd,r.constants.STSD_PREFIX,r.avc1(t))},r.mp3=function(t){var i=t.channelCount,e=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return r.box(r.types[".mp3"],n)},r.mp4a=function(t){var i=t.channelCount,e=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return r.box(r.types.mp4a,n,r.esds(t))},r.esds=function(t){var i=t.config||[],e=i.length,n=new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(i).concat([6,1,2]));return r.box(r.types.esds,n)},r.avc1=function(t){var i=t.avcc,e=t.codecWidth,n=t.codecHeight,s=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,e>>>8&255,255&e,n>>>8&255,255&n,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 r.box(r.types.avc1,s,r.box(r.types.avcC,i))},r.hvc1=function(t){var i=t.hvcc,e=t.codecWidth,n=t.codecHeight,s=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,e>>>8&255,255&e,n>>>8&255,255&n,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 r.box(r.types.hvc1,s,r.box(r.types.hvcC,i))},r.mvex=function(t){return r.box(r.types.mvex,r.trex(t))},r.trex=function(t){var i=t.id,e=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return r.box(r.types.trex,e)},r.moof=function(t,i){return r.box(r.types.moof,r.mfhd(t.sequenceNumber),r.traf(t,i))},r.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return r.box(r.types.mfhd,i)},r.traf=function(t,i){var e=t.id,n=r.box(r.types.tfhd,new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])),s=r.box(r.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),a=r.sdtp(t),o=r.trun(t,a.byteLength+16+16+8+16+8+8);return r.box(r.types.traf,n,s,o,a)},r.sdtp=function(t){for(var i=t.samples||[],e=i.length,n=new Uint8Array(4+e),s=0;s<e;s++){var a=i[s].flags;n[s+4]=a.isLeading<<6|a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy}return r.box(r.types.sdtp,n)},r.trun=function(t,i){var e=t.samples||[],n=e.length,s=12+16*n,a=new Uint8Array(s);i+=8+s,a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var o=0;o<n;o++){var E=e[o].duration,y=e[o].size,T=e[o].flags,k=e[o].cts;a.set([E>>>24&255,E>>>16&255,E>>>8&255,255&E,y>>>24&255,y>>>16&255,y>>>8&255,255&y,T.isLeading<<2|T.dependsOn,T.isDependedOn<<6|T.hasRedundancy<<4|T.isNonSync,0,0,k>>>24&255,k>>>16&255,k>>>8&255,255&k],12+16*o)}return r.box(r.types.trun,a)},r.mdat=function(t){return r.box(r.types.mdat,t)},r}();ot.init();var je=ot,dt=function(){function r(){}return r.getSilentFrame=function(t,i){if(t==="mp4a.40.2"){if(i===1)return new Uint8Array([0,200,0,128,35,128]);if(i===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(i===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(i===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(i===5)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(i===6)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(i===1)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(i===2)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]);if(i===3)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},r}(),Me=I(7),ht=function(){function r(t){this.TAG="MP4Remuxer",this._config=t,this._isLive=t.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new Me.c("audio"),this._videoSegmentInfoList=new Me.c("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!v.a.chrome||!(v.a.version.major<50||v.a.version.major===50&&v.a.version.build<2661)),this._fillSilentAfterSeek=v.a.msedge||v.a.msie,this._mp3UseMpegAudio=!v.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return r.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},r.prototype.bindDataSource=function(t){return t.onDataAvailable=this.remux.bind(this),t.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(r.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(t){this._onInitSegment=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(t){this._onMediaSegment=t},enumerable:!1,configurable:!0}),r.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},r.prototype.seek=function(t){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},r.prototype.remux=function(t,i){if(!this._onMediaSegment)throw new C.a("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(t,i),i&&this._remuxVideo(i),t&&this._remuxAudio(t)},r.prototype._onTrackMetadataReceived=function(t,i){var e=null,n="mp4",s=i.codec;if(t==="audio")this._audioMeta=i,i.codec==="mp3"&&this._mp3UseMpegAudio?(n="mpeg",s="",e=new Uint8Array):e=je.generateInitSegment(i);else{if(t!=="video")return;this._videoMeta=i,e=je.generateInitSegment(i)}if(!this._onInitSegment)throw new C.a("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(t,{type:t,data:e.buffer,codec:s,container:t+"/"+n,mediaDuration:i.duration})},r.prototype._calculateDtsBase=function(t,i){this._dtsBaseInited||(t&&t.samples&&t.samples.length&&(this._audioDtsBase=t.samples[0].dts),i&&i.samples&&i.samples.length&&(this._videoDtsBase=i.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},r.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},r.prototype.flushStashedSamples=function(){var t=this._videoStashedLastSample,i=this._audioStashedLastSample,e={type:"video",id:1,sequenceNumber:0,samples:[],length:0};t!=null&&(e.samples.push(t),e.length=t.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};i!=null&&(n.samples.push(i),n.length=i.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(e,!0),this._remuxAudio(n,!0)},r.prototype._remuxAudio=function(t,i){if(this._audioMeta!=null){var e,n=t,s=n.samples,a=void 0,o=-1,E=this._audioMeta.refSampleDuration,y=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,T=this._dtsBaseInited&&this._audioNextDts===void 0,k=!1;if(s&&s.length!==0&&(s.length!==1||i)){var A=0,w=null,O=0;y?(A=0,O=n.length):(A=8,O=8+n.length);var q=null;if(s.length>1&&(O-=(q=s.pop()).length),this._audioStashedLastSample!=null){var U=this._audioStashedLastSample;this._audioStashedLastSample=null,s.unshift(U),O+=U.length}q!=null&&(this._audioStashedLastSample=q);var Y=s[0].dts-this._dtsBase;if(this._audioNextDts)a=Y-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())a=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(k=!0);else{var Z=this._audioSegmentInfoList.getLastSampleBefore(Y);if(Z!=null){var K=Y-(Z.originalDts+Z.duration);K<=3&&(K=0),a=Y-(Z.dts+Z.duration+K)}else a=0}if(k){var de=Y-a,X=this._videoSegmentInfoList.getLastSegmentBefore(Y);if(X!=null&&X.beginDts<de){if(De=dt.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var H=X.beginDts,re=de-X.beginDts;g.a.v(this.TAG,"InsertPrefixSilentAudio: dts: "+H+", duration: "+re),s.unshift({unit:De,dts:H,pts:H}),O+=De.byteLength}}else k=!1}for(var pe=[],Se=0;Se<s.length;Se++){var _e=(U=s[Se]).unit,ve=U.dts-this._dtsBase,ye=(H=ve,!1),oe=null,ge=0;if(!(ve<-.001)){if(this._audioMeta.codec!=="mp3"){var be=ve;if(this._audioNextDts&&(be=this._audioNextDts),(a=ve-be)<=-3*E){g.a.w(this.TAG,"Dropping 1 audio frame (originalDts: "+ve+" ms ,curRefDts: "+be+" ms) due to dtsCorrection: "+a+" ms overlap.");continue}if(a>=3*E&&this._fillAudioTimestampGap&&!v.a.safari){ye=!0;var De,Ue=Math.floor(a/E);g.a.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
|
|
originalDts: `+ve+" ms, curRefDts: "+be+" ms, dtsCorrection: "+Math.round(a)+" ms, generate: "+Ue+" frames"),H=Math.floor(be),ge=Math.floor(be+E)-H,(De=dt.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))==null&&(g.a.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),De=_e),oe=[];for(var Pe=0;Pe<Ue;Pe++){be+=E;var Ee=Math.floor(be),ze=Math.floor(be+E)-Ee,Ne={dts:Ee,pts:Ee,cts:0,unit:De,size:De.byteLength,duration:ze,originalDts:ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};oe.push(Ne),O+=Ne.size}this._audioNextDts=be+E}else H=Math.floor(be),ge=Math.floor(be+E)-H,this._audioNextDts=be+E}else H=ve-a,Se!==s.length-1?ge=s[Se+1].dts-this._dtsBase-a-H:q!=null?ge=q.dts-this._dtsBase-a-H:ge=pe.length>=1?pe[pe.length-1].duration:Math.floor(E),this._audioNextDts=H+ge;o===-1&&(o=H),pe.push({dts:H,pts:H,cts:0,unit:U.unit,size:U.unit.byteLength,duration:ge,originalDts:ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),ye&&pe.push.apply(pe,oe)}}if(pe.length===0)return n.samples=[],void(n.length=0);for(y?w=new Uint8Array(O):((w=new Uint8Array(O))[0]=O>>>24&255,w[1]=O>>>16&255,w[2]=O>>>8&255,w[3]=255&O,w.set(je.types.mdat,4)),Se=0;Se<pe.length;Se++)_e=pe[Se].unit,w.set(_e,A),A+=_e.byteLength;var Ce=pe[pe.length-1];e=Ce.dts+Ce.duration;var we=new Me.b;we.beginDts=o,we.endDts=e,we.beginPts=o,we.endPts=e,we.originalBeginDts=pe[0].originalDts,we.originalEndDts=Ce.originalDts+Ce.duration,we.firstSample=new Me.d(pe[0].dts,pe[0].pts,pe[0].duration,pe[0].originalDts,!1),we.lastSample=new Me.d(Ce.dts,Ce.pts,Ce.duration,Ce.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(we),n.samples=pe,n.sequenceNumber++;var Ge=null;Ge=y?new Uint8Array:je.moof(n,o),n.samples=[],n.length=0;var xe={type:"audio",data:this._mergeBoxes(Ge,w).buffer,sampleCount:pe.length,info:we};y&&T&&(xe.timestampOffset=o),this._onMediaSegment("audio",xe)}}},r.prototype._remuxVideo=function(t,i){if(this._videoMeta!=null){var e,n,s=t,a=s.samples,o=void 0,E=-1,y=-1;if(a&&a.length!==0&&(a.length!==1||i)){var T=8,k=null,A=8+t.length,w=null;if(a.length>1&&(A-=(w=a.pop()).length),this._videoStashedLastSample!=null){var O=this._videoStashedLastSample;this._videoStashedLastSample=null,a.unshift(O),A+=O.length}w!=null&&(this._videoStashedLastSample=w);var q=a[0].dts-this._dtsBase;if(this._videoNextDts)o=q-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var U=this._videoSegmentInfoList.getLastSampleBefore(q);if(U!=null){var Y=q-(U.originalDts+U.duration);Y<=3&&(Y=0),o=q-(U.dts+U.duration+Y)}else o=0}for(var Z=new Me.b,K=[],de=0;de<a.length;de++){var X=(O=a[de]).dts-this._dtsBase,H=O.isKeyframe,re=X-o,pe=O.cts,Se=re+pe;E===-1&&(E=re,y=Se);var _e=0;if(de!==a.length-1?_e=a[de+1].dts-this._dtsBase-o-re:w!=null?_e=w.dts-this._dtsBase-o-re:_e=K.length>=1?K[K.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),H){var ve=new Me.d(re,Se,_e,O.dts,!0);ve.fileposition=O.fileposition,Z.appendSyncPoint(ve)}K.push({dts:re,pts:Se,cts:pe,units:O.units,size:O.length,isKeyframe:H,duration:_e,originalDts:X,flags:{isLeading:0,dependsOn:H?2:1,isDependedOn:H?1:0,hasRedundancy:0,isNonSync:H?0:1}})}for((k=new Uint8Array(A))[0]=A>>>24&255,k[1]=A>>>16&255,k[2]=A>>>8&255,k[3]=255&A,k.set(je.types.mdat,4),de=0;de<K.length;de++)for(var ye=K[de].units;ye.length;){var oe=ye.shift().data;k.set(oe,T),T+=oe.byteLength}var ge=K[K.length-1];if(e=ge.dts+ge.duration,n=ge.pts+ge.duration,this._videoNextDts=e,Z.beginDts=E,Z.endDts=e,Z.beginPts=y,Z.endPts=n,Z.originalBeginDts=K[0].originalDts,Z.originalEndDts=ge.originalDts+ge.duration,Z.firstSample=new Me.d(K[0].dts,K[0].pts,K[0].duration,K[0].originalDts,K[0].isKeyframe),Z.lastSample=new Me.d(ge.dts,ge.pts,ge.duration,ge.originalDts,ge.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Z),s.samples=K,s.sequenceNumber++,this._forceFirstIDR){var be=K[0].flags;be.dependsOn=2,be.isNonSync=0}var De=je.moof(s,E);s.samples=[],s.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(De,k).buffer,sampleCount:K.length,info:Z})}}},r.prototype._mergeBoxes=function(t,i){var e=new Uint8Array(t.byteLength+i.byteLength);return e.set(t,0),e.set(i,t.byteLength),e},r}(),wt=I(11),Le=I(1),Dt=function(){function r(t,i){this.TAG="TransmuxingController",this._emitter=new B.a,this._config=i,t.segments||(t.segments=[{duration:t.duration,filesize:t.filesize,url:t.url}]),typeof t.cors!="boolean"&&(t.cors=!0),typeof t.withCredentials!="boolean"&&(t.withCredentials=!1),this._mediaDataSource=t,this._currentSegmentIndex=0;var e=0;this._mediaDataSource.segments.forEach(function(n){n.timestampBase=e,e+=n.duration,n.cors=t.cors,n.withCredentials=t.withCredentials,i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy)}),isNaN(e)||this._mediaDataSource.duration===e||(this._mediaDataSource.duration=e),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return r.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},r.prototype.on=function(t,i){this._emitter.addListener(t,i)},r.prototype.off=function(t,i){this._emitter.removeListener(t,i)},r.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},r.prototype._loadSegment=function(t,i){this._currentSegmentIndex=t;var e=this._mediaDataSource.segments[t],n=this._ioctl=new wt.a(e,this._config,t);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),i?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.open(i)},r.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},r.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},r.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},r.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},r.prototype.seek=function(t){if(this._mediaInfo!=null&&this._mediaInfo.isSeekable()){var i=this._searchSegmentIndexContains(t);if(i===this._currentSegmentIndex){var e=this._mediaInfo.segments[i];if(e==null)this._pendingSeekTime=t;else{var n=e.getNearestKeyframe(t);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var s=this._mediaInfo.segments[i];s==null?(this._pendingSeekTime=t,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(i)):(n=s.getNearestKeyframe(t),this._internalAbort(),this._remuxer.seek(t),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[i].timestampBase,this._loadSegment(i,n.fileposition),this._pendingResolveSeekPoint=n.milliseconds,this._reportSegmentMediaInfo(i))}this._enableStatisticsReporter()}},r.prototype._searchSegmentIndexContains=function(t){for(var i=this._mediaDataSource.segments,e=i.length-1,n=0;n<i.length;n++)if(t<i[n].timestampBase){e=n-1;break}return e},r.prototype._onInitChunkArrival=function(t,i){var e=this,n=0;if(i>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(t,i);else{var s=null;(s=u.probe(t)).match&&(this._setupFLVDemuxerRemuxer(s),n=this._demuxer.parseChunks(t,i)),s.match||s.needMoreData||(s=st.probe(t)).match&&(this._setupTSDemuxerRemuxer(s),n=this._demuxer.parseChunks(t,i)),s.match||s.needMoreData||(s=null,g.a.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then(function(){e._internalAbort()}),this._emitter.emit(Le.a.DEMUX_ERROR,$.a.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return n},r.prototype._setupFLVDemuxerRemuxer=function(t){this._demuxer=new u(t,this._config),this._remuxer||(this._remuxer=new ht(this._config));var i=this._mediaDataSource;i.duration==null||isNaN(i.duration)||(this._demuxer.overridedDuration=i.duration),typeof i.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=i.hasAudio),typeof i.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=i.hasVideo),this._demuxer.timestampBase=i.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},r.prototype._setupTSDemuxerRemuxer=function(t){var i=this._demuxer=new st(t,this._config);this._remuxer||(this._remuxer=new ht(this._config)),i.onError=this._onDemuxException.bind(this),i.onMediaInfo=this._onMediaInfo.bind(this),i.onMetaDataArrived=this._onMetaDataArrived.bind(this),i.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),i.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),i.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),i.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),i.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},r.prototype._onMediaInfo=function(t){var i=this;this._mediaInfo==null&&(this._mediaInfo=Object.assign({},t),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,p.a.prototype));var e=Object.assign({},t);Object.setPrototypeOf(e,p.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=e,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var n=i._pendingSeekTime;i._pendingSeekTime=null,i.seek(n)})},r.prototype._onMetaDataArrived=function(t){this._emitter.emit(Le.a.METADATA_ARRIVED,t)},r.prototype._onScriptDataArrived=function(t){this._emitter.emit(Le.a.SCRIPTDATA_ARRIVED,t)},r.prototype._onTimedID3Metadata=function(t){var i=this._remuxer.getTimestampBase();i!=null&&(t.pts!=null&&(t.pts-=i),t.dts!=null&&(t.dts-=i),this._emitter.emit(Le.a.TIMED_ID3_METADATA_ARRIVED,t))},r.prototype._onSMPTE2038Metadata=function(t){var i=this._remuxer.getTimestampBase();i!=null&&(t.pts!=null&&(t.pts-=i),t.dts!=null&&(t.dts-=i),t.nearest_pts!=null&&(t.nearest_pts-=i),this._emitter.emit(Le.a.SMPTE2038_METADATA_ARRIVED,t))},r.prototype._onSCTE35Metadata=function(t){var i=this._remuxer.getTimestampBase();i!=null&&(t.pts!=null&&(t.pts-=i),t.nearest_pts!=null&&(t.nearest_pts-=i),this._emitter.emit(Le.a.SCTE35_METADATA_ARRIVED,t))},r.prototype._onPESPrivateDataDescriptor=function(t){this._emitter.emit(Le.a.PES_PRIVATE_DATA_DESCRIPTOR,t)},r.prototype._onPESPrivateData=function(t){var i=this._remuxer.getTimestampBase();i!=null&&(t.pts!=null&&(t.pts-=i),t.nearest_pts!=null&&(t.nearest_pts-=i),t.dts!=null&&(t.dts-=i),this._emitter.emit(Le.a.PES_PRIVATE_DATA_ARRIVED,t))},r.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},r.prototype._onIOComplete=function(t){var i=t+1;i<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(i)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(Le.a.LOADING_COMPLETE),this._disableStatisticsReporter())},r.prototype._onIORedirect=function(t){var i=this._ioctl.extraData;this._mediaDataSource.segments[i].redirectedURL=t},r.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(Le.a.RECOVERED_EARLY_EOF)},r.prototype._onIOException=function(t,i){g.a.e(this.TAG,"IOException: type = "+t+", code = "+i.code+", msg = "+i.msg),this._emitter.emit(Le.a.IO_ERROR,t,i),this._disableStatisticsReporter()},r.prototype._onDemuxException=function(t,i){g.a.e(this.TAG,"DemuxException: type = "+t+", info = "+i),this._emitter.emit(Le.a.DEMUX_ERROR,t,i)},r.prototype._onRemuxerInitSegmentArrival=function(t,i){this._emitter.emit(Le.a.INIT_SEGMENT,t,i)},r.prototype._onRemuxerMediaSegmentArrival=function(t,i){if(this._pendingSeekTime==null&&(this._emitter.emit(Le.a.MEDIA_SEGMENT,t,i),this._pendingResolveSeekPoint!=null&&t==="video")){var e=i.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,v.a.safari&&e.length>0&&e[0].originalDts===n&&(n=e[0].pts),this._emitter.emit(Le.a.RECOMMEND_SEEKPOINT,n)}},r.prototype._enableStatisticsReporter=function(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},r.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},r.prototype._reportSegmentMediaInfo=function(t){var i=this._mediaInfo.segments[t],e=Object.assign({},i);e.duration=this._mediaInfo.duration,e.segmentCount=this._mediaInfo.segmentCount,delete e.segments,delete e.keyframesIndex,this._emitter.emit(Le.a.MEDIA_INFO,e)},r.prototype._reportStatisticsInfo=function(){var t={};t.url=this._ioctl.currentURL,t.hasRedirect=this._ioctl.hasRedirect,t.hasRedirect&&(t.redirectedURL=this._ioctl.currentRedirectedURL),t.speed=this._ioctl.currentSpeed,t.loaderType=this._ioctl.loaderType,t.currentSegmentIndex=this._currentSegmentIndex,t.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(Le.a.STATISTICS_INFO,t)},r}();Q.a=Dt},function(le,Q,I){var G,B=I(0),g=function(){function b(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return b.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},b.prototype.addBytes=function(_){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=_,this._totalBytes+=_):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=_,this._totalBytes+=_):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=_,this._totalBytes+=_,this._lastCheckpoint=this._now())},Object.defineProperty(b.prototype,"currentKBps",{get:function(){this.addBytes(0);var _=(this._now()-this._lastCheckpoint)/1e3;return _==0&&(_=1),this._intervalBytes/_/1024},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"averageKBps",{get:function(){var _=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/_/1024},enumerable:!1,configurable:!0}),b}(),v=I(2),p=I(4),f=I(3),R=(G=function(b,_){return(G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,u){h.__proto__=u}||function(h,u){for(var c in u)u.hasOwnProperty(c)&&(h[c]=u[c])})(b,_)},function(b,_){function h(){this.constructor=b}G(b,_),b.prototype=_===null?Object.create(_):(h.prototype=_.prototype,new h)}),x=function(b){function _(h,u){var c=b.call(this,"fetch-stream-loader")||this;return c.TAG="FetchStreamLoader",c._seekHandler=h,c._config=u,c._needStash=!0,c._requestAbort=!1,c._abortController=null,c._contentLength=null,c._receivedLength=0,c}return R(_,b),_.isSupported=function(){try{var h=p.a.msedge&&p.a.version.minor>=15048,u=!p.a.msedge||h;return self.fetch&&self.ReadableStream&&u}catch{return!1}},_.prototype.destroy=function(){this.isWorking()&&this.abort(),b.prototype.destroy.call(this)},_.prototype.open=function(h,u){var c=this;this._dataSource=h,this._range=u;var P=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(P=h.redirectedURL);var D=this._seekHandler.getConfig(P,u),V=new self.Headers;if(typeof D.headers=="object"){var te=D.headers;for(var fe in te)te.hasOwnProperty(fe)&&V.append(fe,te[fe])}var me={method:"GET",headers:V,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(var fe in this._config.headers)V.append(fe,this._config.headers[fe]);h.cors===!1&&(me.mode="same-origin"),h.withCredentials&&(me.credentials="include"),h.referrerPolicy&&(me.referrerPolicy=h.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,me.signal=this._abortController.signal),this._status=v.c.kConnecting,self.fetch(D.url,me).then(function(L){if(c._requestAbort)return c._status=v.c.kIdle,void L.body.cancel();if(L.ok&&L.status>=200&&L.status<=299){if(L.url!==D.url&&c._onURLRedirect){var d=c._seekHandler.removeURLParameters(L.url);c._onURLRedirect(d)}var l=L.headers.get("Content-Length");return l!=null&&(c._contentLength=parseInt(l),c._contentLength!==0&&c._onContentLengthKnown&&c._onContentLengthKnown(c._contentLength)),c._pump.call(c,L.body.getReader())}if(c._status=v.c.kError,!c._onError)throw new f.d("FetchStreamLoader: Http code invalid, "+L.status+" "+L.statusText);c._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:L.status,msg:L.statusText})}).catch(function(L){if(!c._abortController||!c._abortController.signal.aborted){if(c._status=v.c.kError,!c._onError)throw L;c._onError(v.b.EXCEPTION,{code:-1,msg:L.message})}})},_.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==v.c.kBuffering||!p.a.chrome)&&this._abortController)try{this._abortController.abort()}catch{}},_.prototype._pump=function(h){var u=this;return h.read().then(function(c){if(c.done)if(u._contentLength!==null&&u._receivedLength<u._contentLength){u._status=v.c.kError;var P=v.b.EARLY_EOF,D={code:-1,msg:"Fetch stream meet Early-EOF"};if(!u._onError)throw new f.d(D.msg);u._onError(P,D)}else u._status=v.c.kComplete,u._onComplete&&u._onComplete(u._range.from,u._range.from+u._receivedLength-1);else{if(u._abortController&&u._abortController.signal.aborted)return void(u._status=v.c.kComplete);if(u._requestAbort===!0)return u._status=v.c.kComplete,h.cancel();u._status=v.c.kBuffering;var V=c.value.buffer,te=u._range.from+u._receivedLength;u._receivedLength+=V.byteLength,u._onDataArrival&&u._onDataArrival(V,te,u._receivedLength),u._pump(h)}}).catch(function(c){if(u._abortController&&u._abortController.signal.aborted)u._status=v.c.kComplete;else if(c.code!==11||!p.a.msedge){u._status=v.c.kError;var P=0,D=null;if(c.code!==19&&c.message!=="network error"||!(u._contentLength===null||u._contentLength!==null&&u._receivedLength<u._contentLength)?(P=v.b.EXCEPTION,D={code:c.code,msg:c.message}):(P=v.b.EARLY_EOF,D={code:c.code,msg:"Fetch stream meet Early-EOF"}),!u._onError)throw new f.d(D.msg);u._onError(P,D)}})},_}(v.a),C=function(){var b=function(_,h){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,c){u.__proto__=c}||function(u,c){for(var P in c)c.hasOwnProperty(P)&&(u[P]=c[P])})(_,h)};return function(_,h){function u(){this.constructor=_}b(_,h),_.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}}(),j=function(b){function _(h,u){var c=b.call(this,"xhr-moz-chunked-loader")||this;return c.TAG="MozChunkedLoader",c._seekHandler=h,c._config=u,c._needStash=!0,c._xhr=null,c._requestAbort=!1,c._contentLength=null,c._receivedLength=0,c}return C(_,b),_.isSupported=function(){try{var h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="moz-chunked-arraybuffer",h.responseType==="moz-chunked-arraybuffer"}catch(u){return B.a.w("MozChunkedLoader",u.message),!1}},_.prototype.destroy=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),b.prototype.destroy.call(this)},_.prototype.open=function(h,u){this._dataSource=h,this._range=u;var c=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(c=h.redirectedURL);var P=this._seekHandler.getConfig(c,u);this._requestURL=P.url;var D=this._xhr=new XMLHttpRequest;if(D.open("GET",P.url,!0),D.responseType="moz-chunked-arraybuffer",D.onreadystatechange=this._onReadyStateChange.bind(this),D.onprogress=this._onProgress.bind(this),D.onloadend=this._onLoadEnd.bind(this),D.onerror=this._onXhrError.bind(this),h.withCredentials&&(D.withCredentials=!0),typeof P.headers=="object"){var V=P.headers;for(var te in V)V.hasOwnProperty(te)&&D.setRequestHeader(te,V[te])}if(typeof this._config.headers=="object"){V=this._config.headers;for(var te in V)V.hasOwnProperty(te)&&D.setRequestHeader(te,V[te])}this._status=v.c.kConnecting,D.send()},_.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=v.c.kComplete},_.prototype._onReadyStateChange=function(h){var u=h.target;if(u.readyState===2){if(u.responseURL!=null&&u.responseURL!==this._requestURL&&this._onURLRedirect){var c=this._seekHandler.removeURLParameters(u.responseURL);this._onURLRedirect(c)}if(u.status!==0&&(u.status<200||u.status>299)){if(this._status=v.c.kError,!this._onError)throw new f.d("MozChunkedLoader: Http code invalid, "+u.status+" "+u.statusText);this._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:u.status,msg:u.statusText})}else this._status=v.c.kBuffering}},_.prototype._onProgress=function(h){if(this._status!==v.c.kError){this._contentLength===null&&h.total!==null&&h.total!==0&&(this._contentLength=h.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var u=h.target.response,c=this._range.from+this._receivedLength;this._receivedLength+=u.byteLength,this._onDataArrival&&this._onDataArrival(u,c,this._receivedLength)}},_.prototype._onLoadEnd=function(h){this._requestAbort!==!0?this._status!==v.c.kError&&(this._status=v.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},_.prototype._onXhrError=function(h){this._status=v.c.kError;var u=0,c=null;if(this._contentLength&&h.loaded<this._contentLength?(u=v.b.EARLY_EOF,c={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(u=v.b.EXCEPTION,c={code:-1,msg:h.constructor.name+" "+h.type}),!this._onError)throw new f.d(c.msg);this._onError(u,c)},_}(v.a),z=function(){var b=function(_,h){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,c){u.__proto__=c}||function(u,c){for(var P in c)c.hasOwnProperty(P)&&(u[P]=c[P])})(_,h)};return function(_,h){function u(){this.constructor=_}b(_,h),_.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}}(),ue=function(b){function _(h,u){var c=b.call(this,"xhr-range-loader")||this;return c.TAG="RangeLoader",c._seekHandler=h,c._config=u,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 g,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 z(_,b),_.isSupported=function(){try{var h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="arraybuffer",h.responseType==="arraybuffer"}catch(u){return B.a.w("RangeLoader",u.message),!1}},_.prototype.destroy=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),b.prototype.destroy.call(this)},Object.defineProperty(_.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),_.prototype.open=function(h,u){this._dataSource=h,this._range=u,this._status=v.c.kConnecting;var c=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(c=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||c?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},_.prototype._openSubRange=function(){var h=1024*this._currentChunkSizeKB,u=this._range.from+this._receivedLength,c=u+h;this._contentLength!=null&&c-this._range.from>=this._contentLength&&(c=this._range.from+this._contentLength-1),this._currentRequestRange={from:u,to:c},this._internalOpen(this._dataSource,this._currentRequestRange)},_.prototype._internalOpen=function(h,u){this._lastTimeLoaded=0;var c=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?c=this._currentRedirectedURL:h.redirectedURL!=null&&(c=h.redirectedURL));var P=this._seekHandler.getConfig(c,u);this._currentRequestURL=P.url;var D=this._xhr=new XMLHttpRequest;if(D.open("GET",P.url,!0),D.responseType="arraybuffer",D.onreadystatechange=this._onReadyStateChange.bind(this),D.onprogress=this._onProgress.bind(this),D.onload=this._onLoad.bind(this),D.onerror=this._onXhrError.bind(this),h.withCredentials&&(D.withCredentials=!0),typeof P.headers=="object"){var V=P.headers;for(var te in V)V.hasOwnProperty(te)&&D.setRequestHeader(te,V[te])}if(typeof this._config.headers=="object"){V=this._config.headers;for(var te in V)V.hasOwnProperty(te)&&D.setRequestHeader(te,V[te])}D.send()},_.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=v.c.kComplete},_.prototype._internalAbort=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)},_.prototype._onReadyStateChange=function(h){var u=h.target;if(u.readyState===2){if(u.responseURL!=null){var c=this._seekHandler.removeURLParameters(u.responseURL);u.responseURL!==this._currentRequestURL&&c!==this._currentRedirectedURL&&(this._currentRedirectedURL=c,this._onURLRedirect&&this._onURLRedirect(c))}if(u.status>=200&&u.status<=299){if(this._waitForTotalLength)return;this._status=v.c.kBuffering}else{if(this._status=v.c.kError,!this._onError)throw new f.d("RangeLoader: Http code invalid, "+u.status+" "+u.statusText);this._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:u.status,msg:u.statusText})}}},_.prototype._onProgress=function(h){if(this._status!==v.c.kError){if(this._contentLength===null){var u=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,u=!0;var c=h.total;this._internalAbort(),c!=null&c!==0&&(this._totalLength=c)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,u)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var P=h.loaded-this._lastTimeLoaded;this._lastTimeLoaded=h.loaded,this._speedSampler.addBytes(P)}},_.prototype._normalizeSpeed=function(h){var u=this._chunkSizeKBList,c=u.length-1,P=0,D=0,V=c;if(h<u[0])return u[0];for(;D<=V;){if((P=D+Math.floor((V-D)/2))===c||h>=u[P]&&h<u[P+1])return u[P];u[P]<h?D=P+1:V=P-1}},_.prototype._onLoad=function(h){if(this._status!==v.c.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var u=this._speedSampler.lastSecondKBps;if(u===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(u=this._speedSampler.currentKBps)),u!==0){var c=this._normalizeSpeed(u);this._currentSpeedNormalized!==c&&(this._currentSpeedNormalized=c,this._currentChunkSizeKB=c)}var P=h.target.response,D=this._range.from+this._receivedLength;this._receivedLength+=P.byteLength;var V=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():V=!0,this._onDataArrival&&this._onDataArrival(P,D,this._receivedLength),V&&(this._status=v.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},_.prototype._onXhrError=function(h){this._status=v.c.kError;var u=0,c=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(u=v.b.EARLY_EOF,c={code:-1,msg:"RangeLoader meet Early-Eof"}):(u=v.b.EXCEPTION,c={code:-1,msg:h.constructor.name+" "+h.type}),!this._onError)throw new f.d(c.msg);this._onError(u,c)},_}(v.a),se=function(){var b=function(_,h){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,c){u.__proto__=c}||function(u,c){for(var P in c)c.hasOwnProperty(P)&&(u[P]=c[P])})(_,h)};return function(_,h){function u(){this.constructor=_}b(_,h),_.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}}(),$=function(b){function _(){var h=b.call(this,"websocket-loader")||this;return h.TAG="WebSocketLoader",h._needStash=!0,h._ws=null,h._requestAbort=!1,h._receivedLength=0,h}return se(_,b),_.isSupported=function(){try{return self.WebSocket!==void 0}catch{return!1}},_.prototype.destroy=function(){this._ws&&this.abort(),b.prototype.destroy.call(this)},_.prototype.open=function(h){try{var u=this._ws=new self.WebSocket(h.url);u.binaryType="arraybuffer",u.onopen=this._onWebSocketOpen.bind(this),u.onclose=this._onWebSocketClose.bind(this),u.onmessage=this._onWebSocketMessage.bind(this),u.onerror=this._onWebSocketError.bind(this),this._status=v.c.kConnecting}catch(P){this._status=v.c.kError;var c={code:P.code,msg:P.message};if(!this._onError)throw new f.d(c.msg);this._onError(v.b.EXCEPTION,c)}},_.prototype.abort=function(){var h=this._ws;!h||h.readyState!==0&&h.readyState!==1||(this._requestAbort=!0,h.close()),this._ws=null,this._status=v.c.kComplete},_.prototype._onWebSocketOpen=function(h){this._status=v.c.kBuffering},_.prototype._onWebSocketClose=function(h){this._requestAbort!==!0?(this._status=v.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},_.prototype._onWebSocketMessage=function(h){var u=this;if(h.data instanceof ArrayBuffer)this._dispatchArrayBuffer(h.data);else if(h.data instanceof Blob){var c=new FileReader;c.onload=function(){u._dispatchArrayBuffer(c.result)},c.readAsArrayBuffer(h.data)}else{this._status=v.c.kError;var P={code:-1,msg:"Unsupported WebSocket message type: "+h.data.constructor.name};if(!this._onError)throw new f.d(P.msg);this._onError(v.b.EXCEPTION,P)}},_.prototype._dispatchArrayBuffer=function(h){var u=h,c=this._receivedLength;this._receivedLength+=u.byteLength,this._onDataArrival&&this._onDataArrival(u,c,this._receivedLength)},_.prototype._onWebSocketError=function(h){this._status=v.c.kError;var u={code:h.code,msg:h.message};if(!this._onError)throw new f.d(u.msg);this._onError(v.b.EXCEPTION,u)},_}(v.a),ne=function(){function b(_){this._zeroStart=_||!1}return b.prototype.getConfig=function(_,h){var u={};if(h.from!==0||h.to!==-1){var c=void 0;c=h.to!==-1?"bytes="+h.from.toString()+"-"+h.to.toString():"bytes="+h.from.toString()+"-",u.Range=c}else this._zeroStart&&(u.Range="bytes=0-");return{url:_,headers:u}},b.prototype.removeURLParameters=function(_){return _},b}(),m=function(){function b(_,h){this._startName=_,this._endName=h}return b.prototype.getConfig=function(_,h){var u=_;if(h.from!==0||h.to!==-1){var c=!0;u.indexOf("?")===-1&&(u+="?",c=!1),c&&(u+="&"),u+=this._startName+"="+h.from.toString(),h.to!==-1&&(u+="&"+this._endName+"="+h.to.toString())}return{url:u,headers:{}}},b.prototype.removeURLParameters=function(_){var h=_.split("?")[0],u=void 0,c=_.indexOf("?");c!==-1&&(u=_.substring(c+1));var P="";if(u!=null&&u.length>0)for(var D=u.split("&"),V=0;V<D.length;V++){var te=D[V].split("="),fe=V>0;te[0]!==this._startName&&te[0]!==this._endName&&(fe&&(P+="&"),P+=D[V])}return P.length===0?h:h+"?"+P},b}(),N=function(){function b(_,h,u){this.TAG="IOController",this._config=h,this._extraData=u,this._stashInitialSize=65536,h.stashInitialSize!=null&&h.stashInitialSize>0&&(this._stashInitialSize=h.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,h.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=_,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(_.url),this._refTotalLength=_.filesize?_.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new g,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return b.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},b.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},b.prototype.isPaused=function(){return this._paused},Object.defineProperty(b.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"extraData",{get:function(){return this._extraData},set:function(_){this._extraData=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(_){this._onDataArrival=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(_){this._onSeeked=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"onError",{get:function(){return this._onError},set:function(_){this._onError=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"onComplete",{get:function(){return this._onComplete},set:function(_){this._onComplete=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(_){this._onRedirect=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(_){this._onRecoveredEarlyEof=_},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasRedirect",{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentSpeed",{get:function(){return this._loaderClass===ue?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),b.prototype._selectSeekHandler=function(){var _=this._config;if(_.seekType==="range")this._seekHandler=new ne(this._config.rangeLoadZeroStart);else if(_.seekType==="param"){var h=_.seekParamStart||"bstart",u=_.seekParamEnd||"bend";this._seekHandler=new m(h,u)}else{if(_.seekType!=="custom")throw new f.b("Invalid seekType in config: "+_.seekType);if(typeof _.customSeekHandler!="function")throw new f.b("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new _.customSeekHandler}},b.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=$;else if(x.isSupported())this._loaderClass=x;else if(j.isSupported())this._loaderClass=j;else{if(!ue.isSupported())throw new f.d("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=ue}},b.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(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)},b.prototype.open=function(_){this._currentRange={from:0,to:-1},_&&(this._currentRange.from=_),this._speedSampler.reset(),_||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},b.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},b.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(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)},b.prototype.resume=function(){if(this._paused){this._paused=!1;var _=this._resumeFrom;this._resumeFrom=0,this._internalSeek(_,!0)}},b.prototype.seek=function(_){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(_,!0)},b.prototype._internalSeek=function(_,h){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(h),this._loader.destroy(),this._loader=null;var u={from:_,to:-1};this._currentRange={from:u.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,u),this._onSeeked&&this._onSeeked()},b.prototype.updateUrl=function(_){if(!_||typeof _!="string"||_.length===0)throw new f.b("Url must be a non-empty string!");this._dataSource.url=_},b.prototype._expandBuffer=function(_){for(var h=this._stashSize;h+1048576<_;)h*=2;if((h+=1048576)!==this._bufferSize){var u=new ArrayBuffer(h);if(this._stashUsed>0){var c=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(u,0,h).set(c,0)}this._stashBuffer=u,this._bufferSize=h}},b.prototype._normalizeSpeed=function(_){var h=this._speedNormalizeList,u=h.length-1,c=0,P=0,D=u;if(_<h[0])return h[0];for(;P<=D;){if((c=P+Math.floor((D-P)/2))===u||_>=h[c]&&_<h[c+1])return h[c];h[c]<_?P=c+1:D=c-1}},b.prototype._adjustStashSize=function(_){var h=0;(h=this._config.isLive?_/8:_<512?_:_>=512&&_<=1024?Math.floor(1.5*_):2*_)>8192&&(h=8192);var u=1024*h+1048576;this._bufferSize<u&&this._expandBuffer(u),this._stashSize=1024*h},b.prototype._dispatchChunks=function(_,h){return this._currentRange.to=h+_.byteLength-1,this._onDataArrival(_,h)},b.prototype._onURLRedirect=function(_){this._redirectedURL=_,this._onRedirect&&this._onRedirect(_)},b.prototype._onContentLengthKnown=function(_){_&&this._fullRequestFlag&&(this._totalLength=_,this._fullRequestFlag=!1)},b.prototype._onLoaderChunkArrival=function(_,h,u){if(!this._onDataArrival)throw new f.a("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(_.byteLength);var c=this._speedSampler.lastSecondKBps;if(c!==0){var P=this._normalizeSpeed(c);this._speedNormalized!==P&&(this._speedNormalized=P,this._adjustStashSize(P))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=h),this._stashUsed+_.byteLength<=this._stashSize)(te=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(_),this._stashUsed),this._stashUsed+=_.byteLength;else if(te=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var D=this._stashBuffer.slice(0,this._stashUsed);(fe=this._dispatchChunks(D,this._stashByteStart))<D.byteLength?fe>0&&(me=new Uint8Array(D,fe),te.set(me,0),this._stashUsed=me.byteLength,this._stashByteStart+=fe):(this._stashUsed=0,this._stashByteStart+=fe),this._stashUsed+_.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+_.byteLength),te=new Uint8Array(this._stashBuffer,0,this._bufferSize)),te.set(new Uint8Array(_),this._stashUsed),this._stashUsed+=_.byteLength}else(fe=this._dispatchChunks(_,h))<_.byteLength&&((V=_.byteLength-fe)>this._bufferSize&&(this._expandBuffer(V),te=new Uint8Array(this._stashBuffer,0,this._bufferSize)),te.set(new Uint8Array(_,fe),0),this._stashUsed+=V,this._stashByteStart=h+fe);else if(this._stashUsed===0){var V;(fe=this._dispatchChunks(_,h))<_.byteLength&&((V=_.byteLength-fe)>this._bufferSize&&this._expandBuffer(V),(te=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(_,fe),0),this._stashUsed+=V,this._stashByteStart=h+fe)}else{var te,fe;if(this._stashUsed+_.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+_.byteLength),(te=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(_),this._stashUsed),this._stashUsed+=_.byteLength,(fe=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&fe>0){var me=new Uint8Array(this._stashBuffer,fe);te.set(me,0)}this._stashUsed-=fe,this._stashByteStart+=fe}}},b.prototype._flushStashBuffer=function(_){if(this._stashUsed>0){var h=this._stashBuffer.slice(0,this._stashUsed),u=this._dispatchChunks(h,this._stashByteStart),c=h.byteLength-u;if(u<h.byteLength){if(!_){if(u>0){var P=new Uint8Array(this._stashBuffer,0,this._bufferSize),D=new Uint8Array(h,u);P.set(D,0),this._stashUsed=D.byteLength,this._stashByteStart+=u}return 0}B.a.w(this.TAG,c+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,c}return 0},b.prototype._onLoaderComplete=function(_,h){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},b.prototype._onLoaderError=function(_,h){switch(B.a.e(this.TAG,"Loader error, code = "+h.code+", msg = "+h.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,_=v.b.UNRECOVERABLE_EARLY_EOF),_){case v.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var u=this._currentRange.to+1;return void(u<this._totalLength&&(B.a.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(u,!1)))}_=v.b.UNRECOVERABLE_EARLY_EOF;break;case v.b.UNRECOVERABLE_EARLY_EOF:case v.b.CONNECTING_TIMEOUT:case v.b.HTTP_STATUS_CODE_INVALID:case v.b.EXCEPTION:}if(!this._onError)throw new f.d("IOException: "+h.msg);this._onError(_,h)},b}();Q.a=N},function(le,Q,I){var G=function(){function B(){}return B.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(g,v){return g.__proto__=v,g},Object.assign=Object.assign||function(g){if(g==null)throw new TypeError("Cannot convert undefined or null to object");for(var v=Object(g),p=1;p<arguments.length;p++){var f=arguments[p];if(f!=null)for(var R in f)f.hasOwnProperty(R)&&(v[R]=f[R])}return v},typeof self.Promise!="function"&&I(15).polyfill()},B}();G.install(),Q.a=G},function(le,Q,I){function G(p){var f={};function R(C){if(f[C])return f[C].exports;var j=f[C]={i:C,l:!1,exports:{}};return p[C].call(j.exports,j,j.exports,R),j.l=!0,j.exports}R.m=p,R.c=f,R.i=function(C){return C},R.d=function(C,j,z){R.o(C,j)||Object.defineProperty(C,j,{configurable:!1,enumerable:!0,get:z})},R.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},R.n=function(C){var j=C&&C.__esModule?function(){return C.default}:function(){return C};return R.d(j,"a",j),j},R.o=function(C,j){return Object.prototype.hasOwnProperty.call(C,j)},R.p="/",R.oe=function(C){throw console.error(C),C};var x=R(R.s=ENTRY_MODULE);return x.default||x}function B(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function g(p,f,R){var x={};x[R]=[];var C=f.toString(),j=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!j)return x;for(var z,ue=j[1],se=new RegExp("(\\\\n|\\W)"+B(ue)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");z=se.exec(C);)z[3]!=="dll-reference"&&x[R].push(z[3]);for(se=new RegExp("\\("+B(ue)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");z=se.exec(C);)p[z[2]]||(x[R].push(z[1]),p[z[2]]=I(z[1]).m),x[z[2]]=x[z[2]]||[],x[z[2]].push(z[4]);for(var $,ne=Object.keys(x),m=0;m<ne.length;m++)for(var N=0;N<x[ne[m]].length;N++)$=x[ne[m]][N],isNaN(1*$)||(x[ne[m]][N]=1*x[ne[m]][N]);return x}function v(p){return Object.keys(p).reduce(function(f,R){return f||p[R].length>0},!1)}le.exports=function(p,f){f=f||{};var R={main:I.m},x=f.all?{main:Object.keys(R.main)}:function(se,$){for(var ne={main:[$]},m={main:[]},N={main:{}};v(ne);)for(var b=Object.keys(ne),_=0;_<b.length;_++){var h=b[_],u=ne[h].pop();if(N[h]=N[h]||{},!N[h][u]&&se[h][u]){N[h][u]=!0,m[h]=m[h]||[],m[h].push(u);for(var c=g(se,se[h][u],h),P=Object.keys(c),D=0;D<P.length;D++)ne[P[D]]=ne[P[D]]||[],ne[P[D]]=ne[P[D]].concat(c[P[D]])}}return m}(R,p),C="";Object.keys(x).filter(function(se){return se!=="main"}).forEach(function(se){for(var $=0;x[se][$];)$++;x[se].push($),R[se][$]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+se+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify($))+")({"+x[se].map(function(ne){return JSON.stringify(ne)+": "+R[se][ne].toString()}).join(",")+`});
|
|
`}),C=C+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+x.main.map(function(se){return JSON.stringify(se)+": "+R.main[se].toString()}).join(",")+"}))(self);";var j=new window.Blob([C],{type:"text/javascript"});if(f.bare)return j;var z=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(j),ue=new window.Worker(z);return ue.objectURL=z,ue}},function(le,Q,I){le.exports=I(19).default},function(le,Q,I){(function(G,B){/*!
|
|
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
* @license Licensed under MIT license
|
|
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
|
* @version v4.2.8+1e68dce6
|
|
*/var g;g=function(){function v(M){return typeof M=="function"}var p=Array.isArray?Array.isArray:function(M){return Object.prototype.toString.call(M)==="[object Array]"},f=0,R=void 0,x=void 0,C=function(M,F){m[f]=M,m[f+1]=F,(f+=2)===2&&(x?x(N):c())},j=typeof window!="undefined"?window:void 0,z=j||{},ue=z.MutationObserver||z.WebKitMutationObserver,se=typeof self=="undefined"&&G!==void 0&&{}.toString.call(G)==="[object process]",$=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function ne(){var M=setTimeout;return function(){return M(N,1)}}var m=new Array(1e3);function N(){for(var M=0;M<f;M+=2)(0,m[M])(m[M+1]),m[M]=void 0,m[M+1]=void 0;f=0}var b,_,h,u,c=void 0;function P(M,F){var ee=this,J=new this.constructor(te);J[V]===void 0&&Re(J);var ie=ee._state;if(ie){var ce=arguments[ie-1];C(function(){return ae(ie,J,ce,ee._result)})}else S(ee,J,M,F);return J}function D(M){if(M&&typeof M=="object"&&M.constructor===this)return M;var F=new this(te);return me(F,M),F}se?c=function(){return G.nextTick(N)}:ue?(_=0,h=new ue(N),u=document.createTextNode(""),h.observe(u,{characterData:!0}),c=function(){u.data=_=++_%2}):$?((b=new MessageChannel).port1.onmessage=N,c=function(){return b.port2.postMessage(0)}):c=j===void 0?function(){try{var M=Function("return this")().require("vertx");return(R=M.runOnLoop||M.runOnContext)!==void 0?function(){R(N)}:ne()}catch{return ne()}}():ne();var V=Math.random().toString(36).substring(2);function te(){}function fe(M,F,ee){F.constructor===M.constructor&&ee===P&&F.constructor.resolve===D?function(J,ie){ie._state===1?d(J,ie._result):ie._state===2?l(J,ie._result):S(ie,void 0,function(ce){return me(J,ce)},function(ce){return l(J,ce)})}(M,F):ee===void 0?d(M,F):v(ee)?function(J,ie,ce){C(function(Te){var ke=!1,Oe=function(Ie,Xe,Ye,Ze){try{Ie.call(Xe,Ye,Ze)}catch(Je){return Je}}(ce,ie,function(Ie){ke||(ke=!0,ie!==Ie?me(Te,Ie):d(Te,Ie))},function(Ie){ke||(ke=!0,l(Te,Ie))},Te._label);!ke&&Oe&&(ke=!0,l(Te,Oe))},J)}(M,F,ee):d(M,F)}function me(M,F){if(M===F)l(M,new TypeError("You cannot resolve a promise with itself"));else if(ie=typeof(J=F),J===null||ie!=="object"&&ie!=="function")d(M,F);else{var ee=void 0;try{ee=F.then}catch(ce){return void l(M,ce)}fe(M,F,ee)}var J,ie}function L(M){M._onerror&&M._onerror(M._result),W(M)}function d(M,F){M._state===void 0&&(M._result=F,M._state=1,M._subscribers.length!==0&&C(W,M))}function l(M,F){M._state===void 0&&(M._state=2,M._result=F,C(L,M))}function S(M,F,ee,J){var ie=M._subscribers,ce=ie.length;M._onerror=null,ie[ce]=F,ie[ce+1]=ee,ie[ce+2]=J,ce===0&&M._state&&C(W,M)}function W(M){var F=M._subscribers,ee=M._state;if(F.length!==0){for(var J=void 0,ie=void 0,ce=M._result,Te=0;Te<F.length;Te+=3)J=F[Te],ie=F[Te+ee],J?ae(ee,J,ie,ce):ie(ce);M._subscribers.length=0}}function ae(M,F,ee,J){var ie=v(ee),ce=void 0,Te=void 0,ke=!0;if(ie){try{ce=ee(J)}catch(Oe){ke=!1,Te=Oe}if(F===ce)return void l(F,new TypeError("A promises callback cannot return that same promise."))}else ce=J;F._state!==void 0||(ie&&ke?me(F,ce):ke===!1?l(F,Te):M===1?d(F,ce):M===2&&l(F,ce))}var he=0;function Re(M){M[V]=he++,M._state=void 0,M._result=void 0,M._subscribers=[]}var Be=function(){function M(F,ee){this._instanceConstructor=F,this.promise=new F(te),this.promise[V]||Re(this.promise),p(ee)?(this.length=ee.length,this._remaining=ee.length,this._result=new Array(this.length),this.length===0?d(this.promise,this._result):(this.length=this.length||0,this._enumerate(ee),this._remaining===0&&d(this.promise,this._result))):l(this.promise,new Error("Array Methods must be provided an Array"))}return M.prototype._enumerate=function(F){for(var ee=0;this._state===void 0&&ee<F.length;ee++)this._eachEntry(F[ee],ee)},M.prototype._eachEntry=function(F,ee){var J=this._instanceConstructor,ie=J.resolve;if(ie===D){var ce=void 0,Te=void 0,ke=!1;try{ce=F.then}catch(Ie){ke=!0,Te=Ie}if(ce===P&&F._state!==void 0)this._settledAt(F._state,ee,F._result);else if(typeof ce!="function")this._remaining--,this._result[ee]=F;else if(J===Ae){var Oe=new J(te);ke?l(Oe,Te):fe(Oe,F,ce),this._willSettleAt(Oe,ee)}else this._willSettleAt(new J(function(Ie){return Ie(F)}),ee)}else this._willSettleAt(ie(F),ee)},M.prototype._settledAt=function(F,ee,J){var ie=this.promise;ie._state===void 0&&(this._remaining--,F===2?l(ie,J):this._result[ee]=J),this._remaining===0&&d(ie,this._result)},M.prototype._willSettleAt=function(F,ee){var J=this;S(F,void 0,function(ie){return J._settledAt(1,ee,ie)},function(ie){return J._settledAt(2,ee,ie)})},M}(),Ae=function(){function M(F){this[V]=he++,this._result=this._state=void 0,this._subscribers=[],te!==F&&(typeof F!="function"&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof M?function(ee,J){try{J(function(ie){me(ee,ie)},function(ie){l(ee,ie)})}catch(ie){l(ee,ie)}}(this,F):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return M.prototype.catch=function(F){return this.then(null,F)},M.prototype.finally=function(F){var ee=this.constructor;return v(F)?this.then(function(J){return ee.resolve(F()).then(function(){return J})},function(J){return ee.resolve(F()).then(function(){throw J})}):this.then(F,F)},M}();return Ae.prototype.then=P,Ae.all=function(M){return new Be(this,M).promise},Ae.race=function(M){var F=this;return p(M)?new F(function(ee,J){for(var ie=M.length,ce=0;ce<ie;ce++)F.resolve(M[ce]).then(ee,J)}):new F(function(ee,J){return J(new TypeError("You must pass an array to race."))})},Ae.resolve=D,Ae.reject=function(M){var F=new this(te);return l(F,M),F},Ae._setScheduler=function(M){x=M},Ae._setAsap=function(M){C=M},Ae._asap=C,Ae.polyfill=function(){var M=void 0;if(B!==void 0)M=B;else if(typeof self!="undefined")M=self;else try{M=Function("return this")()}catch{throw new Error("polyfill failed because global object is unavailable in this environment")}var F=M.Promise;if(F){var ee=null;try{ee=Object.prototype.toString.call(F.resolve())}catch{}if(ee==="[object Promise]"&&!F.cast)return}M.Promise=Ae},Ae.Promise=Ae,Ae},le.exports=g()}).call(this,I(16),I(17))},function(le,Q){var I,G,B=le.exports={};function g(){throw new Error("setTimeout has not been defined")}function v(){throw new Error("clearTimeout has not been defined")}function p($){if(I===setTimeout)return setTimeout($,0);if((I===g||!I)&&setTimeout)return I=setTimeout,setTimeout($,0);try{return I($,0)}catch{try{return I.call(null,$,0)}catch{return I.call(this,$,0)}}}(function(){try{I=typeof setTimeout=="function"?setTimeout:g}catch{I=g}try{G=typeof clearTimeout=="function"?clearTimeout:v}catch{G=v}})();var f,R=[],x=!1,C=-1;function j(){x&&f&&(x=!1,f.length?R=f.concat(R):C=-1,R.length&&z())}function z(){if(!x){var $=p(j);x=!0;for(var ne=R.length;ne;){for(f=R,R=[];++C<ne;)f&&f[C].run();C=-1,ne=R.length}f=null,x=!1,function(m){if(G===clearTimeout)return clearTimeout(m);if((G===v||!G)&&clearTimeout)return G=clearTimeout,clearTimeout(m);try{G(m)}catch{try{return G.call(null,m)}catch{return G.call(this,m)}}}($)}}function ue($,ne){this.fun=$,this.array=ne}function se(){}B.nextTick=function($){var ne=new Array(arguments.length-1);if(arguments.length>1)for(var m=1;m<arguments.length;m++)ne[m-1]=arguments[m];R.push(new ue($,ne)),R.length!==1||x||p(z)},ue.prototype.run=function(){this.fun.apply(null,this.array)},B.title="browser",B.browser=!0,B.env={},B.argv=[],B.version="",B.versions={},B.on=se,B.addListener=se,B.once=se,B.off=se,B.removeListener=se,B.removeAllListeners=se,B.emit=se,B.prependListener=se,B.prependOnceListener=se,B.listeners=function($){return[]},B.binding=function($){throw new Error("process.binding is not supported")},B.cwd=function(){return"/"},B.chdir=function($){throw new Error("process.chdir is not supported")},B.umask=function(){return 0}},function(le,Q){var I;I=function(){return this}();try{I=I||new Function("return this")()}catch{typeof window=="object"&&(I=window)}le.exports=I},function(le,Q,I){I.r(Q);var G=I(9),B=I(12),g=I(10),v=I(1);Q.default=function(p){var f=null,R=function(D,V){p.postMessage({msg:"logcat_callback",data:{type:D,logcat:V}})}.bind(this);function x(D,V){var te={msg:v.a.INIT_SEGMENT,data:{type:D,data:V}};p.postMessage(te,[V.data])}function C(D,V){var te={msg:v.a.MEDIA_SEGMENT,data:{type:D,data:V}};p.postMessage(te,[V.data])}function j(){var D={msg:v.a.LOADING_COMPLETE};p.postMessage(D)}function z(){var D={msg:v.a.RECOVERED_EARLY_EOF};p.postMessage(D)}function ue(D){var V={msg:v.a.MEDIA_INFO,data:D};p.postMessage(V)}function se(D){var V={msg:v.a.METADATA_ARRIVED,data:D};p.postMessage(V)}function $(D){var V={msg:v.a.SCRIPTDATA_ARRIVED,data:D};p.postMessage(V)}function ne(D){var V={msg:v.a.TIMED_ID3_METADATA_ARRIVED,data:D};p.postMessage(V)}function m(D){var V={msg:v.a.SMPTE2038_METADATA_ARRIVED,data:D};p.postMessage(V)}function N(D){var V={msg:v.a.SCTE35_METADATA_ARRIVED,data:D};p.postMessage(V)}function b(D){var V={msg:v.a.PES_PRIVATE_DATA_DESCRIPTOR,data:D};p.postMessage(V)}function _(D){var V={msg:v.a.PES_PRIVATE_DATA_ARRIVED,data:D};p.postMessage(V)}function h(D){var V={msg:v.a.STATISTICS_INFO,data:D};p.postMessage(V)}function u(D,V){p.postMessage({msg:v.a.IO_ERROR,data:{type:D,info:V}})}function c(D,V){p.postMessage({msg:v.a.DEMUX_ERROR,data:{type:D,info:V}})}function P(D){p.postMessage({msg:v.a.RECOMMEND_SEEKPOINT,data:D})}B.a.install(),p.addEventListener("message",function(D){switch(D.data.cmd){case"init":(f=new g.a(D.data.param[0],D.data.param[1])).on(v.a.IO_ERROR,u.bind(this)),f.on(v.a.DEMUX_ERROR,c.bind(this)),f.on(v.a.INIT_SEGMENT,x.bind(this)),f.on(v.a.MEDIA_SEGMENT,C.bind(this)),f.on(v.a.LOADING_COMPLETE,j.bind(this)),f.on(v.a.RECOVERED_EARLY_EOF,z.bind(this)),f.on(v.a.MEDIA_INFO,ue.bind(this)),f.on(v.a.METADATA_ARRIVED,se.bind(this)),f.on(v.a.SCRIPTDATA_ARRIVED,$.bind(this)),f.on(v.a.TIMED_ID3_METADATA_ARRIVED,ne.bind(this)),f.on(v.a.SMPTE2038_METADATA_ARRIVED,m.bind(this)),f.on(v.a.SCTE35_METADATA_ARRIVED,N.bind(this)),f.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR,b.bind(this)),f.on(v.a.PES_PRIVATE_DATA_ARRIVED,_.bind(this)),f.on(v.a.STATISTICS_INFO,h.bind(this)),f.on(v.a.RECOMMEND_SEEKPOINT,P.bind(this));break;case"destroy":f&&(f.destroy(),f=null),p.postMessage({msg:"destroyed"});break;case"start":f.start();break;case"stop":f.stop();break;case"seek":f.seek(D.data.param);break;case"pause":f.pause();break;case"resume":f.resume();break;case"logging_config":var V=D.data.param;G.a.applyConfig(V),V.enableCallback===!0?G.a.addLogListener(R):G.a.removeLogListener(R)}})}},function(le,Q,I){I.r(Q);var G=I(12),B=I(11),g={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function v(){return Object.assign({},g)}var p=function(){function L(){}return L.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},L.supportMSEH265Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"')},L.supportNetworkStreamIO=function(){var d=new B.a({},v()),l=d.loaderType;return d.destroy(),l=="fetch-stream-loader"||l=="xhr-moz-chunked-loader"},L.getNetworkLoaderTypeName=function(){var d=new B.a({},v()),l=d.loaderType;return d.destroy(),l},L.supportNativeMediaPlayback=function(d){L.videoElement==null&&(L.videoElement=window.document.createElement("video"));var l=L.videoElement.canPlayType(d);return l==="probably"||l=="maybe"},L.getFeatureList=function(){var d={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return d.msePlayback=L.supportMSEH264Playback(),d.networkStreamIO=L.supportNetworkStreamIO(),d.networkLoaderName=L.getNetworkLoaderTypeName(),d.mseLivePlayback=d.msePlayback&&d.networkStreamIO,d.mseH265Playback=L.supportMSEH265Playback(),d.nativeMP4H264Playback=L.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),d.nativeMP4H265Playback=L.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),d.nativeWebmVP8Playback=L.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),d.nativeWebmVP9Playback=L.supportNativeMediaPlayback('video/webm; codecs="vp9"'),d},L}(),f=I(2),R=I(6),x=I.n(R),C=I(0),j=I(4),z={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info"},ue=I(13),se=I.n(ue),$=I(9),ne=I(10),m=I(1),N=I(8),b=function(){function L(d,l){if(this.TAG="Transmuxer",this._emitter=new x.a,l.enableWorker&&typeof Worker!="undefined")try{this._worker=se()(18),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[d,l]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},$.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:$.a.getConfig()})}catch{C.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new ne.a(d,l)}else this._controller=new ne.a(d,l);if(this._controller){var S=this._controller;S.on(m.a.IO_ERROR,this._onIOError.bind(this)),S.on(m.a.DEMUX_ERROR,this._onDemuxError.bind(this)),S.on(m.a.INIT_SEGMENT,this._onInitSegment.bind(this)),S.on(m.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),S.on(m.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),S.on(m.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),S.on(m.a.MEDIA_INFO,this._onMediaInfo.bind(this)),S.on(m.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),S.on(m.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),S.on(m.a.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),S.on(m.a.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),S.on(m.a.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),S.on(m.a.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),S.on(m.a.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),S.on(m.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),S.on(m.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return L.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),$.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(d,l){this._emitter.addListener(d,l)},L.prototype.off=function(d,l){this._emitter.removeListener(d,l)},L.prototype.hasWorker=function(){return this._worker!=null},L.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},L.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},L.prototype.seek=function(d){this._worker?this._worker.postMessage({cmd:"seek",param:d}):this._controller.seek(d)},L.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},L.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},L.prototype._onInitSegment=function(d,l){var S=this;Promise.resolve().then(function(){S._emitter.emit(m.a.INIT_SEGMENT,d,l)})},L.prototype._onMediaSegment=function(d,l){var S=this;Promise.resolve().then(function(){S._emitter.emit(m.a.MEDIA_SEGMENT,d,l)})},L.prototype._onLoadingComplete=function(){var d=this;Promise.resolve().then(function(){d._emitter.emit(m.a.LOADING_COMPLETE)})},L.prototype._onRecoveredEarlyEof=function(){var d=this;Promise.resolve().then(function(){d._emitter.emit(m.a.RECOVERED_EARLY_EOF)})},L.prototype._onMediaInfo=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.MEDIA_INFO,d)})},L.prototype._onMetaDataArrived=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.METADATA_ARRIVED,d)})},L.prototype._onScriptDataArrived=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.SCRIPTDATA_ARRIVED,d)})},L.prototype._onTimedID3MetadataArrived=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.TIMED_ID3_METADATA_ARRIVED,d)})},L.prototype._onSMPTE2038MetadataArrived=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.SMPTE2038_METADATA_ARRIVED,d)})},L.prototype._onSCTE35MetadataArrived=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.SCTE35_METADATA_ARRIVED,d)})},L.prototype._onPESPrivateDataDescriptor=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.PES_PRIVATE_DATA_DESCRIPTOR,d)})},L.prototype._onPESPrivateDataArrived=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.PES_PRIVATE_DATA_ARRIVED,d)})},L.prototype._onStatisticsInfo=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.STATISTICS_INFO,d)})},L.prototype._onIOError=function(d,l){var S=this;Promise.resolve().then(function(){S._emitter.emit(m.a.IO_ERROR,d,l)})},L.prototype._onDemuxError=function(d,l){var S=this;Promise.resolve().then(function(){S._emitter.emit(m.a.DEMUX_ERROR,d,l)})},L.prototype._onRecommendSeekpoint=function(d){var l=this;Promise.resolve().then(function(){l._emitter.emit(m.a.RECOMMEND_SEEKPOINT,d)})},L.prototype._onLoggingConfigChanged=function(d){this._worker&&this._worker.postMessage({cmd:"logging_config",param:d})},L.prototype._onWorkerMessage=function(d){var l=d.data,S=l.data;if(l.msg==="destroyed"||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(l.msg){case m.a.INIT_SEGMENT:case m.a.MEDIA_SEGMENT:this._emitter.emit(l.msg,S.type,S.data);break;case m.a.LOADING_COMPLETE:case m.a.RECOVERED_EARLY_EOF:this._emitter.emit(l.msg);break;case m.a.MEDIA_INFO:Object.setPrototypeOf(S,N.a.prototype),this._emitter.emit(l.msg,S);break;case m.a.METADATA_ARRIVED:case m.a.SCRIPTDATA_ARRIVED:case m.a.TIMED_ID3_METADATA_ARRIVED:case m.a.SMPTE2038_METADATA_ARRIVED:case m.a.SCTE35_METADATA_ARRIVED:case m.a.PES_PRIVATE_DATA_DESCRIPTOR:case m.a.PES_PRIVATE_DATA_ARRIVED:case m.a.STATISTICS_INFO:this._emitter.emit(l.msg,S);break;case m.a.IO_ERROR:case m.a.DEMUX_ERROR:this._emitter.emit(l.msg,S.type,S.info);break;case m.a.RECOMMEND_SEEKPOINT:this._emitter.emit(l.msg,S);break;case"logcat_callback":C.a.emitter.emit("log",S.type,S.logcat)}},L}(),_={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"},h=I(7),u=I(3),c=function(){function L(d){this.TAG="MSEController",this._config=d,this._emitter=new x.a,this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new h.a}return L.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(d,l){this._emitter.addListener(d,l)},L.prototype.off=function(d,l){this._emitter.removeListener(d,l)},L.prototype.attachMediaElement=function(d){if(this._mediaSource)throw new u.a("MediaSource has been attached to an HTMLMediaElement!");var l=this._mediaSource=new window.MediaSource;l.addEventListener("sourceopen",this.e.onSourceOpen),l.addEventListener("sourceended",this.e.onSourceEnded),l.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=d,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),d.src=this._mediaSourceObjectURL},L.prototype.detachMediaElement=function(){if(this._mediaSource){var d=this._mediaSource;for(var l in this._sourceBuffers){var S=this._pendingSegments[l];S.splice(0,S.length),this._pendingSegments[l]=null,this._pendingRemoveRanges[l]=null,this._lastInitSegments[l]=null;var W=this._sourceBuffers[l];if(W){if(d.readyState!=="closed"){try{d.removeSourceBuffer(W)}catch(ae){C.a.e(this.TAG,ae.message)}W.removeEventListener("error",this.e.onSourceBufferError),W.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[l]=null,this._sourceBuffers[l]=null}}if(d.readyState==="open")try{d.endOfStream()}catch(ae){C.a.e(this.TAG,ae.message)}d.removeEventListener("sourceopen",this.e.onSourceOpen),d.removeEventListener("sourceended",this.e.onSourceEnded),d.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)},L.prototype.appendInitSegment=function(d,l){if(!this._mediaSource||this._mediaSource.readyState!=="open")return this._pendingSourceBufferInit.push(d),void this._pendingSegments[d.type].push(d);var S=d,W=""+S.container;S.codec&&S.codec.length>0&&(W+=";codecs="+S.codec);var ae=!1;if(C.a.v(this.TAG,"Received Initialization Segment, mimeType: "+W),this._lastInitSegments[S.type]=S,W!==this._mimeTypes[S.type]){if(this._mimeTypes[S.type])C.a.v(this.TAG,"Notice: "+S.type+" mimeType changed, origin: "+this._mimeTypes[S.type]+", target: "+W);else{ae=!0;try{var he=this._sourceBuffers[S.type]=this._mediaSource.addSourceBuffer(W);he.addEventListener("error",this.e.onSourceBufferError),he.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(Re){return C.a.e(this.TAG,Re.message),void this._emitter.emit(_.ERROR,{code:Re.code,msg:Re.message})}}this._mimeTypes[S.type]=W}l||this._pendingSegments[S.type].push(S),ae||this._sourceBuffers[S.type]&&!this._sourceBuffers[S.type].updating&&this._doAppendSegments(),j.a.safari&&S.container==="audio/mpeg"&&S.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=S.mediaDuration/1e3,this._updateMediaSourceDuration())},L.prototype.appendMediaSegment=function(d){var l=d;this._pendingSegments[l.type].push(l),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var S=this._sourceBuffers[l.type];!S||S.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},L.prototype.seek=function(d){for(var l in this._sourceBuffers)if(this._sourceBuffers[l]){var S=this._sourceBuffers[l];if(this._mediaSource.readyState==="open")try{S.abort()}catch(Ae){C.a.e(this.TAG,Ae.message)}this._idrList.clear();var W=this._pendingSegments[l];if(W.splice(0,W.length),this._mediaSource.readyState!=="closed"){for(var ae=0;ae<S.buffered.length;ae++){var he=S.buffered.start(ae),Re=S.buffered.end(ae);this._pendingRemoveRanges[l].push({start:he,end:Re})}if(S.updating||this._doRemoveRanges(),j.a.safari){var Be=this._lastInitSegments[l];Be&&(this._pendingSegments[l].push(Be),S.updating||this._doAppendSegments())}}}},L.prototype.endOfStream=function(){var d=this._mediaSource,l=this._sourceBuffers;d&&d.readyState==="open"?l.video&&l.video.updating||l.audio&&l.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,d.endOfStream()):d&&d.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},L.prototype.getNearestKeyframe=function(d){return this._idrList.getLastSyncPointBeforeDts(d)},L.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var d=this._mediaElement.currentTime;for(var l in this._sourceBuffers){var S=this._sourceBuffers[l];if(S){var W=S.buffered;if(W.length>=1&&d-W.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},L.prototype._doCleanupSourceBuffer=function(){var d=this._mediaElement.currentTime;for(var l in this._sourceBuffers){var S=this._sourceBuffers[l];if(S){for(var W=S.buffered,ae=!1,he=0;he<W.length;he++){var Re=W.start(he),Be=W.end(he);if(Re<=d&&d<Be+3){if(d-Re>=this._config.autoCleanupMaxBackwardDuration){ae=!0;var Ae=d-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[l].push({start:Re,end:Ae})}}else Be<d&&(ae=!0,this._pendingRemoveRanges[l].push({start:Re,end:Be}))}ae&&!S.updating&&this._doRemoveRanges()}}},L.prototype._updateMediaSourceDuration=function(){var d=this._sourceBuffers;if(this._mediaElement.readyState!==0&&this._mediaSource.readyState==="open"&&!(d.video&&d.video.updating||d.audio&&d.audio.updating)){var l=this._mediaSource.duration,S=this._pendingMediaDuration;S>0&&(isNaN(l)||S>l)&&(C.a.v(this.TAG,"Update MediaSource duration from "+l+" to "+S),this._mediaSource.duration=S),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},L.prototype._doRemoveRanges=function(){for(var d in this._pendingRemoveRanges)if(this._sourceBuffers[d]&&!this._sourceBuffers[d].updating)for(var l=this._sourceBuffers[d],S=this._pendingRemoveRanges[d];S.length&&!l.updating;){var W=S.shift();l.remove(W.start,W.end)}},L.prototype._doAppendSegments=function(){var d=this._pendingSegments;for(var l in d)if(this._sourceBuffers[l]&&!this._sourceBuffers[l].updating&&d[l].length>0){var S=d[l].shift();if(S.timestampOffset){var W=this._sourceBuffers[l].timestampOffset,ae=S.timestampOffset/1e3;Math.abs(W-ae)>.1&&(C.a.v(this.TAG,"Update MPEG audio timestampOffset from "+W+" to "+ae),this._sourceBuffers[l].timestampOffset=ae),delete S.timestampOffset}if(!S.data||S.data.byteLength===0)continue;try{this._sourceBuffers[l].appendBuffer(S.data),this._isBufferFull=!1,l==="video"&&S.hasOwnProperty("info")&&this._idrList.appendArray(S.info.syncPoints)}catch(he){this._pendingSegments[l].unshift(S),he.code===22?(this._isBufferFull||this._emitter.emit(_.BUFFER_FULL),this._isBufferFull=!0):(C.a.e(this.TAG,he.message),this._emitter.emit(_.ERROR,{code:he.code,msg:he.message}))}}},L.prototype._onSourceOpen=function(){if(C.a.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var d=this._pendingSourceBufferInit;d.length;){var l=d.shift();this.appendInitSegment(l,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(_.SOURCE_OPEN)},L.prototype._onSourceEnded=function(){C.a.v(this.TAG,"MediaSource onSourceEnded")},L.prototype._onSourceClose=function(){C.a.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},L.prototype._hasPendingSegments=function(){var d=this._pendingSegments;return d.video.length>0||d.audio.length>0},L.prototype._hasPendingRemoveRanges=function(){var d=this._pendingRemoveRanges;return d.video.length>0||d.audio.length>0},L.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(_.UPDATE_END)},L.prototype._onSourceBufferError=function(d){C.a.e(this.TAG,"SourceBuffer Error: "+d)},L}(),P=I(5),D={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},V={NETWORK_EXCEPTION:f.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:f.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:f.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:f.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:P.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:P.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:P.a.CODEC_UNSUPPORTED},te=function(){function L(d,l){this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new x.a,this._config=v(),typeof l=="object"&&Object.assign(this._config,l);var S=d.type.toLowerCase();if(S!=="mse"&&S!=="mpegts"&&S!=="m2ts"&&S!=="flv")throw new u.b("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");d.isLive===!0&&(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._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=d,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var W=j.a.chrome&&(j.a.version.major<50||j.a.version.major===50&&j.a.version.build<2661);this._alwaysSeekKeyframe=!!(W||j.a.msedge||j.a.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return L.prototype.destroy=function(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(d,l){var S=this;d===z.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(function(){S._emitter.emit(z.MEDIA_INFO,S.mediaInfo)}):d===z.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(function(){S._emitter.emit(z.STATISTICS_INFO,S.statisticsInfo)}),this._emitter.addListener(d,l)},L.prototype.off=function(d,l){this._emitter.removeListener(d,l)},L.prototype.attachMediaElement=function(d){var l=this;if(this._mediaElement=d,d.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),d.addEventListener("seeking",this.e.onvSeeking),d.addEventListener("canplay",this.e.onvCanPlay),d.addEventListener("stalled",this.e.onvStalled),d.addEventListener("progress",this.e.onvProgress),this._msectl=new c(this._config),this._msectl.on(_.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(_.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(_.SOURCE_OPEN,function(){l._mseSourceOpened=!0,l._hasPendingLoad&&(l._hasPendingLoad=!1,l.load())}),this._msectl.on(_.ERROR,function(S){l._emitter.emit(z.ERROR,D.MEDIA_ERROR,V.MEDIA_MSE_ERROR,S)}),this._msectl.attachMediaElement(d),this._pendingSeekTime!=null)try{d.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch{}},L.prototype.detachMediaElement=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)},L.prototype.load=function(){var d=this;if(!this._mediaElement)throw new u.a("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new u.a("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&this._mseSourceOpened===!1?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new b(this._mediaDataSource,this._config),this._transmuxer.on(m.a.INIT_SEGMENT,function(l,S){d._msectl.appendInitSegment(S)}),this._transmuxer.on(m.a.MEDIA_SEGMENT,function(l,S){if(d._msectl.appendMediaSegment(S),d._config.lazyLoad&&!d._config.isLive){var W=d._mediaElement.currentTime;S.info.endDts>=1e3*(W+d._config.lazyLoadMaxDuration)&&d._progressChecker==null&&(C.a.v(d.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),d._suspendTransmuxer())}}),this._transmuxer.on(m.a.LOADING_COMPLETE,function(){d._msectl.endOfStream(),d._emitter.emit(z.LOADING_COMPLETE)}),this._transmuxer.on(m.a.RECOVERED_EARLY_EOF,function(){d._emitter.emit(z.RECOVERED_EARLY_EOF)}),this._transmuxer.on(m.a.IO_ERROR,function(l,S){d._emitter.emit(z.ERROR,D.NETWORK_ERROR,l,S)}),this._transmuxer.on(m.a.DEMUX_ERROR,function(l,S){d._emitter.emit(z.ERROR,D.MEDIA_ERROR,l,{code:-1,msg:S})}),this._transmuxer.on(m.a.MEDIA_INFO,function(l){d._mediaInfo=l,d._emitter.emit(z.MEDIA_INFO,Object.assign({},l))}),this._transmuxer.on(m.a.METADATA_ARRIVED,function(l){d._emitter.emit(z.METADATA_ARRIVED,l)}),this._transmuxer.on(m.a.SCRIPTDATA_ARRIVED,function(l){d._emitter.emit(z.SCRIPTDATA_ARRIVED,l)}),this._transmuxer.on(m.a.TIMED_ID3_METADATA_ARRIVED,function(l){d._emitter.emit(z.TIMED_ID3_METADATA_ARRIVED,l)}),this._transmuxer.on(m.a.SMPTE2038_METADATA_ARRIVED,function(l){d._emitter.emit(z.SMPTE2038_METADATA_ARRIVED,l)}),this._transmuxer.on(m.a.SCTE35_METADATA_ARRIVED,function(l){d._emitter.emit(z.SCTE35_METADATA_ARRIVED,l)}),this._transmuxer.on(m.a.PES_PRIVATE_DATA_DESCRIPTOR,function(l){d._emitter.emit(z.PES_PRIVATE_DATA_DESCRIPTOR,l)}),this._transmuxer.on(m.a.PES_PRIVATE_DATA_ARRIVED,function(l){d._emitter.emit(z.PES_PRIVATE_DATA_ARRIVED,l)}),this._transmuxer.on(m.a.STATISTICS_INFO,function(l){d._statisticsInfo=d._fillStatisticsInfo(l),d._emitter.emit(z.STATISTICS_INFO,Object.assign({},d._statisticsInfo))}),this._transmuxer.on(m.a.RECOMMEND_SEEKPOINT,function(l){d._mediaElement&&!d._config.accurateSeek&&(d._requestSetTime=!0,d._mediaElement.currentTime=l/1e3)}),this._transmuxer.open()))},L.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},L.prototype.play=function(){return this._mediaElement.play()},L.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(L.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(d){this._mediaElement.volume=d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(d){this._mediaElement.muted=d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(d){this._mediaElement?this._internalSeek(d):this._pendingSeekTime=d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"statisticsInfo",{get:function(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),L.prototype._fillStatisticsInfo=function(d){if(d.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return d;var l=!0,S=0,W=0;if(this._mediaElement.getVideoPlaybackQuality){var ae=this._mediaElement.getVideoPlaybackQuality();S=ae.totalVideoFrames,W=ae.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(S=this._mediaElement.webkitDecodedFrameCount,W=this._mediaElement.webkitDroppedFrameCount):l=!1;return l&&(d.decodedFrames=S,d.droppedFrames=W),d},L.prototype._onmseUpdateEnd=function(){var d=this._mediaElement.buffered,l=this._mediaElement.currentTime;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&d.length>0&&!this._mediaElement.paused){var S=d.end(d.length-1);if(S>this._config.liveBufferLatencyMaxLatency&&S-l>this._config.liveBufferLatencyMaxLatency){var W=S-this._config.liveBufferLatencyMinRemain;this.currentTime=W}}if(this._config.lazyLoad&&!this._config.isLive){for(var ae=0,he=0;he<d.length;he++){var Re=d.start(he),Be=d.end(he);if(Re<=l&&l<Be){ae=Be;break}}ae>=l+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(C.a.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},L.prototype._onmseBufferFull=function(){C.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()},L.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},L.prototype._checkProgressAndResume=function(){for(var d=this._mediaElement.currentTime,l=this._mediaElement.buffered,S=!1,W=0;W<l.length;W++){var ae=l.start(W),he=l.end(W);if(d>=ae&&d<he){d>=he-this._config.lazyLoadRecoverDuration&&(S=!0);break}}S&&(window.clearInterval(this._progressChecker),this._progressChecker=null,S&&(C.a.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},L.prototype._isTimepointBuffered=function(d){for(var l=this._mediaElement.buffered,S=0;S<l.length;S++){var W=l.start(S),ae=l.end(S);if(d>=W&&d<ae)return!0}return!1},L.prototype._internalSeek=function(d){var l=this._isTimepointBuffered(d),S=!1,W=0;if(d<1&&this._mediaElement.buffered.length>0){var ae=this._mediaElement.buffered.start(0);(ae<1&&d<ae||j.a.safari)&&(S=!0,W=j.a.safari?.1:ae)}if(S)this._requestSetTime=!0,this._mediaElement.currentTime=W;else if(l){if(this._alwaysSeekKeyframe){var he=this._msectl.getNearestKeyframe(Math.floor(1e3*d));this._requestSetTime=!0,this._mediaElement.currentTime=he!=null?he.dts/1e3:d}else this._requestSetTime=!0,this._mediaElement.currentTime=d;this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(d),this._transmuxer.seek(Math.floor(1e3*d)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=d)},L.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var d=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(d)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(d),this._transmuxer.seek(Math.floor(1e3*d)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=d))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},L.prototype._checkAndResumeStuckPlayback=function(d){var l=this._mediaElement;if(d||!this._receivedCanPlay||l.readyState<2){var S=l.buffered;S.length>0&&l.currentTime<S.start(0)&&(C.a.w(this.TAG,"Playback seems stuck at "+l.currentTime+", seek to "+S.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=S.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},L.prototype._onvLoadedMetadata=function(d){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},L.prototype._onvSeeking=function(d){var l=this._mediaElement.currentTime,S=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(l<1&&S.length>0){var W=S.start(0);if(W<1&&l<W||j.a.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=j.a.safari?.1:W)}if(this._isTimepointBuffered(l)){if(this._alwaysSeekKeyframe){var ae=this._msectl.getNearestKeyframe(Math.floor(1e3*l));ae!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=ae.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:l,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},L.prototype._onvCanPlay=function(d){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},L.prototype._onvStalled=function(d){this._checkAndResumeStuckPlayback(!0)},L.prototype._onvProgress=function(d){this._checkAndResumeStuckPlayback()},L}(),fe=function(){function L(d,l){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new x.a,this._config=v(),typeof l=="object"&&Object.assign(this._config,l);var S=d.type.toLowerCase();if(S==="mse"||S==="mpegts"||S==="m2ts"||S==="flv")throw new u.b("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(d.hasOwnProperty("segments"))throw new u.b("NativePlayer("+d.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=d,this._mediaElement=null}return L.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(d,l){var S=this;d===z.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){S._emitter.emit(z.MEDIA_INFO,S.mediaInfo)}):d===z.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){S._emitter.emit(z.STATISTICS_INFO,S.statisticsInfo)}),this._emitter.addListener(d,l)},L.prototype.off=function(d,l){this._emitter.removeListener(d,l)},L.prototype.attachMediaElement=function(d){if(this._mediaElement=d,d.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{d.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch{}},L.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},L.prototype.load=function(){if(!this._mediaElement)throw new u.a("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},L.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},L.prototype.play=function(){return this._mediaElement.play()},L.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(L.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(d){this._mediaElement.volume=d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(d){this._mediaElement.muted=d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(d){this._mediaElement?this._mediaElement.currentTime=d:this._pendingSeekTime=d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"mediaInfo",{get:function(){var d={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(d.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(d.width=this._mediaElement.videoWidth,d.height=this._mediaElement.videoHeight)),d},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"statisticsInfo",{get:function(){var d={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return d;var l=!0,S=0,W=0;if(this._mediaElement.getVideoPlaybackQuality){var ae=this._mediaElement.getVideoPlaybackQuality();S=ae.totalVideoFrames,W=ae.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(S=this._mediaElement.webkitDecodedFrameCount,W=this._mediaElement.webkitDroppedFrameCount):l=!1;return l&&(d.decodedFrames=S,d.droppedFrames=W),d},enumerable:!1,configurable:!0}),L.prototype._onvLoadedMetadata=function(d){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(z.MEDIA_INFO,this.mediaInfo)},L.prototype._reportStatisticsInfo=function(){this._emitter.emit(z.STATISTICS_INFO,this.statisticsInfo)},L}();G.a.install();var me={createPlayer:function(L,d){var l=L;if(l==null||typeof l!="object")throw new u.b("MediaDataSource must be an javascript object!");if(!l.hasOwnProperty("type"))throw new u.b("MediaDataSource must has type field to indicate video file type!");switch(l.type){case"mse":case"mpegts":case"m2ts":case"flv":return new te(l,d);default:return new fe(l,d)}},isSupported:function(){return p.supportMSEH264Playback()},getFeatureList:function(){return p.getFeatureList()}};me.BaseLoader=f.a,me.LoaderStatus=f.c,me.LoaderErrors=f.b,me.Events=z,me.ErrorTypes=D,me.ErrorDetails=V,me.MSEPlayer=te,me.NativePlayer=fe,me.LoggingControl=$.a,Object.defineProperty(me,"version",{enumerable:!0,get:function(){return"1.7.2"}}),Q.default=me}])})})(nt);var It=Ct(nt.exports),Ot=Bt({__proto__:null,default:It},[nt.exports]);export{Ot as m};
|