import{O as Ct}from"./index.26fbcb91.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;P0&&(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=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=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[j].dts&&fR[C].lastSample.originalDts&&f=R[C].lastSample.originalDts&&(C===R.length-1||C0&&(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[R]&&v0){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=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);a32)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<>>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=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;Y0&&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=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;X0)for(X=n;X<8;X++)e.readBits(2);for(X=0;X1&&e.readSEG(),X=0;X0&&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>>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);et.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>>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>>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;w1&&g.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+pe),A++,w=0;w=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){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.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=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=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>>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;w0){for(var Y=w+5;Y1&&(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>>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>>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>>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>>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=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=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;Se1&&(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=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;de0)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;i0&&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._receivedLength299)){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&&(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[P]&&h=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._receivedLength0&&this._receivedLength0)for(var D=u.split("&"),V=0;V0;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[c]&&_=512&&_<=1024?Math.floor(1.5*_):2*_)>8192&&(h=8192);var u=1024*h+1048576;this._bufferSize0){var D=this._stashBuffer.slice(0,this._stashUsed);(fe=this._dispatchChunks(D,this._stashByteStart))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))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(u0){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(u0},!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;_1)for(var m=1;m0&&(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=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=this._config.autoCleanupMaxBackwardDuration){ae=!0;var Ae=d-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[l].push({start:Re,end:Ae})}}else Be0&&(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=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=ae&&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=W&&d0){var ae=this._mediaElement.buffered.start(0);(ae<1&&d0&&l.currentTime0){var W=S.start(0);if(W<1&&l0&&(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};