diff --git a/apps/web/public/vendor-mpegts.js b/apps/web/public/vendor-mpegts.js index 1121f40..f2104f5 100644 --- a/apps/web/public/vendor-mpegts.js +++ b/apps/web/public/vendor-mpegts.js @@ -1,3 +1,3 @@ var ci=Object.create;var{getPrototypeOf:hi,defineProperty:Dt,getOwnPropertyNames:fi}=Object;var pi=Object.prototype.hasOwnProperty;function mi(_e){return this[_e]}var gi,yi,vi=(_e,Ae,Me)=>{var le=_e!=null&&typeof _e==="object";if(le){var Q=Ae?gi??=new WeakMap:yi??=new WeakMap,D=Q.get(_e);if(D)return D}Me=_e!=null?ci(hi(_e)):{};let X=Ae||!_e||!_e.__esModule?Dt(Me,"default",{value:_e,enumerable:!0}):Me;if(_e&&typeof _e==="object"||typeof _e==="function"){for(let P of fi(_e))if(!pi.call(X,P))Dt(X,P,{get:mi.bind(_e,P),enumerable:!0})}if(le)Q.set(_e,X);return X};var Si=(_e,Ae)=>()=>(Ae||_e((Ae={exports:{}}).exports,Ae),Ae.exports);var Mt=Si(function(et,lt){/*! For license information please see mpegts.js.LICENSE.txt */(function(_e,Ae){typeof et=="object"&&typeof lt=="object"?lt.exports=Ae():typeof define=="function"&&define.amd?define([],Ae):typeof et=="object"?et.mpegts=Ae():_e.mpegts=Ae()})(et,function(){return function(){var _e={964:function(le,Q,D){le.exports=function(){function X(V){return typeof V=="function"}var P=Array.isArray?Array.isArray:function(V){return Object.prototype.toString.call(V)==="[object Array]"},_=0,S=void 0,R=void 0,v=function(V,Y){G[_]=V,G[_+1]=Y,(_+=2)===2&&(R?R(m):u())},I=typeof window<"u"?window:void 0,b=I||{},k=b.MutationObserver||b.WebKitMutationObserver,w=typeof self>"u"&&typeof process<"u"&&{}.toString.call(process)==="[object process]",O=typeof Uint8ClampedArray<"u"&&typeof importScripts<"u"&&typeof MessageChannel<"u";function A(){var V=setTimeout;return function(){return V(m,1)}}var G=Array(1000);function m(){for(var V=0;V<_;V+=2)(0,G[V])(G[V+1]),G[V]=void 0,G[V+1]=void 0;_=0}var N,x,K,M,u=void 0;function h(V,Y){var ie=this,oe=new this.constructor(W);oe[E]===void 0&&j(oe);var ue=ie._state;if(ue){var Ee=arguments[ue-1];v(function(){return c(ue,oe,Ee,ie._result)})}else ke(ie,oe,V,Y);return oe}function p(V){if(V&&typeof V=="object"&&V.constructor===this)return V;var Y=new this(W);return te(Y,V),Y}u=w?function(){return process.nextTick(m)}:k?(x=0,K=new k(m),M=document.createTextNode(""),K.observe(M,{characterData:!0}),function(){M.data=x=++x%2}):O?((N=new MessageChannel).port1.onmessage=m,function(){return N.port2.postMessage(0)}):I===void 0?function(){try{var V=Function("return this")().require("vertx");return(S=V.runOnLoop||V.runOnContext)!==void 0?function(){S(m)}:A()}catch(Y){return A()}}():A();var E=Math.random().toString(36).substring(2);function W(){}var z=void 0,se=1,de=2;function me(V,Y,ie){Y.constructor===V.constructor&&ie===h&&Y.constructor.resolve===p?function(oe,ue){ue._state===se?Re(oe,ue._result):ue._state===de?J(oe,ue._result):ke(ue,void 0,function(Ee){return te(oe,Ee)},function(Ee){return J(oe,Ee)})}(V,Y):ie===void 0?Re(V,Y):X(ie)?function(oe,ue,Ee){v(function(Pe){var Ue=!1,je=function(Fe,Xe,nt,Ne){try{Fe.call(Xe,nt,Ne)}catch(Qe){return Qe}}(Ee,ue,function(Fe){Ue||(Ue=!0,ue!==Fe?te(Pe,Fe):Re(Pe,Fe))},function(Fe){Ue||(Ue=!0,J(Pe,Fe))},Pe._label);!Ue&&je&&(Ue=!0,J(Pe,je))},oe)}(V,Y,ie):Re(V,Y)}function te(V,Y){if(V===Y)J(V,TypeError("You cannot resolve a promise with itself"));else if(ue=typeof(oe=Y),oe===null||ue!=="object"&&ue!=="function")Re(V,Y);else{var ie=void 0;try{ie=Y.then}catch(Ee){return void J(V,Ee)}me(V,Y,ie)}var oe,ue}function ee(V){V._onerror&&V._onerror(V._result),L(V)}function Re(V,Y){V._state===z&&(V._result=Y,V._state=se,V._subscribers.length!==0&&v(L,V))}function J(V,Y){V._state===z&&(V._state=de,V._result=Y,v(ee,V))}function ke(V,Y,ie,oe){var ue=V._subscribers,Ee=ue.length;V._onerror=null,ue[Ee]=Y,ue[Ee+se]=ie,ue[Ee+de]=oe,Ee===0&&V._state&&v(L,V)}function L(V){var{_subscribers:Y,_state:ie}=V;if(Y.length!==0){for(var oe=void 0,ue=void 0,Ee=V._result,Pe=0;Pe0&&h.length>M&&!h.warned){h.warned=!0;var E=Error("Possible EventEmitter memory leak detected. "+h.length+" "+String(N)+" listeners added. Use emitter.setMaxListeners() to increase limit");E.name="MaxListenersExceededWarning",E.emitter=m,E.type=N,E.count=h.length,p=E,console&&console.warn&&console.warn(p)}return m}function b(){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 k(m,N,x){var K={fired:!1,wrapFn:void 0,target:m,type:N,listener:x},M=b.bind(K);return M.listener=x,K.wrapFn=M,M}function w(m,N,x){var K=m._events;if(K===void 0)return[];var M=K[N];return M===void 0?[]:typeof M=="function"?x?[M.listener||M]:[M]:x?function(u){for(var h=Array(u.length),p=0;p0&&(u=N[0]),u instanceof Error)throw u;var h=Error("Unhandled error."+(u?" ("+u.message+")":""));throw h.context=u,h}var p=M[m];if(p===void 0)return!1;if(typeof p=="function")X(p,this,N);else{var E=p.length,W=A(p,E);for(x=0;x=0;u--)if(x[u]===N||x[u].listener===N){h=x[u].listener,M=u;break}if(M<0)return this;M===0?x.shift():function(p,E){for(;E+1=0;K--)this.removeListener(m,N[K]);return this},_.prototype.listeners=function(m){return w(this,m,!0)},_.prototype.rawListeners=function(m){return w(this,m,!1)},_.listenerCount=function(m,N){return typeof m.listenerCount=="function"?m.listenerCount(N):O.call(m,N)},_.prototype.listenerCount=O,_.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]}},955:function(le,Q,D){D.r(Q);var X=function(){function P(){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 P.prototype.isComplete=function(){var _=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,S=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&&_&&S},P.prototype.isSeekable=function(){return this.hasKeyframesIndex===!0},P.prototype.getNearestKeyframe=function(_){if(this.keyframesIndex==null)return null;var S=this.keyframesIndex,R=this._search(S.times,_);return{index:R,milliseconds:S.times[R],fileposition:S.filepositions[R]}},P.prototype._search=function(_,S){var R=0,v=_.length-1,I=0,b=0,k=v;for(S<_[0]&&(R=0,b=k+1);b<=k;){if((I=b+Math.floor((k-b)/2))===v||S>=_[I]&&S<_[I+1]){R=I;break}_[I]0&&v[0].originalDts=I[w].dts&&vI[k].lastSample.originalDts&&v=I[k].lastSample.originalDts&&(k===I.length-1||k0&&(w=this._searchNearestSegmentBefore(b.originalBeginDts)+1),this._lastAppendLocation=w,this._list.splice(w,0,b)},R.prototype.getLastSegmentBefore=function(v){var I=this._searchNearestSegmentBefore(v);return I>=0?this._list[I]:null},R.prototype.getLastSampleBefore=function(v){var I=this.getLastSegmentBefore(v);return I!=null?I.lastSample:null},R.prototype.getLastSyncPointBefore=function(v){for(var I=this._searchNearestSegmentBefore(v),b=this._list[I].syncPoints;b.length===0&&I>0;)I--,b=this._list[I].syncPoints;return b.length>0?b[b.length-1]:null},R}()},346:function(le,Q,D){D.r(Q);var X=D(7),P=D.n(X),_=D(856),S=D(994),R=D(403),v=D(867),I=function(){function b(k){this.TAG="MSEController",this._config=k,this._emitter=new(P()),this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onStartStreaming:this._onStartStreaming.bind(this),onEndStreaming:this._onEndStreaming.bind(this),onQualityChange:this._onQualityChange.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._useManagedMediaSource=typeof self.ManagedMediaSource=="function"&&typeof self.MediaSource!="function",this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElementProxy=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]}}return b.prototype.destroy=function(){this._mediaSource&&this.shutdown(),this._mediaSourceObjectURL&&this.revokeObjectURL(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},b.prototype.on=function(k,w){this._emitter.addListener(k,w)},b.prototype.off=function(k,w){this._emitter.removeListener(k,w)},b.prototype.initialize=function(k){if(this._mediaSource)throw new v.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");this._useManagedMediaSource&&_.default.v(this.TAG,"Using ManagedMediaSource");var w=this._mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource;w.addEventListener("sourceopen",this.e.onSourceOpen),w.addEventListener("sourceended",this.e.onSourceEnded),w.addEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(w.addEventListener("startstreaming",this.e.onStartStreaming),w.addEventListener("endstreaming",this.e.onEndStreaming),w.addEventListener("qualitychange",this.e.onQualityChange)),this._mediaElementProxy=k},b.prototype.shutdown=function(){if(this._mediaSource){var k=this._mediaSource;for(var w in this._sourceBuffers){var O=this._pendingSegments[w];O.splice(0,O.length),this._pendingSegments[w]=null,this._pendingRemoveRanges[w]=null,this._lastInitSegments[w]=null;var A=this._sourceBuffers[w];if(A){if(k.readyState!=="closed"){try{k.removeSourceBuffer(A)}catch(G){_.default.e(this.TAG,G.message)}A.removeEventListener("error",this.e.onSourceBufferError),A.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[w]=null,this._sourceBuffers[w]=null}}if(k.readyState==="open")try{k.endOfStream()}catch(G){_.default.e(this.TAG,G.message)}this._mediaElementProxy=null,k.removeEventListener("sourceopen",this.e.onSourceOpen),k.removeEventListener("sourceended",this.e.onSourceEnded),k.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(k.removeEventListener("startstreaming",this.e.onStartStreaming),k.removeEventListener("endstreaming",this.e.onEndStreaming),k.removeEventListener("qualitychange",this.e.onQualityChange)),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._mediaSource=null}},b.prototype.isManagedMediaSource=function(){return this._useManagedMediaSource},b.prototype.getObject=function(){if(!this._mediaSource)throw new v.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSource},b.prototype.getHandle=function(){if(!this._mediaSource)throw new v.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSource.handle},b.prototype.getObjectURL=function(){if(!this._mediaSource)throw new v.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSourceObjectURL==null&&(this._mediaSourceObjectURL=URL.createObjectURL(this._mediaSource)),this._mediaSourceObjectURL},b.prototype.revokeObjectURL=function(){this._mediaSourceObjectURL&&(URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},b.prototype.appendInitSegment=function(k,w){if(w===void 0&&(w=void 0),!this._mediaSource||this._mediaSource.readyState!=="open"||this._mediaSource.streaming===!1)return this._pendingSourceBufferInit.push(k),void this._pendingSegments[k.type].push(k);var O=k,A="".concat(O.container);O.codec&&O.codec.length>0&&(O.codec==="opus"&&S.default.safari&&(O.codec="Opus"),A+=";codecs=".concat(O.codec));var G=!1;if(_.default.v(this.TAG,"Received Initialization Segment, mimeType: "+A),this._lastInitSegments[O.type]=O,A!==this._mimeTypes[O.type]){if(this._mimeTypes[O.type])_.default.v(this.TAG,"Notice: ".concat(O.type," mimeType changed, origin: ").concat(this._mimeTypes[O.type],", target: ").concat(A));else{G=!0;try{var m=this._sourceBuffers[O.type]=this._mediaSource.addSourceBuffer(A);m.addEventListener("error",this.e.onSourceBufferError),m.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(N){return _.default.e(this.TAG,N.message),void this._emitter.emit(R.default.ERROR,{code:N.code,msg:N.message})}}this._mimeTypes[O.type]=A}w||this._pendingSegments[O.type].push(O),G||this._sourceBuffers[O.type]&&!this._sourceBuffers[O.type].updating&&this._doAppendSegments(),S.default.safari&&O.container==="audio/mpeg"&&O.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=O.mediaDuration/1000,this._updateMediaSourceDuration())},b.prototype.appendMediaSegment=function(k){var w=k;this._pendingSegments[w.type].push(w),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var O=this._sourceBuffers[w.type];!O||O.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},b.prototype.flush=function(){for(var k in this._sourceBuffers)if(this._sourceBuffers[k]){var w=this._sourceBuffers[k];if(this._mediaSource.readyState==="open")try{w.abort()}catch(x){_.default.e(this.TAG,x.message)}var O=this._pendingSegments[k];if(O.splice(0,O.length),this._mediaSource.readyState!=="closed"){for(var A=0;A=1&&k-A.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},b.prototype._doCleanupSourceBuffer=function(){var k=this._mediaElementProxy.getCurrentTime();for(var w in this._sourceBuffers){var O=this._sourceBuffers[w];if(O){for(var A=O.buffered,G=!1,m=0;m=this._config.autoCleanupMaxBackwardDuration){G=!0;var K=k-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[w].push({start:N,end:K})}}else x0&&(isNaN(w)||O>w)&&(_.default.v(this.TAG,"Update MediaSource duration from ".concat(w," to ").concat(O)),this._mediaSource.duration=O),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},b.prototype._doRemoveRanges=function(){for(var k in this._pendingRemoveRanges)if(this._sourceBuffers[k]&&!this._sourceBuffers[k].updating)for(var w=this._sourceBuffers[k],O=this._pendingRemoveRanges[k];O.length&&!w.updating;){var A=O.shift();w.remove(A.start,A.end)}},b.prototype._doAppendSegments=function(){var k=this._pendingSegments;for(var w in k)if(this._sourceBuffers[w]&&!this._sourceBuffers[w].updating&&this._mediaSource.streaming!==!1&&k[w].length>0){var O=k[w].shift();if(typeof O.timestampOffset=="number"&&isFinite(O.timestampOffset)){var A=this._sourceBuffers[w].timestampOffset,G=O.timestampOffset/1000;Math.abs(A-G)>0.1&&(_.default.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(A," to ").concat(G)),this._sourceBuffers[w].timestampOffset=G),delete O.timestampOffset}if(!O.data||O.data.byteLength===0)continue;try{this._sourceBuffers[w].appendBuffer(O.data),this._isBufferFull=!1}catch(m){this._pendingSegments[w].unshift(O),m.code===22?(this._isBufferFull||this._emitter.emit(R.default.BUFFER_FULL),this._isBufferFull=!0):(_.default.e(this.TAG,m.message),this._emitter.emit(R.default.ERROR,{code:m.code,msg:m.message}))}}},b.prototype._onSourceOpen=function(){if(_.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var k=this._pendingSourceBufferInit;k.length;){var w=k.shift();this.appendInitSegment(w,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(R.default.SOURCE_OPEN)},b.prototype._onStartStreaming=function(){_.default.v(this.TAG,"ManagedMediaSource onStartStreaming"),this._emitter.emit(R.default.START_STREAMING)},b.prototype._onEndStreaming=function(){_.default.v(this.TAG,"ManagedMediaSource onEndStreaming"),this._emitter.emit(R.default.END_STREAMING)},b.prototype._onQualityChange=function(){_.default.v(this.TAG,"ManagedMediaSource onQualityChange")},b.prototype._onSourceEnded=function(){_.default.v(this.TAG,"MediaSource onSourceEnded")},b.prototype._onSourceClose=function(){_.default.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),this._useManagedMediaSource&&(this._mediaSource.removeEventListener("startstreaming",this.e.onStartStreaming),this._mediaSource.removeEventListener("endstreaming",this.e.onEndStreaming),this._mediaSource.removeEventListener("qualitychange",this.e.onQualityChange)))},b.prototype._hasPendingSegments=function(){var k=this._pendingSegments;return k.video.length>0||k.audio.length>0},b.prototype._hasPendingRemoveRanges=function(){var k=this._pendingRemoveRanges;return k.video.length>0||k.audio.length>0},b.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(R.default.UPDATE_END)},b.prototype._onSourceBufferError=function(k){_.default.e(this.TAG,"SourceBuffer Error: ".concat(k))},b}();Q.default=I},527:function(le,Q,D){D.r(Q);var X=D(7),P=D.n(X),_=D(861),S=D.n(_),R=D(856),v=D(947),I=D(886),b=D(726),k=(D(137),D(955)),w=function(){function O(A,G){if(this.TAG="Transmuxer",this._emitter=new(P()),G.enableWorker&&typeof Worker<"u")try{this._worker=S()(137),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[A,G]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},v.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:v.default.getConfig()})}catch(N){R.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new I.default(A,G)}else this._controller=new I.default(A,G);if(this._controller){var m=this._controller;m.on(b.default.IO_ERROR,this._onIOError.bind(this)),m.on(b.default.DEMUX_ERROR,this._onDemuxError.bind(this)),m.on(b.default.INIT_SEGMENT,this._onInitSegment.bind(this)),m.on(b.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),m.on(b.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),m.on(b.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),m.on(b.default.MEDIA_INFO,this._onMediaInfo.bind(this)),m.on(b.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),m.on(b.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),m.on(b.default.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),m.on(b.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,this._onSynchronousKLVMetadataArrived.bind(this)),m.on(b.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,this._onAsynchronousKLVMetadataArrived.bind(this)),m.on(b.default.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),m.on(b.default.SEI_ARRIVED,this._onSEIArrived.bind(this)),m.on(b.default.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),m.on(b.default.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),m.on(b.default.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),m.on(b.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),m.on(b.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return O.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),v.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},O.prototype.on=function(A,G){this._emitter.addListener(A,G)},O.prototype.off=function(A,G){this._emitter.removeListener(A,G)},O.prototype.hasWorker=function(){return this._worker!=null},O.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},O.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},O.prototype.seek=function(A){this._worker?this._worker.postMessage({cmd:"seek",param:A}):this._controller.seek(A)},O.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},O.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},O.prototype._onInitSegment=function(A,G){var m=this;Promise.resolve().then(function(){m._emitter.emit(b.default.INIT_SEGMENT,A,G)})},O.prototype._onMediaSegment=function(A,G){var m=this;Promise.resolve().then(function(){m._emitter.emit(b.default.MEDIA_SEGMENT,A,G)})},O.prototype._onLoadingComplete=function(){var A=this;Promise.resolve().then(function(){A._emitter.emit(b.default.LOADING_COMPLETE)})},O.prototype._onRecoveredEarlyEof=function(){var A=this;Promise.resolve().then(function(){A._emitter.emit(b.default.RECOVERED_EARLY_EOF)})},O.prototype._onMediaInfo=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.MEDIA_INFO,A)})},O.prototype._onMetaDataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.METADATA_ARRIVED,A)})},O.prototype._onScriptDataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.SCRIPTDATA_ARRIVED,A)})},O.prototype._onTimedID3MetadataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.TIMED_ID3_METADATA_ARRIVED,A)})},O.prototype._onPGSSubtitleArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.PGS_SUBTITLE_ARRIVED,A)})},O.prototype._onSynchronousKLVMetadataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,A)})},O.prototype._onAsynchronousKLVMetadataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,A)})},O.prototype._onSMPTE2038MetadataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.SMPTE2038_METADATA_ARRIVED,A)})},O.prototype._onSEIArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.SEI_ARRIVED,A)})},O.prototype._onSCTE35MetadataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.SCTE35_METADATA_ARRIVED,A)})},O.prototype._onPESPrivateDataDescriptor=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.PES_PRIVATE_DATA_DESCRIPTOR,A)})},O.prototype._onPESPrivateDataArrived=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.PES_PRIVATE_DATA_ARRIVED,A)})},O.prototype._onStatisticsInfo=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.STATISTICS_INFO,A)})},O.prototype._onIOError=function(A,G){var m=this;Promise.resolve().then(function(){m._emitter.emit(b.default.IO_ERROR,A,G)})},O.prototype._onDemuxError=function(A,G){var m=this;Promise.resolve().then(function(){m._emitter.emit(b.default.DEMUX_ERROR,A,G)})},O.prototype._onRecommendSeekpoint=function(A){var G=this;Promise.resolve().then(function(){G._emitter.emit(b.default.RECOMMEND_SEEKPOINT,A)})},O.prototype._onLoggingConfigChanged=function(A){this._worker&&this._worker.postMessage({cmd:"logging_config",param:A})},O.prototype._onWorkerMessage=function(A){var G=A.data,m=G.data;if(G.msg==="destroyed"||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(G.msg){case b.default.INIT_SEGMENT:case b.default.MEDIA_SEGMENT:this._emitter.emit(G.msg,m.type,m.data);break;case b.default.LOADING_COMPLETE:case b.default.RECOVERED_EARLY_EOF:this._emitter.emit(G.msg);break;case b.default.MEDIA_INFO:Object.setPrototypeOf(m,k.default.prototype),this._emitter.emit(G.msg,m);break;case b.default.METADATA_ARRIVED:case b.default.SCRIPTDATA_ARRIVED:case b.default.TIMED_ID3_METADATA_ARRIVED:case b.default.PGS_SUBTITLE_ARRIVED:case b.default.SYNCHRONOUS_KLV_METADATA_ARRIVED:case b.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED:case b.default.SMPTE2038_METADATA_ARRIVED:case b.default.SCTE35_METADATA_ARRIVED:case b.default.SEI_ARRIVED:case b.default.PES_PRIVATE_DATA_DESCRIPTOR:case b.default.PES_PRIVATE_DATA_ARRIVED:case b.default.STATISTICS_INFO:this._emitter.emit(G.msg,m);break;case b.default.IO_ERROR:case b.default.DEMUX_ERROR:this._emitter.emit(G.msg,m.type,m.info);break;case b.default.RECOMMEND_SEEKPOINT:this._emitter.emit(G.msg,m);break;case"logcat_callback":R.default.emitter.emit("log",m.type,m.logcat)}},O}();Q.default=w},886:function(le,Q,D){D.r(Q),D.d(Q,{default:function(){return li}});var X=D(7),P=D.n(X),_=D(856),S=D(994),R=D(955);function v(n,i,t){var e=n;if(i+t=128){i.push(String.fromCharCode(65535&o)),e+=2;continue}}else if(t[e]<240){if(v(t,e,2)&&(o=(15&t[e])<<12|(63&t[e+1])<<6|63&t[e+2])>=2048&&(63488&o)!=55296){i.push(String.fromCharCode(65535&o)),e+=3;continue}}else if(t[e]<248){var o;if(v(t,e,3)&&(o=(7&t[e])<<18|(63&t[e+1])<<12|(63&t[e+2])<<6|63&t[e+3])>65536&&o<1114112){o-=65536,i.push(String.fromCharCode(o>>>10|55296)),i.push(String.fromCharCode(1023&o|56320)),e+=4;continue}}i.push(String.fromCharCode(65533)),++e}return i.join("")},k=D(867),w=(I=new ArrayBuffer(2),new DataView(I).setInt16(0,256,!0),new Int16Array(I)[0]===256),O=function(){function n(){}return n.parseScriptData=function(i,t,e){var a={};try{var o=n.parseValue(i,t,e),r=n.parseValue(i,t+o.size,e-o.size);a[o.data]=r.data}catch(s){_.default.e("AMF",s.toString())}return a},n.parseObject=function(i,t,e){if(e<3)throw new k.IllegalStateException("Data not enough when parse ScriptDataObject");var a=n.parseString(i,t,e),o=n.parseValue(i,t+a.size,e-a.size),r=o.objectEnd;return{data:{name:a.data,value:o.data},size:a.size+o.size,objectEnd:r}},n.parseVariable=function(i,t,e){return n.parseObject(i,t,e)},n.parseString=function(i,t,e){if(e<2)throw new k.IllegalStateException("Data not enough when parse String");var a=new DataView(i,t,e).getUint16(0,!w);return{data:a>0?b(new Uint8Array(i,t+2,a)):"",size:2+a}},n.parseLongString=function(i,t,e){if(e<4)throw new k.IllegalStateException("Data not enough when parse LongString");var a=new DataView(i,t,e).getUint32(0,!w);return{data:a>0?b(new Uint8Array(i,t+4,a)):"",size:4+a}},n.parseDate=function(i,t,e){if(e<10)throw new k.IllegalStateException("Data size invalid when parse Date");var a=new DataView(i,t,e),o=a.getFloat64(0,!w),r=a.getInt16(8,!w);return{data:new Date(o+=60*r*1000),size:10}},n.parseValue=function(i,t,e){if(e<1)throw new k.IllegalStateException("Data not enough when parse Value");var a,o=new DataView(i,t,e),r=1,s=o.getUint8(0),d=!1;try{switch(s){case 0:a=o.getFloat64(1,!w),r+=8;break;case 1:a=!!o.getUint8(1),r+=1;break;case 2:var l=n.parseString(i,t+1,e-1);a=l.data,r+=l.size;break;case 3:a={};var y=0;for((16777215&o.getUint32(e-4,!w))==9&&(y=3);r32)throw new k.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(i<=this._current_word_bits_left){var t=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t}var e=this._current_word_bits_left?this._current_word:0;e>>>=32-this._current_word_bits_left;var a=i-this._current_word_bits_left;this._fillCurrentWord();var o=Math.min(a,this._current_word_bits_left),r=this._current_word>>>32-o;return this._current_word<<=o,this._current_word_bits_left-=o,e<>>i)return this._current_word<<=i,this._current_word_bits_left-=i,i;return this._fillCurrentWord(),i+this._skipLeadingZero()},n.prototype.readUEG=function(){var i=this._skipLeadingZero();return this.readBits(i+1)-1},n.prototype.readSEG=function(){var i=this.readUEG();return 1&i?i+1>>>1:-1*(i>>>1)},n}(),G=function(){function n(){}return n._ebsp2rbsp=function(i){for(var t=i,e=t.byteLength,a=new Uint8Array(e),o=0,r=0;r=2&&t[r]===3&&t[r-1]===0&&t[r-2]===0||(a[o]=t[r],o++);return new Uint8Array(a.buffer,0,o)},n.parseSPS=function(i){for(var t=i.subarray(1,4),e="avc1.",a=0;a<3;a++){var o=t[a].toString(16);o.length<2&&(o="0"+o),e+=o}var r=n._ebsp2rbsp(i),s=new A(r);s.readByte();var d=s.readByte();s.readByte();var l=s.readByte();s.readUEG();var y=n.getProfileString(d),f=n.getLevelString(l),g=1,T=420,B=8,F=8;if((d===100||d===110||d===122||d===244||d===44||d===83||d===86||d===118||d===128||d===138||d===144)&&((g=s.readUEG())===3&&s.readBits(1),g<=3&&(T=[0,420,422,444][g]),B=s.readUEG()+8,F=s.readUEG()+8,s.readBits(1),s.readBool()))for(var q=g!==3?8:12,Z=0;Z0&&ye<16?(Ce=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][ye-1],we=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][ye-1]):ye===255&&(Ce=s.readByte()<<8|s.readByte(),we=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){var Oe=s.readBits(32),Ve=s.readBits(32);pe=s.readBool(),Te=(be=Ve)/(Be=2*Oe)}}var xe=1;Ce===1&&we===1||(xe=Ce/we);var Ge=0,Le=0;g===0?(Ge=1,Le=2-ae):(Ge=g===3?1:2,Le=(g===1?2:1)*(2-ae));var He=16*(ve+1),qe=16*(ne+1)*(2-ae);He-=(ge+ce)*Ge,qe-=(De+Se)*Le;var tt=Math.ceil(He*xe);return s.destroy(),s=null,{codec_mimetype:e,profile_idc:d,level_idc:l,profile_string:y,level_string:f,chroma_format_idc:g,bit_depth:B,bit_depth_luma:B,bit_depth_chroma:F,ref_frames:he,chroma_format:T,chroma_format_string:n.getChromaFormatString(T),frame_rate:{fixed:pe,fps:Te,fps_den:Be,fps_num:be},sar_ratio:{width:Ce,height:we},codec_size:{width:He,height:qe},present_size:{width:tt,height:qe}}},n._skipScalingList=function(i,t){for(var e=8,a=8,o=0;o=2&&t[r]===3&&t[r-1]===0&&t[r-2]===0||(a[o]=t[r],o++);return new Uint8Array(a.buffer,0,o)},n.parseVPS=function(i){var t=n._ebsp2rbsp(i),e=new A(t);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()}},n.parseSPS=function(i){var t=n._ebsp2rbsp(i),e=new A(t);e.readByte(),e.readByte();for(var a=0,o=0,r=0,s=0,d=(e.readBits(4),e.readBits(3)),l=(e.readBool(),e.readBits(2)),y=e.readBool(),f=e.readBits(5),g=e.readByte(),T=e.readByte(),B=e.readByte(),F=e.readByte(),q=e.readByte(),Z=e.readByte(),U=e.readByte(),H=e.readByte(),he=e.readByte(),ve=e.readByte(),ne=e.readByte(),ae=[],ge=[],ce=0;ce0)for(ce=d;ce<8;ce++)e.readBits(2);for(ce=0;ce1&&e.readSEG(),ce=0;ce0&&Ze<=16?($e=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][Ze-1],Je=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][Ze-1]):Ze===255&&($e=e.readBits(16),Je=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()&&(at=e.readBits(32),rt=e.readBits(32),e.readBool()&&e.readUEG(),e.readBool())){var ot,st,it=!1;for(ot=e.readBool(),st=e.readBool(),(ot||st)&&((it=e.readBool())&&(e.readByte(),e.readBits(5),e.readBool(),e.readBits(5)),e.readBits(4),e.readBits(4),it&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)),ce=0;ce<=d;ce++){var bt=e.readBool();Et=bt;var At=!0,dt=1;bt||(At=e.readBool());var Rt=!1;if(At?e.readUEG():Rt=e.readBool(),Rt||(dt=e.readUEG()+1),ot){for(Le=0;Le>3),r=!!(4&i[e]),s=!!(2&i[e]);i[e],e+=1,r&&(e+=1);var d=Number.POSITIVE_INFINITY;if(s){d=0;for(var l=0;;l++){var y=i[e++];if(d|=(127&y)<<7*l,!(128&y))break}}console.log(o),o===1?t=h(h({},n.parseSeuqneceHeader(i.subarray(e,e+d))),{sequence_header_data:i.subarray(a,e+d)}):(o==3&&t||o==6&&t)&&(t=n.parseOBUFrameHeader(i.subarray(e,e+d),0,0,t)),e+=d}return t},n.parseSeuqneceHeader=function(i){var t=new A(i),e=t.readBits(3),a=(t.readBool(),t.readBool()),o=!0,r=0,s=1,d=void 0,l=[];if(a)l.push({operating_point_idc:0,level:t.readBits(5),tier:0});else{if(t.readBool()){var y=t.readBits(32),f=t.readBits(32),g=t.readBool();if(g){for(var T=0;t.readBits(1)===0;)T+=1;T>=32||t.readBits(T)}r=f,s=y,o=g,t.readBool()&&(t.readBits(5),t.readBits(32),d=t.readBits(5),t.readBits(5))}for(var B=t.readBool(),F=t.readBits(5),q=0;q<=F;q++){var Z=t.readBits(12),U=t.readBits(5),H=U>7?t.readBits(1):0;l.push({operating_point_idc:Z,level:U,tier:H}),B&&t.readBool()&&t.readBits(4)}}var he=l[0],ve=he.level,ne=he.tier,ae=t.readBits(4),ge=t.readBits(4),ce=t.readBits(ae+1)+1,De=t.readBits(ge+1)+1,Se=!1;a||(Se=t.readBool()),Se&&(t.readBits(4),t.readBits(4)),t.readBool(),t.readBool(),t.readBool();var Ce=!1,we=2,Te=2,pe=0;a||(t.readBool(),t.readBool(),t.readBool(),t.readBool(),(Ce=t.readBool())&&(t.readBool(),t.readBool()),Te=(we=t.readBool()?2:t.readBits(1))?t.readBool()?2:t.readBits(1):2,pe=Ce?t.readBits(3)+1:0);var be=t.readBool(),Be=(t.readBool(),t.readBool(),t.readBool()),ye=8;ye=e===2&&Be?t.readBool()?12:10:Be?10:8;var Oe=!1;e!==1&&(Oe=t.readBool()),t.readBool()&&(t.readBits(8),t.readBits(8),t.readBits(8));var Ve=1,xe=1;return Oe?(t.readBits(1),Ve=1,xe=1):(t.readBits(1),e==0?(Ve=1,xe=1):e==1?(Ve=0,xe=0):ye==12?t.readBits(1)&&t.readBits(1):(Ve=1,xe=0),Ve&&xe&&t.readBits(2),t.readBits(1)),t.readBool(),t.destroy(),t=null,{codec_mimetype:"av01.".concat(e,".").concat(n.getLevelString(ve,ne),".").concat(ye.toString(10).padStart(2,"0")),level:ve,tier:ne,level_string:n.getLevelString(ve,ne),profile_idc:e,profile_string:"".concat(e),bit_depth:ye,ref_frames:1,chroma_format:n.getChromaFormat(Oe,Ve,xe),chroma_format_string:n.getChromaFormatString(Oe,Ve,xe),sequence_header:{frame_id_numbers_present_flag:Se,additional_frame_id_length_minus_1:void 0,delta_frame_id_length_minus_2:void 0,reduced_still_picture_header:a,decoder_model_info_present_flag:!1,operating_points:l,buffer_removal_time_length_minus_1:d,equal_picture_interval:o,seq_force_screen_content_tools:we,seq_force_integer_mv:Te,enable_order_hint:Ce,order_hint_bits:pe,enable_superres:be,frame_width_bit:ae+1,frame_height_bit:ge+1,max_frame_width:ce,max_frame_height:De},keyframe:void 0,frame_rate:{fixed:o,fps:r/s,fps_den:s,fps_num:r}}},n.parseOBUFrameHeader=function(i,t,e,a){var o=a.sequence_header,r=new A(i),s=(o.max_frame_width,o.max_frame_height,0);o.frame_id_numbers_present_flag&&(s=o.additional_frame_id_length_minus_1+o.delta_frame_id_length_minus_2+3);var d=0,l=!0,y=!0,f=!1;if(!o.reduced_still_picture_header){if(r.readBool())return a;l=(d=r.readBits(2))===2||d===0,(y=r.readBool())&&o.decoder_model_info_present_flag&&o.equal_picture_interval,y&&r.readBool(),f=!!(d===3||d===0&&y)||r.readBool()}a.keyframe=l,r.readBool();var g=o.seq_force_screen_content_tools;o.seq_force_screen_content_tools===2&&(g=r.readBits(1)),g&&(o.seq_force_integer_mv,o.seq_force_integer_mv==2&&r.readBits(1)),o.frame_id_numbers_present_flag&&r.readBits(s);var T;if(T=d==3||!o.reduced_still_picture_header&&r.readBool(),r.readBits(o.order_hint_bits),l||f||r.readBits(3),o.decoder_model_info_present_flag&&r.readBool()){for(var B=0;B<=o.operating_points_cnt_minus_1;B++)if(o.operating_points[B].decoder_model_present_for_this_op[B]){var F=o.operating_points[B].operating_point_idc;(F===0||F>>t&1&&F>>e+8&1)&&r.readBits(o.buffer_removal_time_length_minus_1+1)}}var q=255;if(d===3||d==0&&y||(q=r.readBits(8)),(l||q!==255)&&f&&o.enable_order_hint)for(var Z=0;Z<8;Z++)r.readBits(o.order_hint_bits);if(l){var U=n.frameSizeAndRenderSize(r,T,o);a.codec_size={width:U.FrameWidth,height:U.FrameHeight},a.present_size={width:U.RenderWidth,height:U.RenderHeight},a.sar_ratio={width:U.RenderWidth/U.FrameWidth,height:U.RenderHeight/U.FrameHeight}}return r.destroy(),r=null,a},n.frameSizeAndRenderSize=function(i,t,e){var{max_frame_width:a,max_frame_height:o}=e;t&&(a=i.readBits(e.frame_width_bit)+1,o=i.readBits(e.frame_height_bit)+1);var r=!1;e.enable_superres&&(r=i.readBool());var s=8;r&&(s=i.readBits(3)+9);var d=a;a=Math.floor((8*d+s/2)/s);var l=d,y=o;if(i.readBool()){var f=i.readBits(16)+1,g=i.readBits(16)+1;l=i.readBits(f)+1,y=i.readBits(g)+1}return{UpscaledWidth:d,FrameWidth:a,FrameHeight:o,RenderWidth:l,RenderHeight:y}},n.getLevelString=function(i,t){return"".concat(i.toString(10).padStart(2,"0")).concat(t===0?"M":"H")},n.getChromaFormat=function(i,t,e){return i?0:t===0&&e===0?3:t===1&&e===0?2:t===1&&e===1?1:Number.NaN},n.getChromaFormatString=function(i,t,e){return i?"4:0:0":t===0&&e===0?"4:4:4":t===1&&e===0?"4:2:2":t===1&&e===1?"4:2:0":"Unknown"},n}(),E=function(){};function W(n,i,t){if(!n||n.byteLength<2)return null;var e=1;t==="h265"&&(e=2);var a=function(y){for(var f=y,g=f.byteLength,T=new Uint8Array(g),B=0,F=0;F=2&&f[F]===3&&f[F-1]===0&&f[F-2]===0||(T[B]=f[F],B++);return new Uint8Array(T.buffer,0,B)}(n.subarray(e)),o=0;if(o===a.byteLength-1&&a[o]===128)return null;for(var r=0;o=a.byteLength)return null;r+=a[o++];for(var s=0;o=a.byteLength)return null;if(s+=a[o++],o+s>a.byteLength)return null;var d=new E;d.type=r,d.size=s;var l=a.subarray(o,o+s);return r===5&&s>=16&&(d.uuid=l.subarray(0,16),d.user_data=l.subarray(16)),i!==void 0&&(d.pts=i),d}var z,se=function(){function n(i,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._onSeiArrived=null,this._dataOffset=i.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=i.hasAudioTrack,this._hasVideo=i.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new R.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1000,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1000},this._flvSoundRateTable=[5500,11025,22050,44100,48000],this._mpegSamplingRates=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350],this._mpegAudioV10SampleRateTable=[44100,48000,32000,0],this._mpegAudioV20SampleRateTable=[22050,24000,16000,0],this._mpegAudioV25SampleRateTable=[11025,12000,8000,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256}()}return n.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._onSeiArrived=null},n.probe=function(i){var t=new Uint8Array(i);if(t.byteLength<9)return{needMoreData:!0};var e={match:!1};if(t[0]!==70||t[1]!==76||t[2]!==86||t[3]!==1)return e;var a,o=(4&t[4])>>>2!=0,r=!!(1&t[4]),s=(a=t)[5]<<24|a[6]<<16|a[7]<<8|a[8];return s<9?e:{match:!0,consumed:s,dataOffset:s,hasAudioTrack:o,hasVideoTrack:r}},n.prototype.bindDataSource=function(i){return i.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(n.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(i){this._onTrackMetadata=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(i){this._onMediaInfo=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(i){this._onMetaDataArrived=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(i){this._onScriptDataArrived=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onSeiArrived",{get:function(){return this._onSeiArrived},set:function(i){this._onSeiArrived=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onError",{get:function(){return this._onError},set:function(i){this._onError=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(i){this._onDataAvailable=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(i){this._timestampBase=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"overridedDuration",{get:function(){return this._duration},set:function(i){this._durationOverrided=!0,this._duration=i,this._mediaInfo.duration=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"overridedHasAudio",{set:function(i){this._hasAudioFlagOverrided=!0,this._hasAudio=i,this._mediaInfo.hasAudio=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"overridedHasVideo",{set:function(i){this._hasVideoFlagOverrided=!0,this._hasVideo=i,this._mediaInfo.hasVideo=i},enumerable:!1,configurable:!0}),n.prototype.resetMediaInfo=function(){this._mediaInfo=new R.default},n.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},n.prototype.parseChunks=function(i,t){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new k.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var e=0,a=this._littleEndian;if(t===0){if(!(i.byteLength>13))return 0;e=n.probe(i).dataOffset}for(this._firstParse&&(this._firstParse=!1,t+e!==this._dataOffset&&_.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),(o=new DataView(i,e)).getUint32(0,!a)!==0&&_.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),e+=4);ei.byteLength)break;var r=o.getUint8(0),s=16777215&o.getUint32(0,!a);if(e+11+s+4>i.byteLength)break;if(r===8||r===9||r===18){var d=o.getUint8(4),l=o.getUint8(5),y=o.getUint8(6)|l<<8|d<<16|o.getUint8(7)<<24;16777215&o.getUint32(7,!a)&&_.default.w(this.TAG,"Meet tag which has StreamID != 0!");var f=e+11;switch(r){case 8:this._parseAudioData(i,f,s,y);break;case 9:this._parseVideoData(i,f,s,y,t+e);break;case 18:this._parseScriptData(i,f,s)}var g=o.getUint32(11+s,!a);g!==11+s&&_.default.w(this.TAG,"Invalid PrevTagSize ".concat(g)),e+=11+s+4}else _.default.w(this.TAG,"Unsupported tag type ".concat(r,", skipped")),e+=11+s+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),e},n.prototype._parseScriptData=function(i,t,e){var a=O.parseScriptData(i,t,e);if(a.hasOwnProperty("onMetaData")){if(a.onMetaData==null||typeof a.onMetaData!="object")return void _.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&_.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=a;var o=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},o)),typeof o.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=o.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof o.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=o.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof o.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=o.audiodatarate),typeof o.videodatarate=="number"&&(this._mediaInfo.videoDataRate=o.videodatarate),typeof o.width=="number"&&(this._mediaInfo.width=o.width),typeof o.height=="number"&&(this._mediaInfo.height=o.height),typeof o.duration=="number"){if(!this._durationOverrided){var r=Math.floor(o.duration*this._timescale);this._duration=r,this._mediaInfo.duration=r}}else this._mediaInfo.duration=0;if(typeof o.framerate=="number"){var s=Math.floor(1000*o.framerate);if(s>0){var d=s/1000;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=d,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1000,this._mediaInfo.fps=d}}if(typeof o.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;var l=o.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),o.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=o,_.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(a).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},a))},n.prototype._parseSEIPayload=function(i,t,e){var a=W(i,t,e);a&&typeof this._onSeiArrived=="function"&&this._onSeiArrived(a)},n.prototype._parseKeyframesIndex=function(i){for(var t=[],e=[],a=1;a>>4;if(r!==9)if(r===2||r===3||r===10){var s=0,d=(12&o)>>>2;if(d>=0&&d<=4){s=this._flvSoundRateTable[d];var l=(2&o)>>>1,y=1&o,f=this._audioMetadata,g=this._audioTrack;if(f||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(f=this._audioMetadata={}).type="audio",f.id=g.id,f.timescale=this._timescale,f.duration=this._duration,f.audioSampleRate=s,f.channelCount=y===0?1:2),r===10){var T=this._parseAACAudioData(i,t+1,e-1);if(T==null)return;if(T.packetType===0){if(f.config){if(u(T.data.config,f.config))return;_.default.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var B=T.data;f.audioSampleRate=B.samplingRate,f.channelCount=B.channelCount,f.codec=B.codec,f.originalCodec=B.originalCodec,f.config=B.config,f.refSampleDuration=1024/f.audioSampleRate*f.timescale,_.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",f),(U=this._mediaInfo).audioCodec=f.originalCodec,U.audioSampleRate=f.audioSampleRate,U.audioChannelCount=f.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(T.packetType===1){var F=this._timestampBase+a,q={unit:T.data,length:T.data.byteLength,dts:F,pts:F};g.samples.push(q),g.length+=T.data.length}else _.default.e(this.TAG,"Flv: Unsupported AAC data type ".concat(T.packetType))}else if(r===2){if(!f.codec){if((B=this._parseMP3AudioData(i,t+1,e-1,!0))==null)return;f.audioSampleRate=B.samplingRate,f.channelCount=B.channelCount,f.codec=B.codec,f.originalCodec=B.originalCodec,f.refSampleDuration=1152/f.audioSampleRate*f.timescale,_.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",f),(U=this._mediaInfo).audioCodec=f.codec,U.audioSampleRate=f.audioSampleRate,U.audioChannelCount=f.channelCount,U.audioDataRate=B.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)}if((H=this._parseMP3AudioData(i,t+1,e-1,!1))==null)return;F=this._timestampBase+a;var Z={unit:H,length:H.byteLength,dts:F,pts:F};g.samples.push(Z),g.length+=H.length}else if(r===3){var U;f.codec||(f.audioSampleRate=s,f.sampleSize=8*(l+1),f.littleEndian=!0,f.codec="ipcm",f.originalCodec="ipcm",this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",f),(U=this._mediaInfo).audioCodec=f.codec,U.audioSampleRate=f.audioSampleRate,U.audioChannelCount=f.channelCount,U.audioDataRate=f.sampleSize*f.audioSampleRate,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 H=new Uint8Array(i,t+1,e-1),he=(F=this._timestampBase+a,{unit:H,length:H.byteLength,dts:F,pts:F});g.samples.push(he),g.length+=H.length}}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+d)}else this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+r);else{if(e<=5)return void _.default.w(this.TAG,"Flv: Invalid audio packet, missing AudioFourCC in Ehnanced FLV payload!");var ve=15&o,ne=String.fromCharCode.apply(String,new Uint8Array(i,t,e).slice(1,5));switch(ne){case"Opus":this._parseOpusAudioPacket(i,t+5,e-5,a,ve);break;case"fLaC":this._parseFlacAudioPacket(i,t+5,e-5,a,ve);break;default:this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec: "+ne)}}}},n.prototype._parseAACAudioData=function(i,t,e){if(!(e<=1)){var a={},o=new Uint8Array(i,t,e);return a.packetType=o[0],o[0]===0?a.data=this._parseAACAudioSpecificConfig(i,t+1,e-1):a.data=o.subarray(1),a}_.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},n.prototype._parseAACAudioSpecificConfig=function(i,t,e){var a,o,r=new Uint8Array(i,t,e),s=null,d=0,l=null;if(d=a=r[0]>>>3,(o=(7&r[0])<<1|r[1]>>>7)<0||o>=this._mpegSamplingRates.length)this._onError(m.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var y=this._mpegSamplingRates[o],f=(120&r[1])>>>3;if(!(f<0||f>=8)){d===5&&(l=(7&r[1])<<1|r[2]>>>7,r[2]);var g=self.navigator.userAgent.toLowerCase();return g.indexOf("firefox")!==-1?o>=6?(d=5,s=[,,,,],l=o-3):(d=2,s=[,,],l=o):g.indexOf("android")!==-1?(d=2,s=[,,],l=o):(d=5,l=o,s=[,,,,],o>=6?l=o-3:f===1&&(d=2,s=[,,],l=o)),s[0]=d<<3,s[0]|=(15&o)>>>1,s[1]=(15&o)<<7,s[1]|=(15&f)<<3,d===5&&(s[1]|=(15&l)>>>1,s[2]=(1&l)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:y,channelCount:f,codec:"mp4a.40."+d,originalCodec:"mp4a.40."+a}}this._onError(m.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},n.prototype._parseMP3AudioData=function(i,t,e,a){if(!(e<4)){this._littleEndian;var o=new Uint8Array(i,t,e),r=null;if(a){if(o[0]!==255)return;var s=o[1]>>>3&3,d=(6&o[1])>>1,l=(240&o[2])>>>4,y=(12&o[2])>>>2,f=3&~(o[3]>>>6)?2:1,g=0,T=0;switch(s){case 0:g=this._mpegAudioV25SampleRateTable[y];break;case 2:g=this._mpegAudioV20SampleRateTable[y];break;case 3:g=this._mpegAudioV10SampleRateTable[y]}switch(d){case 1:l>>16&255,B[2]=r.byteLength>>>8&255,B[3]=r.byteLength>>>0&255;var F={config:B,channelCount:g,samplingFrequence:f,sampleSize:T,codec:"flac",originalCodec:"flac"};if(a.config){if(u(F.config,a.config))return;_.default.w(this.TAG,"FlacSequenceHeader has been changed, re-generate initialization segment")}a.audioSampleRate=F.samplingFrequence,a.channelCount=F.channelCount,a.sampleSize=F.sampleSize,a.codec=F.codec,a.originalCodec=F.originalCodec,a.config=F.config,a.refSampleDuration=y!=null?1000*y/F.samplingFrequence:null,_.default.v(this.TAG,"Parsed FlacSequenceHeader"),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",a);var q=this._mediaInfo;q.audioCodec=a.originalCodec,q.audioSampleRate=a.audioSampleRate,q.audioChannelCount=a.channelCount,q.hasVideo?q.videoCodec!=null&&(q.mimeType='video/x-flv; codecs="'+q.videoCodec+","+q.audioCodec+'"'):q.mimeType='video/x-flv; codecs="'+q.audioCodec+'"',q.isComplete()&&this._onMediaInfo(q)},n.prototype._parseFlacAudioData=function(i,t,e,a){var o=this._audioTrack,r=new Uint8Array(i,t,e),s=this._timestampBase+a,d={unit:r,length:r.byteLength,dts:s,pts:s};o.samples.push(d),o.length+=r.length},n.prototype._parseVideoData=function(i,t,e,a,o){if(e<=1)_.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(this._hasVideoFlagOverrided!==!0||this._hasVideo!==!1){var r=new Uint8Array(i,t,e)[0],s=(112&r)>>>4;if(128&r){var d=15&r,l=String.fromCharCode.apply(String,new Uint8Array(i,t,e).slice(1,5));if(l==="hvc1")this._parseEnhancedHEVCVideoPacket(i,t+5,e-5,a,o,s,d);else{if(l!=="av01")return void this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(l));this._parseEnhancedAV1VideoPacket(i,t+5,e-5,a,o,s,d)}}else{var y=15&r;if(y===7)this._parseAVCVideoPacket(i,t+1,e-1,a,o,s);else{if(y!==12)return void this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(y));this._parseHEVCVideoPacket(i,t+1,e-1,a,o,s)}}}},n.prototype._parseAVCVideoPacket=function(i,t,e,a,o,r){if(e<4)_.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var s=this._littleEndian,d=new DataView(i,t,e),l=d.getUint8(0),y=(16777215&d.getUint32(0,!s))<<8>>8;if(l===0)this._parseAVCDecoderConfigurationRecord(i,t+4,e-4);else if(l===1)this._parseAVCVideoData(i,t+4,e-4,a,o,r,y);else if(l!==2)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}},n.prototype._parseHEVCVideoPacket=function(i,t,e,a,o,r){if(e<4)_.default.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var s=this._littleEndian,d=new DataView(i,t,e),l=d.getUint8(0),y=(16777215&d.getUint32(0,!s))<<8>>8;if(l===0)this._parseHEVCDecoderConfigurationRecord(i,t+4,e-4);else if(l===1)this._parseHEVCVideoData(i,t+4,e-4,a,o,r,y);else if(l!==2)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}},n.prototype._parseEnhancedHEVCVideoPacket=function(i,t,e,a,o,r,s){var d=this._littleEndian,l=new DataView(i,t,e);if(s===0)this._parseHEVCDecoderConfigurationRecord(i,t,e);else if(s===1){var y=(4294967040&l.getUint32(0,!d))>>8;this._parseHEVCVideoData(i,t+3,e-3,a,o,r,y)}else if(s===3)this._parseHEVCVideoData(i,t,e,a,o,r,0);else if(s!==2)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(s))},n.prototype._parseEnhancedAV1VideoPacket=function(i,t,e,a,o,r,s){if(this._littleEndian,new DataView(i,t,e),s===0)this._parseAV1CodecConfigurationRecord(i,t,e);else if(s===1)this._parseAV1VideoData(i,t,e,a,o,r,0);else{if(s===5)return void this._onError(m.default.FORMAT_ERROR,"Flv: Not Supported MP2T AV1 video packet type ".concat(s));if(s!==2)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(s))}},n.prototype._parseAVCDecoderConfigurationRecord=function(i,t,e){if(e<7)_.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var a=this._videoMetadata,o=this._videoTrack,r=this._littleEndian,s=new DataView(i,t,e);if(a){if(a.avcc!==void 0){var d=new Uint8Array(i,t,e);if(u(d,a.avcc))return;_.default.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),(a=this._videoMetadata={}).type="video",a.id=o.id,a.timescale=this._timescale,a.duration=this._duration;var l=s.getUint8(0),y=s.getUint8(1);if(s.getUint8(2),s.getUint8(3),l===1&&y!==0)if(this._naluLengthSize=1+(3&s.getUint8(4)),this._naluLengthSize===3||this._naluLengthSize===4){var f=31&s.getUint8(5);if(f!==0){f>1&&_.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(f));for(var g=6,T=0;T1&&_.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(ge)),g++,T=0;T=e){_.default.w(this.TAG,"Malformed Nalu near timestamp ".concat(B,", offset = ").concat(g,", dataSize = ").concat(e));break}var q=l.getUint32(g,!d);if(T===3&&(q>>>=8),q>e-T)return void _.default.w(this.TAG,"Malformed Nalus near timestamp ".concat(B,", NaluSize > DataSize!"));var Z=31&l.getUint8(g+T);Z===5&&(F=!0);var U=new Uint8Array(i,t+g,T+q),H={type:Z,data:U};y.push(H),f+=U.byteLength,Z===6&&this._parseSEIPayload(U.subarray(T),B+s,"h264"),g+=T+q}if(y.length){var he=this._videoTrack,ve={units:y,length:f,isKeyframe:F,dts:B,cts:s,pts:B+s};F&&(ve.fileposition=o),he.samples.push(ve),he.length+=f}},n.prototype._parseHEVCVideoData=function(i,t,e,a,o,r,s){for(var d=this._littleEndian,l=new DataView(i,t,e),y=[],f=0,g=0,T=this._naluLengthSize,B=this._timestampBase+a,F=r===1;g=e){_.default.w(this.TAG,"Malformed Nalu near timestamp ".concat(B,", offset = ").concat(g,", dataSize = ").concat(e));break}var q=l.getUint32(g,!d);if(T===3&&(q>>>=8),q>e-T)return void _.default.w(this.TAG,"Malformed Nalus near timestamp ".concat(B,", NaluSize > DataSize!"));var Z=l.getUint8(g+T)>>1&63;Z!==19&&Z!==20&&Z!==21||(F=!0);var U=new Uint8Array(i,t+g,T+q),H={type:Z,data:U};y.push(H),f+=U.byteLength,Z!==39&&Z!==40||this._parseSEIPayload(U.subarray(T),B+s,"h265"),g+=T+q}if(y.length){var he=this._videoTrack,ve={units:y,length:f,isKeyframe:F,dts:B,cts:s,pts:B+s};F&&(ve.fileposition=o),he.samples.push(ve),he.length+=f}},n.prototype._parseAV1VideoData=function(i,t,e,a,o,r,s){this._littleEndian,new DataView(i,t,e);var d,l=[],y=this._timestampBase+a,f=r===1;if(f){var g=this._videoMetadata,T=p.parseOBUs(new Uint8Array(i,t,e),g.extra);if(T==null)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1 VideoData");console.log(T),g.codecWidth=T.codec_size.width,g.codecHeight=T.codec_size.height,g.presentWidth=T.present_size.width,g.presentHeight=T.present_size.height,g.sarRatio=T.sar_ratio;var B=this._mediaInfo;B.width=g.codecWidth,B.height=g.codecHeight,B.sarNum=g.sarRatio.width,B.sarDen=g.sarRatio.height,_.default.v(this.TAG,"Parsed AV1DecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",g)}if(d=e,l.push({unitType:0,data:new Uint8Array(i,t+0,e)}),l.length){var F=this._videoTrack,q={units:l,length:d,isKeyframe:f,dts:y,cts:s,pts:y+s};f&&(q.fileposition=o),F.samples.push(q),F.length+=d}},n}(),de=se,me=function(){function n(){}return n.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onPGSSubtitleData=null,this.onSynchronousKLVMetadata=null,this.onAsynchronousKLVMetadata=null,this.onSMPTE2038Metadata=null,this.onSEI=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},n}(),te=function(){this.program_pmt_pid={}};(function(n){n[n.kMPEG1Audio=3]="kMPEG1Audio",n[n.kMPEG2Audio=4]="kMPEG2Audio",n[n.kPESPrivateData=6]="kPESPrivateData",n[n.kADTSAAC=15]="kADTSAAC",n[n.kLOASAAC=17]="kLOASAAC",n[n.kAC3=129]="kAC3",n[n.kEAC3=135]="kEAC3",n[n.kMetadata=21]="kMetadata",n[n.kSCTE35=134]="kSCTE35",n[n.kPGS=144]="kPGS",n[n.kH264=27]="kH264",n[n.kH265=36]="kH265"})(z||(z={}));var ee,Re=function(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,av1:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.pgs_pids={},this.pgs_langs={},this.synchronous_klv_pids={},this.asynchronous_klv_pids={},this.scte_35_pids={},this.smpte2038_pids={}},J=function(){},ke=function(){},L=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};(function(n){n[n.kUnspecified=0]="kUnspecified",n[n.kSliceNonIDR=1]="kSliceNonIDR",n[n.kSliceDPA=2]="kSliceDPA",n[n.kSliceDPB=3]="kSliceDPB",n[n.kSliceDPC=4]="kSliceDPC",n[n.kSliceIDR=5]="kSliceIDR",n[n.kSliceSEI=6]="kSliceSEI",n[n.kSliceSPS=7]="kSliceSPS",n[n.kSlicePPS=8]="kSlicePPS",n[n.kSliceAUD=9]="kSliceAUD",n[n.kEndOfSequence=10]="kEndOfSequence",n[n.kEndOfStream=11]="kEndOfStream",n[n.kFiller=12]="kFiller",n[n.kSPSExt=13]="kSPSExt",n[n.kReserved0=14]="kReserved0"})(ee||(ee={}));var c,C,j=function(){},fe=function(n){var i=n.data.byteLength;this.type=n.type,this.data=new Uint8Array(4+i),new DataView(this.data.buffer).setUint32(0,i),this.data.set(n.data,4)},re=function(){function n(i){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=i,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&_.default.e(this.TAG,"Could not find H264 startcode until payload end!")}return n.prototype.findNextStartCodeOffset=function(i){for(var t=i,e=this.data_;;){if(t+3>=e.byteLength)return this.eof_flag_=!0,e.byteLength;var a=e[t+0]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],o=e[t+0]<<16|e[t+1]<<8|e[t+2];if(a===1||o===1)return t;t++}},n.prototype.readNextNaluPayload=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_startcode_offset_,a=31&i[e+=(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3])==1?4:3],o=(128&i[e])>>>7,r=this.findNextStartCodeOffset(e);if(this.current_startcode_offset_=r,!(a>=ee.kReserved0)&&o===0){var s=i.subarray(e,r);(t=new j).type=a,t.data=s}}return t},n}(),V=function(){function n(i,t,e){var a=8+i.byteLength+1+2+t.byteLength,o=!1;i[3]!==66&&i[3]!==77&&i[3]!==88&&(o=!0,a+=4);var r=this.data=new Uint8Array(a);r[0]=1,r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=255,r[5]=225;var s=i.byteLength;r[6]=s>>>8,r[7]=255&s;var d=8;r.set(i,8),r[d+=s]=1;var l=t.byteLength;r[d+1]=l>>>8,r[d+2]=255&l,r.set(t,d+3),d+=3+l,o&&(r[d]=252|e.chroma_format_idc,r[d+1]=248|e.bit_depth_luma-8,r[d+2]=248|e.bit_depth_chroma-8,r[d+3]=0,d+=4)}return n.prototype.getData=function(){return this.data},n}();(function(n){n[n.kNull=0]="kNull",n[n.kAACMain=1]="kAACMain",n[n.kAAC_LC=2]="kAAC_LC",n[n.kAAC_SSR=3]="kAAC_SSR",n[n.kAAC_LTP=4]="kAAC_LTP",n[n.kAAC_SBR=5]="kAAC_SBR",n[n.kAAC_Scalable=6]="kAAC_Scalable",n[n.kLayer1=32]="kLayer1",n[n.kLayer2=33]="kLayer2",n[n.kLayer3=34]="kLayer3"})(c||(c={})),function(n){n[n.k96000Hz=0]="k96000Hz",n[n.k88200Hz=1]="k88200Hz",n[n.k64000Hz=2]="k64000Hz",n[n.k48000Hz=3]="k48000Hz",n[n.k44100Hz=4]="k44100Hz",n[n.k32000Hz=5]="k32000Hz",n[n.k24000Hz=6]="k24000Hz",n[n.k22050Hz=7]="k22050Hz",n[n.k16000Hz=8]="k16000Hz",n[n.k12000Hz=9]="k12000Hz",n[n.k11025Hz=10]="k11025Hz",n[n.k8000Hz=11]="k8000Hz",n[n.k7350Hz=12]="k7350Hz"}(C||(C={}));var Y,ie,oe=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350],ue=(Y=function(n,i){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])},Y(n,i)},function(n,i){if(typeof i!="function"&&i!==null)throw TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=n}Y(n,i),n.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}),Ee=function(){},Pe=function(n){function i(){return n!==null&&n.apply(this,arguments)||this}return ue(i,n),i}(Ee),Ue=function(){function n(i){this.TAG="AACADTSParser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&_.default.e(this.TAG,"Could not found ADTS syncword until payload end")}return n.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<8|e[t+1])>>>4==4095)return t;t++}},n.prototype.readNextAACFrame=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,a=(8&i[e+1])>>>3,o=(6&i[e+1])>>>1,r=1&i[e+1],s=(192&i[e+2])>>>6,d=(60&i[e+2])>>>2,l=(1&i[e+2])<<2|(192&i[e+3])>>>6,y=(3&i[e+3])<<11|i[e+4]<<3|(224&i[e+5])>>>5;if(i[e+6],e+y>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var f=r===1?7:9,g=y-f;e+=f;var T=this.findNextSyncwordOffset(e+g);if(this.current_syncword_offset_=T,(a===0||a===1)&&o===0){var B=i.subarray(e,e+g);(t=new Ee).audio_object_type=s+1,t.sampling_freq_index=d,t.sampling_frequency=oe[d],t.channel_config=l,t.data=B}}return t},n.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},n.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},n}(),je=function(){function n(i){this.TAG="AACLOASParser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&_.default.e(this.TAG,"Could not found LOAS syncword until payload end")}return n.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+1>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<3|e[t+1]>>>5)==695)return t;t++}},n.prototype.getLATMValue=function(i){for(var t=i.readBits(2),e=0,a=0;a<=t;a++)e<<=8,e|=i.readByte();return e},n.prototype.readNextAACFrame=function(i){for(var t=this.data_,e=null;e==null&&!this.eof_flag_;){var a=this.current_syncword_offset_,o=(31&t[a+1])<<8|t[a+2];if(a+3+o>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var r=new A(t.subarray(a+3,a+3+o)),s=null;if(r.readBool()){if(i==null){_.default.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(a+3+o),r.destroy();continue}s=i}else{var d=r.readBool();if(d&&r.readBool()){_.default.e(this.TAG,"audioMuxVersionA is Not Supported"),r.destroy();break}if(d&&this.getLATMValue(r),!r.readBool()){_.default.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),r.destroy();break}if(r.readBits(6)!==0){_.default.e(this.TAG,"more than 2 numSubFrames Not Supported"),r.destroy();break}if(r.readBits(4)!==0){_.default.e(this.TAG,"more than 2 numProgram Not Supported"),r.destroy();break}if(r.readBits(3)!==0){_.default.e(this.TAG,"more than 2 numLayer Not Supported"),r.destroy();break}var l=d?this.getLATMValue(r):0,y=r.readBits(5);l-=5;var f=r.readBits(4);l-=4;var g=r.readBits(4);l-=4,r.readBits(3),(l-=3)>0&&r.readBits(l);var T=r.readBits(3);if(T!==0){_.default.e(this.TAG,"frameLengthType = ".concat(T,". Only frameLengthType = 0 Supported")),r.destroy();break}r.readByte();var B=r.readBool();if(B)if(d)this.getLATMValue(r);else{for(var F=0;;){F<<=8;var q=r.readBool();if(F+=r.readByte(),!q)break}console.log(F)}r.readBool()&&r.readByte(),(s=new Pe).audio_object_type=y,s.sampling_freq_index=f,s.sampling_frequency=oe[s.sampling_freq_index],s.channel_config=g,s.other_data_present=B}for(var Z=0;;){var U=r.readByte();if(Z+=U,U!==255)break}for(var H=new Uint8Array(Z),he=0;he=6?(e=5,i=[,,,,],r=a-3):(e=2,i=[,,],r=a):s.indexOf("android")!==-1?(e=2,i=[,,],r=a):(e=5,r=a,i=[,,,,],a>=6?r=a-3:o===1&&(e=2,i=[,,],r=a)),i[0]=e<<3,i[0]|=(15&a)>>>1,i[1]=(15&a)<<7,i[1]|=(15&o)<<3,e===5&&(i[1]|=(15&r)>>>1,i[2]=(1&r)<<7,i[2]|=8,i[3]=0),this.config=i,this.sampling_rate=oe[a],this.channel_count=o,this.codec_mimetype="mp4a.40."+e,this.original_codec_mimetype="mp4a.40."+t},Xe=function(){},nt=function(){};(function(n){n[n.kSpliceNull=0]="kSpliceNull",n[n.kSpliceSchedule=4]="kSpliceSchedule",n[n.kSpliceInsert=5]="kSpliceInsert",n[n.kTimeSignal=6]="kTimeSignal",n[n.kBandwidthReservation=7]="kBandwidthReservation",n[n.kPrivateCommand=255]="kPrivateCommand"})(ie||(ie={}));var Ne,Qe=function(n){var i=n.readBool();return i?(n.readBits(6),{time_specified_flag:i,pts_time:4*n.readBits(31)+n.readBits(2)}):(n.readBits(7),{time_specified_flag:i})},ht=function(n){var i=n.readBool();return n.readBits(6),{auto_return:i,duration:4*n.readBits(31)+n.readBits(2)}},Ot=function(n,i){var t=i.readBits(8);return n?{component_tag:t}:{component_tag:t,splice_time:Qe(i)}},Pt=function(n){return{component_tag:n.readBits(8),utc_splice_time:n.readBits(32)}},xt=function(n){var i=n.readBits(32),t=n.readBool();n.readBits(7);var e={splice_event_id:i,splice_event_cancel_indicator:t};if(t)return e;if(e.out_of_network_indicator=n.readBool(),e.program_splice_flag=n.readBool(),e.duration_flag=n.readBool(),n.readBits(5),e.program_splice_flag)e.utc_splice_time=n.readBits(32);else{e.component_count=n.readBits(8),e.components=[];for(var a=0;a=e.byteLength)return this.eof_flag_=!0,e.byteLength;var a=e[t+0]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],o=e[t+0]<<16|e[t+1]<<8|e[t+2];if(a===1||o===1)return t;t++}},n.prototype.readNextNaluPayload=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_startcode_offset_,a=i[e+=(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3])==1?4:3]>>1&63,o=(128&i[e])>>>7,r=this.findNextStartCodeOffset(e);if(this.current_startcode_offset_=r,o===0){var s=i.subarray(e,r);(t=new Ht).type=a,t.data=s}}return t},n}(),Wt=function(){function n(i,t,e,a){var o=23+(5+i.byteLength)+(5+t.byteLength)+(5+e.byteLength),r=this.data=new Uint8Array(o);r[0]=1,r[1]=(3&a.general_profile_space)<<6|(a.general_tier_flag?1:0)<<5|31&a.general_profile_idc,r[2]=a.general_profile_compatibility_flags_1,r[3]=a.general_profile_compatibility_flags_2,r[4]=a.general_profile_compatibility_flags_3,r[5]=a.general_profile_compatibility_flags_4,r[6]=a.general_constraint_indicator_flags_1,r[7]=a.general_constraint_indicator_flags_2,r[8]=a.general_constraint_indicator_flags_3,r[9]=a.general_constraint_indicator_flags_4,r[10]=a.general_constraint_indicator_flags_5,r[11]=a.general_constraint_indicator_flags_6,r[12]=a.general_level_idc,r[13]=240|(3840&a.min_spatial_segmentation_idc)>>8,r[14]=255&a.min_spatial_segmentation_idc,r[15]=252|3&a.parallelismType,r[16]=252|3&a.chroma_format_idc,r[17]=248|7&a.bit_depth_luma_minus8,r[18]=248|7&a.bit_depth_chroma_minus8,r[19]=0,r[20]=0,r[21]=(3&a.constant_frame_rate)<<6|(7&a.num_temporal_layers)<<3|(a.temporal_id_nested?1:0)<<2|3,r[22]=3,r[23]=128|Ne.kSliceVPS,r[24]=0,r[25]=1,r[26]=(65280&i.byteLength)>>8,r[27]=255&i.byteLength,r.set(i,28),r[23+(5+i.byteLength)+0]=128|Ne.kSliceSPS,r[23+(5+i.byteLength)+1]=0,r[23+(5+i.byteLength)+2]=1,r[23+(5+i.byteLength)+3]=(65280&t.byteLength)>>8,r[23+(5+i.byteLength)+4]=255&t.byteLength,r.set(t,23+(5+i.byteLength)+5),r[23+(5+i.byteLength+5+t.byteLength)+0]=128|Ne.kSlicePPS,r[23+(5+i.byteLength+5+t.byteLength)+1]=0,r[23+(5+i.byteLength+5+t.byteLength)+2]=1,r[23+(5+i.byteLength+5+t.byteLength)+3]=(65280&e.byteLength)>>8,r[23+(5+i.byteLength+5+t.byteLength)+4]=255&e.byteLength,r.set(e,23+(5+i.byteLength+5+t.byteLength)+5)}return n.prototype.getData=function(){return this.data},n}(),Yt=function(){},Xt=function(){},Qt=function(){},$t=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]],Jt=function(){function n(i){this.TAG="AC3Parser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&_.default.e(this.TAG,"Could not found AC3 syncword until payload end")}return n.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<8|e[t+1])==2935)return t;t++}},n.prototype.readNextAC3Frame=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,a=i[e+4]>>6,o=[48000,44200,33000][a],r=63&i[e+4],s=2*$t[a][r];if(isNaN(s)||e+s>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var d=this.findNextSyncwordOffset(e+s);this.current_syncword_offset_=d;var l=i[e+5]>>3,y=7&i[e+5],f=i[e+6]>>5,g=0;1&f&&f!==1&&(g+=2),4&f&&(g+=2),f===2&&(g+=2);var T=(i[e+6]<<8|i[e+7])>>12-g&1,B=[2,1,2,3,3,4,4,5][f]+T;(t=new Qt).sampling_frequency=o,t.channel_count=B,t.channel_mode=f,t.bit_stream_identification=l,t.low_frequency_effects_channel_on=T,t.bit_stream_mode=y,t.frame_size_code=r,t.data=i.subarray(e,e+s)}return t},n.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},n.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},n}(),Zt=function(n){var i;i=[n.sampling_rate_code<<6|n.bit_stream_identification<<1|n.bit_stream_mode>>2,(3&n.bit_stream_mode)<<6|n.channel_mode<<3|n.low_frequency_effects_channel_on<<2|n.frame_size_code>>4,n.frame_size_code<<4&224],this.config=i,this.sampling_rate=n.sampling_frequency,this.bit_stream_identification=n.bit_stream_identification,this.bit_stream_mode=n.bit_stream_mode,this.low_frequency_effects_channel_on=n.low_frequency_effects_channel_on,this.channel_count=n.channel_count,this.channel_mode=n.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"},ei=function(){},ti=function(){function n(i){this.TAG="EAC3Parser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&_.default.e(this.TAG,"Could not found AC3 syncword until payload end")}return n.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<8|e[t+1])==2935)return t;t++}},n.prototype.readNextEAC3Frame=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,a=new A(i.subarray(e+2)),o=(a.readBits(2),a.readBits(3),a.readBits(11)+1<<1),r=a.readBits(2),s=null,d=null;r===3?(s=[24000,22060,16000][r=a.readBits(2)],d=3):(s=[48000,44100,32000][r],d=a.readBits(2));var l=a.readBits(3),y=a.readBits(1),f=a.readBits(5);if(e+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var g=this.findNextSyncwordOffset(e+o);this.current_syncword_offset_=g;var T=[2,1,2,3,3,4,4,5][l]+y;a.destroy(),(t=new ei).sampling_frequency=s,t.channel_count=T,t.channel_mode=l,t.bit_stream_identification=f,t.low_frequency_effects_channel_on=y,t.frame_size=o,t.num_blks=[1,2,3,6][d],t.data=i.subarray(e,e+o)}return t},n.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},n.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},n}(),ii=function(n){var i,t=Math.floor(n.frame_size*n.sampling_frequency/(16*n.num_blks));i=[255&t,248&t,n.sampling_rate_code<<6|n.bit_stream_identification<<1,n.channel_mode<<1|n.low_frequency_effects_channel_on,0],this.config=i,this.sampling_rate=n.sampling_frequency,this.bit_stream_identification=n.bit_stream_identification,this.num_blks=n.num_blks,this.low_frequency_effects_channel_on=n.low_frequency_effects_channel_on,this.channel_count=n.channel_count,this.channel_mode=n.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"},ni=function(){},ai=function(){function n(i){this.TAG="AV1OBUInMpegTsParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=i,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&_.default.e(this.TAG,"Could not find AV1 startcode until payload end!")}return n._ebsp2rbsp=function(i){for(var t=i,e=t.byteLength,a=new Uint8Array(e),o=0,r=0;r=2&&t[r]===3&&t[r-1]===0&&t[r-2]===0||(a[o]=t[r],o++);return new Uint8Array(a.buffer,0,o)},n.prototype.findNextStartCodeOffset=function(i){for(var t=i,e=this.data_;;){if(t+2>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<16|e[t+1]<<8|e[t+2])==1)return t;t++}},n.prototype.readNextOBUPayload=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_startcode_offset_+3,a=this.findNextStartCodeOffset(e);this.current_startcode_offset_=a,t=n._ebsp2rbsp(i.subarray(e,a))}return t},n}(),ri=function(){},oi=function(){var n=function(i,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])},n(i,t)};return function(i,t){if(typeof t!="function"&&t!==null)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}n(i,t),i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}}(),Ke=function(){return Ke=Object.assign||function(n){for(var i,t=1,e=arguments.length;t=4?(_.default.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),a-=4):o===204&&_.default.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:o,sync_offset:a})},i.prototype.bindDataSource=function(t){return t.onDataArrival=this.parseChunks.bind(this),this},i.prototype.resetMediaInfo=function(){this.media_info_=new R.default},i.prototype.parseChunks=function(t,e){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new k.IllegalStateException("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var a=0;for(this.first_parse_&&(this.first_parse_=!1,a=this.sync_offset_);a+this.ts_packet_size_<=t.byteLength;){var o=e+a;this.ts_packet_size_===192&&(a+=4);var r=new Uint8Array(t,a,188),s=r[0];if(s!==71){_.default.e(this.TAG,"sync_byte = ".concat(s,", not 0x47"));break}var d=(64&r[1])>>>6,l=(r[1],(31&r[1])<<8|r[2]),y=(48&r[3])>>>4,f=15&r[3],g=!(!this.pmt_||this.pmt_.pcr_pid!==l),T={},B=4;if(y==2||y==3){var F=r[4];if(F>0&&(g||y==3)&&(T.discontinuity_indicator=(128&r[5])>>>7,T.random_access_indicator=(64&r[5])>>>6,T.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){var q=300*this.getPcrBase(r)+((1&r[10])<<8|r[11]);this.last_pcr_=q}if(y==2||5+F===188){a+=188,this.ts_packet_size_===204&&(a+=16);continue}B=5+F}if(y==1||y==3){if(l===0||l===this.current_pmt_pid_||this.pmt_!=null&&this.pmt_.pid_stream_type[l]===z.kSCTE35){var Z=188-B;this.handleSectionSlice(t,a+B,Z,{pid:l,file_position:o,payload_unit_start_indicator:d,continuity_conunter:f,random_access_indicator:T.random_access_indicator})}else if(this.pmt_!=null&&this.pmt_.pid_stream_type[l]!=null){Z=188-B;var U=this.pmt_.pid_stream_type[l];l!==this.pmt_.common_pids.h264&&l!==this.pmt_.common_pids.h265&&l!==this.pmt_.common_pids.av1&&l!==this.pmt_.common_pids.adts_aac&&l!==this.pmt_.common_pids.loas_aac&&l!==this.pmt_.common_pids.ac3&&l!==this.pmt_.common_pids.eac3&&l!==this.pmt_.common_pids.opus&&l!==this.pmt_.common_pids.mp3&&this.pmt_.pes_private_data_pids[l]!==!0&&this.pmt_.timed_id3_pids[l]!==!0&&this.pmt_.pgs_pids[l]!==!0&&this.pmt_.synchronous_klv_pids[l]!==!0&&this.pmt_.asynchronous_klv_pids[l]!==!0||this.handlePESSlice(t,a+B,Z,{pid:l,stream_type:U,file_position:o,payload_unit_start_indicator:d,continuity_conunter:f,random_access_indicator:T.random_access_indicator})}}a+=188,this.ts_packet_size_===204&&(a+=16)}return this.dispatchAudioVideoMediaSegment(),a},i.prototype.handleSectionSlice=function(t,e,a,o){var r=new Uint8Array(t,e,a),s=this.section_slice_queues_[o.pid];if(o.payload_unit_start_indicator){var d=r[0];if(s!=null&&s.total_length!==0){var l=new Uint8Array(t,e+1,Math.min(a,d));s.slices.push(l),s.total_length+=l.byteLength,s.total_length===s.expected_length?this.emitSectionSlices(s,o):this.clearSlices(s,o)}for(var y=1+d;y=s.expected_length&&this.clearSlices(s,o),y+=l.byteLength}}else s!=null&&s.total_length!==0&&(l=new Uint8Array(t,e,Math.min(a,s.expected_length-s.total_length)),s.slices.push(l),s.total_length+=l.byteLength,s.total_length===s.expected_length?this.emitSectionSlices(s,o):s.total_length>=s.expected_length&&this.clearSlices(s,o))},i.prototype.handlePESSlice=function(t,e,a,o){var r=new Uint8Array(t,e,a),s=r[0]<<16|r[1]<<8|r[2],d=(r[3],r[4]<<8|r[5]);if(o.payload_unit_start_indicator){if(s!==1)return void _.default.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value ".concat(s));var l=this.pes_slice_queues_[o.pid];l&&(l.expected_length===0||l.expected_length===l.total_length?this.emitPESSlices(l,o):this.clearSlices(l,o)),this.pes_slice_queues_[o.pid]=new L,this.pes_slice_queues_[o.pid].file_position=o.file_position,this.pes_slice_queues_[o.pid].random_access_indicator=o.random_access_indicator}if(this.pes_slice_queues_[o.pid]!=null){var y=this.pes_slice_queues_[o.pid];y.slices.push(r),o.payload_unit_start_indicator&&(y.expected_length=d===0?0:d+6),y.total_length+=r.byteLength,y.expected_length>0&&y.expected_length===y.total_length?this.emitPESSlices(y,o):y.expected_length>0&&y.expected_length>>6,d=e[8],l=void 0,y=void 0;s!==2&&s!==3||(l=this.getTimestamp(e,9),y=s===3?this.getTimestamp(e,14):l);var f=9+d,g=void 0;if(r!==0){if(r<3+d)return void _.default.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");g=r-3-d}else g=e.byteLength-f;var T=e.subarray(f,f+g);switch(t.stream_type){case z.kMPEG1Audio:case z.kMPEG2Audio:this.parseMP3Payload(T,l);break;case z.kPESPrivateData:this.pmt_.common_pids.av1===t.pid?this.parseAV1Payload(T,l,y,t.file_position,t.random_access_indicator):this.pmt_.common_pids.opus===t.pid?this.parseOpusPayload(T,l):this.pmt_.common_pids.ac3===t.pid?this.parseAC3Payload(T,l):this.pmt_.common_pids.eac3===t.pid?this.parseEAC3Payload(T,l):this.pmt_.asynchronous_klv_pids[t.pid]?this.parseAsynchronousKLVMetadataPayload(T,t.pid,o):this.pmt_.smpte2038_pids[t.pid]?this.parseSMPTE2038MetadataPayload(T,l,y,t.pid,o):this.parsePESPrivateDataPayload(T,l,y,t.pid,o);break;case z.kADTSAAC:this.parseADTSAACPayload(T,l);break;case z.kLOASAAC:this.parseLOASAACPayload(T,l);break;case z.kAC3:this.parseAC3Payload(T,l);break;case z.kEAC3:this.parseEAC3Payload(T,l);break;case z.kMetadata:this.pmt_.timed_id3_pids[t.pid]?this.parseTimedID3MetadataPayload(T,l,y,t.pid,o):this.pmt_.synchronous_klv_pids[t.pid]&&this.parseSynchronousKLVMetadataPayload(T,l,y,t.pid,o);break;case z.kPGS:this.parsePGSPayload(T,l,y,t.pid,o,this.pmt_.pgs_langs[t.pid]);break;case z.kH264:this.parseH264Payload(T,l,y,t.file_position,t.random_access_indicator);break;case z.kH265:this.parseH265Payload(T,l,y,t.file_position,t.random_access_indicator)}}else o!==188&&o!==191&&o!==240&&o!==241&&o!==255&&o!==242&&o!==248||t.stream_type!==z.kPESPrivateData||(f=6,g=void 0,g=r!==0?r:e.byteLength-f,T=e.subarray(f,f+g),this.parsePESPrivateDataPayload(T,void 0,void 0,t.pid,o));else _.default.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value ".concat(a))},i.prototype.parsePAT=function(t){var e=t[0];if(e===0){var a=(15&t[1])<<8|t[2],o=(t[3],t[4],(62&t[5])>>>1),r=1&t[5],s=t[6],d=(t[7],null);if(r===1&&s===0)(d=new te).version_number=o;else if((d=this.pat_)==null)return;for(var l=a-5-4,y=-1,f=-1,g=8;g<8+l;g+=4){var T=t[g]<<8|t[g+1],B=(31&t[g+2])<<8|t[g+3];T===0?d.network_pid=B:(d.program_pmt_pid[T]=B,y===-1&&(y=T),f===-1&&(f=B))}r===1&&s===0&&(this.pat_==null&&_.default.v(this.TAG,"Parsed first PAT: ".concat(JSON.stringify(d))),this.pat_=d,this.current_program_=y,this.current_pmt_pid_=f)}else _.default.e(this.TAG,"parsePAT: table_id ".concat(e," is not corresponded to PAT!"))},i.prototype.parsePMT=function(t){var e=t[0];if(e===2){var a=(15&t[1])<<8|t[2],o=t[3]<<8|t[4],r=(62&t[5])>>>1,s=1&t[5],d=t[6],l=(t[7],null);if(s===1&&d===0)(l=new Re).program_number=o,l.version_number=r,this.program_pmt_map_[o]=l;else if((l=this.program_pmt_map_[o])==null)return;l.pcr_pid=(31&t[8])<<8|t[9];for(var y=(15&t[10])<<8|t[11],f=12+y,g=a-9-y-4,T=f;T0){for(var H=T+5;H0)for(H=T+5;H0)for(H=T+5;H1&&(_.default.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(s,"ms, PES pts: ").concat(r,"ms")),r=s)}}for(var d,l=new Ue(t),y=null,f=r;(y=l.readNextAACFrame())!=null;){o=1024/y.sampling_frequency*1000;var g={codec:"aac",data:y};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"aac",audio_object_type:y.audio_object_type,sampling_freq_index:y.sampling_freq_index,sampling_frequency:y.sampling_frequency,channel_config:y.channel_config},this.dispatchAudioInitSegment(g)):this.detectAudioMetadataChange(g)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(g)),d=f;var T=Math.floor(f),B={unit:y.data,length:y.data.byteLength,pts:T,dts:T};this.audio_track_.samples.push(B),this.audio_track_.length+=y.data.byteLength,f+=o}l.hasIncompleteData()&&(this.aac_last_incomplete_data_=l.getIncompleteData()),d&&(this.audio_last_sample_pts_=d)}},i.prototype.parseLOASAACPayload=function(t,e){var a;if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var o=new Uint8Array(t.byteLength+this.aac_last_incomplete_data_.byteLength);o.set(this.aac_last_incomplete_data_,0),o.set(t,this.aac_last_incomplete_data_.byteLength),t=o}var r,s;if(e!=null&&(s=e/this.timescale_),this.audio_metadata_.codec==="aac"){if(e==null&&this.audio_last_sample_pts_!=null)r=1024/this.audio_metadata_.sampling_frequency*1000,s=this.audio_last_sample_pts_+r;else if(e==null)return void _.default.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1000;var d=this.audio_last_sample_pts_+r;Math.abs(d-s)>1&&(_.default.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(d,"ms, PES pts: ").concat(s,"ms")),s=d)}}for(var l,y=new je(t),f=null,g=s;(f=y.readNextAACFrame((a=this.loas_previous_frame)!==null&&a!==void 0?a:void 0))!=null;){this.loas_previous_frame=f,r=1024/f.sampling_frequency*1000;var T={codec:"aac",data:f};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"aac",audio_object_type:f.audio_object_type,sampling_freq_index:f.sampling_freq_index,sampling_frequency:f.sampling_frequency,channel_config:f.channel_config},this.dispatchAudioInitSegment(T)):this.detectAudioMetadataChange(T)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(T)),l=g;var B=Math.floor(g),F={unit:f.data,length:f.data.byteLength,pts:B,dts:B};this.audio_track_.samples.push(F),this.audio_track_.length+=f.data.byteLength,g+=r}y.hasIncompleteData()&&(this.aac_last_incomplete_data_=y.getIncompleteData()),l&&(this.audio_last_sample_pts_=l)}},i.prototype.parseAC3Payload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var a,o;if(e!=null&&(o=e/this.timescale_),this.audio_metadata_.codec==="ac-3"){if(e==null&&this.audio_last_sample_pts_!=null)a=1536/this.audio_metadata_.sampling_frequency*1000,o=this.audio_last_sample_pts_+a;else if(e==null)return void _.default.w(this.TAG,"AC3: Unknown pts")}for(var r,s=new Jt(t),d=null,l=o;(d=s.readNextAC3Frame())!=null;){a=1536/d.sampling_frequency*1000;var y={codec:"ac-3",data:d};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"ac-3",sampling_frequency:d.sampling_frequency,bit_stream_identification:d.bit_stream_identification,bit_stream_mode:d.bit_stream_mode,low_frequency_effects_channel_on:d.low_frequency_effects_channel_on,channel_mode:d.channel_mode},this.dispatchAudioInitSegment(y)):this.detectAudioMetadataChange(y)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(y)),r=l;var f=Math.floor(l),g={unit:d.data,length:d.data.byteLength,pts:f,dts:f};this.audio_track_.samples.push(g),this.audio_track_.length+=d.data.byteLength,l+=a}r&&(this.audio_last_sample_pts_=r)}},i.prototype.parseEAC3Payload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var a,o;if(e!=null&&(o=e/this.timescale_),this.audio_metadata_.codec==="ec-3"){if(e==null&&this.audio_last_sample_pts_!=null)a=256*this.audio_metadata_.num_blks/this.audio_metadata_.sampling_frequency*1000,o=this.audio_last_sample_pts_+a;else if(e==null)return void _.default.w(this.TAG,"EAC3: Unknown pts")}for(var r,s=new ti(t),d=null,l=o;(d=s.readNextEAC3Frame())!=null;){a=1536/d.sampling_frequency*1000;var y={codec:"ec-3",data:d};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"ec-3",sampling_frequency:d.sampling_frequency,bit_stream_identification:d.bit_stream_identification,low_frequency_effects_channel_on:d.low_frequency_effects_channel_on,num_blks:d.num_blks,channel_mode:d.channel_mode},this.dispatchAudioInitSegment(y)):this.detectAudioMetadataChange(y)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(y)),r=l;var f=Math.floor(l),g={unit:d.data,length:d.data.byteLength,pts:f,dts:f};this.audio_track_.samples.push(g),this.audio_track_.length+=d.data.byteLength,l+=a}r&&(this.audio_last_sample_pts_=r)}},i.prototype.parseOpusPayload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var a,o;if(e!=null&&(o=e/this.timescale_),this.audio_metadata_.codec==="opus"){if(e==null&&this.audio_last_sample_pts_!=null)a=20,o=this.audio_last_sample_pts_+a;else if(e==null)return void _.default.w(this.TAG,"Opus: Unknown pts")}for(var r,s=o,d=0;d>>3&3,o=(6&t[1])>>1,r=(t[2],(12&t[2])>>>2),s=3&~(t[3]>>>6)?2:1,d=0,l=34;switch(a){case 0:d=[11025,12000,8000,0][r];break;case 2:d=[22050,24000,16000,0][r];break;case 3:d=[44100,48000,32000,0][r]}switch(o){case 1:l=34;break;case 2:l=33;break;case 3:l=32}var y=new Xt;y.object_type=l,y.sample_rate=d,y.channel_count=s,y.data=t;var f={codec:"mp3",data:y};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"mp3",object_type:l,sample_rate:d,channel_count:s},this.dispatchAudioInitSegment(f)):this.detectAudioMetadataChange(f)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(f));var g={unit:t,length:t.byteLength,pts:e/this.timescale_,dts:e/this.timescale_};this.audio_track_.samples.push(g),this.audio_track_.length+=t.byteLength}},i.prototype.detectAudioMetadataChange=function(t){if(t.codec!==this.audio_metadata_.codec)return _.default.v(this.TAG,"Audio: Audio Codecs changed from "+"".concat(this.audio_metadata_.codec," to ").concat(t.codec)),!0;if(t.codec==="aac"&&this.audio_metadata_.codec==="aac"){if((e=t.data).audio_object_type!==this.audio_metadata_.audio_object_type)return _.default.v(this.TAG,"AAC: AudioObjectType changed from "+"".concat(this.audio_metadata_.audio_object_type," to ").concat(e.audio_object_type)),!0;if(e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return _.default.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sampling_freq_index," to ").concat(e.sampling_freq_index)),!0;if(e.channel_config!==this.audio_metadata_.channel_config)return _.default.v(this.TAG,"AAC: Channel configuration changed from "+"".concat(this.audio_metadata_.channel_config," to ").concat(e.channel_config)),!0}else if(t.codec==="ac-3"&&this.audio_metadata_.codec==="ac-3"){var e;if((e=t.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return _.default.v(this.TAG,"AC3: Sampling Frequency changed from "+"".concat(this.audio_metadata_.sampling_frequency," to ").concat(e.sampling_frequency)),!0;if(e.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return _.default.v(this.TAG,"AC3: Bit Stream Identification changed from "+"".concat(this.audio_metadata_.bit_stream_identification," to ").concat(e.bit_stream_identification)),!0;if(e.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return _.default.v(this.TAG,"AC3: BitStream Mode changed from "+"".concat(this.audio_metadata_.bit_stream_mode," to ").concat(e.bit_stream_mode)),!0;if(e.channel_mode!==this.audio_metadata_.channel_mode)return _.default.v(this.TAG,"AC3: Channel Mode changed from "+"".concat(this.audio_metadata_.channel_mode," to ").concat(e.channel_mode)),!0;if(e.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return _.default.v(this.TAG,"AC3: Low Frequency Effects Channel On changed from "+"".concat(this.audio_metadata_.low_frequency_effects_channel_on," to ").concat(e.low_frequency_effects_channel_on)),!0}else if(t.codec==="opus"&&this.audio_metadata_.codec==="opus"){if((a=t.meta).sample_rate!==this.audio_metadata_.sample_rate)return _.default.v(this.TAG,"Opus: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(a.sample_rate)),!0;if(a.channel_count!==this.audio_metadata_.channel_count)return _.default.v(this.TAG,"Opus: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(a.channel_count)),!0}else if(t.codec==="mp3"&&this.audio_metadata_.codec==="mp3"){var a;if((a=t.data).object_type!==this.audio_metadata_.object_type)return _.default.v(this.TAG,"MP3: AudioObjectType changed from "+"".concat(this.audio_metadata_.object_type," to ").concat(a.object_type)),!0;if(a.sample_rate!==this.audio_metadata_.sample_rate)return _.default.v(this.TAG,"MP3: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(a.sample_rate)),!0;if(a.channel_count!==this.audio_metadata_.channel_count)return _.default.v(this.TAG,"MP3: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(a.channel_count)),!0}return!1},i.prototype.dispatchAudioInitSegment=function(t){var e={type:"audio"};if(e.id=this.audio_track_.id,e.timescale=1000,e.duration=this.duration_,this.audio_metadata_.codec==="aac"){var a=t.codec==="aac"?t.data:null,o=new Fe(a);e.audioSampleRate=o.sampling_rate,e.channelCount=o.channel_count,e.codec=o.codec_mimetype,e.originalCodec=o.original_codec_mimetype,e.config=o.config,e.refSampleDuration=1024/e.audioSampleRate*e.timescale}else if(this.audio_metadata_.codec==="ac-3"){var r=t.codec==="ac-3"?t.data:null,s=new Zt(r);e.audioSampleRate=s.sampling_rate,e.channelCount=s.channel_count,e.codec=s.codec_mimetype,e.originalCodec=s.original_codec_mimetype,e.config=s.config,e.refSampleDuration=1536/e.audioSampleRate*e.timescale}else if(this.audio_metadata_.codec==="ec-3"){var d=t.codec==="ec-3"?t.data:null,l=new ii(d);e.audioSampleRate=l.sampling_rate,e.channelCount=l.channel_count,e.codec=l.codec_mimetype,e.originalCodec=l.original_codec_mimetype,e.config=l.config,e.refSampleDuration=256*l.num_blks/e.audioSampleRate*e.timescale}else this.audio_metadata_.codec==="opus"?(e.audioSampleRate=this.audio_metadata_.sample_rate,e.channelCount=this.audio_metadata_.channel_count,e.channelConfigCode=this.audio_metadata_.channel_config_code,e.codec="opus",e.originalCodec="opus",e.config=void 0,e.refSampleDuration=20):this.audio_metadata_.codec==="mp3"&&(e.audioSampleRate=this.audio_metadata_.sample_rate,e.channelCount=this.audio_metadata_.channel_count,e.codec="mp3",e.originalCodec="mp3",e.config=void 0);this.audio_init_segment_dispatched_==0&&_.default.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: ".concat(e.codec)),this.onTrackMetadata("audio",e),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var y=this.media_info_;y.hasAudio=!0,y.audioCodec=e.originalCodec,y.audioSampleRate=e.audioSampleRate,y.audioChannelCount=e.channelCount,y.hasVideo&&y.videoCodec?y.mimeType='video/mp2t; codecs="'.concat(y.videoCodec,",").concat(y.audioCodec,'"'):y.mimeType='video/mp2t; codecs="'.concat(y.audioCodec,'"'),y.isComplete()&&this.onMediaInfo(y)},i.prototype.dispatchPESPrivateDataDescriptor=function(t,e,a){var o=new nt;o.pid=t,o.stream_type=e,o.descriptor=a,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(o)},i.prototype.parsePESPrivateDataPayload=function(t,e,a,o,r){var s=new Xe;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var d=Math.floor(e/this.timescale_);s.pts=d}else s.nearest_pts=this.getNearestTimestampMilliseconds();if(a!=null){var l=Math.floor(a/this.timescale_);s.dts=l}this.onPESPrivateData&&this.onPESPrivateData(s)},i.prototype.parseTimedID3MetadataPayload=function(t,e,a,o,r){var s=new Xe;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var d=Math.floor(e/this.timescale_);s.pts=d}if(a!=null){var l=Math.floor(a/this.timescale_);s.dts=l}this.onTimedID3Metadata&&this.onTimedID3Metadata(s)},i.prototype.parsePGSPayload=function(t,e,a,o,r,s){var d=new ri;if(d.pid=o,d.lang=s,d.stream_id=r,d.len=t.byteLength,d.data=t,e!=null){var l=Math.floor(e/this.timescale_);d.pts=l}if(a!=null){var y=Math.floor(a/this.timescale_);d.dts=y}this.onPGSSubtitleData&&this.onPGSSubtitleData(d)},i.prototype.parseSynchronousKLVMetadataPayload=function(t,e,a,o,r){var s=new ni;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var d=Math.floor(e/this.timescale_);s.pts=d}if(a!=null){var l=Math.floor(a/this.timescale_);s.dts=l}s.access_units=function(y){for(var f=[],g=0;g+5>>24&255,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e.set(i,4);var s=8;for(r=0;r>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))},n.trak=function(i){return n.box(n.types.trak,n.tkhd(i),n.mdia(i))},n.tkhd=function(i){var{id:t,duration:e,presentWidth:a,presentHeight:o}=i;return n.box(n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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,a>>>8&255,255&a,0,0,o>>>8&255,255&o,0,0]))},n.mdia=function(i){return n.box(n.types.mdia,n.mdhd(i),n.hdlr(i),n.minf(i))},n.mdhd=function(i){var{timescale:t,duration:e}=i;return n.box(n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))},n.hdlr=function(i){var t;return t=i.type==="audio"?n.constants.HDLR_AUDIO:n.constants.HDLR_VIDEO,n.box(n.types.hdlr,t)},n.minf=function(i){var t;return t=i.type==="audio"?n.box(n.types.smhd,n.constants.SMHD):n.box(n.types.vmhd,n.constants.VMHD),n.box(n.types.minf,t,n.dinf(),n.stbl(i))},n.dinf=function(){return n.box(n.types.dinf,n.box(n.types.dref,n.constants.DREF))},n.stbl=function(i){return n.box(n.types.stbl,n.stsd(i),n.box(n.types.stts,n.constants.STTS),n.box(n.types.stsc,n.constants.STSC),n.box(n.types.stsz,n.constants.STSZ),n.box(n.types.stco,n.constants.STCO))},n.stsd=function(i){return i.type==="audio"?i.codec==="mp3"?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.mp3(i)):i.codec==="ac-3"?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.ac3(i)):i.codec==="ec-3"?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.ec3(i)):i.codec==="opus"?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.Opus(i)):i.codec=="flac"?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.fLaC(i)):i.codec=="ipcm"?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.ipcm(i)):n.box(n.types.stsd,n.constants.STSD_PREFIX,n.mp4a(i)):i.type==="video"&&i.codec.startsWith("hvc1")?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.hvc1(i)):i.type==="video"&&i.codec.startsWith("av01")?n.box(n.types.stsd,n.constants.STSD_PREFIX,n.av01(i)):n.box(n.types.stsd,n.constants.STSD_PREFIX,n.avc1(i))},n.mp3=function(i){var{channelCount:t,audioSampleRate:e}=i,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return n.box(n.types[".mp3"],a)},n.mp4a=function(i){var{channelCount:t,audioSampleRate:e}=i,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return n.box(n.types.mp4a,a,n.esds(i))},n.ac3=function(i){var{channelCount:t,audioSampleRate:e}=i,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return n.box(n.types["ac-3"],a,n.box(n.types.dac3,new Uint8Array(i.config)))},n.ec3=function(i){var{channelCount:t,audioSampleRate:e}=i,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return n.box(n.types["ec-3"],a,n.box(n.types.dec3,new Uint8Array(i.config)))},n.esds=function(i){var t=i.config||[],e=t.length,a=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(t).concat([6,1,2]));return n.box(n.types.esds,a)},n.Opus=function(i){var{channelCount:t,audioSampleRate:e}=i,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return n.box(n.types.Opus,a,n.dOps(i))},n.dOps=function(i){var{channelCount:t,channelConfigCode:e,audioSampleRate:a}=i;if(i.config)return n.box(n.types.dOps,i.config);var o=[];switch(e){case 1:case 2:o=[0];break;case 0:o=[255,1,1,0,1];break;case 128:o=[255,2,0,0,1];break;case 3:o=[1,2,1,0,2,1];break;case 4:o=[1,2,2,0,1,2,3];break;case 5:o=[1,3,2,0,4,1,2,3];break;case 6:o=[1,4,2,0,4,1,2,3,5];break;case 7:o=[1,4,2,0,4,1,2,3,5,6];break;case 8:o=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:o=[1,1,2,0,1];break;case 131:o=[1,1,3,0,1,2];break;case 132:o=[1,1,4,0,1,2,3];break;case 133:o=[1,1,5,0,1,2,3,4];break;case 134:o=[1,1,6,0,1,2,3,4,5];break;case 135:o=[1,1,7,0,1,2,3,4,5,6];break;case 136:o=[1,1,8,0,1,2,3,4,5,6,7]}var r=new Uint8Array(pt([0,t,0,0,a>>>24&255,a>>>17&255,a>>>8&255,a>>>0&255,0,0],o,!0));return n.box(n.types.dOps,r)},n.fLaC=function(i){var t=i.channelCount,e=Math.min(i.audioSampleRate,65535),a=i.sampleSize,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,a,0,0,0,0,e>>>8&255,255&e,0,0]);return n.box(n.types.fLaC,o,n.dfLa(i))},n.dfLa=function(i){var t=new Uint8Array(pt([0,0,0,0],i.config,!0));return n.box(n.types.dfLa,t)},n.ipcm=function(i){var t=i.channelCount,e=Math.min(i.audioSampleRate,65535),a=i.sampleSize,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,a,0,0,0,0,e>>>8&255,255&e,0,0]);return i.channelCount===1?n.box(n.types.ipcm,o,n.pcmC(i)):n.box(n.types.ipcm,o,n.chnl(i),n.pcmC(i))},n.chnl=function(i){var t=new Uint8Array([0,0,0,0,1,i.channelCount,0,0,0,0,0,0,0,0]);return n.box(n.types.chnl,t)},n.pcmC=function(i){var t=i.littleEndian?1:0,e=i.sampleSize,a=new Uint8Array([0,0,0,0,t,e]);return n.box(n.types.pcmC,a)},n.avc1=function(i){var{avcc:t,codecWidth:e,codecHeight:a}=i,o=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,a>>>8&255,255&a,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 n.box(n.types.avc1,o,n.box(n.types.avcC,t))},n.hvc1=function(i){var{hvcc:t,codecWidth:e,codecHeight:a}=i,o=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,a>>>8&255,255&a,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 n.box(n.types.hvc1,o,n.box(n.types.hvcC,t))},n.av01=function(i){var t=i.av1c,e=i.codecWidth||192,a=i.codecHeight||108,o=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,a>>>8&255,255&a,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 n.box(n.types.av01,o,n.box(n.types.av1C,t))},n.mvex=function(i){return n.box(n.types.mvex,n.trex(i))},n.trex=function(i){var t=i.id,e=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return n.box(n.types.trex,e)},n.moof=function(i,t){return n.box(n.types.moof,n.mfhd(i.sequenceNumber),n.traf(i,t))},n.mfhd=function(i){var t=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]);return n.box(n.types.mfhd,t)},n.traf=function(i,t){var e=i.id,a=n.box(n.types.tfhd,new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])),o=n.box(n.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=n.sdtp(i),s=n.trun(i,r.byteLength+16+16+8+16+8+8);return n.box(n.types.traf,a,o,s,r)},n.sdtp=function(i){for(var t=i.samples||[],e=t.length,a=new Uint8Array(4+e),o=0;o>>24&255,a>>>16&255,a>>>8&255,255&a,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(var s=0;s>>24&255,d>>>16&255,d>>>8&255,255&d,l>>>24&255,l>>>16&255,l>>>8&255,255&l,y.isLeading<<2|y.dependsOn,y.isDependedOn<<6|y.hasRedundancy<<4|y.isNonSync,0,0,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*s)}return n.box(n.types.trun,r)},n.mdat=function(i){return n.box(n.types.mdat,i)},n}();mt.init();var We=mt,gt=function(){function n(){}return n.getSilentFrame=function(i,t){if(i==="mp4a.40.2"){if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===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(t===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(t===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(t===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(t===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},n}(),ze=D(47),yt=function(){function n(i){this.TAG="MP4Remuxer",this._config=i,this._isLive=i.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 ze.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new ze.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!S.default.chrome||!(S.default.version.major<50||S.default.version.major===50&&S.default.version.build<2661)),this._fillSilentAfterSeek=S.default.msedge||S.default.msie,this._mp3UseMpegAudio=!S.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return n.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},n.prototype.bindDataSource=function(i){return i.onDataAvailable=this.remux.bind(this),i.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(n.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(i){this._onInitSegment=i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(i){this._onMediaSegment=i},enumerable:!1,configurable:!0}),n.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},n.prototype.seek=function(i){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},n.prototype.remux=function(i,t){if(!this._onMediaSegment)throw new k.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(i,t),t&&this._remuxVideo(t),i&&this._remuxAudio(i)},n.prototype._onTrackMetadataReceived=function(i,t){var e=null,a="mp4",o=t.codec;if(i==="audio")this._audioMeta=t,t.codec==="mp3"&&this._mp3UseMpegAudio?(a="mpeg",o="",e=new Uint8Array):e=We.generateInitSegment(t);else{if(i!=="video")return;this._videoMeta=t,e=We.generateInitSegment(t)}if(!this._onInitSegment)throw new k.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(i,{type:i,data:e.buffer,codec:o,container:"".concat(i,"/").concat(a),mediaDuration:t.duration})},n.prototype._calculateDtsBase=function(i,t){this._dtsBaseInited||(i&&i.samples&&i.samples.length&&(this._audioDtsBase=i.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},n.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},n.prototype.flushStashedSamples=function(){var i=this._videoStashedLastSample,t=this._audioStashedLastSample,e={type:"video",id:1,sequenceNumber:0,samples:[],length:0};i!=null&&(e.samples.push(i),e.length=i.length);var a={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};t!=null&&(a.samples.push(t),a.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(e,!0),this._remuxAudio(a,!0)},n.prototype._remuxAudio=function(i,t){if(this._audioMeta!=null){var e,a=i,o=a.samples,r=void 0,s=-1,d=this._audioMeta.refSampleDuration,l=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,y=this._dtsBaseInited&&this._audioNextDts===void 0,f=!1;if(o&&o.length!==0&&(o.length!==1||t)){var g=0,T=null,B=0;l?(g=0,B=a.length):(g=8,B=8+a.length);var F=null;if(o.length>1&&(B-=(F=o.pop()).length),this._audioStashedLastSample!=null){var q=this._audioStashedLastSample;this._audioStashedLastSample=null,o.unshift(q),B+=q.length}F!=null&&(this._audioStashedLastSample=F);var Z=o[0].dts-this._dtsBase;if(this._audioNextDts)r=Z-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())r=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(f=!0);else{var U=this._audioSegmentInfoList.getLastSampleBefore(Z);if(U!=null){var H=Z-(U.originalDts+U.duration);H<=3&&(H=0),r=Z-(U.dts+U.duration+H)}else r=0}if(f){var he=Z-r,ve=this._videoSegmentInfoList.getLastSegmentBefore(Z);if(ve!=null&&ve.beginDts=3*d&&this._fillAudioTimestampGap){Ce=!0;var be,Be=Math.floor(r/d);_.default.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync. `+"originalDts: ".concat(Se," ms, curRefDts: ").concat(pe," ms, ")+"dtsCorrection: ".concat(Math.round(r)," ms, generate: ").concat(Be," frames")),ne=Math.floor(pe),Te=Math.floor(pe+d)-ne,(be=gt.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))==null&&(_.default.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),be=De),we=[];for(var ye=0;ye=1?ge[ge.length-1].duration:Math.floor(d),this._audioNextDts=ne+Te;s===-1&&(s=ne),ge.push({dts:ne,pts:ne,cts:0,unit:q.unit,size:q.unit.byteLength,duration:Te,originalDts:Se,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),Ce&&ge.push.apply(ge,we)}}if(ge.length===0)return a.samples=[],void(a.length=0);for(l?T=new Uint8Array(B):((T=new Uint8Array(B))[0]=B>>>24&255,T[1]=B>>>16&255,T[2]=B>>>8&255,T[3]=255&B,T.set(We.types.mdat,4)),ce=0;ce1&&(g-=(T=r.pop()).length),this._videoStashedLastSample!=null){var B=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(B),g+=B.length}T!=null&&(this._videoStashedLastSample=T);var F=r[0].dts-this._dtsBase;if(this._videoNextDts)s=F-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())s=0;else{var q=this._videoSegmentInfoList.getLastSampleBefore(F);if(q!=null){var Z=F-(q.originalDts+q.duration);Z<=3&&(Z=0),s=F-(q.dts+q.duration+Z)}else s=0}for(var U=new ze.MediaSegmentInfo,H=[],he=0;he=1?H[H.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),ne){var Se=new ze.SampleInfo(ae,ce,De,B.dts,!0);Se.fileposition=B.fileposition,U.appendSyncPoint(Se)}H.push({dts:ae,pts:ce,cts:ge,units:B.units,size:B.length,isKeyframe:ne,duration:De,originalDts:ve,flags:{isLeading:0,dependsOn:ne?2:1,isDependedOn:ne?1:0,hasRedundancy:0,isNonSync:ne?0:1}})}for((f=new Uint8Array(g))[0]=g>>>24&255,f[1]=g>>>16&255,f[2]=g>>>8&255,f[3]=255&g,f.set(We.types.mdat,4),he=0;he0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,a=this._demuxer.parseChunks(i,t);else{var o=null;(o=de.probe(i)).match&&(this._setupFLVDemuxerRemuxer(o),a=this._demuxer.parseChunks(i,t)),o.match||o.needMoreData||(o=ft.probe(i)).match&&(this._setupTSDemuxerRemuxer(o),a=this._demuxer.parseChunks(i,t)),o.match||o.needMoreData||(o=null,_.default.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then(function(){e._internalAbort()}),this._emitter.emit(Ie.default.DEMUX_ERROR,m.default.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return a},n.prototype._setupFLVDemuxerRemuxer=function(i){this._demuxer=new de(i,this._config),this._remuxer||(this._remuxer=new yt(this._config));var t=this._mediaDataSource;t.duration==null||isNaN(t.duration)||(this._demuxer.overridedDuration=t.duration),typeof t.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=t.hasAudio),typeof t.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=t.hasVideo),this._demuxer.timestampBase=t.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._demuxer.onSeiArrived=this._onSEI.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},n.prototype._setupTSDemuxerRemuxer=function(i){var t=this._demuxer=new ft(i,this._config);this._remuxer||(this._remuxer=new yt(this._config)),t.onError=this._onDemuxException.bind(this),t.onMediaInfo=this._onMediaInfo.bind(this),t.onMetaDataArrived=this._onMetaDataArrived.bind(this),t.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),t.onPGSSubtitleData=this._onPGSSubtitle.bind(this),t.onSynchronousKLVMetadata=this._onSynchronousKLVMetadata.bind(this),t.onAsynchronousKLVMetadata=this._onAsynchronousKLVMetadata.bind(this),t.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),t.onSEI=this._onSEI.bind(this),t.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),t.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),t.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)},n.prototype._onMediaInfo=function(i){var t=this;this._mediaInfo==null&&(this._mediaInfo=Object.assign({},i),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,R.default.prototype));var e=Object.assign({},i);Object.setPrototypeOf(e,R.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=e,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var a=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(a)})},n.prototype._onMetaDataArrived=function(i){this._emitter.emit(Ie.default.METADATA_ARRIVED,i)},n.prototype._onScriptDataArrived=function(i){this._emitter.emit(Ie.default.SCRIPTDATA_ARRIVED,i)},n.prototype._onTimedID3Metadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(Ie.default.TIMED_ID3_METADATA_ARRIVED,i))},n.prototype._onPGSSubtitle=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(Ie.default.PGS_SUBTITLE_ARRIVED,i))},n.prototype._onSynchronousKLVMetadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(Ie.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,i))},n.prototype._onAsynchronousKLVMetadata=function(i){this._emitter.emit(Ie.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,i)},n.prototype._onSMPTE2038Metadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),i.nearest_pts!=null&&(i.nearest_pts-=t),this._emitter.emit(Ie.default.SMPTE2038_METADATA_ARRIVED,i))},n.prototype._onSEI=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),this._emitter.emit(Ie.default.SEI_ARRIVED,i))},n.prototype._onSCTE35Metadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.nearest_pts!=null&&(i.nearest_pts-=t),this._emitter.emit(Ie.default.SCTE35_METADATA_ARRIVED,i))},n.prototype._onPESPrivateDataDescriptor=function(i){this._emitter.emit(Ie.default.PES_PRIVATE_DATA_DESCRIPTOR,i)},n.prototype._onPESPrivateData=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.nearest_pts!=null&&(i.nearest_pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(Ie.default.PES_PRIVATE_DATA_ARRIVED,i))},n.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},n.prototype._onIOComplete=function(i){var t=i+1;t0&&e[0].originalDts===a&&(a=e[0].pts),this._emitter.emit(Ie.default.RECOMMEND_SEEKPOINT,a)}},n.prototype._enableStatisticsReporter=function(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},n.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},n.prototype._reportSegmentMediaInfo=function(i){var t=this._mediaInfo.segments[i],e=Object.assign({},t);e.duration=this._mediaInfo.duration,e.segmentCount=this._mediaInfo.segmentCount,delete e.segments,delete e.keyframesIndex,this._emitter.emit(Ie.default.MEDIA_INFO,e)},n.prototype._reportStatisticsInfo=function(){var i={};i.url=this._ioctl.currentURL,i.hasRedirect=this._ioctl.hasRedirect,i.hasRedirect&&(i.redirectedURL=this._ioctl.currentRedirectedURL),i.speed=this._ioctl.currentSpeed,i.loaderType=this._ioctl.loaderType,i.currentSegmentIndex=this._currentSegmentIndex,i.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(Ie.default.STATISTICS_INFO,i)},n}())},137:function(le,Q,D){D.r(Q),D(856);var X=D(947),P=D(811),_=D(886),S=D(726);Q.default=function(R){var v=null,I=function(te,ee){R.postMessage({msg:"logcat_callback",data:{type:te,logcat:ee}})}.bind(this);function b(te,ee){var Re={msg:S.default.INIT_SEGMENT,data:{type:te,data:ee}};R.postMessage(Re,[ee.data])}function k(te,ee){var Re={msg:S.default.MEDIA_SEGMENT,data:{type:te,data:ee}};R.postMessage(Re,[ee.data])}function w(){var te={msg:S.default.LOADING_COMPLETE};R.postMessage(te)}function O(){var te={msg:S.default.RECOVERED_EARLY_EOF};R.postMessage(te)}function A(te){var ee={msg:S.default.MEDIA_INFO,data:te};R.postMessage(ee)}function G(te){var ee={msg:S.default.METADATA_ARRIVED,data:te};R.postMessage(ee)}function m(te){var ee={msg:S.default.SCRIPTDATA_ARRIVED,data:te};R.postMessage(ee)}function N(te){var ee={msg:S.default.TIMED_ID3_METADATA_ARRIVED,data:te};R.postMessage(ee)}function x(te){var ee={msg:S.default.PGS_SUBTITLE_ARRIVED,data:te};R.postMessage(ee)}function K(te){var ee={msg:S.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,data:te};R.postMessage(ee)}function M(te){var ee={msg:S.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,data:te};R.postMessage(ee)}function u(te){var ee={msg:S.default.SMPTE2038_METADATA_ARRIVED,data:te};R.postMessage(ee)}function h(te){var ee={msg:S.default.SEI_ARRIVED,data:te};R.postMessage(ee)}function p(te){var ee={msg:S.default.SCTE35_METADATA_ARRIVED,data:te};R.postMessage(ee)}function E(te){var ee={msg:S.default.PES_PRIVATE_DATA_DESCRIPTOR,data:te};R.postMessage(ee)}function W(te){var ee={msg:S.default.PES_PRIVATE_DATA_ARRIVED,data:te};R.postMessage(ee)}function z(te){var ee={msg:S.default.STATISTICS_INFO,data:te};R.postMessage(ee)}function se(te,ee){R.postMessage({msg:S.default.IO_ERROR,data:{type:te,info:ee}})}function de(te,ee){R.postMessage({msg:S.default.DEMUX_ERROR,data:{type:te,info:ee}})}function me(te){R.postMessage({msg:S.default.RECOMMEND_SEEKPOINT,data:te})}P.default.install(),R.addEventListener("message",function(te){switch(te.data.cmd){case"init":(v=new _.default(te.data.param[0],te.data.param[1])).on(S.default.IO_ERROR,se.bind(this)),v.on(S.default.DEMUX_ERROR,de.bind(this)),v.on(S.default.INIT_SEGMENT,b.bind(this)),v.on(S.default.MEDIA_SEGMENT,k.bind(this)),v.on(S.default.LOADING_COMPLETE,w.bind(this)),v.on(S.default.RECOVERED_EARLY_EOF,O.bind(this)),v.on(S.default.MEDIA_INFO,A.bind(this)),v.on(S.default.METADATA_ARRIVED,G.bind(this)),v.on(S.default.SCRIPTDATA_ARRIVED,m.bind(this)),v.on(S.default.TIMED_ID3_METADATA_ARRIVED,N.bind(this)),v.on(S.default.PGS_SUBTITLE_ARRIVED,x.bind(this)),v.on(S.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,K.bind(this)),v.on(S.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,M.bind(this)),v.on(S.default.SMPTE2038_METADATA_ARRIVED,u.bind(this)),v.on(S.default.SEI_ARRIVED,h.bind(this)),v.on(S.default.SCTE35_METADATA_ARRIVED,p.bind(this)),v.on(S.default.PES_PRIVATE_DATA_DESCRIPTOR,E.bind(this)),v.on(S.default.PES_PRIVATE_DATA_ARRIVED,W.bind(this)),v.on(S.default.STATISTICS_INFO,z.bind(this)),v.on(S.default.RECOMMEND_SEEKPOINT,me.bind(this));break;case"destroy":v&&(v.destroy(),v=null),R.postMessage({msg:"destroyed"});break;case"start":v.start();break;case"stop":v.stop();break;case"seek":v.seek(te.data.param);break;case"pause":v.pause();break;case"resume":v.resume();break;case"logging_config":var ee=te.data.param;X.default.applyConfig(ee),ee.enableCallback===!0?X.default.addLogListener(I):X.default.removeLogListener(I)}})}},827:function(le,Q,D){D.r(Q),Q.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},976:function(le,Q,D){le.exports=D(311).default},653:function(le,Q,D){D.r(Q),D.d(Q,{default:function(){return K}});var X,P=D(856),_=function(){function M(){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 M.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},M.prototype.addBytes=function(u){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=u,this._totalBytes+=u):this._now()-this._lastCheckpoint<1000?(this._intervalBytes+=u,this._totalBytes+=u):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=u,this._totalBytes+=u,this._lastCheckpoint=this._now())},Object.defineProperty(M.prototype,"currentKBps",{get:function(){this.addBytes(0);var u=(this._now()-this._lastCheckpoint)/1000;return u==0&&(u=1),this._intervalBytes/u/1024},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"averageKBps",{get:function(){var u=(this._now()-this._firstCheckpoint)/1000;return this._totalBytes/u/1024},enumerable:!1,configurable:!0}),M}(),S=D(470),R=D(994),v=D(867),I=(X=function(M,u){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var E in p)Object.prototype.hasOwnProperty.call(p,E)&&(h[E]=p[E])},X(M,u)},function(M,u){if(typeof u!="function"&&u!==null)throw TypeError("Class extends value "+String(u)+" is not a constructor or null");function h(){this.constructor=M}X(M,u),M.prototype=u===null?Object.create(u):(h.prototype=u.prototype,new h)}),b=function(M){function u(h,p){var E=M.call(this,"fetch-stream-loader")||this;return E.TAG="FetchStreamLoader",E._seekHandler=h,E._config=p,E._needStash=!0,E._requestAbort=!1,E._abortController=null,E._contentLength=null,E._receivedLength=0,E}return I(u,M),u.isSupported=function(){try{var h=R.default.msedge&&R.default.version.minor>=15048,p=!R.default.msedge||h;return self.fetch&&self.ReadableStream&&p}catch(E){return!1}},u.prototype.destroy=function(){this.isWorking()&&this.abort(),M.prototype.destroy.call(this)},u.prototype.open=function(h,p){var E=this;this._dataSource=h,this._range=p;var W=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(W=h.redirectedURL);var z=this._seekHandler.getConfig(W,p),se=new self.Headers;if(typeof z.headers=="object"){var de=z.headers;for(var me in de)de.hasOwnProperty(me)&&se.append(me,de[me])}var te={method:"GET",headers:se,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(var me in this._config.headers)se.append(me,this._config.headers[me]);h.cors===!1&&(te.mode="same-origin"),h.withCredentials&&(te.credentials="include"),h.referrerPolicy&&(te.referrerPolicy=h.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,te.signal=this._abortController.signal),this._status=S.LoaderStatus.kConnecting,self.fetch(z.url,te).then(function(ee){if(E._requestAbort)return E._status=S.LoaderStatus.kIdle,void ee.body.cancel();if(ee.ok&&ee.status>=200&&ee.status<=299){if(ee.url!==z.url&&E._onURLRedirect){var Re=E._seekHandler.removeURLParameters(ee.url);E._onURLRedirect(Re)}var J=ee.headers.get("Content-Length");return J!=null&&(E._contentLength=parseInt(J),E._contentLength!==0&&E._onContentLengthKnown&&E._onContentLengthKnown(E._contentLength)),E._pump.call(E,ee.body.getReader())}if(E._status=S.LoaderStatus.kError,!E._onError)throw new v.RuntimeException("FetchStreamLoader: Http code invalid, "+ee.status+" "+ee.statusText);E._onError(S.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:ee.status,msg:ee.statusText})}).catch(function(ee){if(!E._abortController||!E._abortController.signal.aborted){if(E._status=S.LoaderStatus.kError,!E._onError)throw ee;E._onError(S.LoaderErrors.EXCEPTION,{code:-1,msg:ee.message})}})},u.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==S.LoaderStatus.kBuffering||!R.default.chrome)&&this._abortController)try{this._abortController.abort()}catch(h){}},u.prototype._pump=function(h){var p=this;return h.read().then(function(E){if(E.done)if(p._contentLength!==null&&p._receivedLength299)){if(this._status=S.LoaderStatus.kError,!this._onError)throw new v.RuntimeException("MozChunkedLoader: Http code invalid, "+p.status+" "+p.statusText);this._onError(S.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:p.status,msg:p.statusText})}else this._status=S.LoaderStatus.kBuffering}},u.prototype._onProgress=function(h){if(this._status!==S.LoaderStatus.kError){this._contentLength===null&&h.total!==null&&h.total!==0&&(this._contentLength=h.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var p=h.target.response,E=this._range.from+this._receivedLength;this._receivedLength+=p.byteLength,this._onDataArrival&&this._onDataArrival(p,E,this._receivedLength)}},u.prototype._onLoadEnd=function(h){this._requestAbort!==!0?this._status!==S.LoaderStatus.kError&&(this._status=S.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},u.prototype._onXhrError=function(h){this._status=S.LoaderStatus.kError;var p=0,E=null;if(this._contentLength&&h.loaded=this._contentLength&&(E=this._range.from+this._contentLength-1),this._currentRequestRange={from:p,to:E},this._internalOpen(this._dataSource,this._currentRequestRange)},u.prototype._internalOpen=function(h,p){this._lastTimeLoaded=0;var E=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?E=this._currentRedirectedURL:h.redirectedURL!=null&&(E=h.redirectedURL));var W=this._seekHandler.getConfig(E,p);this._currentRequestURL=W.url;var z=this._xhr=new XMLHttpRequest;if(z.open("GET",W.url,!0),z.responseType="arraybuffer",z.onreadystatechange=this._onReadyStateChange.bind(this),z.onprogress=this._onProgress.bind(this),z.onload=this._onLoad.bind(this),z.onerror=this._onXhrError.bind(this),h.withCredentials&&(z.withCredentials=!0),typeof W.headers=="object"){var se=W.headers;for(var de in se)se.hasOwnProperty(de)&&z.setRequestHeader(de,se[de])}if(typeof this._config.headers=="object")for(var de in se=this._config.headers)se.hasOwnProperty(de)&&z.setRequestHeader(de,se[de]);z.send()},u.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=S.LoaderStatus.kComplete},u.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)},u.prototype._onReadyStateChange=function(h){var p=h.target;if(p.readyState===2){if(p.responseURL!=null){var E=this._seekHandler.removeURLParameters(p.responseURL);p.responseURL!==this._currentRequestURL&&E!==this._currentRedirectedURL&&(this._currentRedirectedURL=E,this._onURLRedirect&&this._onURLRedirect(E))}if(p.status>=200&&p.status<=299){if(this._waitForTotalLength)return;this._status=S.LoaderStatus.kBuffering}else{if(this._status=S.LoaderStatus.kError,!this._onError)throw new v.RuntimeException("RangeLoader: Http code invalid, "+p.status+" "+p.statusText);this._onError(S.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:p.status,msg:p.statusText})}}},u.prototype._onProgress=function(h){if(this._status!==S.LoaderStatus.kError){if(this._contentLength===null){var p=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,p=!0;var E=h.total;this._internalAbort(),E!=null&E!==0&&(this._totalLength=E)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,p)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var W=h.loaded-this._lastTimeLoaded;this._lastTimeLoaded=h.loaded,this._speedSampler.addBytes(W)}},u.prototype._normalizeSpeed=function(h){var p=this._chunkSizeKBList,E=p.length-1,W=0,z=0,se=E;if(h=p[W]&&h=3&&(p=this._speedSampler.currentKBps)),p!==0){var E=this._normalizeSpeed(p);this._currentSpeedNormalized!==E&&(this._currentSpeedNormalized=E,this._currentChunkSizeKB=E)}var W=h.target.response,z=this._range.from+this._receivedLength;this._receivedLength+=W.byteLength;var se=!1;this._contentLength!=null&&this._receivedLength0&&this._receivedLength0)for(var z=p.split("&"),se=0;se0;de[0]!==this._startName&&de[0]!==this._endName&&(me&&(W+="&"),W+=z[se])}return W.length===0?h:h+"?"+W},M}(),K=function(){function M(u,h,p){this.TAG="IOController",this._config=h,this._extraData=p,this._stashInitialSize=65536,h.stashInitialSize!=null&&h.stashInitialSize>0&&(this._stashInitialSize=h.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=Math.max(this._stashSize,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=u,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(u.url),this._refTotalLength=u.filesize?u.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new _,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 M.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},M.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},M.prototype.isPaused=function(){return this._paused},Object.defineProperty(M.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"extraData",{get:function(){return this._extraData},set:function(u){this._extraData=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(u){this._onDataArrival=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(u){this._onSeeked=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onError",{get:function(){return this._onError},set:function(u){this._onError=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onComplete",{get:function(){return this._onComplete},set:function(u){this._onComplete=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(u){this._onRedirect=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(u){this._onRecoveredEarlyEof=u},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"hasRedirect",{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"currentSpeed",{get:function(){return this._loaderClass===A?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),M.prototype._selectSeekHandler=function(){var u=this._config;if(u.seekType==="range")this._seekHandler=new N(this._config.rangeLoadZeroStart);else if(u.seekType==="param"){var h=u.seekParamStart||"bstart",p=u.seekParamEnd||"bend";this._seekHandler=new x(h,p)}else{if(u.seekType!=="custom")throw new v.InvalidArgumentException("Invalid seekType in config: ".concat(u.seekType));if(typeof u.customSeekHandler!="function")throw new v.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new u.customSeekHandler}},M.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=m;else if(b.isSupported())this._loaderClass=b;else if(w.isSupported())this._loaderClass=w;else{if(!A.isSupported())throw new v.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=A}},M.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)},M.prototype.open=function(u){this._currentRange={from:0,to:-1},u&&(this._currentRange.from=u),this._speedSampler.reset(),u||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},M.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},M.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)},M.prototype.resume=function(){if(this._paused){this._paused=!1;var u=this._resumeFrom;this._resumeFrom=0,this._internalSeek(u,!0)}},M.prototype.seek=function(u){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(u,!0)},M.prototype._internalSeek=function(u,h){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(h),this._loader.destroy(),this._loader=null;var p={from:u,to:-1};this._currentRange={from:p.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,p),this._onSeeked&&this._onSeeked()},M.prototype.updateUrl=function(u){if(!u||typeof u!="string"||u.length===0)throw new v.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=u},M.prototype._expandBuffer=function(u){for(var h=this._stashSize;h+10485760){var E=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(p,0,h).set(E,0)}this._stashBuffer=p,this._bufferSize=h}},M.prototype._normalizeSpeed=function(u){var h=this._speedNormalizeList,p=h.length-1,E=0,W=0,z=p;if(u=h[E]&&u=512&&u<=1024?Math.floor(1.5*u):2*u)>8192&&(h=8192);var p=1024*h+1048576;this._bufferSize0){var z=this._stashBuffer.slice(0,this._stashUsed);(me=this._dispatchChunks(z,this._stashByteStart))0&&(te=new Uint8Array(z,me),de.set(te,0),this._stashUsed=te.byteLength,this._stashByteStart+=me):(this._stashUsed=0,this._stashByteStart+=me),this._stashUsed+u.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+u.byteLength),de=new Uint8Array(this._stashBuffer,0,this._bufferSize)),de.set(new Uint8Array(u),this._stashUsed),this._stashUsed+=u.byteLength}else(me=this._dispatchChunks(u,h))this._bufferSize&&(this._expandBuffer(se),de=new Uint8Array(this._stashBuffer,0,this._bufferSize)),de.set(new Uint8Array(u,me),0),this._stashUsed+=se,this._stashByteStart=h+me);else if(this._stashUsed===0){var se;(me=this._dispatchChunks(u,h))this._bufferSize&&this._expandBuffer(se),(de=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(u,me),0),this._stashUsed+=se,this._stashByteStart=h+me)}else{var de,me;if(this._stashUsed+u.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+u.byteLength),(de=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(u),this._stashUsed),this._stashUsed+=u.byteLength,(me=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))0){var te=new Uint8Array(this._stashBuffer,me);de.set(te,0)}this._stashUsed-=me,this._stashByteStart+=me}}},M.prototype._flushStashBuffer=function(u){if(this._stashUsed>0){var h=this._stashBuffer.slice(0,this._stashUsed),p=this._dispatchChunks(h,this._stashByteStart),E=h.byteLength-p;if(p0){var W=new Uint8Array(this._stashBuffer,0,this._bufferSize),z=new Uint8Array(h,p);W.set(z,0),this._stashUsed=z.byteLength,this._stashByteStart+=p}return 0}P.default.w(this.TAG,"".concat(E," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,E}return 0},M.prototype._onLoaderComplete=function(u,h){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},M.prototype._onLoaderError=function(u,h){switch(P.default.e(this.TAG,"Loader error, code = ".concat(h.code,", msg = ").concat(h.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,u=S.LoaderErrors.UNRECOVERABLE_EARLY_EOF),u){case S.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var p=this._currentRange.to+1;return void(p0){var fe=this._media_element.buffered.start(0);(fe<1&&c0){var fe=j.start(0);if(fe<1&&C=fe&&c0&&this._suspendTransmuxerIfBufferedPositionExceeded(j)},L.prototype._suspendTransmuxerIfBufferedPositionExceeded=function(c){c>=this._media_element.currentTime+this._config.lazyLoadMaxDuration&&!this._paused&&(b.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this.suspendTransmuxer(),this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate))},L.prototype.suspendTransmuxer=function(){this._paused=!0,this._on_pause_transmuxer()},L.prototype._resumeTransmuxerIfNeeded=function(){for(var c=this._media_element.buffered,C=this._media_element.currentTime,j=this._config.lazyLoadRecoverDuration,fe=!1,re=0;re=V&&C=Y-j&&(fe=!0);break}}fe&&(b.default.v(this.TAG,"Continue loading from paused position"),this.resumeTransmuxer(),this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate))},L.prototype.resumeTransmuxer=function(){this._paused=!1,this._on_resume_transmuxer()},L}(),E=function(){function L(c,C){this.TAG="StartupStallJumper",this._media_element=null,this._on_direct_seek=null,this._canplay_received=!1,this.e=null,this._media_element=c,this._on_direct_seek=C,this.e={onMediaCanPlay:this._onMediaCanPlay.bind(this),onMediaStalled:this._onMediaStalled.bind(this),onMediaProgress:this._onMediaProgress.bind(this)},this._media_element.addEventListener("canplay",this.e.onMediaCanPlay),this._media_element.addEventListener("stalled",this.e.onMediaStalled),this._media_element.addEventListener("progress",this.e.onMediaProgress)}return L.prototype.destroy=function(){this._media_element.removeEventListener("canplay",this.e.onMediaCanPlay),this._media_element.removeEventListener("stalled",this.e.onMediaStalled),this._media_element.removeEventListener("progress",this.e.onMediaProgress),this._media_element=null,this._on_direct_seek=null},L.prototype._onMediaCanPlay=function(c){this._canplay_received=!0,this._media_element.removeEventListener("canplay",this.e.onMediaCanPlay)},L.prototype._onMediaStalled=function(c){this._detectAndFixStuckPlayback(!0)},L.prototype._onMediaProgress=function(c){this._detectAndFixStuckPlayback()},L.prototype._detectAndFixStuckPlayback=function(c){var C=this._media_element,j=C.buffered;c||!this._canplay_received||C.readyState<2?j.length>0&&C.currentTimethis._config.liveBufferLatencyMaxLatency&&fe-C>this._config.liveBufferLatencyMaxLatency){var re=fe-this._config.liveBufferLatencyMinRemain;this._on_direct_seek(re)}}},L}(),z=function(){function L(c,C){this._config=null,this._media_element=null,this.e=null,this._config=c,this._media_element=C,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)},this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate)}return L.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element=null,this._config=null},L.prototype._onMediaTimeUpdate=function(c){if(this._config.isLive&&this._config.liveSync){var C=this._getCurrentLatency();if(C>this._config.liveSyncMaxLatency){var j=Math.min(2,Math.max(1,this._config.liveSyncPlaybackRate));this._media_element.playbackRate=j}else C>this._config.liveSyncTargetLatency||this._media_element.playbackRate!==1&&this._media_element.playbackRate!==0&&(this._media_element.playbackRate=1)}},L.prototype._getCurrentLatency=function(){if(!this._media_element)return 0;var c=this._media_element.buffered,C=this._media_element.currentTime;return c.length==0?0:c.end(c.length-1)-C},L}(),se=function(){function L(c,C){this.TAG="PlayerEngineMainThread",this._emitter=new k,this._media_element=null,this._mse_controller=null,this._transmuxer=null,this._pending_seek_time=null,this._seeking_handler=null,this._loading_controller=null,this._startup_stall_jumper=null,this._live_latency_chaser=null,this._live_latency_synchronizer=null,this._mse_source_opened=!1,this._has_pending_load=!1,this._loaded_metadata_received=!1,this._media_info=null,this._statistics_info=null,this.e=null,this._media_data_source=c,this._config=S(),typeof C=="object"&&Object.assign(this._config,C),c.isLive===!0&&(this._config.isLive=!0),this.e={onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this)}}return L.prototype.destroy=function(){this._emitter.emit(A.default.DESTROYING),this._transmuxer&&this.unload(),this._media_element&&this.detachMediaElement(),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(c,C){var j=this;this._emitter.addListener(c,C),c===A.default.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){return j._emitter.emit(A.default.MEDIA_INFO,j.mediaInfo)}):c==A.default.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){return j._emitter.emit(A.default.STATISTICS_INFO,j.statisticsInfo)})},L.prototype.off=function(c,C){this._emitter.removeListener(c,C)},L.prototype.attachMediaElement=function(c){var C=this;this._media_element=c,c.src="",c.removeAttribute("src"),c.srcObject=null,c.load(),c.addEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._mse_controller=new O.default(this._config),this._mse_controller.on(m.default.UPDATE_END,this._onMSEUpdateEnd.bind(this)),this._mse_controller.on(m.default.BUFFER_FULL,this._onMSEBufferFull.bind(this)),this._mse_controller.on(m.default.SOURCE_OPEN,this._onMSESourceOpen.bind(this)),this._mse_controller.on(m.default.ERROR,this._onMSEError.bind(this)),this._mse_controller.on(m.default.START_STREAMING,this._onMSEStartStreaming.bind(this)),this._mse_controller.on(m.default.END_STREAMING,this._onMSEEndStreaming.bind(this)),this._mse_controller.initialize({getCurrentTime:function(){return C._media_element.currentTime},getReadyState:function(){return C._media_element.readyState}}),this._mse_controller.isManagedMediaSource()?(c.disableRemotePlayback=!0,c.srcObject=this._mse_controller.getObject()):c.src=this._mse_controller.getObjectURL()},L.prototype.detachMediaElement=function(){this._media_element&&(this._mse_controller.shutdown(),this._media_element.removeEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._media_element.src="",this._media_element.removeAttribute("src"),this._media_element.srcObject=null,this._media_element.load(),this._media_element=null,this._mse_controller.revokeObjectURL()),this._mse_controller&&(this._mse_controller.destroy(),this._mse_controller=null)},L.prototype.load=function(){var c=this;if(!this._media_element)throw new x.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new x.IllegalStateException("load() has been called, please call unload() first!");this._has_pending_load||(!this._config.deferLoadAfterSourceOpen||this._mse_source_opened?(this._transmuxer=new G.default(this._media_data_source,this._config),this._transmuxer.on(K.default.INIT_SEGMENT,function(C,j){c._mse_controller.appendInitSegment(j)}),this._transmuxer.on(K.default.MEDIA_SEGMENT,function(C,j){c._mse_controller.appendMediaSegment(j),!c._config.isLive&&C==="video"&&j.data&&j.data.byteLength>0&&"info"in j&&c._seeking_handler.appendSyncPoints(j.info.syncPoints),c._loading_controller.notifyBufferedPositionChanged(j.info.endDts/1000)}),this._transmuxer.on(K.default.LOADING_COMPLETE,function(){c._mse_controller.endOfStream(),c._emitter.emit(A.default.LOADING_COMPLETE)}),this._transmuxer.on(K.default.RECOVERED_EARLY_EOF,function(){c._emitter.emit(A.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(K.default.IO_ERROR,function(C,j){c._emitter.emit(A.default.ERROR,N.ErrorTypes.NETWORK_ERROR,C,j)}),this._transmuxer.on(K.default.DEMUX_ERROR,function(C,j){c._emitter.emit(A.default.ERROR,N.ErrorTypes.MEDIA_ERROR,C,j)}),this._transmuxer.on(K.default.MEDIA_INFO,function(C){c._media_info=C,c._emitter.emit(A.default.MEDIA_INFO,Object.assign({},C))}),this._transmuxer.on(K.default.STATISTICS_INFO,function(C){c._statistics_info=c._fillStatisticsInfo(C),c._emitter.emit(A.default.STATISTICS_INFO,Object.assign({},C))}),this._transmuxer.on(K.default.RECOMMEND_SEEKPOINT,function(C){c._media_element&&!c._config.accurateSeek&&c._seeking_handler.directSeek(C/1000)}),this._transmuxer.on(K.default.METADATA_ARRIVED,function(C){c._emitter.emit(A.default.METADATA_ARRIVED,C)}),this._transmuxer.on(K.default.SCRIPTDATA_ARRIVED,function(C){c._emitter.emit(A.default.SCRIPTDATA_ARRIVED,C)}),this._transmuxer.on(K.default.TIMED_ID3_METADATA_ARRIVED,function(C){c._emitter.emit(A.default.TIMED_ID3_METADATA_ARRIVED,C)}),this._transmuxer.on(K.default.PGS_SUBTITLE_ARRIVED,function(C){c._emitter.emit(A.default.PGS_SUBTITLE_ARRIVED,C)}),this._transmuxer.on(K.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(C){c._emitter.emit(A.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,C)}),this._transmuxer.on(K.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(C){c._emitter.emit(A.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,C)}),this._transmuxer.on(K.default.SMPTE2038_METADATA_ARRIVED,function(C){c._emitter.emit(A.default.SMPTE2038_METADATA_ARRIVED,C)}),this._transmuxer.on(K.default.SEI_ARRIVED,function(C){c._emitter.emit(A.default.SEI_ARRIVED,C)}),this._transmuxer.on(K.default.SCTE35_METADATA_ARRIVED,function(C){c._emitter.emit(A.default.SCTE35_METADATA_ARRIVED,C)}),this._transmuxer.on(K.default.PES_PRIVATE_DATA_DESCRIPTOR,function(C){c._emitter.emit(A.default.PES_PRIVATE_DATA_DESCRIPTOR,C)}),this._transmuxer.on(K.default.PES_PRIVATE_DATA_ARRIVED,function(C){c._emitter.emit(A.default.PES_PRIVATE_DATA_ARRIVED,C)}),this._seeking_handler=new h(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new p(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new E(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new W(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new z(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0),this._transmuxer.open()):this._has_pending_load=!0)},L.prototype.unload=function(){var c,C,j,fe,re,V,Y,ie,oe;(c=this._media_element)===null||c===void 0||c.pause(),(C=this._live_latency_synchronizer)===null||C===void 0||C.destroy(),this._live_latency_synchronizer=null,(j=this._live_latency_chaser)===null||j===void 0||j.destroy(),this._live_latency_chaser=null,(fe=this._startup_stall_jumper)===null||fe===void 0||fe.destroy(),this._startup_stall_jumper=null,(re=this._loading_controller)===null||re===void 0||re.destroy(),this._loading_controller=null,(V=this._seeking_handler)===null||V===void 0||V.destroy(),this._seeking_handler=null,(Y=this._mse_controller)===null||Y===void 0||Y.flush(),(ie=this._transmuxer)===null||ie===void 0||ie.close(),(oe=this._transmuxer)===null||oe===void 0||oe.destroy(),this._transmuxer=null},L.prototype.play=function(){return this._media_element.play()},L.prototype.pause=function(){this._media_element.pause()},L.prototype.seek=function(c){this._media_element&&this._seeking_handler?this._seeking_handler.seek(c):this._pending_seek_time=c},Object.defineProperty(L.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),L.prototype._onMSESourceOpen=function(){this._mse_source_opened=!0,this._has_pending_load&&(this._has_pending_load=!1,this.load())},L.prototype._onMSEUpdateEnd=function(){this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),this._loading_controller.notifyBufferedPositionChanged()},L.prototype._onMSEBufferFull=function(){b.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},L.prototype._onMSEError=function(c){this._emitter.emit(A.default.ERROR,N.ErrorTypes.MEDIA_ERROR,N.ErrorDetails.MEDIA_MSE_ERROR,c)},L.prototype._onMSEStartStreaming=function(){this._loaded_metadata_received&&(this._config.isLive||(b.default.v(this.TAG,"Resume transmuxing task due to ManagedMediaSource onStartStreaming"),this._loading_controller.resumeTransmuxer()))},L.prototype._onMSEEndStreaming=function(){this._config.isLive||(b.default.v(this.TAG,"Suspend transmuxing task due to ManagedMediaSource onEndStreaming"),this._loading_controller.suspendTransmuxer())},L.prototype._onMediaLoadedMetadata=function(c){this._loaded_metadata_received=!0,this._pending_seek_time!=null&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},L.prototype._onRequestDirectSeek=function(c){this._seeking_handler.directSeek(c)},L.prototype._onRequiredUnbufferedSeek=function(c){this._mse_controller.flush(),this._transmuxer.seek(c)},L.prototype._onRequestPauseTransmuxer=function(){this._transmuxer.pause()},L.prototype._onRequestResumeTransmuxer=function(){this._transmuxer.resume()},L.prototype._fillStatisticsInfo=function(c){if(c.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return c;var C=!0,j=0,fe=0;if(this._media_element.getVideoPlaybackQuality){var re=this._media_element.getVideoPlaybackQuality();j=re.totalVideoFrames,fe=re.droppedVideoFrames}else this._media_element.webkitDecodedFrameCount!=null?(j=this._media_element.webkitDecodedFrameCount,fe=this._media_element.webkitDroppedFrameCount):C=!1;return C&&(c.decodedFrames=j,c.droppedFrames=fe),c},L}(),de=D(861),me=D(947),te=function(){function L(c,C){this.TAG="PlayerEngineDedicatedThread",this._emitter=new k,this._media_element=null,this._worker_destroying=!1,this._seeking_handler=null,this._loading_controller=null,this._startup_stall_jumper=null,this._live_latency_chaser=null,this._live_latency_synchronizer=null,this._pending_seek_time=null,this._media_info=null,this._statistics_info=null,this.e=null,this._media_data_source=c,this._config=S(),typeof C=="object"&&Object.assign(this._config,C),c.isLive===!0&&(this._config.isLive=!0),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this),onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this),onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this),onMediaReadyStateChanged:this._onMediaReadyStateChange.bind(this)},me.default.registerListener(this.e.onLoggingConfigChanged),this._worker=de(877,{all:!0}),this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",media_data_source:this._media_data_source,config:this._config}),this._worker.postMessage({cmd:"logging_config",logging_config:me.default.getConfig()})}return L.isSupported=function(){return!!(self.Worker&&(self.MediaSource&&("canConstructInDedicatedWorker"in self.MediaSource)&&self.MediaSource.canConstructInDedicatedWorker===!0||self.ManagedMediaSource&&("canConstructInDedicatedWorker"in self.ManagedMediaSource)&&self.ManagedMediaSource.canConstructInDedicatedWorker===!0))},L.prototype.destroy=function(){this._emitter.emit(A.default.DESTROYING),this.unload(),this.detachMediaElement(),this._worker_destroying=!0,this._worker.postMessage({cmd:"destroy"}),me.default.removeListener(this.e.onLoggingConfigChanged),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(c,C){var j=this;this._emitter.addListener(c,C),c===A.default.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){return j._emitter.emit(A.default.MEDIA_INFO,j.mediaInfo)}):c==A.default.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){return j._emitter.emit(A.default.STATISTICS_INFO,j.statisticsInfo)})},L.prototype.off=function(c,C){this._emitter.removeListener(c,C)},L.prototype.attachMediaElement=function(c){this._media_element=c,this._media_element.src="",this._media_element.removeAttribute("src"),this._media_element.srcObject=null,this._media_element.load(),this._media_element.addEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element.addEventListener("readystatechange",this.e.onMediaReadyStateChanged),this._worker.postMessage({cmd:"initialize_mse"})},L.prototype.detachMediaElement=function(){this._worker.postMessage({cmd:"shutdown_mse"}),this._media_element&&(this._media_element.removeEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element.removeEventListener("readystatechange",this.e.onMediaReadyStateChanged),this._media_element.src="",this._media_element.removeAttribute("src"),this._media_element.srcObject=null,this._media_element.load(),this._media_element=null)},L.prototype.load=function(){this._worker.postMessage({cmd:"load"}),this._seeking_handler=new h(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new p(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new E(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new W(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new z(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0)},L.prototype.unload=function(){var c,C,j,fe,re,V;(c=this._media_element)===null||c===void 0||c.pause(),this._worker.postMessage({cmd:"unload"}),(C=this._live_latency_synchronizer)===null||C===void 0||C.destroy(),this._live_latency_synchronizer=null,(j=this._live_latency_chaser)===null||j===void 0||j.destroy(),this._live_latency_chaser=null,(fe=this._startup_stall_jumper)===null||fe===void 0||fe.destroy(),this._startup_stall_jumper=null,(re=this._loading_controller)===null||re===void 0||re.destroy(),this._loading_controller=null,(V=this._seeking_handler)===null||V===void 0||V.destroy(),this._seeking_handler=null},L.prototype.play=function(){return this._media_element.play()},L.prototype.pause=function(){this._media_element.pause()},L.prototype.seek=function(c){this._media_element&&this._seeking_handler?this._seeking_handler.seek(c):this._pending_seek_time=c},Object.defineProperty(L.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),L.prototype._onLoggingConfigChanged=function(c){var C;(C=this._worker)===null||C===void 0||C.postMessage({cmd:"logging_config",logging_config:c})},L.prototype._onMSEUpdateEnd=function(){this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),this._loading_controller.notifyBufferedPositionChanged()},L.prototype._onMSEBufferFull=function(){b.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},L.prototype._onMediaLoadedMetadata=function(c){this._pending_seek_time!=null&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},L.prototype._onRequestDirectSeek=function(c){this._seeking_handler.directSeek(c)},L.prototype._onRequiredUnbufferedSeek=function(c){this._worker.postMessage({cmd:"unbuffered_seek",milliseconds:c})},L.prototype._onRequestPauseTransmuxer=function(){this._worker.postMessage({cmd:"pause_transmuxer"})},L.prototype._onRequestResumeTransmuxer=function(){this._worker.postMessage({cmd:"resume_transmuxer"})},L.prototype._onMediaTimeUpdate=function(c){this._worker.postMessage({cmd:"timeupdate",current_time:c.target.currentTime})},L.prototype._onMediaReadyStateChange=function(c){this._worker.postMessage({cmd:"readystatechange",ready_state:c.target.readyState})},L.prototype._onWorkerMessage=function(c){var C,j=c.data,fe=j.msg;if(fe=="destroyed"||this._worker_destroying)return this._worker_destroying=!1,(C=this._worker)===null||C===void 0||C.terminate(),void(this._worker=null);switch(fe){case"mse_init":var re=j;typeof self.ManagedMediaSource=="function"&&typeof self.MediaSource!="function"&&(this._media_element.disableRemotePlayback=!0),this._media_element.srcObject=re.handle;break;case"mse_event":(re=j).event==m.default.UPDATE_END?this._onMSEUpdateEnd():re.event==m.default.BUFFER_FULL&&this._onMSEBufferFull();break;case"transmuxing_event":if((re=j).event==K.default.MEDIA_INFO){var V=j;this._media_info=V.info,this._emitter.emit(A.default.MEDIA_INFO,Object.assign({},V.info))}else if(re.event==K.default.STATISTICS_INFO){var Y=j;this._statistics_info=this._fillStatisticsInfo(Y.info),this._emitter.emit(A.default.STATISTICS_INFO,Object.assign({},Y.info))}else if(re.event==K.default.RECOMMEND_SEEKPOINT){var ie=j;this._media_element&&!this._config.accurateSeek&&this._seeking_handler.directSeek(ie.milliseconds/1000)}break;case"player_event":if((re=j).event==A.default.ERROR){var oe=j;this._emitter.emit(A.default.ERROR,oe.error_type,oe.error_detail,oe.info)}else if("extraData"in re){var ue=j;this._emitter.emit(ue.event,ue.extraData)}break;case"logcat_callback":re=j,b.default.emitter.emit("log",re.type,re.logcat);break;case"buffered_position_changed":re=j,this._loading_controller.notifyBufferedPositionChanged(re.buffered_position_milliseconds/1000)}},L.prototype._fillStatisticsInfo=function(c){if(c.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return c;var C=!0,j=0,fe=0;if(this._media_element.getVideoPlaybackQuality){var re=this._media_element.getVideoPlaybackQuality();j=re.totalVideoFrames,fe=re.droppedVideoFrames}else this._media_element.webkitDecodedFrameCount!=null?(j=this._media_element.webkitDecodedFrameCount,fe=this._media_element.webkitDroppedFrameCount):C=!1;return C&&(c.decodedFrames=j,c.droppedFrames=fe),c},L}(),ee=function(){function L(c,C){this.TAG="MSEPlayer",this._type="MSEPlayer",this._media_element=null,this._player_engine=null;var j=c.type.toLowerCase();if(j!=="mse"&&j!=="mpegts"&&j!=="m2ts"&&j!=="flv")throw new x.InvalidArgumentException("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");if(C&&C.enableWorkerForMSE&&te.isSupported())try{this._player_engine=new te(c,C)}catch(fe){b.default.e(this.TAG,"Error while initializing PlayerEngineDedicatedThread, fallback to PlayerEngineMainThread"),this._player_engine=new se(c,C)}else this._player_engine=new se(c,C)}return L.prototype.destroy=function(){this._player_engine.destroy(),this._player_engine=null,this._media_element=null},L.prototype.on=function(c,C){this._player_engine.on(c,C)},L.prototype.off=function(c,C){this._player_engine.off(c,C)},L.prototype.attachMediaElement=function(c){this._media_element=c,this._player_engine.attachMediaElement(c)},L.prototype.detachMediaElement=function(){this._media_element=null,this._player_engine.detachMediaElement()},L.prototype.load=function(){this._player_engine.load()},L.prototype.unload=function(){this._player_engine.unload()},L.prototype.play=function(){return this._player_engine.play()},L.prototype.pause=function(){this._player_engine.pause()},Object.defineProperty(L.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"buffered",{get:function(){return this._media_element.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"duration",{get:function(){return this._media_element.duration},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"volume",{get:function(){return this._media_element.volume},set:function(c){this._media_element.volume=c},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"muted",{get:function(){return this._media_element.muted},set:function(c){this._media_element.muted=c},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"currentTime",{get:function(){return this._media_element?this._media_element.currentTime:0},set:function(c){this._player_engine.seek(c)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"mediaInfo",{get:function(){return this._player_engine.mediaInfo},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"statisticsInfo",{get:function(){return this._player_engine.statisticsInfo},enumerable:!1,configurable:!0}),L}(),Re=function(){function L(c,C){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(w()),this._config=S(),typeof C=="object"&&Object.assign(this._config,C);var j=c.type.toLowerCase();if(j==="mse"||j==="mpegts"||j==="m2ts"||j==="flv")throw new x.InvalidArgumentException("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(c.hasOwnProperty("segments"))throw new x.InvalidArgumentException("NativePlayer(".concat(c.type,") doesn't support multipart playback!"));this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=c,this._mediaElement=null}return L.prototype.destroy=function(){this._emitter.emit(A.default.DESTROYING),this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},L.prototype.on=function(c,C){var j=this;c===A.default.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){j._emitter.emit(A.default.MEDIA_INFO,j.mediaInfo)}):c===A.default.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){j._emitter.emit(A.default.STATISTICS_INFO,j.statisticsInfo)}),this._emitter.addListener(c,C)},L.prototype.off=function(c,C){this._emitter.removeListener(c,C)},L.prototype.attachMediaElement=function(c){if(this._mediaElement=c,c.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{c.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(C){}},L.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},L.prototype.load=function(){if(!this._mediaElement)throw new x.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},L.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},L.prototype.play=function(){return this._mediaElement.play()},L.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(L.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(c){this._mediaElement.volume=c},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(c){this._mediaElement.muted=c},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(c){this._mediaElement?this._mediaElement.currentTime=c:this._pendingSeekTime=c},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"mediaInfo",{get:function(){var c={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(c.duration=Math.floor(1000*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(c.width=this._mediaElement.videoWidth,c.height=this._mediaElement.videoHeight)),c},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"statisticsInfo",{get:function(){var c={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return c;var C=!0,j=0,fe=0;if(this._mediaElement.getVideoPlaybackQuality){var re=this._mediaElement.getVideoPlaybackQuality();j=re.totalVideoFrames,fe=re.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(j=this._mediaElement.webkitDecodedFrameCount,fe=this._mediaElement.webkitDroppedFrameCount):C=!1;return C&&(c.decodedFrames=j,c.droppedFrames=fe),c},enumerable:!1,configurable:!0}),L.prototype._onvLoadedMetadata=function(c){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(A.default.MEDIA_INFO,this.mediaInfo)},L.prototype._reportStatisticsInfo=function(){this._emitter.emit(A.default.STATISTICS_INFO,this.statisticsInfo)},L}();X.default.install();var J={createPlayer:function(L,c){var C=L;if(C==null||typeof C!="object")throw new x.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!C.hasOwnProperty("type"))throw new x.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(C.type){case"mse":case"mpegts":case"m2ts":case"flv":return new ee(C,c);default:return new Re(C,c)}},isSupported:function(){return v.supportMSEH264Playback()},getFeatureList:function(){return v.getFeatureList()}};J.BaseLoader=I.BaseLoader,J.LoaderStatus=I.LoaderStatus,J.LoaderErrors=I.LoaderErrors,J.Events=A.default,J.ErrorTypes=N.ErrorTypes,J.ErrorDetails=N.ErrorDetails,J.MSEPlayer=ee,J.NativePlayer=Re,J.LoggingControl=me.default,Object.defineProperty(J,"version",{enumerable:!0,get:function(){return"1.8.2"}});var ke=J},355:function(le,Q,D){D.r(Q),D.d(Q,{ErrorDetails:function(){return S},ErrorTypes:function(){return _}});var X=D(470),P=D(827),_={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},S={NETWORK_EXCEPTION:X.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:X.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:X.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:X.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:P.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:P.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:P.default.CODEC_UNSUPPORTED}},994:function(le,Q,D){D.r(Q);var X={};(function(){var P=self.navigator.userAgent.toLowerCase(),_=/(edge)\/([\w.]+)/.exec(P)||/(opr)[\/]([\w.]+)/.exec(P)||/(chrome)[ \/]([\w.]+)/.exec(P)||/(iemobile)[\/]([\w.]+)/.exec(P)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(P)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(P)||/(webkit)[ \/]([\w.]+)/.exec(P)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(P)||/(msie) ([\w.]+)/.exec(P)||P.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(P)||P.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(P)||[],S=/(ipad)/.exec(P)||/(ipod)/.exec(P)||/(windows phone)/.exec(P)||/(iphone)/.exec(P)||/(kindle)/.exec(P)||/(android)/.exec(P)||/(windows)/.exec(P)||/(mac)/.exec(P)||/(linux)/.exec(P)||/(cros)/.exec(P)||[],R={browser:_[5]||_[3]||_[1]||"",version:_[2]||_[4]||"0",majorVersion:_[4]||_[2]||"0",platform:S[0]||""},v={};if(R.browser){v[R.browser]=!0;var I=R.majorVersion.split(".");v.version={major:parseInt(R.majorVersion,10),string:R.version},I.length>1&&(v.version.minor=parseInt(I[1],10)),I.length>2&&(v.version.build=parseInt(I[2],10))}if(R.platform&&(v[R.platform]=!0),(v.chrome||v.opr||v.safari)&&(v.webkit=!0),v.rv||v.iemobile){v.rv&&delete v.rv;var b="msie";R.browser=b,v[b]=!0}if(v.edge){delete v.edge;var k="msedge";R.browser=k,v[k]=!0}if(v.opr){var w="opera";R.browser=w,v[w]=!0}if(v.safari&&v.android){var O="android";R.browser=O,v[O]=!0}for(var A in v.name=R.browser,v.platform=R.platform,X)X.hasOwnProperty(A)&&delete X[A];Object.assign(X,v)})(),Q.default=X},867:function(le,Q,D){D.r(Q),D.d(Q,{IllegalStateException:function(){return S},InvalidArgumentException:function(){return R},NotImplementedException:function(){return v},RuntimeException:function(){return _}});var X,P=(X=function(I,b){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,w){k.__proto__=w}||function(k,w){for(var O in w)Object.prototype.hasOwnProperty.call(w,O)&&(k[O]=w[O])},X(I,b)},function(I,b){if(typeof b!="function"&&b!==null)throw TypeError("Class extends value "+String(b)+" is not a constructor or null");function k(){this.constructor=I}X(I,b),I.prototype=b===null?Object.create(b):(k.prototype=b.prototype,new k)}),_=function(){function I(b){this._message=b}return Object.defineProperty(I.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),I.prototype.toString=function(){return this.name+": "+this.message},I}(),S=function(I){function b(k){return I.call(this,k)||this}return P(b,I),Object.defineProperty(b.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),b}(_),R=function(I){function b(k){return I.call(this,k)||this}return P(b,I),Object.defineProperty(b.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),b}(_),v=function(I){function b(k){return I.call(this,k)||this}return P(b,I),Object.defineProperty(b.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),b}(_)},856:function(le,Q,D){D.r(Q);var X=D(7),P=D.n(X),_=function(){function S(){}return S.e=function(R,v){R&&!S.FORCE_GLOBAL_TAG||(R=S.GLOBAL_TAG);var I="[".concat(R,"] > ").concat(v);S.ENABLE_CALLBACK&&S.emitter.emit("log","error",I),S.ENABLE_ERROR&&(console.error?console.error(I):console.warn?console.warn(I):console.log(I))},S.i=function(R,v){R&&!S.FORCE_GLOBAL_TAG||(R=S.GLOBAL_TAG);var I="[".concat(R,"] > ").concat(v);S.ENABLE_CALLBACK&&S.emitter.emit("log","info",I),S.ENABLE_INFO&&(console.info?console.info(I):console.log(I))},S.w=function(R,v){R&&!S.FORCE_GLOBAL_TAG||(R=S.GLOBAL_TAG);var I="[".concat(R,"] > ").concat(v);S.ENABLE_CALLBACK&&S.emitter.emit("log","warn",I),S.ENABLE_WARN&&(console.warn?console.warn(I):console.log(I))},S.d=function(R,v){R&&!S.FORCE_GLOBAL_TAG||(R=S.GLOBAL_TAG);var I="[".concat(R,"] > ").concat(v);S.ENABLE_CALLBACK&&S.emitter.emit("log","debug",I),S.ENABLE_DEBUG&&(console.debug?console.debug(I):console.log(I))},S.v=function(R,v){R&&!S.FORCE_GLOBAL_TAG||(R=S.GLOBAL_TAG);var I="[".concat(R,"] > ").concat(v);S.ENABLE_CALLBACK&&S.emitter.emit("log","verbose",I),S.ENABLE_VERBOSE&&console.log(I)},S}();_.GLOBAL_TAG="mpegts.js",_.FORCE_GLOBAL_TAG=!1,_.ENABLE_ERROR=!0,_.ENABLE_INFO=!0,_.ENABLE_WARN=!0,_.ENABLE_DEBUG=!0,_.ENABLE_VERBOSE=!0,_.ENABLE_CALLBACK=!1,_.emitter=new(P()),Q.default=_},947:function(le,Q,D){D.r(Q);var X=D(7),P=D.n(X),_=D(856),S=function(){function R(){}return Object.defineProperty(R,"forceGlobalTag",{get:function(){return _.default.FORCE_GLOBAL_TAG},set:function(v){_.default.FORCE_GLOBAL_TAG=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"globalTag",{get:function(){return _.default.GLOBAL_TAG},set:function(v){_.default.GLOBAL_TAG=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"enableAll",{get:function(){return _.default.ENABLE_VERBOSE&&_.default.ENABLE_DEBUG&&_.default.ENABLE_INFO&&_.default.ENABLE_WARN&&_.default.ENABLE_ERROR},set:function(v){_.default.ENABLE_VERBOSE=v,_.default.ENABLE_DEBUG=v,_.default.ENABLE_INFO=v,_.default.ENABLE_WARN=v,_.default.ENABLE_ERROR=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"enableDebug",{get:function(){return _.default.ENABLE_DEBUG},set:function(v){_.default.ENABLE_DEBUG=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"enableVerbose",{get:function(){return _.default.ENABLE_VERBOSE},set:function(v){_.default.ENABLE_VERBOSE=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"enableInfo",{get:function(){return _.default.ENABLE_INFO},set:function(v){_.default.ENABLE_INFO=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"enableWarn",{get:function(){return _.default.ENABLE_WARN},set:function(v){_.default.ENABLE_WARN=v,R._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(R,"enableError",{get:function(){return _.default.ENABLE_ERROR},set:function(v){_.default.ENABLE_ERROR=v,R._notifyChange()},enumerable:!1,configurable:!0}),R.getConfig=function(){return{globalTag:_.default.GLOBAL_TAG,forceGlobalTag:_.default.FORCE_GLOBAL_TAG,enableVerbose:_.default.ENABLE_VERBOSE,enableDebug:_.default.ENABLE_DEBUG,enableInfo:_.default.ENABLE_INFO,enableWarn:_.default.ENABLE_WARN,enableError:_.default.ENABLE_ERROR,enableCallback:_.default.ENABLE_CALLBACK}},R.applyConfig=function(v){_.default.GLOBAL_TAG=v.globalTag,_.default.FORCE_GLOBAL_TAG=v.forceGlobalTag,_.default.ENABLE_VERBOSE=v.enableVerbose,_.default.ENABLE_DEBUG=v.enableDebug,_.default.ENABLE_INFO=v.enableInfo,_.default.ENABLE_WARN=v.enableWarn,_.default.ENABLE_ERROR=v.enableError,_.default.ENABLE_CALLBACK=v.enableCallback},R._notifyChange=function(){var v=R.emitter;if(v.listenerCount("change")>0){var I=R.getConfig();v.emit("change",I)}},R.registerListener=function(v){R.emitter.addListener("change",v)},R.removeListener=function(v){R.emitter.removeListener("change",v)},R.addLogListener=function(v){_.default.emitter.addListener("log",v),_.default.emitter.listenerCount("log")>0&&(_.default.ENABLE_CALLBACK=!0,R._notifyChange())},R.removeLogListener=function(v){_.default.emitter.removeListener("log",v),_.default.emitter.listenerCount("log")===0&&(_.default.ENABLE_CALLBACK=!1,R._notifyChange())},R}();S.emitter=new(P()),Q.default=S},811:function(le,Q,D){D.r(Q);var X=function(){function P(){}return P.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(_,S){return _.__proto__=S,_},Object.assign=Object.assign||function(_){if(_==null)throw TypeError("Cannot convert undefined or null to object");for(var S=Object(_),R=1;R0?0|S:0;return this.substring(R,R+_.length)===_}}),typeof self.Promise!="function"&&D(964).polyfill()},P}();X.install(),Q.default=X},861:function(le,Q,D){function X(b){var k={};function w(A){if(k[A])return k[A].exports;var G=k[A]={i:A,id:A,l:!1,loaded:!1,exports:{}};return b[A].call(G.exports,G,G.exports,w),G.l=!0,G.loaded=!0,G.exports}w.m=b,w.c=k,w.d=function(A,G){for(var m in G)w.o(G,m)&&!w.o(A,m)&&Object.defineProperty(A,m,{enumerable:!0,get:G[m]})},w.r=function(A){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},w.n=function(A){var G=A&&A.__esModule?function(){return A.default}:function(){return A};return w.d(G,{a:G}),G},w.o=function(A,G){return Object.prototype.hasOwnProperty.call(A,G)},w.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||Function("return this")()}catch(A){if(typeof self=="object")return self}}(),w.p="/";var O=w(ENTRY_MODULE);return O.default||O}var P="[\\.|\\-|\\+|\\w|/|@]+",_="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+P+").*?\\)";function S(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function R(b){return!isNaN(1*b)}function v(b,k,w){var O={};O[w]=[];var A=k.toString(),G=A.match(/^(?:function\s*\w*\s*)?\(\s*\w+\s*,\s*\w+\s*,\s*(\w+)\s*\)/);if(!G)return O;for(var m,N=G[1],x=new RegExp("(\\\\n|\\W)"+S(N)+_,"g");m=x.exec(A);)m[3]!=="dll-reference"&&O[w].push(m[3]);for(x=new RegExp("\\("+S(N)+'\\("(dll-reference\\s('+P+'))"\\)\\)'+_,"g");m=x.exec(A);)b[m[2]]||(O[w].push(m[1]),b[m[2]]=D(m[1]).m),O[m[2]]=O[m[2]]||[],O[m[2]].push(m[4]);for(var K=Object.keys(O),M=0;M0},!1)}le.exports=function(b,k){k=k||{};var w={main:D.m},O=k.all?{main:Object.keys(w.main)}:function(x,K){for(var M={main:[K]},u={main:[]},h={main:{}};I(M);)for(var p=Object.keys(M),E=0;E{try{return Ae(R)}catch{return!1}})){let R=_t(_);if(R)D.push(R)}}if(D.length===0)return null;let X=D.length===1?D[0]:`${String(D[0])} and ${String(D[1])}`;return`This ${le} is ${String(X)}, which this browser cannot decode.${Me?` ${Me}`:""}`}var bi="VLC can — the button is beside Play.";function Ct(_e,Ae){return ct(_e,Ae,bi,"channel")}var Ai=[[/\bAFT[A-Z0-9]+\b/i,"firetv"],[/\bKF[A-Z]+\b/,"silk"],[/\bSilk\b/i,"silk"],[/\bAndroid TV\b/i,"androidtv"],[/\bGoogleTV\b/i,"googletv"],[/\bTizen\b/i,"tizen"],[/\bWeb0S\b/i,"webos"],[/\bRoku\b/i,"roku"],[/AppleTV/i,"appletv"],[/\bCrKey\b/i,"chromecast"],[/\bSMART-TV\b/i,"smarttv"],[/\bSmartTV\b/i,"smarttv"]];function Ri(_e){if(!_e)return null;for(let[Ae,Me]of Ai)if(Ae.test(_e))return Me;return null}function wt(_e){return Ri(_e)!==null}function It(_e){return{enableWorker:!0,enableStashBuffer:!0,stashInitialSize:393216,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:5,liveBufferLatencyMinRemain:1,autoCleanupSourceBuffer:!0,autoCleanupMaxBackwardDuration:30,autoCleanupMinBackwardDuration:10,lazyLoad:!1,lazyLoadMaxDuration:60,lazyLoadRecoverDuration:30,seekType:"range"}}function Ti(){try{return Boolean(Ye.default.getFeatureList().mseLivePlayback)}catch{return!1}}var Bt=5,Li=2000,ki=5000,Di=3;function Mi(_e,Ae,Me,le=()=>{}){let Q=It(wt(navigator.userAgent)),D=null,X=!1,P=0,_=null,S=null,R=-1,v=0,I=()=>{if(_)clearTimeout(_);if(S)clearInterval(S);_=null,S=null},b=()=>{if(!D)return;let m=D;D=null;try{m.destroy()}catch{}},k=(m)=>{if(X)return;X=!0,I(),b(),Me(m)},w=(m)=>{if(X)return;if(P>=Bt)return k(m);P+=1,I(),b(),le(`Reconnecting… (${P}/${Bt})`),_=setTimeout(()=>{if(_=null,!X)A()},Li*2**(P-1))},O=()=>{if(S)clearInterval(S);R=_e.currentTime,v=0,S=setInterval(()=>{if(X||!D)return;if(_e.paused||_e.ended||_e.seeking){v=0,R=_e.currentTime;return}if(_e.currentTime===R){if(v+=1,v>=Di)v=0,w("The stream stopped sending. Try VLC, or press Play again.");return}R=_e.currentTime,v=0},ki)};function A(){D=Ye.default.createPlayer({type:"mpegts",isLive:!0,url:Ae,withCredentials:!0},Q),D.on(Ye.default.Events.MEDIA_INFO,(m)=>{let N=Ct(m,(x)=>window.MediaSource?.isTypeSupported?.(x)??!1);if(N)k(N)}),D.on(Ye.default.Events.ERROR,(m,N,x)=>{let K=x?.code;if(K===429)return k("The line was busy. Try that again.");if(K===409)return k("Somebody else is watching that line right now. Try again in a bit.");if(K===404)return k("That channel is no longer on your list.");if(K===415)return k("That channel needs a different player. Try VLC.");if(K===502||K===504)return k("Your provider did not send a stream for that channel.");if(m===Ye.default.ErrorTypes.NETWORK_ERROR)return w("The stream stopped. Your provider may have dropped it, or you started another channel somewhere else.");w(N?`That stream could not be played here (${N}). Try VLC.`:"That stream could not be played here. Try VLC.")}),D.attachMediaElement(_e),D.load(),D.play()?.catch(()=>{}),O()}let G=()=>{P=0,le(null)};return _e.addEventListener("playing",G),A(),()=>{X=!0,I(),_e.removeEventListener("playing",G),b(),_e.removeAttribute("src"),_e.load()}}window.__tipoffPlayer={supported:Ti,attach:Mi}; +`}),A=A+"new (("+X.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+O.main.map(function(x){return JSON.stringify(x)+": "+w.main[x].toString()}).join(",")+"}))(self);";var G=new self.Blob([A],{type:"text/javascript"});if(k.bare)return G;var m=(self.URL||self.webkitURL||self.mozURL||self.msURL).createObjectURL(G),N=new self.Worker(m);return N.objectURL=m,N}},403:function(le,Q,D){var X;D.r(Q),function(P){P.ERROR="error",P.SOURCE_OPEN="source_open",P.UPDATE_END="update_end",P.BUFFER_FULL="buffer_full",P.START_STREAMING="start_streaming",P.END_STREAMING="end_streaming"}(X||(X={})),Q.default=X},726:function(le,Q,D){var X;D.r(Q),function(P){P.IO_ERROR="io_error",P.DEMUX_ERROR="demux_error",P.INIT_SEGMENT="init_segment",P.MEDIA_SEGMENT="media_segment",P.LOADING_COMPLETE="loading_complete",P.RECOVERED_EARLY_EOF="recovered_early_eof",P.MEDIA_INFO="media_info",P.METADATA_ARRIVED="metadata_arrived",P.SCRIPTDATA_ARRIVED="scriptdata_arrived",P.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",P.PGS_SUBTITLE_ARRIVED="pgs_subtitle_arrived",P.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",P.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",P.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",P.SEI_ARRIVED="sei_arrived",P.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",P.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",P.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",P.STATISTICS_INFO="statistics_info",P.RECOMMEND_SEEKPOINT="recommend_seekpoint"}(X||(X={})),Q.default=X},877:function(le,Q,D){D.r(Q);var X=D(856),P=D(947),_=D(867),S=D(403),R=D(346),v=D(527),I=D(726),b=D(117),k=D(355);Q.default=function(w){var O="PlayerEngineWorker",A=function(J,ke){w.postMessage({msg:"logcat_callback",type:J,logcat:ke})}.bind(void 0),G=null,m=null,N=null,x=null,K=!1,M=!1,u=0,h=0,p=!1;function E(){N&&(N.shutdown(),N.destroy(),N=null)}function W(){if(G==null||m==null)throw new _.IllegalStateException("Worker not initialized");if(x)throw new _.IllegalStateException("Transmuxer has been initialized");M||(!m.deferLoadAfterSourceOpen||K?((x=new v.default(G,m)).on(I.default.INIT_SEGMENT,function(J,ke){N.appendInitSegment(ke)}),x.on(I.default.MEDIA_SEGMENT,function(J,ke){N.appendMediaSegment(ke),w.postMessage({msg:"buffered_position_changed",buffered_position_milliseconds:ke.info.endDts})}),x.on(I.default.LOADING_COMPLETE,function(){N.endOfStream(),w.postMessage({msg:"player_event",event:b.default.LOADING_COMPLETE})}),x.on(I.default.RECOVERED_EARLY_EOF,function(){w.postMessage({msg:"player_event",event:b.default.RECOVERED_EARLY_EOF})}),x.on(I.default.IO_ERROR,function(J,ke){w.postMessage({msg:"player_event",event:b.default.ERROR,error_type:k.ErrorTypes.NETWORK_ERROR,error_detail:J,info:ke})}),x.on(I.default.DEMUX_ERROR,function(J,ke){w.postMessage({msg:"player_event",event:b.default.ERROR,error_type:k.ErrorTypes.MEDIA_ERROR,error_detail:J,info:ke})}),x.on(I.default.MEDIA_INFO,function(J){ee(I.default.MEDIA_INFO,J)}),x.on(I.default.STATISTICS_INFO,function(J){ee(I.default.STATISTICS_INFO,J)}),x.on(I.default.RECOMMEND_SEEKPOINT,function(J){(function(ke){w.postMessage({msg:"transmuxing_event",event:I.default.RECOMMEND_SEEKPOINT,milliseconds:ke})})(J)}),x.on(I.default.METADATA_ARRIVED,function(J){Re(b.default.METADATA_ARRIVED,J)}),x.on(I.default.SCRIPTDATA_ARRIVED,function(J){Re(b.default.SCRIPTDATA_ARRIVED,J)}),x.on(I.default.TIMED_ID3_METADATA_ARRIVED,function(J){Re(b.default.TIMED_ID3_METADATA_ARRIVED,J)}),x.on(I.default.PGS_SUBTITLE_ARRIVED,function(J){Re(b.default.PGS_SUBTITLE_ARRIVED,J)}),x.on(I.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(J){Re(b.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,J)}),x.on(I.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(J){Re(b.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,J)}),x.on(I.default.SMPTE2038_METADATA_ARRIVED,function(J){Re(b.default.SMPTE2038_METADATA_ARRIVED,J)}),x.on(I.default.SEI_ARRIVED,function(J){Re(b.default.SEI_ARRIVED,J)}),x.on(I.default.SCTE35_METADATA_ARRIVED,function(J){Re(b.default.SCTE35_METADATA_ARRIVED,J)}),x.on(I.default.PES_PRIVATE_DATA_DESCRIPTOR,function(J){Re(b.default.PES_PRIVATE_DATA_DESCRIPTOR,J)}),x.on(I.default.PES_PRIVATE_DATA_ARRIVED,function(J){Re(b.default.PES_PRIVATE_DATA_ARRIVED,J)}),x.open()):M=!0)}function z(){N&&N.flush(),x&&(x.close(),x.destroy(),x=null)}function se(){K=!0,M&&(M=!1,W())}function de(){w.postMessage({msg:"mse_event",event:S.default.UPDATE_END})}function me(){X.default.v(O,"MSE SourceBuffer is full, report to main thread"),w.postMessage({msg:"mse_event",event:S.default.BUFFER_FULL})}function te(J){w.postMessage({msg:"player_event",event:b.default.ERROR,error_type:k.ErrorTypes.MEDIA_ERROR,error_detail:k.ErrorTypes.MEDIA_MSE_ERROR,info:J})}function ee(J,ke){w.postMessage({msg:"transmuxing_event",event:J,info:ke})}function Re(J,ke){w.postMessage({msg:"player_event",event:J,extraData:ke})}w.addEventListener("message",function(J){if(!p){var ke=J.data;switch(ke.cmd){case"logging_config":var L=ke;P.default.applyConfig(L.logging_config),L.logging_config.enableCallback===!0?P.default.addLogListener(A):P.default.removeLogListener(A);break;case"init":G=(L=ke).media_data_source,m=L.config;break;case"destroy":x&&z(),N&&E(),p=!0,w.postMessage({msg:"destroyed"});break;case"initialize_mse":(function(){X.default.v(O,"Initializing MediaSource in DedicatedWorker"),(N=new R.default(m)).on(S.default.SOURCE_OPEN,se.bind(this)),N.on(S.default.UPDATE_END,de.bind(this)),N.on(S.default.BUFFER_FULL,me.bind(this)),N.on(S.default.ERROR,te.bind(this)),N.initialize({getCurrentTime:function(){return u},getReadyState:function(){return h}});var c=N.getHandle();w.postMessage({msg:"mse_init",handle:c},[c])})();break;case"shutdown_mse":E();break;case"load":W();break;case"unload":z();break;case"unbuffered_seek":L=ke,N.flush(),x.seek(L.milliseconds);break;case"timeupdate":u=(L=ke).current_time;break;case"readystatechange":h=(L=ke).ready_state;break;case"pause_transmuxer":x.pause();break;case"resume_transmuxer":x.resume()}}})}},117:function(le,Q,D){var X;D.r(Q),function(P){P.ERROR="error",P.LOADING_COMPLETE="loading_complete",P.RECOVERED_EARLY_EOF="recovered_early_eof",P.MEDIA_INFO="media_info",P.METADATA_ARRIVED="metadata_arrived",P.SCRIPTDATA_ARRIVED="scriptdata_arrived",P.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",P.PGS_SUBTITLE_ARRIVED="pgs_subtitle_arrived",P.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",P.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",P.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",P.SEI_ARRIVED="sei_arrived",P.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",P.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",P.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",P.STATISTICS_INFO="statistics_info",P.DESTROYING="destroying"}(X||(X={})),Q.default=X}},Ae={};function Me(le){var Q=Ae[le];if(Q!==void 0)return Q.exports;var D=Ae[le]={exports:{}};return _e[le].call(D.exports,D,D.exports,Me),D.exports}return Me.m=_e,Me.n=function(le){var Q=le&&le.__esModule?function(){return le.default}:function(){return le};return Me.d(Q,{a:Q}),Q},Me.d=function(le,Q){if(Array.isArray(Q))for(var D=0;D{try{return Ae(R)}catch{return!1}})){let R=_t(_);if(R)D.push(R)}}if(D.length===0)return null;let X=D.length===1?D[0]:`${String(D[0])} and ${String(D[1])}`;return`This ${le} is ${String(X)}, which this browser cannot decode.${Me?` ${Me}`:""}`}var bi="VLC can — the button is beside Play.";function Ct(_e,Ae){return ct(_e,Ae,bi,"channel")}var Ai=[[/\bAFT[A-Z0-9]+\b/i,"firetv"],[/\bKF[A-Z]+\b/,"silk"],[/\bSilk\b/i,"silk"],[/\bAndroid TV\b/i,"androidtv"],[/\bGoogleTV\b/i,"googletv"],[/\bTizen\b/i,"tizen"],[/\bWeb0S\b/i,"webos"],[/\bRoku\b/i,"roku"],[/AppleTV/i,"appletv"],[/\bCrKey\b/i,"chromecast"],[/\bSMART-TV\b/i,"smarttv"],[/\bSmartTV\b/i,"smarttv"]];function Ri(_e){if(!_e)return null;for(let[Ae,Me]of Ai)if(Ae.test(_e))return Me;return null}function wt(_e){return Ri(_e)!==null}function It(_e){return{enableWorker:!1,enableStashBuffer:!0,stashInitialSize:393216,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:5,liveBufferLatencyMinRemain:1,autoCleanupSourceBuffer:!0,autoCleanupMaxBackwardDuration:30,autoCleanupMinBackwardDuration:10,lazyLoad:!1,lazyLoadMaxDuration:60,lazyLoadRecoverDuration:30,seekType:"range"}}function Ti(){try{return Boolean(Ye.default.getFeatureList().mseLivePlayback)}catch{return!1}}var Bt=5,Li=2000,ki=5000,Di=3;function Mi(_e,Ae,Me,le=()=>{}){let Q=It(wt(navigator.userAgent)),D=null,X=!1,P=0,_=null,S=null,R=-1,v=0,I=()=>{if(_)clearTimeout(_);if(S)clearInterval(S);_=null,S=null},b=()=>{if(!D)return;let m=D;D=null;try{m.destroy()}catch{}},k=(m)=>{if(X)return;X=!0,I(),b(),Me(m)},w=(m)=>{if(X)return;if(P>=Bt)return k(m);P+=1,I(),b(),le(`Reconnecting… (${P}/${Bt})`),_=setTimeout(()=>{if(_=null,!X)A()},Li*2**(P-1))},O=()=>{if(S)clearInterval(S);R=_e.currentTime,v=0,S=setInterval(()=>{if(X||!D)return;if(_e.paused||_e.ended||_e.seeking){v=0,R=_e.currentTime;return}if(_e.currentTime===R){if(v+=1,v>=Di)v=0,w("The stream stopped sending. Try VLC, or press Play again.");return}R=_e.currentTime,v=0},ki)};function A(){D=Ye.default.createPlayer({type:"mpegts",isLive:!0,url:Ae,withCredentials:!0},Q),D.on(Ye.default.Events.MEDIA_INFO,(m)=>{let N=Ct(m,(x)=>window.MediaSource?.isTypeSupported?.(x)??!1);if(N)k(N)}),D.on(Ye.default.Events.ERROR,(m,N,x)=>{let K=x?.code;if(K===429)return k("The line was busy. Try that again.");if(K===409)return k("Somebody else is watching that line right now. Try again in a bit.");if(K===404)return k("That channel is no longer on your list.");if(K===415)return k("That channel needs a different player. Try VLC.");if(K===502||K===504)return k("Your provider did not send a stream for that channel.");if(m===Ye.default.ErrorTypes.NETWORK_ERROR)return w("The stream stopped. Your provider may have dropped it, or you started another channel somewhere else.");w(N?`That stream could not be played here (${N}). Try VLC.`:"That stream could not be played here. Try VLC.")}),D.attachMediaElement(_e),D.load(),D.play()?.catch(()=>{}),O()}let G=()=>{P=0,le(null)};return _e.addEventListener("playing",G),A(),()=>{X=!0,I(),_e.removeEventListener("playing",G),b(),_e.removeAttribute("src"),_e.load()}}window.__tipoffPlayer={supported:Ti,attach:Mi}; diff --git a/apps/web/src/client/tv.js b/apps/web/src/client/tv.js index a98b9fe..2820c72 100644 --- a/apps/web/src/client/tv.js +++ b/apps/web/src/client/tv.js @@ -82,14 +82,32 @@ export function isTvBrowser(userAgent) { export function playerConfig(_isTv) { return { /* - * Demux on a worker thread. + * NOT on a worker thread, and this one is a trap worth the paragraph. * - * A transport stream at broadcast bitrate is real work, and on the main - * thread it competes with rendering the page it is playing on -- which - * shows up as dropped frames rather than as an error. mpegts.js builds the - * worker from a blob URL; we serve no CSP, so there is nothing to allow. + * Demuxing a broadcast-bitrate transport stream on the main thread competes + * with rendering the page it is playing on, so `enableWorker: true` looks + * like free performance, and media-streamer's live TV player does set it. + * It cannot be copied here. + * + * mpegts.js builds its worker by STRINGIFYING `__webpack_modules__` -- + * webpack's internal module registry -- in `utils/webworkify-webpack.js`. + * That global exists in media-streamer, which is Next.js and therefore + * webpack. This bundle is built by Bun, where there is no such global, so + * the worker it assembles is broken. + * + * And it fails in the worst available way. `Transmuxer` wraps the worker + * setup in a try/catch and falls back to inline transmuxing -- but only a + * SYNCHRONOUS throw reaches that catch. A Worker that constructs from a + * blob whose body then fails is an asynchronous failure: nothing throws, + * nothing falls back, the init segment never arrives, and the player sits + * there having reported no error at all. That is not a dropped frame, it is + * "the stream does not play", which is what shipping this caused. + * + * Everything else in this profile came over from the television's, which + * had been running in production for weeks. This was the one line that had + * never run anywhere but under webpack. */ - enableWorker: true, + enableWorker: false, /* * Read ahead, on every screen. diff --git a/test/player-codecs.test.js b/test/player-codecs.test.js index dfe168e..b65df64 100644 --- a/test/player-codecs.test.js +++ b/test/player-codecs.test.js @@ -307,11 +307,25 @@ describe('the buffering profile follows the screen', () => { expect(config.stashInitialSize).toBe(384 * 1024); }); - test('the demuxer runs off the main thread', () => { - // Broadcast-bitrate demuxing competes with rendering the page it plays on, - // and loses as dropped frames rather than as an error. We serve no CSP, so - // mpegts.js can build its blob worker unimpeded. - expect(playerConfig(false).enableWorker).toBe(true); + test('the demuxer does NOT run off the main thread', () => { + /* + * A regression test with a real outage behind it. + * + * `enableWorker: true` reads like free performance and media-streamer's + * live TV player does set it, so it was copied over -- and every stream + * stopped playing. mpegts.js builds its worker by stringifying + * `__webpack_modules__`, webpack's internal module registry. media-streamer + * is Next.js, so that global is there. This bundle is built by Bun, so it + * is not, and the worker is broken. + * + * The failure is silent: Transmuxer's try/catch only sees a SYNCHRONOUS + * throw, and a Worker that constructs from a bad blob fails asynchronously. + * Nothing throws, nothing falls back to inline transmuxing, no init segment + * ever arrives, and the player reports no error at all. + * + * Do not turn this on again without changing how this file is bundled. + */ + expect(playerConfig(false).enableWorker).toBe(false); }); test('both profiles still drop what has been watched, and never idle', () => {