@cinecrew/cinecrew-player 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/package.json +5 -3
- package/src/native/InlineLivePlayer.js +11 -1
- package/src/native/media/WebVideoPlayer.js +74 -7
- package/src/native/media/web/useWebDashPlayback.native.js +3 -0
- package/src/native/media/web/useWebDashPlayback.web.js +84 -0
- package/src/native/media/web/useWebFlvPlayback.web.js +156 -0
- package/src/native/media/web/useWebHlsPlayback.web.js +25 -2
- package/src/native/media/web/useWebMpegTsPlayback.native.js +1 -1
- package/src/native/media/web/useWebMpegTsPlayback.web.js +72 -22
- package/src/native/media/web/useWebOgvPlayback.native.js +3 -0
- package/src/native/media/web/useWebOgvPlayback.web.js +312 -0
- package/src/utils/playerError.js +34 -0
- package/src/utils/webRecording.js +17 -5
- package/src/web/index.js +215 -76
- package/src/web/styles.css +37 -4
- package/types/index.d.ts +20 -2
- package/vendor/mpegts.js/mpegts.js +3 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! For license information please see mpegts.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mpegts=t():e.mpegts=t()}(this,function(){return function(){var e={191:function(e,t,i){e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=0,n=void 0,r=void 0,o=function(e,t){h[a]=e,h[a+1]=t,2===(a+=2)&&(r?r(f):y())};var s="undefined"!=typeof window?window:void 0,d=s||{},l=d.MutationObserver||d.WebKitMutationObserver,_="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),u="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function c(){var e=setTimeout;return function(){return e(f,1)}}var h=new Array(1e3);function f(){for(var e=0;e<a;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;a=0}var p,m,g,v,y=void 0;function S(e,t){var i=this,a=new this.constructor(b);void 0===a[A]&&x(a);var n=i._state;if(n){var r=arguments[n-1];o(function(){return O(n,a,r,i._result)})}else I(i,a,e,t);return a}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return D(t,e),t}y=_?function(){return process.nextTick(f)}:l?(m=0,g=new l(f),v=document.createTextNode(""),g.observe(v,{characterData:!0}),function(){v.data=m=++m%2}):u?((p=new MessageChannel).port1.onmessage=f,function(){return p.port2.postMessage(0)}):void 0===s?function(){try{var e=Function("return this")().require("vertx");return void 0!==(n=e.runOnLoop||e.runOnContext)?function(){n(f)}:c()}catch(e){return c()}}():c();var A=Math.random().toString(36).substring(2);function b(){}var R=void 0,T=1,L=2;function k(t,i,a){i.constructor===t.constructor&&a===S&&i.constructor.resolve===E?function(e,t){t._state===T?C(e,t._result):t._state===L?w(e,t._result):I(t,void 0,function(t){return D(e,t)},function(t){return w(e,t)})}(t,i):void 0===a?C(t,i):e(a)?function(e,t,i){o(function(e){var a=!1,n=function(e,t,i,a){try{e.call(t,i,a)}catch(e){return e}}(i,t,function(i){a||(a=!0,t!==i?D(e,i):C(e,i))},function(t){a||(a=!0,w(e,t))},e._label);!a&&n&&(a=!0,w(e,n))},e)}(t,i,a):C(t,i)}function D(e,t){if(e===t)w(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(a=t),null===a||"object"!==n&&"function"!==n)C(e,t);else{var i=void 0;try{i=t.then}catch(t){return void w(e,t)}k(e,t,i)}var a,n}function M(e){e._onerror&&e._onerror(e._result),B(e)}function C(e,t){e._state===R&&(e._result=t,e._state=T,0!==e._subscribers.length&&o(B,e))}function w(e,t){e._state===R&&(e._state=L,e._result=t,o(M,e))}function I(e,t,i,a){var n=e._subscribers,r=n.length;e._onerror=null,n[r]=t,n[r+T]=i,n[r+L]=a,0===r&&e._state&&o(B,e)}function B(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var a=void 0,n=void 0,r=e._result,o=0;o<t.length;o+=3)a=t[o],n=t[o+i],a?O(i,a,n,r):n(r);e._subscribers.length=0}}function O(t,i,a,n){var r=e(a),o=void 0,s=void 0,d=!0;if(r){try{o=a(n)}catch(e){d=!1,s=e}if(i===o)return void w(i,new TypeError("A promises callback cannot return that same promise."))}else o=n;i._state!==R||(r&&d?D(i,o):!1===d?w(i,s):t===T?C(i,o):t===L&&w(i,o))}var P=0;function x(e){e[A]=P++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=function(){function e(e,i){this._instanceConstructor=e,this.promise=new e(b),this.promise[A]||x(this.promise),t(i)?(this.length=i.length,this._remaining=i.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(i),0===this._remaining&&C(this.promise,this._result))):w(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===R&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,a=i.resolve;if(a===E){var n=void 0,r=void 0,o=!1;try{n=e.then}catch(e){o=!0,r=e}if(n===S&&e._state!==R)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(i===N){var s=new i(b);o?w(s,r):k(s,e,n),this._willSettleAt(s,t)}else this._willSettleAt(new i(function(t){return t(e)}),t)}else this._willSettleAt(a(e),t)},e.prototype._settledAt=function(e,t,i){var a=this.promise;a._state===R&&(this._remaining--,e===L?w(a,i):this._result[t]=i),0===this._remaining&&C(a,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;I(e,void 0,function(e){return i._settledAt(T,t,e)},function(e){return i._settledAt(L,t,e)})},e}();var N=function(){function t(e){this[A]=P++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t(function(t){D(e,t)},function(t){w(e,t)})}catch(t){w(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var i=this,a=i.constructor;return e(t)?i.then(function(e){return a.resolve(t()).then(function(){return e})},function(e){return a.resolve(t()).then(function(){throw e})}):i.then(t,t)},t}();return N.prototype.then=S,N.all=function(e){return new U(this,e).promise},N.race=function(e){var i=this;return t(e)?new i(function(t,a){for(var n=e.length,r=0;r<n;r++)i.resolve(e[r]).then(t,a)}):new i(function(e,t){return t(new TypeError("You must pass an array to race."))})},N.resolve=E,N.reject=function(e){var t=new this(b);return w(t,e),t},N._setScheduler=function(e){r=e},N._setAsap=function(e){o=e},N._asap=o,N.polyfill=function(){var e=void 0;if(void 0!==i.g)e=i.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var a=null;try{a=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===a&&!t.cast)return}e.Promise=N},N.Promise=N,N}()},554:function(e){"use strict";var t,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise(function(i,a){function n(i){e.removeListener(t,r),a(i)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}p(e,t,r,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,n)})},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function l(e,t,i,a){var n,r,o,l;if(s(i),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),r=e._events),o=r[t]),void 0===o)o=r[t]=i,++e._eventsCount;else if("function"==typeof o?o=r[t]=a?[i,o]:[o,i]:a?o.unshift(i):o.push(i),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=o.length,l=_,console&&console.warn&&console.warn(l)}return e}function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,i){var a={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=_.bind(a);return n.listener=i,a.wrapFn=n,n}function c(e,t,i){var a=e._events;if(void 0===a)return[];var n=a[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):f(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function f(e,t){for(var i=new Array(t),a=0;a<t;++a)i[a]=e[a];return i}function p(e,t,i,a){if("function"==typeof e.on)a.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function n(r){a.once&&e.removeEventListener(t,n),i(r)})}}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),r.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},r.prototype.getMaxListeners=function(){return d(this)},r.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var d=r[e];if(void 0===d)return!1;if("function"==typeof d)a(d,this,t);else{var l=d.length,_=f(d,l);for(i=0;i<l;++i)a(_[i],this,t)}return!0},r.prototype.addListener=function(e,t){return l(this,e,t,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(e,t){return l(this,e,t,!0)},r.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},r.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},r.prototype.removeListener=function(e,t){var i,a,n,r,o;if(s(t),void 0===(a=this._events))return this;if(void 0===(i=a[e]))return this;if(i===t||i.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete a[e],a.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,r=i.length-1;r>=0;r--)if(i[r]===t||i[r].listener===t){o=i[r].listener,n=r;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(a[e]=i[0]),void 0!==a.removeListener&&this.emit("removeListener",e,o||t)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(e){var t,i,a;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,r=Object.keys(i);for(a=0;a<r.length;++a)"removeListener"!==(n=r[a])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(a=t.length-1;a>=0;a--)this.removeListener(e,t[a]);return this},r.prototype.listeners=function(e){return c(this,e,!0)},r.prototype.rawListeners=function(e){return c(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},r.prototype.listenerCount=h,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},106:function(e,t,i){"use strict";i.r(t);var a=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,a=e.length-1,n=0,r=0,o=a;for(t<e[0]&&(i=0,r=o+1);r<=o;){if((n=r+Math.floor((o-r)/2))===a||t>=e[n]&&t<e[n+1]){i=n;break}e[n]<t?r=n+1:o=n-1}return i},e}();t.default=a},14:function(e,t,i){"use strict";i.r(t),i.d(t,{IDRSampleList:function(){return r},MediaSegmentInfo:function(){return n},MediaSegmentInfoList:function(){return o},SampleInfo:function(){return a}});var a=function(e,t,i,a,n){this.dts=e,this.pts=t,this.duration=i,this.originalDts=a,this.isSyncPoint=n,this.fileposition=null},n=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),r=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,a=t.length-1,n=0,r=0,o=a;for(e<t[0].dts&&(i=0,r=o+1);r<=o;){if((n=r+Math.floor((o-r)/2))===a||e>=t[n].dts&&e<t[n+1].dts){i=n;break}t[n].dts<e?r=n+1:o=n-1}return this._list[i]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,a=0,n=0,r=i,o=0;if(e<t[0].originalBeginDts)return-1;for(;n<=r;){if((a=n+Math.floor((r-n)/2))===i||e>t[a].lastSample.originalDts&&e<t[a+1].originalBeginDts){o=a;break}t[a].originalBeginDts<e?n=a+1:r=a-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,a=this._lastAppendLocation,n=0;-1!==a&&a<t.length&&i.originalBeginDts>=t[a].lastSample.originalDts&&(a===t.length-1||a<t.length-1&&i.originalBeginDts<t[a+1].originalBeginDts)?n=a+1:t.length>0&&(n=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},339:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=i(291),o=i(687),s=i(136),d=i(842),l=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new(n()),this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),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="function"==typeof self.ManagedMediaSource&&!("function"==typeof self.MediaSource),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 e.prototype.destroy=function(){this._mediaSource&&this.shutdown(),this._mediaSourceObjectURL&&this.revokeObjectURL(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.initialize=function(e){if(this._mediaSource)throw new d.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");this._useManagedMediaSource&&r.default.v(this.TAG,"Using ManagedMediaSource");var t=this._mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(t.addEventListener("startstreaming",this.e.onStartStreaming),t.addEventListener("endstreaming",this.e.onEndStreaming),t.addEventListener("qualitychange",this.e.onQualityChange)),this._mediaElementProxy=e},e.prototype.shutdown=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var a=this._sourceBuffers[t];if(a){if("closed"!==e.readyState){try{e.removeSourceBuffer(a)}catch(e){r.default.e(this.TAG,e.message)}a.removeEventListener("error",this.e.onSourceBufferError),a.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){r.default.e(this.TAG,e.message)}this._mediaElementProxy=null,e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(e.removeEventListener("startstreaming",this.e.onStartStreaming),e.removeEventListener("endstreaming",this.e.onEndStreaming),e.removeEventListener("qualitychange",this.e.onQualityChange)),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._mediaSource=null}},e.prototype.isManagedMediaSource=function(){return this._useManagedMediaSource},e.prototype.getObject=function(){if(!this._mediaSource)throw new d.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSource},e.prototype.getHandle=function(){if(!this._mediaSource)throw new d.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSource.handle},e.prototype.getObjectURL=function(){if(!this._mediaSource)throw new d.IllegalStateException("MediaSource has not been initialized yet!");return null==this._mediaSourceObjectURL&&(this._mediaSourceObjectURL=URL.createObjectURL(this._mediaSource)),this._mediaSourceObjectURL},e.prototype.revokeObjectURL=function(){this._mediaSourceObjectURL&&(URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){var i;if(void 0===t&&(t=void 0),!this._mediaSource||"open"!==this._mediaSource.readyState||!1===this._mediaSource.streaming)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var a=e,n="".concat(a.container);a.codec&&a.codec.length>0&&("opus"===a.codec&&o.default.safari&&(a.codec="Opus"),n+=";codecs=".concat(a.codec));var d=!1;if(r.default.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[a.type]=a,n!==this._mimeTypes[a.type]){if(this._mimeTypes[a.type])r.default.v(this.TAG,"Notice: ".concat(a.type," mimeType changed, origin: ").concat(this._mimeTypes[a.type],", target: ").concat(n));else{d=!0;try{var l=this._sourceBuffers[a.type]=this._mediaSource.addSourceBuffer(n);l.addEventListener("error",this.e.onSourceBufferError),l.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return r.default.e(this.TAG,e.message),void(null===(i=this._emitter)||void 0===i||i.emit(s.default.ERROR,{code:e.code,msg:e.message}))}}this._mimeTypes[a.type]=n}t||this._pendingSegments[a.type].push(a),d||this._sourceBuffers[a.type]&&!this._sourceBuffers[a.type].updating&&this._doAppendSegments(),o.default.safari&&"audio/mpeg"===a.container&&a.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=a.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.flush=function(){for(var e in this._sourceBuffers)if(this._sourceBuffers[e]){var t=this._sourceBuffers[e];if("open"===this._mediaSource.readyState)try{t.abort()}catch(e){r.default.e(this.TAG,e.message)}var i=this._pendingSegments[e];if(i.splice(0,i.length),"closed"!==this._mediaSource.readyState){for(var a=0;a<t.buffered.length;a++){var n=t.buffered.start(a),s=t.buffered.end(a);this._pendingRemoveRanges[e].push({start:n,end:s})}if(t.updating||this._doRemoveRanges(),o.default.safari){var d=this._lastInitSegments[e];d&&(this._pendingSegments[e].push(d),t.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElementProxy.getCurrentTime();for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i)try{var a=i.buffered;if(a&&a.length>=1&&e-a.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}catch(e){}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElementProxy.getCurrentTime();for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var a=i.buffered,n=!1,r=0;r<a.length;r++){var o=a.start(r),s=a.end(r);if(o<=e&&e<s+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){n=!0;var d=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:d})}}else s<e&&(n=!0,this._pendingRemoveRanges[t].push({start:o,end:s}))}n&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElementProxy.getReadyState()&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(r.default.v(this.TAG,"Update MediaSource duration from ".concat(t," to ").concat(i)),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var a=i.shift();t.remove(a.start,a.end)}},e.prototype._doAppendSegments=function(){var e,t,i=this._pendingSegments;for(var a in i)if(this._sourceBuffers[a]&&!this._sourceBuffers[a].updating&&!1!==this._mediaSource.streaming&&i[a].length>0){var n=i[a].shift();if("number"==typeof n.timestampOffset&&isFinite(n.timestampOffset)){var o=this._sourceBuffers[a].timestampOffset,d=n.timestampOffset/1e3;Math.abs(o-d)>.1&&(r.default.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(o," to ").concat(d)),this._sourceBuffers[a].timestampOffset=d),delete n.timestampOffset}if(!n.data||0===n.data.byteLength)continue;try{this._sourceBuffers[a].appendBuffer(n.data),this._isBufferFull=!1}catch(i){this._pendingSegments[a].unshift(n),22===i.code?(this._isBufferFull||null===(e=this._emitter)||void 0===e||e.emit(s.default.BUFFER_FULL),this._isBufferFull=!0):(r.default.e(this.TAG,i.message),null===(t=this._emitter)||void 0===t||t.emit(s.default.ERROR,{code:i.code,msg:i.message}))}}},e.prototype._onSourceOpen=function(){var e;if(r.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var t=this._pendingSourceBufferInit;t.length;){var i=t.shift();this.appendInitSegment(i,!0)}this._hasPendingSegments()&&this._doAppendSegments(),null===(e=this._emitter)||void 0===e||e.emit(s.default.SOURCE_OPEN)},e.prototype._onStartStreaming=function(){var e;r.default.v(this.TAG,"ManagedMediaSource onStartStreaming"),null===(e=this._emitter)||void 0===e||e.emit(s.default.START_STREAMING)},e.prototype._onEndStreaming=function(){var e;r.default.v(this.TAG,"ManagedMediaSource onEndStreaming"),null===(e=this._emitter)||void 0===e||e.emit(s.default.END_STREAMING)},e.prototype._onQualityChange=function(){r.default.v(this.TAG,"ManagedMediaSource onQualityChange")},e.prototype._onSourceEnded=function(){r.default.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){r.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(this._mediaSource.removeEventListener("startstreaming",this.e.onStartStreaming),this._mediaSource.removeEventListener("endstreaming",this.e.onEndStreaming),this._mediaSource.removeEventListener("qualitychange",this.e.onQualityChange)))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){var e;this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),null===(e=this._emitter)||void 0===e||e.emit(s.default.UPDATE_END)},e.prototype._onSourceBufferError=function(e){r.default.e(this.TAG,"SourceBuffer Error: ".concat(e))},e}();t.default=l},136:function(e,t,i){"use strict";var a;i.r(t),function(e){e.ERROR="error",e.SOURCE_OPEN="source_open",e.UPDATE_END="update_end",e.BUFFER_FULL="buffer_full",e.START_STREAMING="start_streaming",e.END_STREAMING="end_streaming"}(a||(a={})),t.default=a},902:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=i(966),o=i.n(r),s=i(291),d=i(258),l=i(385),_=i(125),u=(i(944),i(106)),c=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new(n()),t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=o()(944),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},d.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:d.default.getConfig()})}catch(i){s.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new l.default(e,t)}else this._controller=new l.default(e,t);if(this._controller){var i=this._controller;i.on(_.default.IO_ERROR,this._onIOError.bind(this)),i.on(_.default.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(_.default.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(_.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(_.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(_.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(_.default.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(_.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(_.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(_.default.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),i.on(_.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,this._onSynchronousKLVMetadataArrived.bind(this)),i.on(_.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,this._onAsynchronousKLVMetadataArrived.bind(this)),i.on(_.default.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),i.on(_.default.SEI_ARRIVED,this._onSEIArrived.bind(this)),i.on(_.default.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),i.on(_.default.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),i.on(_.default.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),i.on(_.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(_.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),d.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.INIT_SEGMENT,e,t)})},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.MEDIA_SEGMENT,e,t)})},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then(function(){var t;null===(t=e._emitter)||void 0===t||t.emit(_.default.LOADING_COMPLETE)})},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then(function(){var t;null===(t=e._emitter)||void 0===t||t.emit(_.default.RECOVERED_EARLY_EOF)})},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.MEDIA_INFO,e)})},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.METADATA_ARRIVED,e)})},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SCRIPTDATA_ARRIVED,e)})},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.TIMED_ID3_METADATA_ARRIVED,e)})},e.prototype._onPGSSubtitleArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.PGS_SUBTITLE_ARRIVED,e)})},e.prototype._onSynchronousKLVMetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,e)})},e.prototype._onAsynchronousKLVMetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)})},e.prototype._onSMPTE2038MetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SMPTE2038_METADATA_ARRIVED,e)})},e.prototype._onSEIArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SEI_ARRIVED,e)})},e.prototype._onSCTE35MetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SCTE35_METADATA_ARRIVED,e)})},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.PES_PRIVATE_DATA_DESCRIPTOR,e)})},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.PES_PRIVATE_DATA_ARRIVED,e)})},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.STATISTICS_INFO,e)})},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.IO_ERROR,e,t)})},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.DEMUX_ERROR,e,t)})},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.RECOMMEND_SEEKPOINT,e)})},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t,i,a,n,r,o,d=e.data,l=d.data;if("destroyed"===d.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(d.msg){case _.default.INIT_SEGMENT:case _.default.MEDIA_SEGMENT:null===(t=this._emitter)||void 0===t||t.emit(d.msg,l.type,l.data);break;case _.default.LOADING_COMPLETE:case _.default.RECOVERED_EARLY_EOF:null===(i=this._emitter)||void 0===i||i.emit(d.msg);break;case _.default.MEDIA_INFO:Object.setPrototypeOf(l,u.default.prototype),null===(a=this._emitter)||void 0===a||a.emit(d.msg,l);break;case _.default.METADATA_ARRIVED:case _.default.SCRIPTDATA_ARRIVED:case _.default.TIMED_ID3_METADATA_ARRIVED:case _.default.PGS_SUBTITLE_ARRIVED:case _.default.SYNCHRONOUS_KLV_METADATA_ARRIVED:case _.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED:case _.default.SMPTE2038_METADATA_ARRIVED:case _.default.SCTE35_METADATA_ARRIVED:case _.default.SEI_ARRIVED:case _.default.PES_PRIVATE_DATA_DESCRIPTOR:case _.default.PES_PRIVATE_DATA_ARRIVED:case _.default.STATISTICS_INFO:null===(n=this._emitter)||void 0===n||n.emit(d.msg,l);break;case _.default.IO_ERROR:case _.default.DEMUX_ERROR:null===(r=this._emitter)||void 0===r||r.emit(d.msg,l.type,l.info);break;case _.default.RECOMMEND_SEEKPOINT:null===(o=this._emitter)||void 0===o||o.emit(d.msg,l);break;case"logcat_callback":s.default.emitter.emit("log",l.type,l.logcat)}},e}();t.default=c},385:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return Ge}});var a=i(554),n=i.n(a),r=i(291),o=i(687),s=i(106);function d(e,t,i){var a=e;if(t+i<a.length){for(;i--;)if(128!=(192&a[++t]))return!1;return!0}return!1}var l,_=function(e){for(var t=[],i=e,a=0,n=e.length;a<n;)if(i[a]<128)t.push(String.fromCharCode(i[a])),++a;else{if(i[a]<192);else if(i[a]<224){if(d(i,a,1)&&(r=(31&i[a])<<6|63&i[a+1])>=128){t.push(String.fromCharCode(65535&r)),a+=2;continue}}else if(i[a]<240){if(d(i,a,2)&&(r=(15&i[a])<<12|(63&i[a+1])<<6|63&i[a+2])>=2048&&55296!=(63488&r)){t.push(String.fromCharCode(65535&r)),a+=3;continue}}else if(i[a]<248){var r;if(d(i,a,3)&&(r=(7&i[a])<<18|(63&i[a+1])<<12|(63&i[a+2])<<6|63&i[a+3])>65536&&r<1114112){r-=65536,t.push(String.fromCharCode(r>>>10|55296)),t.push(String.fromCharCode(1023&r|56320)),a+=4;continue}}t.push(String.fromCharCode(65533)),++a}return t.join("")},u=i(842),c=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]),h=function(){function e(){}return e.parseScriptData=function(t,i,a){var n={};try{var o=e.parseValue(t,i,a),s=e.parseValue(t,i+o.size,a-o.size);n[o.data]=s.data}catch(e){r.default.e("AMF",e.toString())}return n},e.parseObject=function(t,i,a){if(a<3)throw new u.IllegalStateException("Data not enough when parse ScriptDataObject");var n=e.parseString(t,i,a),r=e.parseValue(t,i+n.size,a-n.size),o=r.objectEnd;return{data:{name:n.data,value:r.data},size:n.size+r.size,objectEnd:o}},e.parseVariable=function(t,i,a){return e.parseObject(t,i,a)},e.parseString=function(e,t,i){if(i<2)throw new u.IllegalStateException("Data not enough when parse String");var a=new DataView(e,t,i).getUint16(0,!c);return{data:a>0?_(new Uint8Array(e,t+2,a)):"",size:2+a}},e.parseLongString=function(e,t,i){if(i<4)throw new u.IllegalStateException("Data not enough when parse LongString");var a=new DataView(e,t,i).getUint32(0,!c);return{data:a>0?_(new Uint8Array(e,t+4,a)):"",size:4+a}},e.parseDate=function(e,t,i){if(i<10)throw new u.IllegalStateException("Data size invalid when parse Date");var a=new DataView(e,t,i),n=a.getFloat64(0,!c),r=a.getInt16(8,!c);return{data:new Date(n+=60*r*1e3),size:10}},e.parseValue=function(t,i,a){if(a<1)throw new u.IllegalStateException("Data not enough when parse Value");var n,o=new DataView(t,i,a),s=1,d=o.getUint8(0),l=!1;try{switch(d){case 0:n=o.getFloat64(1,!c),s+=8;break;case 1:n=!!o.getUint8(1),s+=1;break;case 2:var _=e.parseString(t,i+1,a-1);n=_.data,s+=_.size;break;case 3:n={};var h=0;for(9==(16777215&o.getUint32(a-4,!c))&&(h=3);s<a-4;){var f=e.parseObject(t,i+s,a-s-h);if(f.objectEnd)break;n[f.data.name]=f.data.value,s+=f.size}s<=a-3&&9==(16777215&o.getUint32(s-1,!c))&&(s+=3);break;case 8:for(n={},s+=4,h=0,9==(16777215&o.getUint32(a-4,!c))&&(h=3);s<a-8;){var p=e.parseVariable(t,i+s,a-s-h);if(p.objectEnd)break;n[p.data.name]=p.data.value,s+=p.size}s<=a-3&&9==(16777215&o.getUint32(s-1,!c))&&(s+=3);break;case 9:n=void 0,s=1,l=!0;break;case 10:n=[];var m=o.getUint32(1,!c);s+=4;for(var g=0;g<m;g++){var v=e.parseValue(t,i+s,a-s);n.push(v.data),s+=v.size}break;case 11:var y=e.parseDate(t,i+1,a-1);n=y.data,s+=y.size;break;case 12:var S=e.parseString(t,i+1,a-1);n=S.data,s+=S.size;break;default:s=a,r.default.w("AMF","Unsupported AMF value type "+d)}}catch(e){r.default.e("AMF",e.toString())}return{data:n,size:s,objectEnd:l}},e}(),f=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new u.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new u.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var a=e-this._current_word_bits_left;this._fillCurrentWord();var n=Math.min(a,this._current_word_bits_left),r=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,i<<n|r},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(this._current_word&2147483648>>>e)return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),p=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)},e.parseSPS=function(t){for(var i=t.subarray(1,4),a="avc1.",n=0;n<3;n++){var r=i[n].toString(16);r.length<2&&(r="0"+r),a+=r}var o=e._ebsp2rbsp(t),s=new f(o);s.readByte();var d=s.readByte();s.readByte();var l=s.readByte();s.readUEG();var _=e.getProfileString(d),u=e.getLevelString(l),c=1,h=420,p=8,m=8;if((100===d||110===d||122===d||244===d||44===d||83===d||86===d||118===d||128===d||138===d||144===d)&&(3===(c=s.readUEG())&&s.readBits(1),c<=3&&(h=[0,420,422,444][c]),p=s.readUEG()+8,m=s.readUEG()+8,s.readBits(1),s.readBool()))for(var g=3!==c?8:12,v=0;v<g;v++)s.readBool()&&(v<6?e._skipScalingList(s,16):e._skipScalingList(s,64));s.readUEG();var y=s.readUEG();if(0===y)s.readUEG();else if(1===y){s.readBits(1),s.readSEG(),s.readSEG();var S=s.readUEG();for(v=0;v<S;v++)s.readSEG()}var E=s.readUEG();s.readBits(1);var A=s.readUEG(),b=s.readUEG(),R=s.readBits(1);0===R&&s.readBits(1),s.readBits(1);var T=0,L=0,k=0,D=0;s.readBool()&&(T=s.readUEG(),L=s.readUEG(),k=s.readUEG(),D=s.readUEG());var M=1,C=1,w=0,I=!0,B=0,O=0;if(s.readBool()){if(s.readBool()){var P=s.readByte();P>0&&P<16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][P-1],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][P-1]):255===P&&(M=s.readByte()<<8|s.readByte(),C=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 x=s.readBits(32),U=s.readBits(32);I=s.readBool(),w=(B=U)/(O=2*x)}}var N=1;1===M&&1===C||(N=M/C);var V=0,G=0;0===c?(V=1,G=2-R):(V=3===c?1:2,G=(1===c?2:1)*(2-R));var F=16*(A+1),j=16*(b+1)*(2-R);F-=(T+L)*V,j-=(k+D)*G;var z=Math.ceil(F*N);return s.destroy(),s=null,{codec_mimetype:a,profile_idc:d,level_idc:l,profile_string:_,level_string:u,chroma_format_idc:c,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:m,ref_frames:E,chroma_format:h,chroma_format_string:e.getChromaFormatString(h),frame_rate:{fixed:I,fps:w,fps_den:O,fps_num:B},sar_ratio:{width:M,height:C},codec_size:{width:F,height:j},present_size:{width:z,height:j}}},e._skipScalingList=function(e,t){for(var i=8,a=8,n=0;n<t;n++)0!==a&&(a=(i+e.readSEG()+256)%256),i=0===a?i:a},e.getProfileString=function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}(),m=i(24),g=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)},e.parseVPS=function(t){var i=e._ebsp2rbsp(t),a=new f(i);return a.readByte(),a.readByte(),a.readBits(4),a.readBits(2),a.readBits(6),{num_temporal_layers:a.readBits(3)+1,temporal_id_nested:a.readBool()}},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),a=new f(i);a.readByte(),a.readByte();for(var n=0,r=0,o=0,s=0,d=(a.readBits(4),a.readBits(3)),l=(a.readBool(),a.readBits(2)),_=a.readBool(),u=a.readBits(5),c=a.readByte(),h=a.readByte(),p=a.readByte(),m=a.readByte(),g=a.readByte(),v=a.readByte(),y=a.readByte(),S=a.readByte(),E=a.readByte(),A=a.readByte(),b=a.readByte(),R=[],T=[],L=0;L<d;L++)R.push(a.readBool()),T.push(a.readBool());if(d>0)for(L=d;L<8;L++)a.readBits(2);for(L=0;L<d;L++)R[L]&&(a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte()),T[L]&&a.readByte();a.readUEG();var k=a.readUEG();3==k&&a.readBits(1);var D=a.readUEG(),M=a.readUEG();a.readBool()&&(n+=a.readUEG(),r+=a.readUEG(),o+=a.readUEG(),s+=a.readUEG());var C=a.readUEG(),w=a.readUEG(),I=a.readUEG();for(L=a.readBool()?0:d;L<=d;L++)a.readUEG(),a.readUEG(),a.readUEG();if(a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readBool()&&a.readBool())for(var B=0;B<4;B++)for(var O=0;O<(3===B?2:6);O++)if(a.readBool()){var P=Math.min(64,1<<4+(B<<1));for(B>1&&a.readSEG(),L=0;L<P;L++)a.readSEG()}else a.readUEG();a.readBool(),a.readBool(),a.readBool()&&(a.readByte(),a.readUEG(),a.readUEG(),a.readBool());var x=a.readUEG(),U=0;for(L=0;L<x;L++){var N=!1;if(0!==L&&(N=a.readBool()),N){L===x&&a.readUEG(),a.readBool(),a.readUEG();for(var V=0,G=0;G<=U;G++){var F=a.readBool(),j=!1;F||(j=a.readBool()),(F||j)&&V++}U=V}else{var z=a.readUEG(),H=a.readUEG();for(U=z+H,G=0;G<z;G++)a.readUEG(),a.readBool();for(G=0;G<H;G++)a.readUEG(),a.readBool()}}if(a.readBool()){var q=a.readUEG();for(L=0;L<q;L++){for(G=0;G<I+4;G++)a.readBits(1);a.readBits(1)}}var K=0,W=1,Y=1,X=!1,Q=1,J=1;if(a.readBool(),a.readBool(),a.readBool()){if(a.readBool()){var Z=a.readByte();Z>0&&Z<=16?(W=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][Z-1],Y=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][Z-1]):255===Z&&(W=a.readBits(16),Y=a.readBits(16))}if(a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(3),a.readBool(),a.readBool()&&(a.readByte(),a.readByte(),a.readByte())),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool(),a.readBool(),a.readBool(),a.readBool()&&(a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG()),a.readBool()&&(Q=a.readBits(32),J=a.readBits(32),a.readBool()&&a.readUEG(),a.readBool())){var $,ee,te=!1;for($=a.readBool(),ee=a.readBool(),($||ee)&&((te=a.readBool())&&(a.readByte(),a.readBits(5),a.readBool(),a.readBits(5)),a.readBits(4),a.readBits(4),te&&a.readBits(4),a.readBits(5),a.readBits(5),a.readBits(5)),L=0;L<=d;L++){var ie=a.readBool();X=ie;var ae=!0,ne=1;ie||(ae=a.readBool());var re=!1;if(ae?a.readUEG():re=a.readBool(),re||(ne=a.readUEG()+1),$){for(G=0;G<ne;G++)a.readUEG(),a.readUEG(),te&&(a.readUEG(),a.readUEG());a.readBool()}if(ee){for(G=0;G<ne;G++)a.readUEG(),a.readUEG(),te&&(a.readUEG(),a.readUEG());a.readBool()}}}a.readBool()&&(a.readBool(),a.readBool(),a.readBool(),K=a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG())}a.readBool();var oe="hvc1.".concat(u,".1.L").concat(b,".B0"),se=D-(n+r)*(1===k||2===k?2:1),de=M-(o+s)*(1===k?2:1),le=1;return 1!==W&&1!==Y&&(le=W/Y),a.destroy(),a=null,{codec_mimetype:oe,profile_string:e.getProfileString(u),level_string:e.getLevelString(b),profile_idc:u,bit_depth:C+8,ref_frames:1,chroma_format:k,chroma_format_string:e.getChromaFormatString(k),general_level_idc:b,general_profile_space:l,general_tier_flag:_,general_profile_idc:u,general_profile_compatibility_flags_1:c,general_profile_compatibility_flags_2:h,general_profile_compatibility_flags_3:p,general_profile_compatibility_flags_4:m,general_constraint_indicator_flags_1:g,general_constraint_indicator_flags_2:v,general_constraint_indicator_flags_3:y,general_constraint_indicator_flags_4:S,general_constraint_indicator_flags_5:E,general_constraint_indicator_flags_6:A,min_spatial_segmentation_idc:K,constant_frame_rate:0,chroma_format_idc:k,bit_depth_luma_minus8:C,bit_depth_chroma_minus8:w,frame_rate:{fixed:X,fps:J/Q,fps_den:Q,fps_num:J},sar_ratio:{width:W,height:Y},codec_size:{width:se,height:de},present_size:{width:se*le,height:de}}},e.parsePPS=function(t){var i=e._ebsp2rbsp(t),a=new f(i);a.readByte(),a.readByte(),a.readUEG(),a.readUEG(),a.readBool(),a.readBool(),a.readBits(3),a.readBool(),a.readBool(),a.readUEG(),a.readUEG(),a.readSEG(),a.readBool(),a.readBool(),a.readBool()&&a.readUEG(),a.readSEG(),a.readSEG(),a.readBool(),a.readBool(),a.readBool(),a.readBool();var n=a.readBool(),r=a.readBool(),o=1;return r&&n?o=0:r?o=3:n&&(o=2),{parallelismType:o}},e.getChromaFormatString=function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},e.getProfileString=function(e){switch(e){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}},e.getLevelString=function(e){return(e/30).toFixed(1)},e}();function v(e){return e.byteOffset%2==0&&e.byteLength%2==0}function y(e){return e.byteOffset%4==0&&e.byteLength%4==0}function S(e,t){for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}var E=function(e,t){return e.byteLength===t.byteLength&&(y(e)&&y(t)?function(e,t){return S(new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4),new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4))}(e,t):v(e)&&v(t)?function(e,t){return S(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2))}(e,t):function(e,t){return S(e,t)}(e,t))},A=function(){return A=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},A.apply(this,arguments)},b=function(){function e(){}return e.parseOBUs=function(t,i){for(var a=0;a<t.byteLength;){var n=a,r=(t[a],(120&t[a])>>3),o=!!(4&t[a]),s=!!(2&t[a]);t[a],a+=1,o&&(a+=1);var d=Number.POSITIVE_INFINITY;if(s){d=0;for(var l=0;;l++){var _=t[a++];if(d|=(127&_)<<7*l,!(128&_))break}}console.log(r),1===r?i=A(A({},e.parseSeuqneceHeader(t.subarray(a,a+d))),{sequence_header_data:t.subarray(n,a+d)}):(3==r&&i||6==r&&i)&&(i=e.parseOBUFrameHeader(t.subarray(a,a+d),0,0,i)),a+=d}return i},e.parseSeuqneceHeader=function(t){var i=new f(t),a=i.readBits(3),n=(i.readBool(),i.readBool()),r=!0,o=0,s=1,d=void 0,l=[];if(n)l.push({operating_point_idc:0,level:i.readBits(5),tier:0});else{if(i.readBool()){var _=i.readBits(32),u=i.readBits(32),c=i.readBool();if(c){for(var h=0;0===i.readBits(1);)h+=1;h>=32||i.readBits(h)}o=u,s=_,r=c,i.readBool()&&(i.readBits(5),i.readBits(32),d=i.readBits(5),i.readBits(5))}for(var p=i.readBool(),m=i.readBits(5),g=0;g<=m;g++){var v=i.readBits(12),y=i.readBits(5),S=y>7?i.readBits(1):0;l.push({operating_point_idc:v,level:y,tier:S}),p&&i.readBool()&&i.readBits(4)}}var E=l[0],A=E.level,b=E.tier,R=i.readBits(4),T=i.readBits(4),L=i.readBits(R+1)+1,k=i.readBits(T+1)+1,D=!1;n||(D=i.readBool()),D&&(i.readBits(4),i.readBits(4)),i.readBool(),i.readBool(),i.readBool();var M=!1,C=2,w=2,I=0;n||(i.readBool(),i.readBool(),i.readBool(),i.readBool(),(M=i.readBool())&&(i.readBool(),i.readBool()),w=(C=i.readBool()?2:i.readBits(1))?i.readBool()?2:i.readBits(1):2,I=M?i.readBits(3)+1:0);var B=i.readBool(),O=(i.readBool(),i.readBool(),i.readBool()),P=8;P=2===a&&O?i.readBool()?12:10:O?10:8;var x=!1;1!==a&&(x=i.readBool()),i.readBool()&&(i.readBits(8),i.readBits(8),i.readBits(8));var U=1,N=1;return x?(i.readBits(1),U=1,N=1):(i.readBits(1),0==a?(U=1,N=1):1==a?(U=0,N=0):12==P?i.readBits(1)&&i.readBits(1):(U=1,N=0),U&&N&&i.readBits(2),i.readBits(1)),i.readBool(),i.destroy(),i=null,{codec_mimetype:"av01.".concat(a,".").concat(e.getLevelString(A,b),".").concat(P.toString(10).padStart(2,"0")),level:A,tier:b,level_string:e.getLevelString(A,b),profile_idc:a,profile_string:"".concat(a),bit_depth:P,ref_frames:1,chroma_format:e.getChromaFormat(x,U,N),chroma_format_string:e.getChromaFormatString(x,U,N),sequence_header:{frame_id_numbers_present_flag:D,additional_frame_id_length_minus_1:void 0,delta_frame_id_length_minus_2:void 0,reduced_still_picture_header:n,decoder_model_info_present_flag:!1,operating_points:l,buffer_removal_time_length_minus_1:d,equal_picture_interval:r,seq_force_screen_content_tools:C,seq_force_integer_mv:w,enable_order_hint:M,order_hint_bits:I,enable_superres:B,frame_width_bit:R+1,frame_height_bit:T+1,max_frame_width:L,max_frame_height:k},keyframe:void 0,frame_rate:{fixed:r,fps:o/s,fps_den:s,fps_num:o}}},e.parseOBUFrameHeader=function(t,i,a,n){var r=n.sequence_header,o=new f(t),s=(r.max_frame_width,r.max_frame_height,0);r.frame_id_numbers_present_flag&&(s=r.additional_frame_id_length_minus_1+r.delta_frame_id_length_minus_2+3);var d=0,l=!0,_=!0,u=!1;if(!r.reduced_still_picture_header){if(o.readBool())return n;l=2===(d=o.readBits(2))||0===d,(_=o.readBool())&&r.decoder_model_info_present_flag&&r.equal_picture_interval,_&&o.readBool(),u=!!(3===d||0===d&&_)||o.readBool()}n.keyframe=l,o.readBool();var c=r.seq_force_screen_content_tools;2===r.seq_force_screen_content_tools&&(c=o.readBits(1)),c&&(r.seq_force_integer_mv,2==r.seq_force_integer_mv&&o.readBits(1)),r.frame_id_numbers_present_flag&&o.readBits(s);var h;if(h=3==d||!r.reduced_still_picture_header&&o.readBool(),o.readBits(r.order_hint_bits),l||u||o.readBits(3),r.decoder_model_info_present_flag&&o.readBool())for(var p=0;p<=r.operating_points_cnt_minus_1;p++)if(r.operating_points[p].decoder_model_present_for_this_op[p]){var m=r.operating_points[p].operating_point_idc;(0===m||m>>i&1&&m>>a+8&1)&&o.readBits(r.buffer_removal_time_length_minus_1+1)}var g=255;if(3===d||0==d&&_||(g=o.readBits(8)),(l||255!==g)&&u&&r.enable_order_hint)for(var v=0;v<8;v++)o.readBits(r.order_hint_bits);if(l){var y=e.frameSizeAndRenderSize(o,h,r);n.codec_size={width:y.FrameWidth,height:y.FrameHeight},n.present_size={width:y.RenderWidth,height:y.RenderHeight},n.sar_ratio={width:y.RenderWidth/y.FrameWidth,height:y.RenderHeight/y.FrameHeight}}return o.destroy(),o=null,n},e.frameSizeAndRenderSize=function(e,t,i){var a=i.max_frame_width,n=i.max_frame_height;t&&(a=e.readBits(i.frame_width_bit)+1,n=e.readBits(i.frame_height_bit)+1);var r=!1;i.enable_superres&&(r=e.readBool());var o=8;r&&(o=e.readBits(3)+9);var s=a;a=Math.floor((8*s+o/2)/o);var d=s,l=n;if(e.readBool()){var _=e.readBits(16)+1,u=e.readBits(16)+1;d=e.readBits(_)+1,l=e.readBits(u)+1}return{UpscaledWidth:s,FrameWidth:a,FrameHeight:n,RenderWidth:d,RenderHeight:l}},e.getLevelString=function(e,t){return"".concat(e.toString(10).padStart(2,"0")).concat(0===t?"M":"H")},e.getChromaFormat=function(e,t,i){return e?0:0===t&&0===i?3:1===t&&0===i?2:1===t&&1===i?1:Number.NaN},e.getChromaFormatString=function(e,t,i){return e?"4:0:0":0===t&&0===i?"4:4:4":1===t&&0===i?"4:2:2":1===t&&1===i?"4:2:0":"Unknown"},e}(),R=function(){};function T(e,t,i){if(!e||e.byteLength<2)return null;var a=1;"h265"===i&&(a=2);var n=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)}(e.subarray(a)),r=0;if(r===n.byteLength-1&&128===n[r])return null;for(var o=0;r<n.byteLength&&255===n[r];)o+=255,r++;if(r>=n.byteLength)return null;o+=n[r++];for(var s=0;r<n.byteLength&&255===n[r];)s+=255,r++;if(r>=n.byteLength)return null;if(s+=n[r++],r+s>n.byteLength)return null;var d=new R;d.type=o,d.size=s;var l=n.subarray(r,r+s);return 5===o&&s>=16&&(d.uuid=l.subarray(0,16),d.user_data=l.subarray(16)),void 0!==t&&(d.pts=t),d}var L,k=function(){function e(e,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=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new s.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=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return e.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},e.probe=function(e){var t=new Uint8Array(e);if(t.byteLength<9)return{needMoreData:!0};var i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var a,n=(4&t[4])>>>2!=0,r=!!(1&t[4]),o=(a=t)[5]<<24|a[6]<<16|a[7]<<8|a[8];return o<9?i:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:n,hasVideoTrack:r}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeiArrived",{get:function(){return this._onSeiArrived},set:function(e){this._onSeiArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new s.default},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new u.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var a=0,n=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;a=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+a!==this._dataOffset&&r.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(o=new DataView(t,a)).getUint32(0,!n)&&r.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),a+=4);a<t.byteLength;){this._dispatch=!0;var o=new DataView(t,a);if(a+11+4>t.byteLength)break;var s=o.getUint8(0),d=16777215&o.getUint32(0,!n);if(a+11+d+4>t.byteLength)break;if(8===s||9===s||18===s){var l=o.getUint8(4),_=o.getUint8(5),c=o.getUint8(6)|_<<8|l<<16|o.getUint8(7)<<24;16777215&o.getUint32(7,!n)&&r.default.w(this.TAG,"Meet tag which has StreamID != 0!");var h=a+11;switch(s){case 8:this._parseAudioData(t,h,d,c);break;case 9:this._parseVideoData(t,h,d,c,i+a);break;case 18:this._parseScriptData(t,h,d)}var f=o.getUint32(11+d,!n);f!==11+d&&r.default.w(this.TAG,"Invalid PrevTagSize ".concat(f)),a+=11+d+4}else r.default.w(this.TAG,"Unsupported tag type ".concat(s,", skipped")),a+=11+d+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),a},e.prototype._parseScriptData=function(e,t,i){var a=h.parseScriptData(e,t,i);if(a.hasOwnProperty("onMetaData")){if(null==a.onMetaData||"object"!=typeof a.onMetaData)return void r.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&r.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=a;var n=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},n)),"boolean"==typeof n.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=n.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof n.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=n.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof n.audiodatarate&&(this._mediaInfo.audioDataRate=n.audiodatarate),"number"==typeof n.videodatarate&&(this._mediaInfo.videoDataRate=n.videodatarate),"number"==typeof n.width&&(this._mediaInfo.width=n.width),"number"==typeof n.height&&(this._mediaInfo.height=n.height),"number"==typeof n.duration){if(!this._durationOverrided){var o=Math.floor(n.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if("number"==typeof n.framerate){var s=Math.floor(1e3*n.framerate);if(s>0){var d=s/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=d,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=d}}if("object"==typeof n.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var l=n.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),n.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=n,r.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))},e.prototype._parseSEIPayload=function(e,t,i){var a=T(e,t,i);a&&"function"==typeof this._onSeiArrived&&this._onSeiArrived(a)},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],a=1;a<e.times.length;a++){var n=this._timestampBase+Math.floor(1e3*e.times[a]);t.push(n),i.push(e.filepositions[a])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,a){if(i<=1)r.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var n=new DataView(e,t,i).getUint8(0),o=n>>>4;if(9!==o)if(2===o||3===o||10===o){var s=0,d=(12&n)>>>2;if(d>=0&&d<=4){s=this._flvSoundRateTable[d];var l=(2&n)>>>1,_=1&n,u=this._audioMetadata,c=this._audioTrack;if(u||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(u=this._audioMetadata={}).type="audio",u.id=c.id,u.timescale=this._timescale,u.duration=this._duration,u.audioSampleRate=s,u.channelCount=0===_?1:2),10===o){var h=this._parseAACAudioData(e,t+1,i-1);if(null==h)return;if(0===h.packetType){if(u.config){if(E(h.data.config,u.config))return;r.default.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var f=h.data;u.audioSampleRate=f.samplingRate,u.channelCount=f.channelCount,u.codec=f.codec,u.originalCodec=f.originalCodec,u.config=f.config,u.refSampleDuration=1024/u.audioSampleRate*u.timescale,r.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",u),(y=this._mediaInfo).audioCodec=u.originalCodec,y.audioSampleRate=u.audioSampleRate,y.audioChannelCount=u.channelCount,y.hasVideo?null!=y.videoCodec&&(y.mimeType='video/x-flv; codecs="'+y.videoCodec+","+y.audioCodec+'"'):y.mimeType='video/x-flv; codecs="'+y.audioCodec+'"',y.isComplete()&&this._onMediaInfo(y)}else if(1===h.packetType){var p=this._timestampBase+a,g={unit:h.data,length:h.data.byteLength,dts:p,pts:p};c.samples.push(g),c.length+=h.data.length}else r.default.e(this.TAG,"Flv: Unsupported AAC data type ".concat(h.packetType))}else if(2===o){if(!u.codec){if(null==(f=this._parseMP3AudioData(e,t+1,i-1,!0)))return;u.audioSampleRate=f.samplingRate,u.channelCount=f.channelCount,u.codec=f.codec,u.originalCodec=f.originalCodec,u.refSampleDuration=1152/u.audioSampleRate*u.timescale,r.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",u),(y=this._mediaInfo).audioCodec=u.codec,y.audioSampleRate=u.audioSampleRate,y.audioChannelCount=u.channelCount,y.audioDataRate=f.bitRate,y.hasVideo?null!=y.videoCodec&&(y.mimeType='video/x-flv; codecs="'+y.videoCodec+","+y.audioCodec+'"'):y.mimeType='video/x-flv; codecs="'+y.audioCodec+'"',y.isComplete()&&this._onMediaInfo(y)}if(null==(S=this._parseMP3AudioData(e,t+1,i-1,!1)))return;p=this._timestampBase+a;var v={unit:S,length:S.byteLength,dts:p,pts:p};c.samples.push(v),c.length+=S.length}else if(3===o){var y;u.codec||(u.audioSampleRate=s,u.sampleSize=8*(l+1),u.littleEndian=!0,u.codec="ipcm",u.originalCodec="ipcm",this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",u),(y=this._mediaInfo).audioCodec=u.codec,y.audioSampleRate=u.audioSampleRate,y.audioChannelCount=u.channelCount,y.audioDataRate=u.sampleSize*u.audioSampleRate,y.hasVideo?null!=y.videoCodec&&(y.mimeType='video/x-flv; codecs="'+y.videoCodec+","+y.audioCodec+'"'):y.mimeType='video/x-flv; codecs="'+y.audioCodec+'"',y.isComplete()&&this._onMediaInfo(y));var S=new Uint8Array(e,t+1,i-1),A=(p=this._timestampBase+a,{unit:S,length:S.byteLength,dts:p,pts:p});c.samples.push(A),c.length+=S.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: "+o);else{if(i<=5)return void r.default.w(this.TAG,"Flv: Invalid audio packet, missing AudioFourCC in Ehnanced FLV payload!");var b=15&n,R=String.fromCharCode.apply(String,new Uint8Array(e,t,i).slice(1,5));switch(R){case"Opus":this._parseOpusAudioPacket(e,t+5,i-5,a,b);break;case"fLaC":this._parseFlacAudioPacket(e,t+5,i-5,a,b);break;default:this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec: "+R)}}}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var a={},n=new Uint8Array(e,t,i);return a.packetType=n[0],0===n[0]?a.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):a.data=n.subarray(1),a}r.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var a,n,r=new Uint8Array(e,t,i),o=null,s=0,d=null;if(s=a=r[0]>>>3,(n=(7&r[0])<<1|r[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(m.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var l=this._mpegSamplingRates[n],_=(120&r[1])>>>3;if(!(_<0||_>=8)){5===s&&(d=(7&r[1])<<1|r[2]>>>7,r[2]);var u=self.navigator.userAgent.toLowerCase();return-1!==u.indexOf("firefox")?n>=6?(s=5,o=new Array(4),d=n-3):(s=2,o=new Array(2),d=n):-1!==u.indexOf("android")?(s=2,o=new Array(2),d=n):(s=5,d=n,o=new Array(4),n>=6?d=n-3:1===_&&(s=2,o=new Array(2),d=n)),o[0]=s<<3,o[0]|=(15&n)>>>1,o[1]=(15&n)<<7,o[1]|=(15&_)<<3,5===s&&(o[1]|=(15&d)>>>1,o[2]=(1&d)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:l,channelCount:_,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+a}}this._onError(m.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,a){if(!(i<4)){this._littleEndian;var n=new Uint8Array(e,t,i),o=null;if(a){if(255!==n[0])return;var s=n[1]>>>3&3,d=(6&n[1])>>1,l=(240&n[2])>>>4,_=(12&n[2])>>>2,u=3&~(n[3]>>>6)?2:1,c=0,h=0;switch(s){case 0:c=this._mpegAudioV25SampleRateTable[_];break;case 2:c=this._mpegAudioV20SampleRateTable[_];break;case 3:c=this._mpegAudioV10SampleRateTable[_]}switch(d){case 1:l<this._mpegAudioL3BitRateTable.length&&(h=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(h=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(h=this._mpegAudioL1BitRateTable[l])}o={bitRate:h,samplingRate:c,channelCount:u,codec:"mp3",originalCodec:"mp3"}}else o=n;return o}r.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseOpusAudioPacket=function(e,t,i,a,n){if(0===n)this._parseOpusSequenceHeader(e,t,i);else if(1===n)this._parseOpusAudioData(e,t,i,a);else if(2!==n)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(n))},e.prototype._parseOpusSequenceHeader=function(e,t,i){if(i<=16)r.default.w(this.TAG,"Flv: Invalid OpusSequenceHeader, lack of data!");else{var a=this._audioMetadata,n=this._audioTrack;a||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(a=this._audioMetadata={}).type="audio",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration);var o=new DataView(e,t,i);o.setUint8(8,0);var s=o.getUint8(9);o.setUint16(10,o.getUint16(10,!0),!1);var d=o.getUint32(12,!0);o.setUint32(12,o.getUint32(12,!0),!1);var l={config:new Uint8Array(e,t+8,i-8),channelCount:s,samplingFrequence:d,codec:"opus",originalCodec:"opus"};if(a.config){if(E(l.config,a.config))return;r.default.w(this.TAG,"OpusSequenceHeader has been changed, re-generate initialization segment")}a.audioSampleRate=l.samplingFrequence,a.channelCount=l.channelCount,a.codec=l.codec,a.originalCodec=l.originalCodec,a.config=l.config,a.refSampleDuration=20,r.default.v(this.TAG,"Parsed OpusSequenceHeader"),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 _=this._mediaInfo;_.audioCodec=a.originalCodec,_.audioSampleRate=a.audioSampleRate,_.audioChannelCount=a.channelCount,_.hasVideo?null!=_.videoCodec&&(_.mimeType='video/x-flv; codecs="'+_.videoCodec+","+_.audioCodec+'"'):_.mimeType='video/x-flv; codecs="'+_.audioCodec+'"',_.isComplete()&&this._onMediaInfo(_)}},e.prototype._parseOpusAudioData=function(e,t,i,a){var n=this._audioTrack,r=new Uint8Array(e,t,i),o=this._timestampBase+a,s={unit:r,length:r.byteLength,dts:o,pts:o};n.samples.push(s),n.length+=r.length},e.prototype._parseFlacAudioPacket=function(e,t,i,a,n){if(0===n)this._parseFlacSequenceHeader(e,t,i);else if(1===n)this._parseFlacAudioData(e,t,i,a);else if(2!==n)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid Flac audio packet type ".concat(n))},e.prototype._parseFlacSequenceHeader=function(e,t,i){var a=this._audioMetadata,n=this._audioTrack;a||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(a=this._audioMetadata={}).type="audio",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration);var o=new Uint8Array(e,t+4,i-4),s=new f(o),d=s.readBits(16),l=s.readBits(16),_=l===d?l:null;s.readBits(24),s.readBits(24);var u=s.readBits(20),c=s.readBits(3)+1,h=s.readBits(5)+1;s.destroy();var p=new Uint8Array(o.byteLength+4);p.set(o,4),p[0]=128,p[1]=o.byteLength>>>16&255,p[2]=o.byteLength>>>8&255,p[3]=o.byteLength>>>0&255;var m={config:p,channelCount:c,samplingFrequence:u,sampleSize:h,codec:"flac",originalCodec:"flac"};if(a.config){if(E(m.config,a.config))return;r.default.w(this.TAG,"FlacSequenceHeader has been changed, re-generate initialization segment")}a.audioSampleRate=m.samplingFrequence,a.channelCount=m.channelCount,a.sampleSize=m.sampleSize,a.codec=m.codec,a.originalCodec=m.originalCodec,a.config=m.config,a.refSampleDuration=null!=_?1e3*_/m.samplingFrequence:null,r.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 g=this._mediaInfo;g.audioCodec=a.originalCodec,g.audioSampleRate=a.audioSampleRate,g.audioChannelCount=a.channelCount,g.hasVideo?null!=g.videoCodec&&(g.mimeType='video/x-flv; codecs="'+g.videoCodec+","+g.audioCodec+'"'):g.mimeType='video/x-flv; codecs="'+g.audioCodec+'"',g.isComplete()&&this._onMediaInfo(g)},e.prototype._parseFlacAudioData=function(e,t,i,a){var n=this._audioTrack,r=new Uint8Array(e,t,i),o=this._timestampBase+a,s={unit:r,length:r.byteLength,dts:o,pts:o};n.samples.push(s),n.length+=r.length},e.prototype._parseVideoData=function(e,t,i,a,n){if(i<=1)r.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,i)[0],s=(112&o)>>>4;if(128&o){var d=15&o,l=String.fromCharCode.apply(String,new Uint8Array(e,t,i).slice(1,5));if("hvc1"===l)this._parseEnhancedHEVCVideoPacket(e,t+5,i-5,a,n,s,d);else{if("av01"!==l)return void this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(l));this._parseEnhancedAV1VideoPacket(e,t+5,i-5,a,n,s,d)}}else{var _=15&o;if(7===_)this._parseAVCVideoPacket(e,t+1,i-1,a,n,s);else{if(12!==_)return void this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(_));this._parseHEVCVideoPacket(e,t+1,i-1,a,n,s)}}}},e.prototype._parseAVCVideoPacket=function(e,t,i,a,n,o){if(i<4)r.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var s=this._littleEndian,d=new DataView(e,t,i),l=d.getUint8(0),_=(16777215&d.getUint32(0,!s))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseAVCVideoData(e,t+4,i-4,a,n,o,_);else if(2!==l)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}},e.prototype._parseHEVCVideoPacket=function(e,t,i,a,n,o){if(i<4)r.default.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var s=this._littleEndian,d=new DataView(e,t,i),l=d.getUint8(0),_=(16777215&d.getUint32(0,!s))<<8>>8;if(0===l)this._parseHEVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseHEVCVideoData(e,t+4,i-4,a,n,o,_);else if(2!==l)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}},e.prototype._parseEnhancedHEVCVideoPacket=function(e,t,i,a,n,r,o){var s=this._littleEndian,d=new DataView(e,t,i);if(0===o)this._parseHEVCDecoderConfigurationRecord(e,t,i);else if(1===o){var l=(4294967040&d.getUint32(0,!s))>>8;this._parseHEVCVideoData(e,t+3,i-3,a,n,r,l)}else if(3===o)this._parseHEVCVideoData(e,t,i,a,n,r,0);else if(2!==o)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(o))},e.prototype._parseEnhancedAV1VideoPacket=function(e,t,i,a,n,r,o){if(this._littleEndian,new DataView(e,t,i),0===o)this._parseAV1CodecConfigurationRecord(e,t,i);else if(1===o)this._parseAV1VideoData(e,t,i,a,n,r,0);else{if(5===o)return void this._onError(m.default.FORMAT_ERROR,"Flv: Not Supported MP2T AV1 video packet type ".concat(o));if(2!==o)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(o))}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)r.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var a=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,i);if(a){if(void 0!==a.avcc){var d=new Uint8Array(e,t,i);if(E(d,a.avcc))return;r.default.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(a=this._videoMetadata={}).type="video",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration;var l=s.getUint8(0),_=s.getUint8(1);if(s.getUint8(2),s.getUint8(3),1===l&&0!==_)if(this._naluLengthSize=1+(3&s.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var u=31&s.getUint8(5);if(0!==u){u>1&&r.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(u));for(var c=6,h=0;h<u;h++){var f=s.getUint16(c,!o);if(c+=2,0!==f){var g=new Uint8Array(e,t+c,f);c+=f;var v=p.parseSPS(g);if(0===h){a.codecWidth=v.codec_size.width,a.codecHeight=v.codec_size.height,a.presentWidth=v.present_size.width,a.presentHeight=v.present_size.height,a.profile=v.profile_string,a.level=v.level_string,a.bitDepth=v.bit_depth,a.chromaFormat=v.chroma_format,a.sarRatio=v.sar_ratio,a.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(a.frameRate=this._referenceFrameRate);var y=a.frameRate.fps_den,S=a.frameRate.fps_num;a.refSampleDuration=a.timescale*(y/S);for(var A=g.subarray(1,4),b="avc1.",R=0;R<3;R++){var T=A[R].toString(16);T.length<2&&(T="0"+T),b+=T}a.codec=b;var L=this._mediaInfo;L.width=a.codecWidth,L.height=a.codecHeight,L.fps=a.frameRate.fps,L.profile=a.profile,L.level=a.level,L.refFrames=v.ref_frames,L.chromaFormat=v.chroma_format_string,L.sarNum=a.sarRatio.width,L.sarDen=a.sarRatio.height,L.videoCodec=b,L.hasAudio?null!=L.audioCodec&&(L.mimeType='video/x-flv; codecs="'+L.videoCodec+","+L.audioCodec+'"'):L.mimeType='video/x-flv; codecs="'+L.videoCodec+'"',L.isComplete()&&this._onMediaInfo(L)}}}var k=s.getUint8(c);if(0!==k){for(k>1&&r.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(k)),c++,h=0;h<k;h++)f=s.getUint16(c,!o),c+=2,0!==f&&(c+=f);a.avcc=new Uint8Array(i),a.avcc.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",a)}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(m.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseHEVCDecoderConfigurationRecord=function(e,t,i){if(i<22)r.default.w(this.TAG,"Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!");else{var a=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,i);if(a){if(void 0!==a.hvcc){var d=new Uint8Array(e,t,i);if(E(d,a.hvcc))return;r.default.w(this.TAG,"HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(a=this._videoMetadata={}).type="video",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration;var l=s.getUint8(0),_=31&s.getUint8(1);if(0!==l&&1!==l||0===_)this._onError(m.default.FORMAT_ERROR,"Flv: Invalid HEVCDecoderConfigurationRecord");else if(this._naluLengthSize=1+(3&s.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var u=s.getUint8(22),c=0,h=23;c<u;c++){var f=63&s.getUint8(h+0),p=s.getUint16(h+1,!o);h+=3;for(var v=0;v<p;v++){var y=s.getUint16(h+0,!o);if(0===v)if(33===f){h+=2;var S=new Uint8Array(e,t+h,y),A=g.parseSPS(S);a.codecWidth=A.codec_size.width,a.codecHeight=A.codec_size.height,a.presentWidth=A.present_size.width,a.presentHeight=A.present_size.height,a.profile=A.profile_string,a.level=A.level_string,a.bitDepth=A.bit_depth,a.chromaFormat=A.chroma_format,a.sarRatio=A.sar_ratio,a.frameRate=A.frame_rate,!1!==A.frame_rate.fixed&&0!==A.frame_rate.fps_num&&0!==A.frame_rate.fps_den||(a.frameRate=this._referenceFrameRate);var b=a.frameRate.fps_den,R=a.frameRate.fps_num;a.refSampleDuration=a.timescale*(b/R),a.codec=A.codec_mimetype;var T=this._mediaInfo;T.width=a.codecWidth,T.height=a.codecHeight,T.fps=a.frameRate.fps,T.profile=a.profile,T.level=a.level,T.refFrames=A.ref_frames,T.chromaFormat=A.chroma_format_string,T.sarNum=a.sarRatio.width,T.sarDen=a.sarRatio.height,T.videoCodec=A.codec_mimetype,T.hasAudio?null!=T.audioCodec&&(T.mimeType='video/x-flv; codecs="'+T.videoCodec+","+T.audioCodec+'"'):T.mimeType='video/x-flv; codecs="'+T.videoCodec+'"',T.isComplete()&&this._onMediaInfo(T),h+=y}else h+=2+y;else h+=2+y}}a.hvcc=new Uint8Array(i),a.hvcc.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Parsed HEVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",a)}else this._onError(m.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1))}},e.prototype._parseAV1CodecConfigurationRecord=function(e,t,i){if(i<4)r.default.w(this.TAG,"Flv: Invalid AV1CodecConfigurationRecord, lack of data!");else{var a=this._videoMetadata,n=this._videoTrack,o=(this._littleEndian,new DataView(e,t,i));a?void 0!==a.av1c&&r.default.w(this.TAG,"Found another AV1CodecConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(a=this._videoMetadata={}).type="video",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration);var s=127&o.getUint8(0);if(o.getUint8(1),o.getUint8(1),o.getUint8(2),1===s){var d=b.parseOBUs(new Uint8Array(e,t+4,i-4));if(null!=d){a.profile=d.profile_string,a.level=d.level_string,a.bitDepth=d.bit_depth,a.chromaFormat=d.chroma_format,a.frameRate=d.frame_rate,!1!==d.frame_rate.fixed&&0!==d.frame_rate.fps_num&&0!==d.frame_rate.fps_den||(a.frameRate=this._referenceFrameRate);var l=a.frameRate.fps_den,_=a.frameRate.fps_num;a.refSampleDuration=a.timescale*(l/_),a.codec=d.codec_mimetype,a.extra=d;var u=this._mediaInfo;u.fps=a.frameRate.fps,u.profile=a.profile,u.level=a.level,u.refFrames=d.ref_frames,u.chromaFormat=d.chroma_format_string,u.videoCodec=d.codec_mimetype,u.hasAudio?null!=u.audioCodec&&(u.mimeType='video/x-flv; codecs="'+u.videoCodec+","+u.audioCodec+'"'):u.mimeType='video/x-flv; codecs="'+u.videoCodec+'"',u.isComplete()&&this._onMediaInfo(u),a.av1c=new Uint8Array(i),a.av1c.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Preparing AV1CodecConfigurationRecord")}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,a,n,o,s){for(var d=this._littleEndian,l=new DataView(e,t,i),_=[],u=0,c=0,h=this._naluLengthSize,f=this._timestampBase+a,p=1===o;c<i;){if(c+4>=i){r.default.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(c,", dataSize = ").concat(i));break}var m=l.getUint32(c,!d);if(3===h&&(m>>>=8),m>i-h)return void r.default.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var g=31&l.getUint8(c+h);5===g&&(p=!0);var v=new Uint8Array(e,t+c,h+m),y={type:g,data:v};_.push(y),u+=v.byteLength,6===g&&this._parseSEIPayload(v.subarray(h),f+s,"h264"),c+=h+m}if(_.length){var S=this._videoTrack,E={units:_,length:u,isKeyframe:p,dts:f,cts:s,pts:f+s};p&&(E.fileposition=n),S.samples.push(E),S.length+=u}},e.prototype._parseHEVCVideoData=function(e,t,i,a,n,o,s){for(var d=this._littleEndian,l=new DataView(e,t,i),_=[],u=0,c=0,h=this._naluLengthSize,f=this._timestampBase+a,p=1===o;c<i;){if(c+4>=i){r.default.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(c,", dataSize = ").concat(i));break}var m=l.getUint32(c,!d);if(3===h&&(m>>>=8),m>i-h)return void r.default.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var g=l.getUint8(c+h)>>1&63;19!==g&&20!==g&&21!==g||(p=!0);var v=new Uint8Array(e,t+c,h+m),y={type:g,data:v};_.push(y),u+=v.byteLength,39!==g&&40!==g||this._parseSEIPayload(v.subarray(h),f+s,"h265"),c+=h+m}if(_.length){var S=this._videoTrack,E={units:_,length:u,isKeyframe:p,dts:f,cts:s,pts:f+s};p&&(E.fileposition=n),S.samples.push(E),S.length+=u}},e.prototype._parseAV1VideoData=function(e,t,i,a,n,o,s){this._littleEndian,new DataView(e,t,i);var d,l=[],_=this._timestampBase+a,u=1===o;if(u){var c=this._videoMetadata,h=b.parseOBUs(new Uint8Array(e,t,i),c.extra);if(null==h)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1 VideoData");console.log(h),c.codecWidth=h.codec_size.width,c.codecHeight=h.codec_size.height,c.presentWidth=h.present_size.width,c.presentHeight=h.present_size.height,c.sarRatio=h.sar_ratio;var f=this._mediaInfo;f.width=c.codecWidth,f.height=c.codecHeight,f.sarNum=c.sarRatio.width,f.sarDen=c.sarRatio.height,r.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",c)}if(d=i,l.push({unitType:0,data:new Uint8Array(e,t+0,i)}),l.length){var p=this._videoTrack,g={units:l,length:d,isKeyframe:u,dts:_,cts:s,pts:_+s};u&&(g.fileposition=n),p.samples.push(g),p.length+=d}},e}(),D=k,M=function(){function e(){}return e.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},e}(),C=function(){this.program_pmt_pid={}};!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kLOASAAC=17]="kLOASAAC",e[e.kAC3=129]="kAC3",e[e.kEAC3=135]="kEAC3",e[e.kMetadata=21]="kMetadata",e[e.kSCTE35=134]="kSCTE35",e[e.kPGS=144]="kPGS",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(L||(L={}));var w,I=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={}},B=function(){},O=function(){},P=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(w||(w={}));var x,U,N=function(){},V=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},G=function(){function e(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not find H264 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var a=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===a||1===n)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,a=31&e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3],n=(128&e[i])>>>7,r=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=r,!(a>=w.kReserved0)&&0===n){var o=e.subarray(i,r);(t=new N).type=a,t.data=o}}return t},e}(),F=function(){function e(e,t,i){var a=8+e.byteLength+1+2+t.byteLength,n=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(n=!0,a+=4);var r=this.data=new Uint8Array(a);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var o=e.byteLength;r[6]=o>>>8,r[7]=255&o;var s=8;r.set(e,8),r[s+=o]=1;var d=t.byteLength;r[s+1]=d>>>8,r[s+2]=255&d,r.set(t,s+3),s+=3+d,n&&(r[s]=252|i.chroma_format_idc,r[s+1]=248|i.bit_depth_luma-8,r[s+2]=248|i.bit_depth_chroma-8,r[s+3]=0,s+=4)}return e.prototype.getData=function(){return this.data},e}();!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(x||(x={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(U||(U={}));var j,z,H=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],q=(j=function(e,t){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},j(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}j(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),K=function(){},W=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return q(t,e),t}(K),Y=function(){function e(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found ADTS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=(8&e[i+1])>>>3,n=(6&e[i+1])>>>1,r=1&e[i+1],o=(192&e[i+2])>>>6,s=(60&e[i+2])>>>2,d=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var _=1===r?7:9,u=l-_;i+=_;var c=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=c,(0===a||1===a)&&0===n){var h=e.subarray(i,i+u);(t=new K).audio_object_type=o+1,t.sampling_freq_index=s,t.sampling_frequency=H[s],t.channel_config=d,t.data=h}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),X=function(){function e(e){this.TAG="AACLOASParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found LOAS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695==(i[t+0]<<3|i[t+1]>>>5))return t;t++}},e.prototype.getLATMValue=function(e){for(var t=e.readBits(2),i=0,a=0;a<=t;a++)i<<=8,i|=e.readByte();return i},e.prototype.readNextAACFrame=function(e){for(var t=this.data_,i=null;null==i&&!this.eof_flag_;){var a=this.current_syncword_offset_,n=(31&t[a+1])<<8|t[a+2];if(a+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var o=new f(t.subarray(a+3,a+3+n)),s=null;if(o.readBool()){if(null==e){r.default.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(a+3+n),o.destroy();continue}s=e}else{var d=o.readBool();if(d&&o.readBool()){r.default.e(this.TAG,"audioMuxVersionA is Not Supported"),o.destroy();break}if(d&&this.getLATMValue(o),!o.readBool()){r.default.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){r.default.e(this.TAG,"more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){r.default.e(this.TAG,"more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){r.default.e(this.TAG,"more than 2 numLayer Not Supported"),o.destroy();break}var l=d?this.getLATMValue(o):0,_=o.readBits(5);l-=5;var u=o.readBits(4);l-=4;var c=o.readBits(4);l-=4,o.readBits(3),(l-=3)>0&&o.readBits(l);var h=o.readBits(3);if(0!==h){r.default.e(this.TAG,"frameLengthType = ".concat(h,". Only frameLengthType = 0 Supported")),o.destroy();break}o.readByte();var p=o.readBool();if(p)if(d)this.getLATMValue(o);else{for(var m=0;;){m<<=8;var g=o.readBool();if(m+=o.readByte(),!g)break}console.log(m)}o.readBool()&&o.readByte(),(s=new W).audio_object_type=_,s.sampling_freq_index=u,s.sampling_frequency=H[s.sampling_freq_index],s.channel_config=c,s.other_data_present=p}for(var v=0;;){var y=o.readByte();if(v+=y,255!==y)break}for(var S=new Uint8Array(v),E=0;E<v;E++)S[E]=o.readByte();(i=new W).audio_object_type=s.audio_object_type,i.sampling_freq_index=s.sampling_freq_index,i.sampling_frequency=H[s.sampling_freq_index],i.channel_config=s.channel_config,i.other_data_present=s.other_data_present,i.data=S,this.current_syncword_offset_=this.findNextSyncwordOffset(a+3+n)}return i},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Q=function(e){var t=null,i=e.audio_object_type,a=e.audio_object_type,n=e.sampling_freq_index,r=e.channel_config,o=0,s=navigator.userAgent.toLowerCase();-1!==s.indexOf("firefox")?n>=6?(a=5,t=new Array(4),o=n-3):(a=2,t=new Array(2),o=n):-1!==s.indexOf("android")?(a=2,t=new Array(2),o=n):(a=5,o=n,t=new Array(4),n>=6?o=n-3:1===r&&(a=2,t=new Array(2),o=n)),t[0]=a<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&r)<<3,5===a&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=H[n],this.channel_count=r,this.codec_mimetype="mp4a.40."+a,this.original_codec_mimetype="mp4a.40."+i},J=function(){},Z=function(){};!function(e){e[e.kSpliceNull=0]="kSpliceNull",e[e.kSpliceSchedule=4]="kSpliceSchedule",e[e.kSpliceInsert=5]="kSpliceInsert",e[e.kTimeSignal=6]="kTimeSignal",e[e.kBandwidthReservation=7]="kBandwidthReservation",e[e.kPrivateCommand=255]="kPrivateCommand"}(z||(z={}));var $,ee=function(e){var t=e.readBool();return t?(e.readBits(6),{time_specified_flag:t,pts_time:4*e.readBits(31)+e.readBits(2)}):(e.readBits(7),{time_specified_flag:t})},te=function(e){var t=e.readBool();return e.readBits(6),{auto_return:t,duration:4*e.readBits(31)+e.readBits(2)}},ie=function(e,t){var i=t.readBits(8);return e?{component_tag:i}:{component_tag:i,splice_time:ee(t)}},ae=function(e){return{component_tag:e.readBits(8),utc_splice_time:e.readBits(32)}},ne=function(e){var t=e.readBits(32),i=e.readBool();e.readBits(7);var a={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return a;if(a.out_of_network_indicator=e.readBool(),a.program_splice_flag=e.readBool(),a.duration_flag=e.readBool(),e.readBits(5),a.program_splice_flag)a.utc_splice_time=e.readBits(32);else{a.component_count=e.readBits(8),a.components=[];for(var n=0;n<a.component_count;n++)a.components.push(ae(e))}return a.duration_flag&&(a.break_duration=te(e)),a.unique_program_id=e.readBits(16),a.avail_num=e.readBits(8),a.avails_expected=e.readBits(8),a},re=function(e,t,i,a){return{descriptor_tag:e,descriptor_length:t,identifier:i,provider_avail_id:a.readBits(32)}},oe=function(e,t,i,a){var n=a.readBits(8),r=a.readBits(3);a.readBits(5);for(var o="",s=0;s<r;s++)o+=String.fromCharCode(a.readBits(8));return{descriptor_tag:e,descriptor_length:t,identifier:i,preroll:n,dtmf_count:r,DTMF_char:o}},se=function(e){var t=e.readBits(8);return e.readBits(7),{component_tag:t,pts_offset:4*e.readBits(31)+e.readBits(2)}},de=function(e,t,i,a){var n=a.readBits(32),r=a.readBool();a.readBits(7);var o={descriptor_tag:e,descriptor_length:t,identifier:i,segmentation_event_id:n,segmentation_event_cancel_indicator:r};if(r)return o;if(o.program_segmentation_flag=a.readBool(),o.segmentation_duration_flag=a.readBool(),o.delivery_not_restricted_flag=a.readBool(),o.delivery_not_restricted_flag?a.readBits(5):(o.web_delivery_allowed_flag=a.readBool(),o.no_regional_blackout_flag=a.readBool(),o.archive_allowed_flag=a.readBool(),o.device_restrictions=a.readBits(2)),!o.program_segmentation_flag){o.component_count=a.readBits(8),o.components=[];for(var s=0;s<o.component_count;s++)o.components.push(se(a))}o.segmentation_duration_flag&&(o.segmentation_duration=a.readBits(40)),o.segmentation_upid_type=a.readBits(8),o.segmentation_upid_length=a.readBits(8);var d=new Uint8Array(o.segmentation_upid_length);for(s=0;s<o.segmentation_upid_length;s++)d[s]=a.readBits(8);return o.segmentation_upid=d.buffer,o.segmentation_type_id=a.readBits(8),o.segment_num=a.readBits(8),o.segments_expected=a.readBits(8),52!==o.segmentation_type_id&&54!==o.segmentation_type_id&&56!==o.segmentation_type_id&&58!==o.segmentation_type_id||(o.sub_segment_num=a.readBits(8),o.sub_segments_expected=a.readBits(8)),o},le=function(e,t,i,a){return{descriptor_tag:e,descriptor_length:t,identifier:i,TAI_seconds:a.readBits(48),TAI_ns:a.readBits(32),UTC_offset:a.readBits(16)}},_e=function(e){return{component_tag:e.readBits(8),ISO_code:String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8)),Bit_Stream_Mode:e.readBits(3),Num_Channels:e.readBits(4),Full_Srvc_Audio:e.readBool()}},ue=function(e,t,i,a){for(var n=a.readBits(4),r=[],o=0;o<n;o++)r.push(_e(a));return{descriptor_tag:e,descriptor_length:t,identifier:i,audio_count:n,components:r}};!function(e){e[e.kSliceIDR_W_RADL=19]="kSliceIDR_W_RADL",e[e.kSliceIDR_N_LP=20]="kSliceIDR_N_LP",e[e.kSliceCRA_NUT=21]="kSliceCRA_NUT",e[e.kSliceVPS=32]="kSliceVPS",e[e.kSliceSPS=33]="kSliceSPS",e[e.kSlicePPS=34]="kSlicePPS",e[e.kSliceAUD=35]="kSliceAUD",e[e.kSliceSEI=39]="kSliceSEI",e[e.kSliceSEISuffix=40]="kSliceSEISuffix"}($||($={}));var ce=function(){},he=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},fe=function(){function e(e){this.TAG="H265AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not find H265 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var a=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===a||1===n)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,a=e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3]>>1&63,n=(128&e[i])>>>7,r=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=r,0===n){var o=e.subarray(i,r);(t=new ce).type=a,t.data=o}}return t},e}(),pe=function(){function e(e,t,i,a){var n=23+(5+e.byteLength)+(5+t.byteLength)+(5+i.byteLength),r=this.data=new Uint8Array(n);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|$.kSliceVPS,r[24]=0,r[25]=1,r[26]=(65280&e.byteLength)>>8,r[27]=255&e.byteLength,r.set(e,28),r[23+(5+e.byteLength)+0]=128|$.kSliceSPS,r[23+(5+e.byteLength)+1]=0,r[23+(5+e.byteLength)+2]=1,r[23+(5+e.byteLength)+3]=(65280&t.byteLength)>>8,r[23+(5+e.byteLength)+4]=255&t.byteLength,r.set(t,23+(5+e.byteLength)+5),r[23+(5+e.byteLength+5+t.byteLength)+0]=128|$.kSlicePPS,r[23+(5+e.byteLength+5+t.byteLength)+1]=0,r[23+(5+e.byteLength+5+t.byteLength)+2]=1,r[23+(5+e.byteLength+5+t.byteLength)+3]=(65280&i.byteLength)>>8,r[23+(5+e.byteLength+5+t.byteLength)+4]=255&i.byteLength,r.set(i,23+(5+e.byteLength+5+t.byteLength)+5)}return e.prototype.getData=function(){return this.data},e}(),me=function(){},ge=function(){},ve=function(){},ye=[[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]],Se=function(){function e(e){this.TAG="AC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found AC3 syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]))return t;t++}},e.prototype.readNextAC3Frame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=e[i+4]>>6,n=[48e3,44200,33e3][a],r=63&e[i+4],o=2*ye[a][r];if(isNaN(o)||i+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var s=this.findNextSyncwordOffset(i+o);this.current_syncword_offset_=s;var d=e[i+5]>>3,l=7&e[i+5],_=e[i+6]>>5,u=0;1&_&&1!==_&&(u+=2),4&_&&(u+=2),2===_&&(u+=2);var c=(e[i+6]<<8|e[i+7])>>12-u&1,h=[2,1,2,3,3,4,4,5][_]+c;(t=new ve).sampling_frequency=n,t.channel_count=h,t.channel_mode=_,t.bit_stream_identification=d,t.low_frequency_effects_channel_on=c,t.bit_stream_mode=l,t.frame_size_code=r,t.data=e.subarray(i,i+o)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Ee=function(e){var t;t=[e.sampling_rate_code<<6|e.bit_stream_identification<<1|e.bit_stream_mode>>2,(3&e.bit_stream_mode)<<6|e.channel_mode<<3|e.low_frequency_effects_channel_on<<2|e.frame_size_code>>4,e.frame_size_code<<4&224],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.bit_stream_mode=e.bit_stream_mode,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"},Ae=function(){},be=function(){function e(e){this.TAG="EAC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found AC3 syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]))return t;t++}},e.prototype.readNextEAC3Frame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=new f(e.subarray(i+2)),n=(a.readBits(2),a.readBits(3),a.readBits(11)+1<<1),r=a.readBits(2),o=null,s=null;3===r?(o=[24e3,22060,16e3][r=a.readBits(2)],s=3):(o=[48e3,44100,32e3][r],s=a.readBits(2));var d=a.readBits(3),l=a.readBits(1),_=a.readBits(5);if(i+n>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var u=this.findNextSyncwordOffset(i+n);this.current_syncword_offset_=u;var c=[2,1,2,3,3,4,4,5][d]+l;a.destroy(),(t=new Ae).sampling_frequency=o,t.channel_count=c,t.channel_mode=d,t.bit_stream_identification=_,t.low_frequency_effects_channel_on=l,t.frame_size=n,t.num_blks=[1,2,3,6][s],t.data=e.subarray(i,i+n)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Re=function(e){var t,i=Math.floor(e.frame_size*e.sampling_frequency/(16*e.num_blks));t=[255&i,248&i,e.sampling_rate_code<<6|e.bit_stream_identification<<1,e.channel_mode<<1|e.low_frequency_effects_channel_on,0],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.num_blks=e.num_blks,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"},Te=function(){},Le=function(){function e(e){this.TAG="AV1OBUInMpegTsParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not find AV1 startcode until payload end!")}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)},e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+2>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(1==(i[t+0]<<16|i[t+1]<<8|i[t+2]))return t;t++}},e.prototype.readNextOBUPayload=function(){for(var t=this.data_,i=null;null==i&&!this.eof_flag_;){var a=this.current_startcode_offset_+3,n=this.findNextStartCodeOffset(a);this.current_startcode_offset_=n,i=e._ebsp2rbsp(t.subarray(a,n))}return i},e}(),ke=function(){},De=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Me=function(){return Me=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Me.apply(this,arguments)},Ce=function(e){function t(t,i){var a=e.call(this)||this;return a.TAG="TSDemuxer",a.audio_disabled_=!1,a.first_parse_=!0,a.media_info_=new s.default,a.timescale_=90,a.duration_=0,a.current_pmt_pid_=-1,a.program_pmt_map_={},a.pes_slice_queues_={},a.section_slice_queues_={},a.video_metadata_={vps:void 0,sps:void 0,pps:void 0,av1c:void 0,details:void 0},a.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},a.last_pcr_base_=NaN,a.timestamp_offset_=0,a.audio_last_sample_pts_=void 0,a.aac_last_incomplete_data_=null,a.has_video_=!1,a.has_audio_=!1,a.video_init_segment_dispatched_=!1,a.audio_init_segment_dispatched_=!1,a.video_metadata_changed_=!1,a.audio_metadata_changed_=!1,a.loas_previous_frame=null,a.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},a.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},a.ts_packet_size_=t.ts_packet_size,a.sync_offset_=t.sync_offset,a.config_=i,a.audio_disabled_=Boolean(null==i?void 0:i.disableAudio),a}return De(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),i=-1,a=188;if(t.byteLength<=3*a)return{needMoreData:!0};for(;-1===i;){for(var n=Math.min(1e3,t.byteLength-3*a),o=0;o<n;){if(71===t[o]&&71===t[o+a]&&71===t[o+2*a]){i=o;break}o++}if(-1===i)if(188===a)a=192;else{if(192!==a)break;a=204}}return-1===i?{match:!1}:(192===a&&i>=4?(r.default.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===a&&r.default.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:a,sync_offset:i})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new s.default},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new u.IllegalStateException("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0;for(this.first_parse_&&(this.first_parse_=!1,i=this.sync_offset_);i+this.ts_packet_size_<=e.byteLength;){var a=t+i;192===this.ts_packet_size_&&(i+=4);var n=new Uint8Array(e,i,188),o=n[0];if(71!==o){r.default.e(this.TAG,"sync_byte = ".concat(o,", not 0x47"));break}var s=(64&n[1])>>>6,d=(n[1],(31&n[1])<<8|n[2]),l=(48&n[3])>>>4,_=15&n[3],c=!(!this.pmt_||this.pmt_.pcr_pid!==d),h={},f=4;if(2==l||3==l){var p=n[4];if(p>0&&(c||3==l)&&(h.discontinuity_indicator=(128&n[5])>>>7,h.random_access_indicator=(64&n[5])>>>6,h.elementary_stream_priority_indicator=(32&n[5])>>>5,(16&n[5])>>>4)){var m=300*this.getPcrBase(n)+((1&n[10])<<8|n[11]);this.last_pcr_=m}if(2==l||5+p===188){i+=188,204===this.ts_packet_size_&&(i+=16);continue}f=5+p}if(1==l||3==l)if(0===d||d===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[d]===L.kSCTE35){var g=188-f;this.handleSectionSlice(e,i+f,g,{pid:d,file_position:a,payload_unit_start_indicator:s,continuity_conunter:_,random_access_indicator:h.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[d]){g=188-f;var v=this.pmt_.pid_stream_type[d];d!==this.pmt_.common_pids.h264&&d!==this.pmt_.common_pids.h265&&d!==this.pmt_.common_pids.av1&&d!==this.pmt_.common_pids.adts_aac&&d!==this.pmt_.common_pids.loas_aac&&d!==this.pmt_.common_pids.ac3&&d!==this.pmt_.common_pids.eac3&&d!==this.pmt_.common_pids.opus&&d!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[d]&&!0!==this.pmt_.timed_id3_pids[d]&&!0!==this.pmt_.pgs_pids[d]&&!0!==this.pmt_.synchronous_klv_pids[d]&&!0!==this.pmt_.asynchronous_klv_pids[d]||this.handlePESSlice(e,i+f,g,{pid:d,stream_type:v,file_position:a,payload_unit_start_indicator:s,continuity_conunter:_,random_access_indicator:h.random_access_indicator})}i+=188,204===this.ts_packet_size_&&(i+=16)}return this.dispatchAudioVideoMediaSegment(),i},t.prototype.handleSectionSlice=function(e,t,i,a){var n=new Uint8Array(e,t,i),r=this.section_slice_queues_[a.pid];if(a.payload_unit_start_indicator){var o=n[0];if(null!=r&&0!==r.total_length){var s=new Uint8Array(e,t+1,Math.min(i,o));r.slices.push(s),r.total_length+=s.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,a):this.clearSlices(r,a)}for(var d=1+o;d<n.byteLength&&255!==n[d+0];){var l=(15&n[d+1])<<8|n[d+2];this.section_slice_queues_[a.pid]=new P,(r=this.section_slice_queues_[a.pid]).expected_length=l+3,r.file_position=a.file_position,r.random_access_indicator=a.random_access_indicator,s=new Uint8Array(e,t+d,Math.min(i-d,r.expected_length-r.total_length)),r.slices.push(s),r.total_length+=s.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,a):r.total_length>=r.expected_length&&this.clearSlices(r,a),d+=s.byteLength}}else null!=r&&0!==r.total_length&&(s=new Uint8Array(e,t,Math.min(i,r.expected_length-r.total_length)),r.slices.push(s),r.total_length+=s.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,a):r.total_length>=r.expected_length&&this.clearSlices(r,a))},t.prototype.handlePESSlice=function(e,t,i,a){var n=new Uint8Array(e,t,i),o=n[0]<<16|n[1]<<8|n[2],s=(n[3],n[4]<<8|n[5]);if(a.payload_unit_start_indicator){if(1!==o)return void r.default.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value ".concat(o));var d=this.pes_slice_queues_[a.pid];d&&(0===d.expected_length||d.expected_length===d.total_length?this.emitPESSlices(d,a):this.clearSlices(d,a)),this.pes_slice_queues_[a.pid]=new P,this.pes_slice_queues_[a.pid].file_position=a.file_position,this.pes_slice_queues_[a.pid].random_access_indicator=a.random_access_indicator}if(null!=this.pes_slice_queues_[a.pid]){var l=this.pes_slice_queues_[a.pid];l.slices.push(n),a.payload_unit_start_indicator&&(l.expected_length=0===s?0:s+6),l.total_length+=n.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,a):l.expected_length>0&&l.expected_length<l.total_length&&this.clearSlices(l,a)}},t.prototype.emitSectionSlices=function(e,t){for(var i=new Uint8Array(e.total_length),a=0,n=0;a<e.slices.length;a++){var r=e.slices[a];i.set(r,n),n+=r.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new O;o.pid=t.pid,o.data=i,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parseSection(o)},t.prototype.emitPESSlices=function(e,t){for(var i=new Uint8Array(e.total_length),a=0,n=0;a<e.slices.length;a++){var r=e.slices[a];i.set(r,n),n+=r.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new B;o.pid=t.pid,o.data=i,o.stream_type=t.stream_type,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parsePES(o)},t.prototype.clearSlices=function(e,t){e.slices=[],e.expected_length=-1,e.total_length=0},t.prototype.parseSection=function(e){var t=e.data,i=e.pid;0===i?this.parsePAT(t):i===this.current_pmt_pid_?this.parsePMT(t):null!=this.pmt_&&this.pmt_.scte_35_pids[i]&&this.parseSCTE35(t)},t.prototype.parsePES=function(e){var t=e.data,i=t[0]<<16|t[1]<<8|t[2],a=t[3],n=t[4]<<8|t[5];if(1===i)if(188!==a&&190!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a){t[6];var o=(192&t[7])>>>6,s=t[8],d=void 0,l=void 0;2!==o&&3!==o||(d=this.getTimestamp(t,9),l=3===o?this.getTimestamp(t,14):d);var _=9+s,u=void 0;if(0!==n){if(n<3+s)return void r.default.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");u=n-3-s}else u=t.byteLength-_;var c=t.subarray(_,_+u);switch(e.stream_type){case L.kMPEG1Audio:case L.kMPEG2Audio:this.parseMP3Payload(c,d);break;case L.kPESPrivateData:this.pmt_.common_pids.av1===e.pid?this.parseAV1Payload(c,d,l,e.file_position,e.random_access_indicator):this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(c,d):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(c,d):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(c,d):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(c,e.pid,a):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(c,d,l,e.pid,a):this.parsePESPrivateDataPayload(c,d,l,e.pid,a);break;case L.kADTSAAC:this.parseADTSAACPayload(c,d);break;case L.kLOASAAC:this.parseLOASAACPayload(c,d);break;case L.kAC3:this.parseAC3Payload(c,d);break;case L.kEAC3:this.parseEAC3Payload(c,d);break;case L.kMetadata:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(c,d,l,e.pid,a):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(c,d,l,e.pid,a);break;case L.kPGS:this.parsePGSPayload(c,d,l,e.pid,a,this.pmt_.pgs_langs[e.pid]);break;case L.kH264:this.parseH264Payload(c,d,l,e.file_position,e.random_access_indicator);break;case L.kH265:this.parseH265Payload(c,d,l,e.file_position,e.random_access_indicator)}}else 188!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a||e.stream_type!==L.kPESPrivateData||(_=6,u=void 0,u=0!==n?n:t.byteLength-_,c=t.subarray(_,_+u),this.parsePESPrivateDataPayload(c,void 0,void 0,e.pid,a));else r.default.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value ".concat(i))},t.prototype.parsePAT=function(e){var t=e[0];if(0===t){var i=(15&e[1])<<8|e[2],a=(e[3],e[4],(62&e[5])>>>1),n=1&e[5],o=e[6],s=(e[7],null);if(1===n&&0===o)(s=new C).version_number=a;else if(null==(s=this.pat_))return;for(var d=i-5-4,l=-1,_=-1,u=8;u<8+d;u+=4){var c=e[u]<<8|e[u+1],h=(31&e[u+2])<<8|e[u+3];0===c?s.network_pid=h:(s.program_pmt_pid[c]=h,-1===l&&(l=c),-1===_&&(_=h))}1===n&&0===o&&(null==this.pat_&&r.default.v(this.TAG,"Parsed first PAT: ".concat(JSON.stringify(s))),this.pat_=s,this.current_program_=l,this.current_pmt_pid_=_)}else r.default.e(this.TAG,"parsePAT: table_id ".concat(t," is not corresponded to PAT!"))},t.prototype.parsePMT=function(e){var t=e[0];if(2===t){var i=(15&e[1])<<8|e[2],a=e[3]<<8|e[4],n=(62&e[5])>>>1,o=1&e[5],s=e[6],d=(e[7],null);if(1===o&&0===s)(d=new I).program_number=a,d.version_number=n,this.program_pmt_map_[a]=d;else if(null==(d=this.program_pmt_map_[a]))return;d.pcr_pid=(31&e[8])<<8|e[9];for(var l=(15&e[10])<<8|e[11],_=12+l,u=i-9-l-4,c=_;c<_+u;){var h=e[c],f=(31&e[c+1])<<8|e[c+2],p=(15&e[c+3])<<8|e[c+4];d.pid_stream_type[f]=h;var m=d.common_pids.h264||d.common_pids.h265,g=d.common_pids.adts_aac||d.common_pids.loas_aac||d.common_pids.ac3||d.common_pids.eac3||d.common_pids.opus||d.common_pids.mp3;if(h!==L.kH264||m)if(h!==L.kH265||m)if(this.audio_disabled_||h!==L.kADTSAAC||g)if(this.audio_disabled_||h!==L.kLOASAAC||g)if(this.audio_disabled_||h!==L.kAC3||g)if(this.audio_disabled_||h!==L.kEAC3||g)if(this.audio_disabled_||h!==L.kMPEG1Audio&&h!==L.kMPEG2Audio||g){if(h===L.kPESPrivateData){if(d.pes_private_data_pids[f]=!0,p>0){for(var v=c+5;v<c+5+p;){var y=e[v+0],S=e[v+1];if(5===y){var E=String.fromCharCode.apply(String,Array.from(e.subarray(v+2,v+2+S)));"VANC"===E?d.smpte2038_pids[f]=!0:"AV01"===E?d.common_pids.av1=f:this.audio_disabled_||"Opus"!==E?"KLVA"===E&&(d.asynchronous_klv_pids[f]=!0):d.common_pids.opus=f}else if(127===y){if(f===d.common_pids.opus){var A=null;if(128===e[v+2]&&(A=e[v+3]),null==A){r.default.e(this.TAG,"Not Supported Opus channel count.");continue}var b={codec:"opus",channel_count:15&A?15&A:2,channel_config_code:A,sample_rate:48e3},R={codec:"opus",meta:b};0==this.audio_init_segment_dispatched_?(this.audio_metadata_=b,this.dispatchAudioInitSegment(R)):this.detectAudioMetadataChange(R)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(R))}}else 128===y&&f===d.common_pids.av1&&(this.video_metadata_.av1c=e.subarray(v+2,v+2+S));v+=2+S}var T=e.subarray(c+5,c+5+p);this.dispatchPESPrivateDataDescriptor(f,h,T)}}else if(h===L.kMetadata){if(p>0)for(v=c+5;v<c+5+p;){y=e[v+0];var k=e[v+1];if(38===y){var D=e[v+2]<<8|e[v+3],M=null;65535===D&&(M=String.fromCharCode.apply(String,Array.from(e.subarray(v+4,v+4+4))));var C=null;if(255===e[v+4+(65535===D?4:0)]){var w=4+(65535===D?4:0)+1;C=String.fromCharCode.apply(String,Array.from(e.subarray(v+w,v+w+4)))}"ID3 "===M&&"ID3 "===C?d.timed_id3_pids[f]=!0:"KLVA"===C&&(d.synchronous_klv_pids[f]=!0)}v+=2+k}}else if(h===L.kSCTE35)d.scte_35_pids[f]=!0;else if(h===L.kPGS){if(d.pgs_langs[f]="und",p>0)for(v=c+5;v<c+5+p;){y=e[v+0];var B=e[v+1];if(10===y){var O=String.fromCharCode.apply(String,Array.from(e.slice(v+2,v+5)));d.pgs_langs[f]=O}v+=2+B}d.pgs_pids[f]=!0}}else d.common_pids.mp3=f;else d.common_pids.eac3=f;else d.common_pids.ac3=f;else d.common_pids.loas_aac=f;else d.common_pids.adts_aac=f;else d.common_pids.h265=f;else d.common_pids.h264=f;c+=5+p}a===this.current_program_&&(null==this.pmt_&&r.default.v(this.TAG,"Parsed first PMT: ".concat(JSON.stringify(d))),this.pmt_=d,(d.common_pids.h264||d.common_pids.h265||d.common_pids.av1)&&(this.has_video_=!0),!this.audio_disabled_&&(d.common_pids.adts_aac||d.common_pids.loas_aac||d.common_pids.ac3||d.common_pids.opus||d.common_pids.mp3)&&(this.has_audio_=!0))}else r.default.e(this.TAG,"parsePMT: table_id ".concat(t," is not corresponded to PMT!"))},t.prototype.parseSCTE35=function(e){var t=function(e){var t=new f(e),i=t.readBits(8),a=t.readBool(),n=t.readBool();t.readBits(2);var r=t.readBits(12),o=t.readBits(8),s=t.readBool(),d=t.readBits(6),l=4*t.readBits(31)+t.readBits(2),_=t.readBits(8),u=t.readBits(12),c=t.readBits(12),h=t.readBits(8),p=null;h===z.kSpliceNull?p={}:h===z.kSpliceSchedule?p=function(e){for(var t=e.readBits(8),i=[],a=0;a<t;a++)i.push(ne(e));return{splice_count:t,events:i}}(t):h===z.kSpliceInsert?p=function(e){var t=e.readBits(32),i=e.readBool();e.readBits(7);var a={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return a;if(a.out_of_network_indicator=e.readBool(),a.program_splice_flag=e.readBool(),a.duration_flag=e.readBool(),a.splice_immediate_flag=e.readBool(),e.readBits(4),a.program_splice_flag&&!a.splice_immediate_flag&&(a.splice_time=ee(e)),!a.program_splice_flag){a.component_count=e.readBits(8),a.components=[];for(var n=0;n<a.component_count;n++)a.components.push(ie(a.splice_immediate_flag,e))}return a.duration_flag&&(a.break_duration=te(e)),a.unique_program_id=e.readBits(16),a.avail_num=e.readBits(8),a.avails_expected=e.readBits(8),a}(t):h===z.kTimeSignal?p=function(e){return{splice_time:ee(e)}}(t):h===z.kBandwidthReservation?p={}:h===z.kPrivateCommand?p=function(e,t){for(var i=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8)),a=new Uint8Array(e-4),n=0;n<e-4;n++)a[n]=t.readBits(8);return{identifier:i,private_data:a.buffer}}(c,t):t.readBits(8*c);for(var m=[],g=t.readBits(16),v=0;v<g;){var y=t.readBits(8),S=t.readBits(8),E=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8));0===y?m.push(re(y,S,E,t)):1===y?m.push(oe(y,S,E,t)):2===y?m.push(de(y,S,E,t)):3===y?m.push(le(y,S,E,t)):4===y?m.push(ue(y,S,E,t)):t.readBits(8*(S-4)),v+=2+S}var A={table_id:i,section_syntax_indicator:a,private_indicator:n,section_length:r,protocol_version:o,encrypted_packet:s,encryption_algorithm:d,pts_adjustment:l,cw_index:_,tier:u,splice_command_length:c,splice_command_type:h,splice_command:p,descriptor_loop_length:g,splice_descriptors:m,E_CRC32:s?t.readBits(32):void 0,CRC32:t.readBits(32)};if(h===z.kSpliceInsert){var b=p;if(b.splice_event_cancel_indicator)return{splice_command_type:h,detail:A,data:e};if(b.program_splice_flag&&!b.splice_immediate_flag){var R=b.duration_flag?b.break_duration.auto_return:void 0,T=b.duration_flag?b.break_duration.duration/90:void 0;return b.splice_time.time_specified_flag?{splice_command_type:h,pts:(l+b.splice_time.pts_time)%Math.pow(2,33),auto_return:R,duraiton:T,detail:A,data:e}:{splice_command_type:h,auto_return:R,duraiton:T,detail:A,data:e}}return{splice_command_type:h,auto_return:R=b.duration_flag?b.break_duration.auto_return:void 0,duraiton:T=b.duration_flag?b.break_duration.duration/90:void 0,detail:A,data:e}}if(h===z.kTimeSignal){var L=p;return L.splice_time.time_specified_flag?{splice_command_type:h,pts:(l+L.splice_time.pts_time)%Math.pow(2,33),detail:A,data:e}:{splice_command_type:h,detail:A,data:e}}return{splice_command_type:h,detail:A,data:e}}(e);if(null!=t.pts){var i=Math.floor(t.pts/this.timescale_);t.pts=i}else t.nearest_pts=this.getNearestTimestampMilliseconds();this.onSCTE35Metadata&&this.onSCTE35Metadata(t)},t.prototype.parseAV1Payload=function(e,t,i,a,n){for(var r=new Le(e),o=null,s=[],d=0,l=!1,_=null;null!=(o=r.readNextOBUPayload());){if((_=b.parseOBUs(o,this.video_metadata_.details))&&!0===_.keyframe)if(this.video_init_segment_dispatched_){if(!0===this.detectVideoMetadataChange(null,_)){var u;this.video_metadata_changed_=!0,this.dispatchVideoMediaSegment(),(u=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+_.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),u.set(_.sequence_header_data,this.video_metadata_.av1c.byteLength),_.av1c=u,this.dispatchVideoInitSegment()}}else(u=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+_.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),u.set(_.sequence_header_data,this.video_metadata_.av1c.byteLength),_.av1c=u,this.video_metadata_.details=_,this.dispatchVideoInitSegment();this.video_metadata_.details=_,l||(l=_.keyframe),s.push({data:o}),d+=o.byteLength}var c=Math.floor(t/this.timescale_),h=Math.floor(i/this.timescale_);if(s.length){var f=this.video_track_,p={units:s,length:d,isKeyframe:l,dts:h,pts:c,cts:c-h,file_position:a};f.samples.push(p),f.length+=d}},t.prototype.parseH264Payload=function(e,t,i,a,n){for(var o=new G(e),s=null,d=[],l=0,_=!1;null!=(s=o.readNextNaluPayload());){var u=new V(s);if(u.type===w.kSliceSPS){var c=p.parseSPS(s.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(u,c)&&(r.default.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:u,pps:void 0,av1c:void 0,details:c}):(this.video_metadata_.sps=u,this.video_metadata_.details=c)}else u.type===w.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=u,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):u.type===w.kSliceIDR||u.type===w.kSliceNonIDR&&1===n?_=!0:u.type===w.kSliceSEI&&this.parseSEIPayload(s.data,t,"h264");this.video_init_segment_dispatched_&&(d.push(u),l+=u.data.byteLength)}var h=Math.floor(t/this.timescale_),f=Math.floor(i/this.timescale_);if(d.length){var m=this.video_track_,g={units:d,length:l,isKeyframe:_,dts:f,pts:h,cts:h-f,file_position:a};m.samples.push(g),m.length+=l}},t.prototype.parseH265Payload=function(e,t,i,a,n){for(var o=new fe(e),s=null,d=[],l=0,_=!1;null!=(s=o.readNextNaluPayload());){var u=new he(s);if(u.type===$.kSliceVPS){if(!this.video_init_segment_dispatched_){var c=g.parseVPS(s.data);this.video_metadata_.vps=u,this.video_metadata_.details=Me(Me({},this.video_metadata_.details),c)}}else u.type===$.kSliceSPS?(c=g.parseSPS(s.data),this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(u,c)&&(r.default.v(this.TAG,"H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:u,pps:void 0,av1c:void 0,details:c}):(this.video_metadata_.sps=u,this.video_metadata_.details=Me(Me({},this.video_metadata_.details),c))):u.type===$.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(c=g.parsePPS(s.data),this.video_metadata_.pps=u,this.video_metadata_.details=Me(Me({},this.video_metadata_.details),c),this.video_metadata_.vps&&this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):u.type===$.kSliceIDR_W_RADL||u.type===$.kSliceIDR_N_LP||u.type===$.kSliceCRA_NUT?_=!0:u.type!==$.kSliceSEI&&u.type!==$.kSliceSEISuffix||this.parseSEIPayload(s.data,t,"h265");this.video_init_segment_dispatched_&&(d.push(u),l+=u.data.byteLength)}var h=Math.floor(t/this.timescale_),f=Math.floor(i/this.timescale_);if(d.length){var p=this.video_track_,m={units:d,length:l,isKeyframe:_,dts:f,pts:h,cts:h-f,file_position:a};p.samples.push(m),p.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(t.codec_mimetype!==this.video_metadata_.details.codec_mimetype)return r.default.v(this.TAG,"Video: Codec mimeType changed from "+"".concat(this.video_metadata_.details.codec_mimetype," to ").concat(t.codec_mimetype)),!0;if(t.codec_size.width!==this.video_metadata_.details.codec_size.width||t.codec_size.height!==this.video_metadata_.details.codec_size.height){var i=this.video_metadata_.details.codec_size,a=t.codec_size;return r.default.v(this.TAG,"Video: Coded Resolution changed from "+"".concat(i.width,"x").concat(i.height," to ").concat(a.width,"x").concat(a.height)),!0}return t.present_size.width!==this.video_metadata_.details.present_size.width&&(r.default.v(this.TAG,"Video: Present resolution width changed from "+"".concat(this.video_metadata_.details.present_size.width," to ").concat(t.present_size.width)),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.details,t={type:"video"};t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;var i=t.frameRate.fps_den,a=t.frameRate.fps_num;if(t.refSampleDuration=i/a*1e3,t.codec=e.codec_mimetype,this.video_metadata_.av1c)t.av1c=this.video_metadata_.av1c,0==this.video_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first AV1 for mimeType: ".concat(t.codec));else if(this.video_metadata_.vps){var n=this.video_metadata_.vps.data.subarray(4),o=this.video_metadata_.sps.data.subarray(4),s=this.video_metadata_.pps.data.subarray(4),d=new pe(n,o,s,e);t.hvcc=d.getData(),0==this.video_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first HEVCDecoderConfigurationRecord for mimeType: ".concat(t.codec))}else{o=this.video_metadata_.sps.data.subarray(4),s=this.video_metadata_.pps.data.subarray(4);var l=new F(o,s,e);t.avcc=l.getData(),0==this.video_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: ".concat(t.codec))}this.onTrackMetadata("video",t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var _=this.media_info_;_.hasVideo=!0,_.width=t.codecWidth,_.height=t.codecHeight,_.fps=t.frameRate.fps,_.profile=t.profile,_.level=t.level,_.refFrames=e.ref_frames,_.chromaFormat=e.chroma_format_string,_.sarNum=t.sarRatio.width,_.sarDen=t.sarRatio.height,_.videoCodec=t.codec,_.hasAudio&&_.audioCodec?_.mimeType='video/mp2t; codecs="'.concat(_.videoCodec,",").concat(_.audioCodec,'"'):_.mimeType='video/mp2t; codecs="'.concat(_.videoCodec,'"'),_.isComplete()&&this.onMediaInfo(_)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseADTSAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var i=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);i.set(this.aac_last_incomplete_data_,0),i.set(e,this.aac_last_incomplete_data_.byteLength),e=i}var a,n;if(null!=t&&(n=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)a=1024/this.audio_metadata_.sampling_frequency*1e3,n=this.audio_last_sample_pts_+a;else if(null==t)return void r.default.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){a=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.audio_last_sample_pts_+a;Math.abs(o-n)>1&&(r.default.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(o,"ms, PES pts: ").concat(n,"ms")),n=o)}}for(var s,d=new Y(e),l=null,_=n;null!=(l=d.readNextAACFrame());){a=1024/l.sampling_frequency*1e3;var u={codec:"aac",data:l};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u)),s=_;var c=Math.floor(_),h={unit:l.data,length:l.data.byteLength,pts:c,dts:c};this.audio_track_.samples.push(h),this.audio_track_.length+=l.data.byteLength,_+=a}d.hasIncompleteData()&&(this.aac_last_incomplete_data_=d.getIncompleteData()),s&&(this.audio_last_sample_pts_=s)}},t.prototype.parseLOASAACPayload=function(e,t){var i;if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var a=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);a.set(this.aac_last_incomplete_data_,0),a.set(e,this.aac_last_incomplete_data_.byteLength),e=a}var n,o;if(null!=t&&(o=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)n=1024/this.audio_metadata_.sampling_frequency*1e3,o=this.audio_last_sample_pts_+n;else if(null==t)return void r.default.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){n=1024/this.audio_metadata_.sampling_frequency*1e3;var s=this.audio_last_sample_pts_+n;Math.abs(s-o)>1&&(r.default.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(s,"ms, PES pts: ").concat(o,"ms")),o=s)}}for(var d,l=new X(e),_=null,u=o;null!=(_=l.readNextAACFrame(null!==(i=this.loas_previous_frame)&&void 0!==i?i:void 0));){this.loas_previous_frame=_,n=1024/_.sampling_frequency*1e3;var c={codec:"aac",data:_};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:_.audio_object_type,sampling_freq_index:_.sampling_freq_index,sampling_frequency:_.sampling_frequency,channel_config:_.channel_config},this.dispatchAudioInitSegment(c)):this.detectAudioMetadataChange(c)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(c)),d=u;var h=Math.floor(u),f={unit:_.data,length:_.data.byteLength,pts:h,dts:h};this.audio_track_.samples.push(f),this.audio_track_.length+=_.data.byteLength,u+=n}l.hasIncompleteData()&&(this.aac_last_incomplete_data_=l.getIncompleteData()),d&&(this.audio_last_sample_pts_=d)}},t.prototype.parseAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i,a;if(null!=t&&(a=t/this.timescale_),"ac-3"===this.audio_metadata_.codec)if(null==t&&null!=this.audio_last_sample_pts_)i=1536/this.audio_metadata_.sampling_frequency*1e3,a=this.audio_last_sample_pts_+i;else if(null==t)return void r.default.w(this.TAG,"AC3: Unknown pts");for(var n,o=new Se(e),s=null,d=a;null!=(s=o.readNextAC3Frame());){i=1536/s.sampling_frequency*1e3;var l={codec:"ac-3",data:s};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"ac-3",sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,bit_stream_mode:s.bit_stream_mode,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),n=d;var _=Math.floor(d),u={unit:s.data,length:s.data.byteLength,pts:_,dts:_};this.audio_track_.samples.push(u),this.audio_track_.length+=s.data.byteLength,d+=i}n&&(this.audio_last_sample_pts_=n)}},t.prototype.parseEAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i,a;if(null!=t&&(a=t/this.timescale_),"ec-3"===this.audio_metadata_.codec)if(null==t&&null!=this.audio_last_sample_pts_)i=256*this.audio_metadata_.num_blks/this.audio_metadata_.sampling_frequency*1e3,a=this.audio_last_sample_pts_+i;else if(null==t)return void r.default.w(this.TAG,"EAC3: Unknown pts");for(var n,o=new be(e),s=null,d=a;null!=(s=o.readNextEAC3Frame());){i=1536/s.sampling_frequency*1e3;var l={codec:"ec-3",data:s};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"ec-3",sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,num_blks:s.num_blks,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),n=d;var _=Math.floor(d),u={unit:s.data,length:s.data.byteLength,pts:_,dts:_};this.audio_track_.samples.push(u),this.audio_track_.length+=s.data.byteLength,d+=i}n&&(this.audio_last_sample_pts_=n)}},t.prototype.parseOpusPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i,a;if(null!=t&&(a=t/this.timescale_),"opus"===this.audio_metadata_.codec)if(null==t&&null!=this.audio_last_sample_pts_)i=20,a=this.audio_last_sample_pts_+i;else if(null==t)return void r.default.w(this.TAG,"Opus: Unknown pts");for(var n,o=a,s=0;s<e.length;){i=20;for(var d=!!(16&e[s+1]),l=!!(8&e[s+1]),_=s+2,u=0;255===e[_];)u+=255,_+=1;u+=e[_],_+=1,_+=d?2:0,_+=l?2:0,n=o;var c=Math.floor(o),h=e.slice(_,_+u),f={unit:h,length:h.byteLength,pts:c,dts:c};this.audio_track_.samples.push(f),this.audio_track_.length+=h.byteLength,o+=i,s=_+u}n&&(this.audio_last_sample_pts_=n)}},t.prototype.parseMP3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i=e[1]>>>3&3,a=(6&e[1])>>1,n=(e[2],(12&e[2])>>>2),r=3&~(e[3]>>>6)?2:1,o=0,s=34;switch(i){case 0:o=[11025,12e3,8e3,0][n];break;case 2:o=[22050,24e3,16e3,0][n];break;case 3:o=[44100,48e3,32e3,0][n]}switch(a){case 1:s=34;break;case 2:s=33;break;case 3:s=32}var d=new ge;d.object_type=s,d.sample_rate=o,d.channel_count=r,d.data=e;var l={codec:"mp3",data:d};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:s,sample_rate:o,channel_count:r},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l));var _={unit:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_};this.audio_track_.samples.push(_),this.audio_track_.length+=e.byteLength}},t.prototype.detectAudioMetadataChange=function(e){if(e.codec!==this.audio_metadata_.codec)return r.default.v(this.TAG,"Audio: Audio Codecs changed from "+"".concat(this.audio_metadata_.codec," to ").concat(e.codec)),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){if((t=e.data).audio_object_type!==this.audio_metadata_.audio_object_type)return r.default.v(this.TAG,"AAC: AudioObjectType changed from "+"".concat(this.audio_metadata_.audio_object_type," to ").concat(t.audio_object_type)),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return r.default.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sampling_freq_index," to ").concat(t.sampling_freq_index)),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return r.default.v(this.TAG,"AAC: Channel configuration changed from "+"".concat(this.audio_metadata_.channel_config," to ").concat(t.channel_config)),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){var t;if((t=e.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return r.default.v(this.TAG,"AC3: Sampling Frequency changed from "+"".concat(this.audio_metadata_.sampling_frequency," to ").concat(t.sampling_frequency)),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return r.default.v(this.TAG,"AC3: Bit Stream Identification changed from "+"".concat(this.audio_metadata_.bit_stream_identification," to ").concat(t.bit_stream_identification)),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return r.default.v(this.TAG,"AC3: BitStream Mode changed from "+"".concat(this.audio_metadata_.bit_stream_mode," to ").concat(t.bit_stream_mode)),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return r.default.v(this.TAG,"AC3: Channel Mode changed from "+"".concat(this.audio_metadata_.channel_mode," to ").concat(t.channel_mode)),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return r.default.v(this.TAG,"AC3: Low Frequency Effects Channel On changed from "+"".concat(this.audio_metadata_.low_frequency_effects_channel_on," to ").concat(t.low_frequency_effects_channel_on)),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){if((i=e.meta).sample_rate!==this.audio_metadata_.sample_rate)return r.default.v(this.TAG,"Opus: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(i.sample_rate)),!0;if(i.channel_count!==this.audio_metadata_.channel_count)return r.default.v(this.TAG,"Opus: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(i.channel_count)),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){var i;if((i=e.data).object_type!==this.audio_metadata_.object_type)return r.default.v(this.TAG,"MP3: AudioObjectType changed from "+"".concat(this.audio_metadata_.object_type," to ").concat(i.object_type)),!0;if(i.sample_rate!==this.audio_metadata_.sample_rate)return r.default.v(this.TAG,"MP3: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(i.sample_rate)),!0;if(i.channel_count!==this.audio_metadata_.channel_count)return r.default.v(this.TAG,"MP3: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(i.channel_count)),!0}return!1},t.prototype.dispatchAudioInitSegment=function(e){var t={type:"audio"};if(t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_,"aac"===this.audio_metadata_.codec){var i="aac"===e.codec?e.data:null,a=new Q(i);t.audioSampleRate=a.sampling_rate,t.channelCount=a.channel_count,t.codec=a.codec_mimetype,t.originalCodec=a.original_codec_mimetype,t.config=a.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale}else if("ac-3"===this.audio_metadata_.codec){var n="ac-3"===e.codec?e.data:null,o=new Ee(n);t.audioSampleRate=o.sampling_rate,t.channelCount=o.channel_count,t.codec=o.codec_mimetype,t.originalCodec=o.original_codec_mimetype,t.config=o.config,t.refSampleDuration=1536/t.audioSampleRate*t.timescale}else if("ec-3"===this.audio_metadata_.codec){var s="ec-3"===e.codec?e.data:null,d=new Re(s);t.audioSampleRate=d.sampling_rate,t.channelCount=d.channel_count,t.codec=d.codec_mimetype,t.originalCodec=d.original_codec_mimetype,t.config=d.config,t.refSampleDuration=256*d.num_blks/t.audioSampleRate*t.timescale}else"opus"===this.audio_metadata_.codec?(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.channelConfigCode=this.audio_metadata_.channel_config_code,t.codec="opus",t.originalCodec="opus",t.config=void 0,t.refSampleDuration=20):"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==this.audio_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: ".concat(t.codec)),this.onTrackMetadata("audio",t),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var l=this.media_info_;l.hasAudio=!0,l.audioCodec=t.originalCodec,l.audioSampleRate=t.audioSampleRate,l.audioChannelCount=t.channelCount,l.hasVideo&&l.videoCodec?l.mimeType='video/mp2t; codecs="'.concat(l.videoCodec,",").concat(l.audioCodec,'"'):l.mimeType='video/mp2t; codecs="'.concat(l.audioCodec,'"'),l.isComplete()&&this.onMediaInfo(l)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,i){var a=new Z;a.pid=e,a.stream_type=t,a.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(a)},t.prototype.parsePESPrivateDataPayload=function(e,t,i,a,n){var r=new J;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}else r.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}this.onPESPrivateData&&this.onPESPrivateData(r)},t.prototype.parseTimedID3MetadataPayload=function(e,t,i,a,n){var r=new J;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}if(null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}this.onTimedID3Metadata&&this.onTimedID3Metadata(r)},t.prototype.parsePGSPayload=function(e,t,i,a,n,r){var o=new ke;if(o.pid=a,o.lang=r,o.stream_id=n,o.len=e.byteLength,o.data=e,null!=t){var s=Math.floor(t/this.timescale_);o.pts=s}if(null!=i){var d=Math.floor(i/this.timescale_);o.dts=d}this.onPGSSubtitleData&&this.onPGSSubtitleData(o)},t.prototype.parseSynchronousKLVMetadataPayload=function(e,t,i,a,n){var r=new Te;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}if(null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}r.access_units=function(e){for(var t=[],i=0;i+5<e.byteLength;){var a=e[i+0],n=e[i+1],r=e[i+2],o=e[i+3]<<8|e[i+4],s=e.slice(i+5,i+5+o);t.push({service_id:a,sequence_number:n,flags:r,data:s}),i+=5+o}return t}(e),this.onSynchronousKLVMetadata&&this.onSynchronousKLVMetadata(r)},t.prototype.parseAsynchronousKLVMetadataPayload=function(e,t,i){var a=new J;a.pid=t,a.stream_id=i,a.len=e.byteLength,a.data=e,this.onAsynchronousKLVMetadata&&this.onAsynchronousKLVMetadata(a)},t.prototype.parseSMPTE2038MetadataPayload=function(e,t,i,a,n){var r=new me;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}if(r.nearest_pts=this.getNearestTimestampMilliseconds(),null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}r.ancillaries=function(e){for(var t=new f(e),i=0,a=[];i+=6,0===t.readBits(6);){var n=t.readBool();i+=1;var r=t.readBits(11);i+=11;var o=t.readBits(12);i+=12;var s=255&t.readBits(10);i+=10;var d=255&t.readBits(10);i+=10;var l=255&t.readBits(10);i+=10;for(var _=new Uint8Array(l),u=0;u<l;u++){var c=255&t.readBits(10);i+=10,_[u]=c}t.readBits(10),i+=10;var h="User Defined";65===s?7===d&&(h="SCTE-104"):95===s?220===d?h="ARIB STD-B37 (1SEG)":221===d?h="ARIB STD-B37 (ANALOG)":222===d?h="ARIB STD-B37 (SD)":223===d&&(h="ARIB STD-B37 (HD)"):97===s&&(1===d?h="EIA-708":2===d&&(h="EIA-608")),a.push({yc_indicator:n,line_number:r,horizontal_offset:o,did:s,sdid:d,user_data:_,description:h,information:{}}),t.readBits(8-(i-Math.floor(i/8))%8),i+=(8-(i-Math.floor(i/8)))%8}return t.destroy(),t=null,a}(e),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(r)},t.prototype.parseSEIPayload=function(e,t,i){var a=T(e,null!=t?Math.floor(t/this.timescale_):void 0,i);a&&this.onSEI&&this.onSEI(a)},t.prototype.getNearestTimestampMilliseconds=function(){return null!=this.audio_last_sample_pts_?Math.floor(this.audio_last_sample_pts_):null!=this.last_pcr_?Math.floor(this.last_pcr_/300/this.timescale_):void 0},t.prototype.getPcrBase=function(e){var t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296<this.last_pcr_base_&&(t+=8589934592,this.timestamp_offset_+=8589934592),this.last_pcr_base_=t,t},t.prototype.getTimestamp=function(e,t){var i=536870912*(14&e[t])+4194304*(255&e[t+1])+16384*(254&e[t+2])+128*(255&e[t+3])+(254&e[t+4])/2+this.timestamp_offset_;return i+4294967296<this.last_pcr_base_&&(i+=8589934592),i},t}(M),we=Ce,Ie=function(e,t,i){if(i||2===arguments.length)for(var a,n=0,r=t.length;n<r;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},Be=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],av01:[],av1C:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],chnl:[],".mp3":[],Opus:[],dOps:[],fLaC:[],dfLa:[],ipcm:[],pcmC:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,a=Array.prototype.slice.call(arguments,1),n=a.length,r=0;r<n;r++)t+=a[r].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var o=8;for(r=0;r<n;r++)i.set(a[r],o),o+=a[r].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),a=e.moov(t),n=new Uint8Array(i.byteLength+a.byteLength);return n.set(i,0),n.set(a,i.byteLength),n},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),a=e.trak(t),n=e.mvex(t);return e.box(e.types.moov,i,a,n)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,a=t.duration,n=t.presentWidth,r=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,r>>>8&255,255&r,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,a=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,85,196,0,0]))},e.hdlr=function(t){var i;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):"ac-3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ac3(t)):"ec-3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ec3(t)):"opus"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.Opus(t)):"flac"==t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.fLaC(t)):"ipcm"==t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ipcm(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"video"===t.type&&t.codec.startsWith("hvc1")?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t)):"video"===t.type&&t.codec.startsWith("av01")?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.av01(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types[".mp3"],n)},e.mp4a=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.mp4a,n,e.esds(t))},e.ac3=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types["ac-3"],n,e.box(e.types.dac3,new Uint8Array(t.config)))},e.ec3=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types["ec-3"],n,e.box(e.types.dec3,new Uint8Array(t.config)))},e.esds=function(t){var i=t.config||[],a=i.length,n=new Uint8Array([0,0,0,0,3,23+a,0,1,0,4,15+a,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([a]).concat(i).concat([6,1,2]));return e.box(e.types.esds,n)},e.Opus=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.Opus,n,e.dOps(t))},e.dOps=function(t){var i=t.channelCount,a=t.channelConfigCode,n=t.audioSampleRate;if(t.config)return e.box(e.types.dOps,t.config);var r=[];switch(a){case 1:case 2:r=[0];break;case 0:r=[255,1,1,0,1];break;case 128:r=[255,2,0,0,1];break;case 3:r=[1,2,1,0,2,1];break;case 4:r=[1,2,2,0,1,2,3];break;case 5:r=[1,3,2,0,4,1,2,3];break;case 6:r=[1,4,2,0,4,1,2,3,5];break;case 7:r=[1,4,2,0,4,1,2,3,5,6];break;case 8:r=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:r=[1,1,2,0,1];break;case 131:r=[1,1,3,0,1,2];break;case 132:r=[1,1,4,0,1,2,3];break;case 133:r=[1,1,5,0,1,2,3,4];break;case 134:r=[1,1,6,0,1,2,3,4,5];break;case 135:r=[1,1,7,0,1,2,3,4,5,6];break;case 136:r=[1,1,8,0,1,2,3,4,5,6,7]}var o=new Uint8Array(Ie([0,i,0,0,n>>>24&255,n>>>17&255,n>>>8&255,n>>>0&255,0,0],r,!0));return e.box(e.types.dOps,o)},e.fLaC=function(t){var i=t.channelCount,a=Math.min(t.audioSampleRate,65535),n=t.sampleSize,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,n,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.fLaC,r,e.dfLa(t))},e.dfLa=function(t){var i=new Uint8Array(Ie([0,0,0,0],t.config,!0));return e.box(e.types.dfLa,i)},e.ipcm=function(t){var i=t.channelCount,a=Math.min(t.audioSampleRate,65535),n=t.sampleSize,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,n,0,0,0,0,a>>>8&255,255&a,0,0]);return 1===t.channelCount?e.box(e.types.ipcm,r,e.pcmC(t)):e.box(e.types.ipcm,r,e.chnl(t),e.pcmC(t))},e.chnl=function(t){var i=new Uint8Array([0,0,0,0,1,t.channelCount,0,0,0,0,0,0,0,0]);return e.box(e.types.chnl,i)},e.pcmC=function(t){var i=t.littleEndian?1:0,a=t.sampleSize,n=new Uint8Array([0,0,0,0,i,a]);return e.box(e.types.pcmC,n)},e.avc1=function(t){var i=t.avcc,a=t.codecWidth,n=t.codecHeight,r=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,a>>>8&255,255&a,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,r,e.box(e.types.avcC,i))},e.hvc1=function(t){var i=t.hvcc,a=t.codecWidth,n=t.codecHeight,r=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,a>>>8&255,255&a,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,r,e.box(e.types.hvcC,i))},e.av01=function(t){var i=t.av1c,a=t.codecWidth||192,n=t.codecHeight||108,r=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,a>>>8&255,255&a,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.av01,r,e.box(e.types.av1C,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,a=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,a)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var a=t.id,n=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a])),r=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,n,r,s,o)},e.sdtp=function(t){for(var i=t.samples||[],a=i.length,n=new Uint8Array(4+a),r=0;r<a;r++){var o=i[r].flags;n[r+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,n)},e.trun=function(t,i){var a=t.samples||[],n=a.length,r=12+16*n,o=new Uint8Array(r);i+=8+r,o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var s=0;s<n;s++){var d=a[s].duration,l=a[s].size,_=a[s].flags,u=a[s].cts;o.set([d>>>24&255,d>>>16&255,d>>>8&255,255&d,l>>>24&255,l>>>16&255,l>>>8&255,255&l,_.isLeading<<2|_.dependsOn,_.isDependedOn<<6|_.hasRedundancy<<4|_.isNonSync,0,0,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*s)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();Be.init();var Oe=Be,Pe=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)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(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),xe=i(14),Ue=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,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 xe.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new xe.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.default.chrome||!(o.default.version.major<50||50===o.default.version.major&&o.default.version.build<2661)),this._fillSilentAfterSeek=o.default.msedge||o.default.msie,this._mp3UseMpegAudio=!o.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.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},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new u.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,a="mp4",n=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(a="mpeg",n="",i=new Uint8Array):i=Oe.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=Oe.generateInitSegment(t)}if(!this._onInitSegment)throw new u.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:n,container:"".concat(e,"/").concat(a),mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.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)},e.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var a={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(a.samples.push(t),a.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(a,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,a=e,n=a.samples,o=void 0,s=-1,d=this._audioMeta.refSampleDuration,l="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,_=this._dtsBaseInited&&void 0===this._audioNextDts,u=!1;if(n&&0!==n.length&&(1!==n.length||t)){var c=0,h=null,f=0;l?(c=0,f=a.length):(c=8,f=8+a.length);var p=null;if(n.length>1&&(f-=(p=n.pop()).length),null!=this._audioStashedLastSample){var m=this._audioStashedLastSample;this._audioStashedLastSample=null,n.unshift(m),f+=m.length}null!=p&&(this._audioStashedLastSample=p);var g=n[0].dts-this._dtsBase;if(this._audioNextDts)o=g-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())o=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(u=!0);else{var v=this._audioSegmentInfoList.getLastSampleBefore(g);if(null!=v){var y=g-(v.originalDts+v.duration);y<=3&&(y=0),o=g-(v.dts+v.duration+y)}else o=0}if(u){var S=g-o,E=this._videoSegmentInfoList.getLastSegmentBefore(g);if(null!=E&&E.beginDts<S){if(I=Pe.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var A=E.beginDts,b=S-E.beginDts;r.default.v(this.TAG,"InsertPrefixSilentAudio: dts: ".concat(A,", duration: ").concat(b)),n.unshift({unit:I,dts:A,pts:A}),f+=I.byteLength}}else u=!1}for(var R=[],T=0;T<n.length;T++){var L=(m=n[T]).unit,k=m.dts-this._dtsBase,D=(A=k,!1),M=null,C=0;if(!(k<-.001)){if("mp3"!==this._audioMeta.codec&&null!=d){var w=k;if(this._audioNextDts&&(w=this._audioNextDts),(o=k-w)<=-3*d){r.default.w(this.TAG,"Dropping 1 audio frame (originalDts: ".concat(k," ms ,curRefDts: ").concat(w," ms) due to dtsCorrection: ").concat(o," ms overlap."));continue}if(o>=3*d&&this._fillAudioTimestampGap){D=!0;var I,B=Math.floor(o/d);r.default.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n"+"originalDts: ".concat(k," ms, curRefDts: ").concat(w," ms, ")+"dtsCorrection: ".concat(Math.round(o)," ms, generate: ").concat(B," frames")),A=Math.floor(w),C=Math.floor(w+d)-A,null==(I=Pe.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(r.default.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),I=L),M=[];for(var O=0;O<B;O++){w+=d;var P=Math.floor(w),x=Math.floor(w+d)-P,U={dts:P,pts:P,cts:0,unit:I,size:I.byteLength,duration:x,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};M.push(U),f+=U.size}this._audioNextDts=w+d}else A=Math.floor(w),C=Math.floor(w+d)-A,this._audioNextDts=w+d}else A=k-o,C=T!==n.length-1?n[T+1].dts-this._dtsBase-o-A:null!=p?p.dts-this._dtsBase-o-A:R.length>=1?R[R.length-1].duration:Math.floor(d),this._audioNextDts=A+C;-1===s&&(s=A),R.push({dts:A,pts:A,cts:0,unit:m.unit,size:m.unit.byteLength,duration:C,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),D&&R.push.apply(R,M)}}if(0===R.length)return a.samples=[],void(a.length=0);for(l?h=new Uint8Array(f):((h=new Uint8Array(f))[0]=f>>>24&255,h[1]=f>>>16&255,h[2]=f>>>8&255,h[3]=255&f,h.set(Oe.types.mdat,4)),T=0;T<R.length;T++)L=R[T].unit,h.set(L,c),c+=L.byteLength;var N=R[R.length-1];i=N.dts+N.duration;var V=new xe.MediaSegmentInfo;V.beginDts=s,V.endDts=i,V.beginPts=s,V.endPts=i,V.originalBeginDts=R[0].originalDts,V.originalEndDts=N.originalDts+N.duration,V.firstSample=new xe.SampleInfo(R[0].dts,R[0].pts,R[0].duration,R[0].originalDts,!1),V.lastSample=new xe.SampleInfo(N.dts,N.pts,N.duration,N.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(V),a.samples=R,a.sequenceNumber++;var G;G=l?new Uint8Array:Oe.moof(a,s),a.samples=[],a.length=0;var F={type:"audio",data:this._mergeBoxes(G,h).buffer,sampleCount:R.length,info:V};l&&_&&(F.timestampOffset=s),this._onMediaSegment("audio",F)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,a,n=e,r=n.samples,o=void 0,s=-1,d=-1;if(r&&0!==r.length&&(1!==r.length||t)){var l=8,_=null,u=8+e.length,c=null;if(r.length>1&&(u-=(c=r.pop()).length),null!=this._videoStashedLastSample){var h=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(h),u+=h.length}null!=c&&(this._videoStashedLastSample=c);var f=r[0].dts-this._dtsBase;if(this._videoNextDts)o=f-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var p=this._videoSegmentInfoList.getLastSampleBefore(f);if(null!=p){var m=f-(p.originalDts+p.duration);m<=3&&(m=0),o=f-(p.dts+p.duration+m)}else o=0}for(var g=new xe.MediaSegmentInfo,v=[],y=0;y<r.length;y++){var S=(h=r[y]).dts-this._dtsBase,E=h.isKeyframe,A=S-o,b=h.cts,R=A+b;-1===s&&(s=A,d=R);var T=0;if(T=y!==r.length-1?r[y+1].dts-this._dtsBase-o-A:null!=c?c.dts-this._dtsBase-o-A:v.length>=1?v[v.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),E){var L=new xe.SampleInfo(A,R,T,h.dts,!0);L.fileposition=h.fileposition,g.appendSyncPoint(L)}v.push({dts:A,pts:R,cts:b,units:h.units,size:h.length,isKeyframe:E,duration:T,originalDts:S,flags:{isLeading:0,dependsOn:E?2:1,isDependedOn:E?1:0,hasRedundancy:0,isNonSync:E?0:1}})}for((_=new Uint8Array(u))[0]=u>>>24&255,_[1]=u>>>16&255,_[2]=u>>>8&255,_[3]=255&u,_.set(Oe.types.mdat,4),y=0;y<v.length;y++)for(var k=v[y].units;k.length;){var D=k.shift().data;_.set(D,l),l+=D.byteLength}var M=v[v.length-1];if(i=M.dts+M.duration,a=M.pts+M.duration,this._videoNextDts=i,g.beginDts=s,g.endDts=i,g.beginPts=d,g.endPts=a,g.originalBeginDts=v[0].originalDts,g.originalEndDts=M.originalDts+M.duration,g.firstSample=new xe.SampleInfo(v[0].dts,v[0].pts,v[0].duration,v[0].originalDts,v[0].isKeyframe),g.lastSample=new xe.SampleInfo(M.dts,M.pts,M.duration,M.originalDts,M.isKeyframe),this._isLive||this._videoSegmentInfoList.append(g),n.samples=v,n.sequenceNumber++,this._forceFirstIDR){var C=v[0].flags;C.dependsOn=2,C.isNonSync=0}var w=Oe.moof(n,s);n.samples=[],n.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(w,_).buffer,sampleCount:v.length,info:g})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}(),Ne=i(74),Ve=i(125),Ge=(i(187),function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new(n()),this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach(function(a){a.timestampBase=i,i+=a.duration,a.cors=e.cors,a.withCredentials=e.withCredentials,t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy)}),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],a=this._ioctl=new Ne.default(i,this._config,e);a.onError=this._onIOException.bind(this),a.onSeeked=this._onIOSeeked.bind(this),a.onComplete=this._onIOComplete.bind(this),a.onRedirect=this._onIORedirect.bind(this),a.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):a.onDataArrival=this._onInitChunkArrival.bind(this),a.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var a=i.getNearestKeyframe(e);this._remuxer.seek(a.milliseconds),this._ioctl.seek(a.fileposition),this._pendingResolveSeekPoint=a.milliseconds}}else{var n=this._mediaInfo.segments[t];null==n?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(a=n.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,a.fileposition),this._pendingResolveSeekPoint=a.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,a=0;a<t.length;a++)if(e<t[a].timestampBase){i=a-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i,a=this,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else{var o=null;(o=D.probe(e)).match&&(this._setupFLVDemuxerRemuxer(o),n=this._demuxer.parseChunks(e,t)),o.match||o.needMoreData||(o=we.probe(e)).match&&(this._setupTSDemuxerRemuxer(o),n=this._demuxer.parseChunks(e,t)),o.match||o.needMoreData||(o=null,r.default.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then(function(){a._internalAbort()}),null===(i=this._emitter)||void 0===i||i.emit(Ve.default.DEMUX_ERROR,m.default.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return n},e.prototype._setupFLVDemuxerRemuxer=function(e){this._demuxer=new D(e,this._config),this._remuxer||(this._remuxer=new Ue(this._config));var t=this._mediaDataSource;null==t.duration||isNaN(t.duration)||(this._demuxer.overridedDuration=t.duration),"boolean"==typeof t.hasAudio&&(this._demuxer.overridedHasAudio=t.hasAudio),"boolean"==typeof t.hasVideo&&(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)},e.prototype._setupTSDemuxerRemuxer=function(e){var t=this._demuxer=new we(e,this._config);this._remuxer||(this._remuxer=new Ue(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)},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,s.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,s.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)})},e.prototype._onMetaDataArrived=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.TIMED_ID3_METADATA_ARRIVED,e))},e.prototype._onPGSSubtitle=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.PGS_SUBTITLE_ARRIVED,e))},e.prototype._onSynchronousKLVMetadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,e))},e.prototype._onAsynchronousKLVMetadata=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)},e.prototype._onSMPTE2038Metadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null!=e.nearest_pts&&(e.nearest_pts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SMPTE2038_METADATA_ARRIVED,e))},e.prototype._onSEI=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SEI_ARRIVED,e))},e.prototype._onSCTE35Metadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.nearest_pts&&(e.nearest_pts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SCTE35_METADATA_ARRIVED,e))},e.prototype._onPESPrivateDataDescriptor=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.nearest_pts&&(e.nearest_pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.PES_PRIVATE_DATA_ARRIVED,e))},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t,i=e+1;i<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(i)):(this._remuxer&&this._remuxer.flushStashedSamples(),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(Ve.default.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){var i;r.default.e(this.TAG,"IOException: type = ".concat(e,", code = ").concat(t.code,", msg = ").concat(t.msg)),null===(i=this._emitter)||void 0===i||i.emit(Ve.default.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){var i;r.default.e(this.TAG,"DemuxException: type = ".concat(e,", info = ").concat(t)),null===(i=this._emitter)||void 0===i||i.emit(Ve.default.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){var i;null===(i=this._emitter)||void 0===i||i.emit(Ve.default.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){var i,a;if(null==this._pendingSeekTime&&(null===(i=this._emitter)||void 0===i||i.emit(Ve.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var n=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.default.safari&&n.length>0&&n[0].originalDts===r&&(r=n[0].pts),null===(a=this._emitter)||void 0===a||a.emit(Ve.default.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t,i=this._mediaInfo.segments[e],a=Object.assign({},i);a.duration=this._mediaInfo.duration,a.segmentCount=this._mediaInfo.segmentCount,delete a.segments,delete a.keyframesIndex,null===(t=this._emitter)||void 0===t||t.emit(Ve.default.MEDIA_INFO,a)},e.prototype._reportStatisticsInfo=function(){var e,t={};t.url=this._ioctl.currentURL,t.hasRedirect=this._ioctl.hasRedirect,t.hasRedirect&&(t.redirectedURL=this._ioctl.currentRedirectedURL),t.speed=this._ioctl.currentSpeed,t.loaderType=this._ioctl.loaderType,t.currentSegmentIndex=this._currentSegmentIndex,t.totalSegmentCount=this._mediaDataSource.segments.length,null===(e=this._emitter)||void 0===e||e.emit(Ve.default.STATISTICS_INFO,t)},e}())},125:function(e,t,i){"use strict";var a;i.r(t),function(e){e.IO_ERROR="io_error",e.DEMUX_ERROR="demux_error",e.INIT_SEGMENT="init_segment",e.MEDIA_SEGMENT="media_segment",e.LOADING_COMPLETE="loading_complete",e.RECOVERED_EARLY_EOF="recovered_early_eof",e.MEDIA_INFO="media_info",e.METADATA_ARRIVED="metadata_arrived",e.SCRIPTDATA_ARRIVED="scriptdata_arrived",e.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",e.PGS_SUBTITLE_ARRIVED="pgs_subtitle_arrived",e.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",e.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",e.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",e.SEI_ARRIVED="sei_arrived",e.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",e.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",e.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",e.STATISTICS_INFO="statistics_info",e.RECOMMEND_SEEKPOINT="recommend_seekpoint"}(a||(a={})),t.default=a},944:function(e,t,i){"use strict";i.r(t),i(291);var a=i(258),n=i(760),r=i(385),o=i(125);t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function s(t,i){var a={msg:o.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(a,[i.data])}function d(t,i){var a={msg:o.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(a,[i.data])}function l(){var t={msg:o.default.LOADING_COMPLETE};e.postMessage(t)}function _(){var t={msg:o.default.RECOVERED_EARLY_EOF};e.postMessage(t)}function u(t){var i={msg:o.default.MEDIA_INFO,data:t};e.postMessage(i)}function c(t){var i={msg:o.default.METADATA_ARRIVED,data:t};e.postMessage(i)}function h(t){var i={msg:o.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:o.default.TIMED_ID3_METADATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:o.default.PGS_SUBTITLE_ARRIVED,data:t};e.postMessage(i)}function m(t){var i={msg:o.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,data:t};e.postMessage(i)}function g(t){var i={msg:o.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,data:t};e.postMessage(i)}function v(t){var i={msg:o.default.SMPTE2038_METADATA_ARRIVED,data:t};e.postMessage(i)}function y(t){var i={msg:o.default.SEI_ARRIVED,data:t};e.postMessage(i)}function S(t){var i={msg:o.default.SCTE35_METADATA_ARRIVED,data:t};e.postMessage(i)}function E(t){var i={msg:o.default.PES_PRIVATE_DATA_DESCRIPTOR,data:t};e.postMessage(i)}function A(t){var i={msg:o.default.PES_PRIVATE_DATA_ARRIVED,data:t};e.postMessage(i)}function b(t){var i={msg:o.default.STATISTICS_INFO,data:t};e.postMessage(i)}function R(t,i){e.postMessage({msg:o.default.IO_ERROR,data:{type:t,info:i}})}function T(t,i){e.postMessage({msg:o.default.DEMUX_ERROR,data:{type:t,info:i}})}function L(t){e.postMessage({msg:o.default.RECOMMEND_SEEKPOINT,data:t})}n.default.install(),e.addEventListener("message",function(n){switch(n.data.cmd){case"init":(t=new r.default(n.data.param[0],n.data.param[1])).on(o.default.IO_ERROR,R.bind(this)),t.on(o.default.DEMUX_ERROR,T.bind(this)),t.on(o.default.INIT_SEGMENT,s.bind(this)),t.on(o.default.MEDIA_SEGMENT,d.bind(this)),t.on(o.default.LOADING_COMPLETE,l.bind(this)),t.on(o.default.RECOVERED_EARLY_EOF,_.bind(this)),t.on(o.default.MEDIA_INFO,u.bind(this)),t.on(o.default.METADATA_ARRIVED,c.bind(this)),t.on(o.default.SCRIPTDATA_ARRIVED,h.bind(this)),t.on(o.default.TIMED_ID3_METADATA_ARRIVED,f.bind(this)),t.on(o.default.PGS_SUBTITLE_ARRIVED,p.bind(this)),t.on(o.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,m.bind(this)),t.on(o.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,g.bind(this)),t.on(o.default.SMPTE2038_METADATA_ARRIVED,v.bind(this)),t.on(o.default.SEI_ARRIVED,y.bind(this)),t.on(o.default.SCTE35_METADATA_ARRIVED,S.bind(this)),t.on(o.default.PES_PRIVATE_DATA_DESCRIPTOR,E.bind(this)),t.on(o.default.PES_PRIVATE_DATA_ARRIVED,A.bind(this)),t.on(o.default.STATISTICS_INFO,b.bind(this)),t.on(o.default.RECOMMEND_SEEKPOINT,L.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var k=n.data.param;a.default.applyConfig(k),!0===k.enableCallback?a.default.addLogListener(i):a.default.removeLogListener(i)}})}},24:function(e,t,i){"use strict";i.r(t),t.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},497:function(e,t,i){e.exports=i(75).default},74:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return y}});var a,n=i(291),r=function(){function e(){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 e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}(),o=i(187),s=i(687),d=i(842),l=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},a(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),_=function(e){function t(t,i){var a=e.call(this,"fetch-stream-loader")||this;return a.TAG="FetchStreamLoader",a._seekHandler=t,a._config=i,a._needStash=!0,a._requestAbort=!1,a._abortController=null,a._contentLength=null,a._receivedLength=0,a}return l(t,e),t.isSupported=function(){try{var e=s.default.msedge&&s.default.version.minor>=15048,t=!s.default.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var a=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(a=e.redirectedURL);var n=this._seekHandler.getConfig(a,t),r=new self.Headers;if("object"==typeof n.headers){var s=n.headers;for(var l in s)s.hasOwnProperty(l)&&r.append(l,s[l])}var _={method:"GET",headers:r,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)r.append(l,this._config.headers[l]);!1===e.cors&&(_.mode="same-origin"),e.withCredentials&&(_.credentials="include"),e.referrerPolicy&&(_.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,_.signal=this._abortController.signal),this._status=o.LoaderStatus.kConnecting,self.fetch(n.url,_).then(function(e){if(i._requestAbort)return i._status=o.LoaderStatus.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==n.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var a=e.headers.get("Content-Length");return null!=a&&(i._contentLength=parseInt(a),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=o.LoaderStatus.kError,!i._onError)throw new d.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=o.LoaderStatus.kError,!i._onError)throw e;i._onError(o.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})}})},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.LoaderStatus.kBuffering||!s.default.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then(function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.LoaderStatus.kError;var a=o.LoaderErrors.EARLY_EOF,n={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new d.RuntimeException(n.msg);t._onError(a,n)}else t._status=o.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.LoaderStatus.kComplete);if(!0===t._requestAbort)return t._status=o.LoaderStatus.kComplete,e.cancel();t._status=o.LoaderStatus.kBuffering;var r=i.value.buffer,s=t._range.from+t._receivedLength;t._receivedLength+=r.byteLength,t._onDataArrival&&t._onDataArrival(r,s,t._receivedLength),t._pump(e)}}).catch(function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.LoaderStatus.kComplete;else if(11!==e.code||!s.default.msedge){t._status=o.LoaderStatus.kError;var i=0,a=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=o.LoaderErrors.EXCEPTION,a={code:e.code,msg:e.message}):(i=o.LoaderErrors.EARLY_EOF,a={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new d.RuntimeException(a.msg);t._onError(i,a)}})},t}(o.BaseLoader),u=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),c=function(e){function t(t,i){var a=e.call(this,"xhr-moz-chunked-loader")||this;return a.TAG="MozChunkedLoader",a._seekHandler=t,a._config=i,a._needStash=!0,a._xhr=null,a._requestAbort=!1,a._contentLength=null,a._receivedLength=0,a}return u(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return n.default.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var a=this._seekHandler.getConfig(i,t);this._requestURL=a.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",a.url,!0),n.responseType="moz-chunked-arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onloadend=this._onLoadEnd.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof a.headers){var r=a.headers;for(var s in r)r.hasOwnProperty(s)&&n.setRequestHeader(s,r[s])}if("object"==typeof this._config.headers)for(var s in r=this._config.headers)r.hasOwnProperty(s)&&n.setRequestHeader(s,r[s]);this._status=o.LoaderStatus.kConnecting,n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.LoaderStatus.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=o.LoaderStatus.kError,!this._onError)throw new d.RuntimeException("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.LoaderStatus.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.LoaderStatus.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.LoaderStatus.kError&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new d.RuntimeException(i.msg);this._onError(t,i)},t}(o.BaseLoader),h=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),f=function(e){function t(t,i){var a=e.call(this,"xhr-range-loader")||this;return a.TAG="RangeLoader",a._seekHandler=t,a._config=i,a._needStash=!1,a._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],a._currentChunkSizeKB=384,a._currentSpeedNormalized=0,a._zeroSpeedChunkCount=0,a._xhr=null,a._speedSampler=new r,a._requestAbort=!1,a._waitForTotalLength=!1,a._totalLengthReceived=!1,a._currentRequestURL=null,a._currentRedirectedURL=null,a._currentRequestRange=null,a._totalLength=null,a._contentLength=null,a._receivedLength=0,a._lastTimeLoaded=0,a}return h(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return n.default.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.LoaderStatus.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var a=this._seekHandler.getConfig(i,t);this._currentRequestURL=a.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",a.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof a.headers){var r=a.headers;for(var o in r)r.hasOwnProperty(o)&&n.setRequestHeader(o,r[o])}if("object"==typeof this._config.headers)for(var o in r=this._config.headers)r.hasOwnProperty(o)&&n.setRequestHeader(o,r[o]);n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.LoaderStatus.kComplete},t.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)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.LoaderStatus.kBuffering}else{if(this._status=o.LoaderStatus.kError,!this._onError)throw new d.RuntimeException("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.LoaderStatus.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var a=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(a)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,a=0,n=0,r=i;if(e<t[0])return t[0];for(;n<=r;){if((a=n+Math.floor((r-n)/2))===i||e>=t[a]&&e<t[a+1])return t[a];t[a]<e?n=a+1:r=a-1}},t.prototype._onLoad=function(e){if(this._status!==o.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var a=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=a.byteLength;var r=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():r=!0,this._onDataArrival&&this._onDataArrival(a,n,this._receivedLength),r&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new d.RuntimeException(i.msg);this._onError(t,i)},t}(o.BaseLoader),p=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),m=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return p(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=o.LoaderStatus.kConnecting}catch(e){this._status=o.LoaderStatus.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new d.RuntimeException(i.msg);this._onError(o.LoaderErrors.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=o.LoaderStatus.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=o.LoaderStatus.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=o.LoaderStatus.kError;var a={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new d.RuntimeException(a.msg);this._onError(o.LoaderErrors.EXCEPTION,a)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=o.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new d.RuntimeException(t.msg);this._onError(o.LoaderErrors.EXCEPTION,t)},t}(o.BaseLoader),g=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var a;a=-1!==t.to?"bytes=".concat(t.from.toString(),"-").concat(t.to.toString()):"bytes=".concat(t.from.toString(),"-"),i.Range=a}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}(),v=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var a=!0;-1===i.indexOf("?")&&(i+="?",a=!1),a&&(i+="&"),i+="".concat(this._startName,"=").concat(t.from.toString()),-1!==t.to&&(i+="&".concat(this._endName,"=").concat(t.to.toString()))}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,a=e.indexOf("?");-1!==a&&(i=e.substring(a+1));var n="";if(null!=i&&i.length>0)for(var r=i.split("&"),o=0;o<r.length;o++){var s=r[o].split("="),d=o>0;s[0]!==this._startName&&s[0]!==this._endName&&(d&&(n+="&"),n+=r[o])}return 0===n.length?t:t+"?"+n},e}(),y=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.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,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new r,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 e.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},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===f?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new g(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new v(t,i)}else{if("custom"!==e.seekType)throw new d.InvalidArgumentException("Invalid seekType in config: ".concat(e.seekType));if("function"!=typeof e.customSeekHandler)throw new d.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=m;else if(_.isSupported())this._loaderClass=_;else if(c.isSupported())this._loaderClass=c;else{if(!f.isSupported())throw new d.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=f}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new d.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var a=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(a,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,a=0,n=0,r=i;if(e<t[0])return t[0];for(;n<=r;){if((a=n+Math.floor((r-n)/2))===i||e>=t[a]&&e<t[a+1])return t[a];t[a]<e?n=a+1:r=a-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new d.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var a=this._speedSampler.lastSecondKBps;if(0!==a){var n=this._normalizeSpeed(a);this._speedNormalized!==n&&(this._speedNormalized=n,this._adjustStashSize(n))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(s=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(s=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var r=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(r,this._stashByteStart))<r.byteLength?l>0&&(_=new Uint8Array(r,l),s.set(_,0),this._stashUsed=_.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(o),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l);else if(0===this._stashUsed){var o;(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&this._expandBuffer(o),(s=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l)}else{var s,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(s=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var _=new Uint8Array(this._stashBuffer,l);s.set(_,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),a=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var r=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,i);r.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=i}return 0}n.default.w(this.TAG,"".concat(a," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,a}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(n.default.e(this.TAG,"Loader error, code = ".concat(t.code,", msg = ").concat(t.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case o.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=o.LoaderErrors.UNRECOVERABLE_EARLY_EOF;case o.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case o.LoaderErrors.CONNECTING_TIMEOUT:case o.LoaderErrors.HTTP_STATUS_CODE_INVALID:case o.LoaderErrors.EXCEPTION:}if(!this._onError)throw new d.RuntimeException("IOException: "+t.msg);this._onError(e,t)},e}()},187:function(e,t,i){"use strict";i.r(t),i.d(t,{BaseLoader:function(){return o},LoaderErrors:function(){return r},LoaderStatus:function(){return n}});var a=i(842),n={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},r={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},o=function(){function e(e){this._type=e||"undefined",this._status=n.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=n.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===n.kConnecting||this._status===n.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new a.NotImplementedException("Unimplemented abstract function!")},e.prototype.abort=function(){throw new a.NotImplementedException("Unimplemented abstract function!")},e}()},75:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return O}});var a=i(760),n=i(74),r={enableWorker:!1,enableWorkerForMSE:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyChasingOnPaused:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,liveSync:!1,liveSyncMaxLatency:1.2,liveSyncTargetLatency:.8,liveSyncPlaybackRate:1.2,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function o(){return Object.assign({},r)}var s=function(){function e(){}return e.supportMSEH264Playback=function(){var e='video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=self.MediaSource&&self.MediaSource.isTypeSupported(e),i=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported(e);return t||i},e.supportMSEH265Playback=function(){var e='video/mp4; codecs="hvc1.1.6.L93.B0"',t=self.MediaSource&&self.MediaSource.isTypeSupported(e),i=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported(e);return t||i},e.supportNetworkStreamIO=function(){var e=new n.default({},o()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.default({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.mseH265Playback=e.supportMSEH265Playback(),t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeMP4H265Playback=e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}(),d=s,l=i(187),_=i(291),u=i(554),c=i.n(u),h=i(339),f=i(768),p=i(902),m=i(136),g=i(952),v=i(842),y=i(125),S=i(687),E=i(14),A=function(){function e(e,t,i){this.TAG="SeekingHandler",this._config=null,this._media_element=null,this._always_seek_keyframe=!1,this._on_unbuffered_seek=null,this._request_set_current_time=!1,this._seek_request_record_clocktime=null,this._idr_sample_list=new E.IDRSampleList,this.e=null,this._config=e,this._media_element=t,this._on_unbuffered_seek=i,this.e={onMediaSeeking:this._onMediaSeeking.bind(this)};var a=S.default.chrome&&(S.default.version.major<50||50===S.default.version.major&&S.default.version.build<2661);this._always_seek_keyframe=!!(a||S.default.msedge||S.default.msie),this._always_seek_keyframe&&(this._config.accurateSeek=!1),this._media_element.addEventListener("seeking",this.e.onMediaSeeking)}return e.prototype.destroy=function(){this._idr_sample_list.clear(),this._idr_sample_list=null,this._media_element.removeEventListener("seeking",this.e.onMediaSeeking),this._media_element=null,this._on_unbuffered_seek=null},e.prototype.seek=function(e){var t=this._isPositionBuffered(e),i=!1;if(e<1&&this._media_element.buffered.length>0){var a=this._media_element.buffered.start(0);(a<1&&e<a||S.default.safari)&&(i=!0,e=S.default.safari?.1:a)}if(i)this.directSeek(e);else if(t)if(this._always_seek_keyframe){var n=this._getNearestKeyframe(Math.floor(1e3*e));null!=n&&(e=n.dts/1e3),this.directSeek(e)}else this.directSeek(e);else this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*e)),this._config.accurateSeek&&this.directSeek(e)},e.prototype.directSeek=function(e){this._request_set_current_time=!0,this._media_element.currentTime=e},e.prototype.appendSyncPoints=function(e){this._idr_sample_list.appendArray(e)},e.prototype._onMediaSeeking=function(t){if(this._request_set_current_time)this._request_set_current_time=!1;else{var i=this._media_element.currentTime,a=this._media_element.buffered;if(i<1&&a.length>0){var n=a.start(0);if(n<1&&i<n||S.default.safari){var r=S.default.safari?.1:n;return void this.directSeek(r)}}if(this._isPositionBuffered(i)){if(this._always_seek_keyframe){var o=this._getNearestKeyframe(Math.floor(1e3*i));null!=o&&(i=o.dts/1e3,this.directSeek(i))}}else this._seek_request_record_clocktime=e._getClockTime(),window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)}},e.prototype._pollAndApplyUnbufferedSeek=function(){if(null!=this._seek_request_record_clocktime)if(this._seek_request_record_clocktime<=e._getClockTime()-100){var t=this._media_element.currentTime;this._seek_request_record_clocktime=null,this._isPositionBuffered(t)||(this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*t)),this._config.accurateSeek&&this.directSeek(t))}else window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)},e.prototype._isPositionBuffered=function(e){for(var t=this._media_element.buffered,i=0;i<t.length;i++){var a=t.start(i),n=t.end(i);if(e>=a&&e<n)return!0}return!1},e.prototype._getNearestKeyframe=function(e){return this._idr_sample_list.getLastSyncPointBeforeDts(e)},e._getClockTime=function(){return self.performance&&self.performance.now?self.performance.now():Date.now()},e}(),b=function(){function e(e,t,i,a){this.TAG="LoadingController",this._config=null,this._media_element=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null,this._paused=!1,this.e=null,this._config=e,this._media_element=t,this._on_pause_transmuxer=i,this._on_resume_transmuxer=a,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)}}return e.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this.e=null,this._media_element=null,this._config=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null},e.prototype.notifyBufferedPositionChanged=function(e){!this._config.isLive&&this._config.lazyLoad&&(null==e?this._suspendTransmuxerIfNeeded():this._suspendTransmuxerIfBufferedPositionExceeded(e))},e.prototype._onMediaTimeUpdate=function(e){this._paused&&this._resumeTransmuxerIfNeeded()},e.prototype._suspendTransmuxerIfNeeded=function(){for(var e=this._media_element.buffered,t=this._media_element.currentTime,i=0,a=0;a<e.length;a++){var n=e.start(a),r=e.end(a);if(n<=t&&t<r){i=r;break}}i>0&&this._suspendTransmuxerIfBufferedPositionExceeded(i)},e.prototype._suspendTransmuxerIfBufferedPositionExceeded=function(e){e>=this._media_element.currentTime+this._config.lazyLoadMaxDuration&&!this._paused&&(_.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this.suspendTransmuxer(),this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate))},e.prototype.suspendTransmuxer=function(){this._paused=!0,this._on_pause_transmuxer()},e.prototype._resumeTransmuxerIfNeeded=function(){for(var e=this._media_element.buffered,t=this._media_element.currentTime,i=this._config.lazyLoadRecoverDuration,a=!1,n=0;n<e.length;n++){var r=e.start(n),o=e.end(n);if(t>=r&&t<o){t>=o-i&&(a=!0);break}}a&&(_.default.v(this.TAG,"Continue loading from paused position"),this.resumeTransmuxer(),this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate))},e.prototype.resumeTransmuxer=function(){this._paused=!1,this._on_resume_transmuxer()},e}(),R=function(){function e(e,t){this.TAG="StartupStallJumper",this._media_element=null,this._on_direct_seek=null,this._canplay_received=!1,this.e=null,this._media_element=e,this._on_direct_seek=t,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 e.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},e.prototype._onMediaCanPlay=function(e){this._canplay_received=!0,this._media_element.removeEventListener("canplay",this.e.onMediaCanPlay)},e.prototype._onMediaStalled=function(e){this._detectAndFixStuckPlayback(!0)},e.prototype._onMediaProgress=function(e){this._detectAndFixStuckPlayback()},e.prototype._detectAndFixStuckPlayback=function(e){var t=this._media_element,i=t.buffered;e||!this._canplay_received||t.readyState<2?i.length>0&&t.currentTime<i.start(0)&&(_.default.w(this.TAG,"Playback seems stuck at ".concat(t.currentTime,", seek to ").concat(i.start(0))),this._on_direct_seek(i.start(0)),this._media_element.removeEventListener("progress",this.e.onMediaProgress)):this._media_element.removeEventListener("progress",this.e.onMediaProgress)},e}(),T=function(){function e(e,t,i){this._config=null,this._media_element=null,this._on_direct_seek=null,this._config=e,this._media_element=t,this._on_direct_seek=i}return e.prototype.destroy=function(){this._on_direct_seek=null,this._media_element=null,this._config=null},e.prototype.notifyBufferedRangeUpdate=function(){this._chaseLiveLatency()},e.prototype._chaseLiveLatency=function(){var e=this._media_element.buffered,t=this._media_element.currentTime,i=this._media_element.paused;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&0!=e.length&&(this._config.liveBufferLatencyChasingOnPaused||!i)){var a=e.end(e.length-1);if(a>this._config.liveBufferLatencyMaxLatency&&a-t>this._config.liveBufferLatencyMaxLatency){var n=a-this._config.liveBufferLatencyMinRemain;this._on_direct_seek(n)}}},e}(),L=function(){function e(e,t){this._config=null,this._media_element=null,this.e=null,this._config=e,this._media_element=t,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)},this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate)}return e.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element=null,this._config=null},e.prototype._onMediaTimeUpdate=function(e){if(this._config.isLive&&this._config.liveSync){var t=this._getCurrentLatency();if(t>this._config.liveSyncMaxLatency){var i=Math.min(2,Math.max(1,this._config.liveSyncPlaybackRate));this._media_element.playbackRate=i}else t>this._config.liveSyncTargetLatency||1!==this._media_element.playbackRate&&0!==this._media_element.playbackRate&&(this._media_element.playbackRate=1)}},e.prototype._getCurrentLatency=function(){if(!this._media_element)return 0;var e=this._media_element.buffered,t=this._media_element.currentTime;return 0==e.length?0:e.end(e.length-1)-t},e}(),k=function(){function e(e,t){this.TAG="PlayerEngineMainThread",this._emitter=new u,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=e,this._config=o(),"object"==typeof t&&Object.assign(this._config,t),!0===e.isLive&&(this._config.isLive=!0),this.e={onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this)}}return e.prototype.destroy=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.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},e.prototype.on=function(e,t){var i=this;this._emitter.addListener(e,t),e===f.default.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.MEDIA_INFO,i.mediaInfo)}):e==f.default.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.STATISTICS_INFO,i.statisticsInfo)})},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;this._media_element=e,e.src="",e.removeAttribute("src"),e.srcObject=null,e.load(),e.addEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._mse_controller=new h.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 t._media_element.currentTime},getReadyState:function(){return t._media_element.readyState}}),this._mse_controller.isManagedMediaSource()?(e.disableRemotePlayback=!0,e.srcObject=this._mse_controller.getObject()):e.src=this._mse_controller.getObjectURL()},e.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)},e.prototype.load=function(){var e=this;if(!this._media_element)throw new v.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new v.IllegalStateException("load() has been called, please call unload() first!");this._has_pending_load||(!this._config.deferLoadAfterSourceOpen||this._mse_source_opened?(this._transmuxer=new p.default(this._media_data_source,this._config),this._transmuxer.on(y.default.INIT_SEGMENT,function(t,i){e._mse_controller.appendInitSegment(i)}),this._transmuxer.on(y.default.MEDIA_SEGMENT,function(t,i){var a;e._mse_controller.appendMediaSegment(i),!e._config.isLive&&"video"===t&&i.data&&i.data.byteLength>0&&"info"in i&&e._seeking_handler.appendSyncPoints(i.info.syncPoints),null===(a=e._loading_controller)||void 0===a||a.notifyBufferedPositionChanged(i.info.endDts/1e3)}),this._transmuxer.on(y.default.LOADING_COMPLETE,function(){var t;e._mse_controller.endOfStream(),null===(t=e._emitter)||void 0===t||t.emit(f.default.LOADING_COMPLETE)}),this._transmuxer.on(y.default.RECOVERED_EARLY_EOF,function(){var t;null===(t=e._emitter)||void 0===t||t.emit(f.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(y.default.IO_ERROR,function(t,i){var a;null===(a=e._emitter)||void 0===a||a.emit(f.default.ERROR,g.ErrorTypes.NETWORK_ERROR,t,i)}),this._transmuxer.on(y.default.DEMUX_ERROR,function(t,i){var a;null===(a=e._emitter)||void 0===a||a.emit(f.default.ERROR,g.ErrorTypes.MEDIA_ERROR,t,i)}),this._transmuxer.on(y.default.MEDIA_INFO,function(t){var i;e._media_info=t,null===(i=e._emitter)||void 0===i||i.emit(f.default.MEDIA_INFO,Object.assign({},t))}),this._transmuxer.on(y.default.STATISTICS_INFO,function(t){var i;e._statistics_info=e._fillStatisticsInfo(t),null===(i=e._emitter)||void 0===i||i.emit(f.default.STATISTICS_INFO,Object.assign({},t))}),this._transmuxer.on(y.default.RECOMMEND_SEEKPOINT,function(t){e._media_element&&!e._config.accurateSeek&&e._seeking_handler.directSeek(t/1e3)}),this._transmuxer.on(y.default.METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.SCRIPTDATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SCRIPTDATA_ARRIVED,t)}),this._transmuxer.on(y.default.TIMED_ID3_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.TIMED_ID3_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.PGS_SUBTITLE_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.PGS_SUBTITLE_ARRIVED,t)}),this._transmuxer.on(y.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.SMPTE2038_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SMPTE2038_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.SEI_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SEI_ARRIVED,t)}),this._transmuxer.on(y.default.SCTE35_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SCTE35_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.PES_PRIVATE_DATA_DESCRIPTOR,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.PES_PRIVATE_DATA_DESCRIPTOR,t)}),this._transmuxer.on(y.default.PES_PRIVATE_DATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.PES_PRIVATE_DATA_ARRIVED,t)}),this._seeking_handler=new A(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new b(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new R(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new T(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new L(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0),this._transmuxer.open()):this._has_pending_load=!0)},e.prototype.unload=function(){var e,t,i,a,n,r,o,s,d;null===(e=this._media_element)||void 0===e||e.pause(),null===(t=this._live_latency_synchronizer)||void 0===t||t.destroy(),this._live_latency_synchronizer=null,null===(i=this._live_latency_chaser)||void 0===i||i.destroy(),this._live_latency_chaser=null,null===(a=this._startup_stall_jumper)||void 0===a||a.destroy(),this._startup_stall_jumper=null,null===(n=this._loading_controller)||void 0===n||n.destroy(),this._loading_controller=null,null===(r=this._seeking_handler)||void 0===r||r.destroy(),this._seeking_handler=null,null===(o=this._mse_controller)||void 0===o||o.flush(),null===(s=this._transmuxer)||void 0===s||s.close(),null===(d=this._transmuxer)||void 0===d||d.destroy(),this._transmuxer=null},e.prototype.play=function(){return this._media_element.play()},e.prototype.pause=function(){this._media_element.pause()},e.prototype.seek=function(e){this._media_element&&this._seeking_handler?this._seeking_handler.seek(e):this._pending_seek_time=e},Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),e.prototype._onMSESourceOpen=function(){this._mse_source_opened=!0,this._has_pending_load&&(this._has_pending_load=!1,this.load())},e.prototype._onMSEUpdateEnd=function(){var e;this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),null===(e=this._loading_controller)||void 0===e||e.notifyBufferedPositionChanged()},e.prototype._onMSEBufferFull=function(){_.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},e.prototype._onMSEError=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(f.default.ERROR,g.ErrorTypes.MEDIA_ERROR,g.ErrorDetails.MEDIA_MSE_ERROR,e)},e.prototype._onMSEStartStreaming=function(){this._loaded_metadata_received&&(this._config.isLive||(_.default.v(this.TAG,"Resume transmuxing task due to ManagedMediaSource onStartStreaming"),this._loading_controller.resumeTransmuxer()))},e.prototype._onMSEEndStreaming=function(){this._config.isLive||(_.default.v(this.TAG,"Suspend transmuxing task due to ManagedMediaSource onEndStreaming"),this._loading_controller.suspendTransmuxer())},e.prototype._onMediaLoadedMetadata=function(e){this._loaded_metadata_received=!0,null!=this._pending_seek_time&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},e.prototype._onRequestDirectSeek=function(e){this._seeking_handler.directSeek(e)},e.prototype._onRequiredUnbufferedSeek=function(e){this._mse_controller.flush(),this._transmuxer.seek(e)},e.prototype._onRequestPauseTransmuxer=function(){this._transmuxer.pause()},e.prototype._onRequestResumeTransmuxer=function(){this._transmuxer.resume()},e.prototype._fillStatisticsInfo=function(e){if(e.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return e;var t=!0,i=0,a=0;if(this._media_element.getVideoPlaybackQuality){var n=this._media_element.getVideoPlaybackQuality();i=n.totalVideoFrames,a=n.droppedVideoFrames}else null!=this._media_element.webkitDecodedFrameCount?(i=this._media_element.webkitDecodedFrameCount,a=this._media_element.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=a),e},e}(),D=i(966),M=i(258),C=function(){function e(e,t){this.TAG="PlayerEngineDedicatedThread",this._emitter=new u,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=e,this._config=o(),"object"==typeof t&&Object.assign(this._config,t),!0===e.isLive&&(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)},M.default.registerListener(this.e.onLoggingConfigChanged),this._worker=D(150,{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:M.default.getConfig()})}return e.isSupported=function(){return!!(self.Worker&&(self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker||self.ManagedMediaSource&&"canConstructInDedicatedWorker"in self.ManagedMediaSource&&!0===self.ManagedMediaSource.canConstructInDedicatedWorker))},e.prototype.destroy=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.default.DESTROYING),this.unload(),this.detachMediaElement(),this._worker_destroying=!0,this._worker.postMessage({cmd:"destroy"}),M.default.removeListener(this.e.onLoggingConfigChanged),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;this._emitter.addListener(e,t),e===f.default.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.MEDIA_INFO,i.mediaInfo)}):e==f.default.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.STATISTICS_INFO,i.statisticsInfo)})},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){this._media_element=e,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"})},e.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)},e.prototype.load=function(){this._worker.postMessage({cmd:"load"}),this._seeking_handler=new A(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new b(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new R(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new T(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new L(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0)},e.prototype.unload=function(){var e,t,i,a,n,r;null===(e=this._media_element)||void 0===e||e.pause(),this._worker.postMessage({cmd:"unload"}),null===(t=this._live_latency_synchronizer)||void 0===t||t.destroy(),this._live_latency_synchronizer=null,null===(i=this._live_latency_chaser)||void 0===i||i.destroy(),this._live_latency_chaser=null,null===(a=this._startup_stall_jumper)||void 0===a||a.destroy(),this._startup_stall_jumper=null,null===(n=this._loading_controller)||void 0===n||n.destroy(),this._loading_controller=null,null===(r=this._seeking_handler)||void 0===r||r.destroy(),this._seeking_handler=null},e.prototype.play=function(){return this._media_element.play()},e.prototype.pause=function(){this._media_element.pause()},e.prototype.seek=function(e){this._media_element&&this._seeking_handler?this._seeking_handler.seek(e):this._pending_seek_time=e},Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),e.prototype._onLoggingConfigChanged=function(e){var t;null===(t=this._worker)||void 0===t||t.postMessage({cmd:"logging_config",logging_config:e})},e.prototype._onMSEUpdateEnd=function(){var e;this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),null===(e=this._loading_controller)||void 0===e||e.notifyBufferedPositionChanged()},e.prototype._onMSEBufferFull=function(){_.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},e.prototype._onMediaLoadedMetadata=function(e){null!=this._pending_seek_time&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},e.prototype._onRequestDirectSeek=function(e){this._seeking_handler.directSeek(e)},e.prototype._onRequiredUnbufferedSeek=function(e){this._worker.postMessage({cmd:"unbuffered_seek",milliseconds:e})},e.prototype._onRequestPauseTransmuxer=function(){this._worker.postMessage({cmd:"pause_transmuxer"})},e.prototype._onRequestResumeTransmuxer=function(){this._worker.postMessage({cmd:"resume_transmuxer"})},e.prototype._onMediaTimeUpdate=function(e){this._worker.postMessage({cmd:"timeupdate",current_time:e.target.currentTime})},e.prototype._onMediaReadyStateChange=function(e){this._worker.postMessage({cmd:"readystatechange",ready_state:e.target.readyState})},e.prototype._onWorkerMessage=function(e){var t,i,a,n,r,o,s=e.data,d=s.msg;if("destroyed"==d||this._worker_destroying)return this._worker_destroying=!1,null===(t=this._worker)||void 0===t||t.terminate(),void(this._worker=null);switch(d){case"mse_init":var l=s;"function"==typeof self.ManagedMediaSource&&!("function"==typeof self.MediaSource)&&(this._media_element.disableRemotePlayback=!0),this._media_element.srcObject=l.handle;break;case"mse_event":(l=s).event==m.default.UPDATE_END?this._onMSEUpdateEnd():l.event==m.default.BUFFER_FULL&&this._onMSEBufferFull();break;case"transmuxing_event":if((l=s).event==y.default.MEDIA_INFO){var u=s;this._media_info=u.info,null===(i=this._emitter)||void 0===i||i.emit(f.default.MEDIA_INFO,Object.assign({},u.info))}else if(l.event==y.default.STATISTICS_INFO){var c=s;this._statistics_info=this._fillStatisticsInfo(c.info),null===(a=this._emitter)||void 0===a||a.emit(f.default.STATISTICS_INFO,Object.assign({},c.info))}else if(l.event==y.default.RECOMMEND_SEEKPOINT){var h=s;this._media_element&&!this._config.accurateSeek&&this._seeking_handler.directSeek(h.milliseconds/1e3)}break;case"player_event":if((l=s).event==f.default.ERROR){var p=s;null===(n=this._emitter)||void 0===n||n.emit(f.default.ERROR,p.error_type,p.error_detail,p.info)}else if("extraData"in l){var g=s;null===(r=this._emitter)||void 0===r||r.emit(g.event,g.extraData)}break;case"logcat_callback":l=s,_.default.emitter.emit("log",l.type,l.logcat);break;case"buffered_position_changed":l=s,null===(o=this._loading_controller)||void 0===o||o.notifyBufferedPositionChanged(l.buffered_position_milliseconds/1e3)}},e.prototype._fillStatisticsInfo=function(e){if(e.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return e;var t=!0,i=0,a=0;if(this._media_element.getVideoPlaybackQuality){var n=this._media_element.getVideoPlaybackQuality();i=n.totalVideoFrames,a=n.droppedVideoFrames}else null!=this._media_element.webkitDecodedFrameCount?(i=this._media_element.webkitDecodedFrameCount,a=this._media_element.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=a),e},e}(),w=function(){function e(e,t){this.TAG="MSEPlayer",this._type="MSEPlayer",this._media_element=null,this._player_engine=null;var i=e.type.toLowerCase();if("mse"!==i&&"mpegts"!==i&&"m2ts"!==i&&"flv"!==i)throw new v.InvalidArgumentException("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");if(t&&t.enableWorkerForMSE&&C.isSupported())try{this._player_engine=new C(e,t)}catch(i){_.default.e(this.TAG,"Error while initializing PlayerEngineDedicatedThread, fallback to PlayerEngineMainThread"),this._player_engine=new k(e,t)}else this._player_engine=new k(e,t)}return e.prototype.destroy=function(){this._player_engine.destroy(),this._player_engine=null,this._media_element=null},e.prototype.on=function(e,t){this._player_engine.on(e,t)},e.prototype.off=function(e,t){this._player_engine.off(e,t)},e.prototype.attachMediaElement=function(e){this._media_element=e,this._player_engine.attachMediaElement(e)},e.prototype.detachMediaElement=function(){this._media_element=null,this._player_engine.detachMediaElement()},e.prototype.load=function(){this._player_engine.load()},e.prototype.unload=function(){this._player_engine.unload()},e.prototype.play=function(){return this._player_engine.play()},e.prototype.pause=function(){this._player_engine.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._media_element.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._media_element.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._media_element.volume},set:function(e){this._media_element.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._media_element.muted},set:function(e){this._media_element.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._media_element?this._media_element.currentTime:0},set:function(e){this._player_engine.seek(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return this._player_engine.mediaInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return this._player_engine.statisticsInfo},enumerable:!1,configurable:!0}),e}(),I=function(){function e(e,t){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(c()),this._config=o(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"===i||"mpegts"===i||"m2ts"===i||"flv"===i)throw new v.InvalidArgumentException("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new v.InvalidArgumentException("NativePlayer(".concat(e.type,") doesn't support multipart playback!"));this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.default.DESTROYING),this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===f.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){var e;null===(e=i._emitter)||void 0===e||e.emit(f.default.MEDIA_INFO,i.mediaInfo)}):e===f.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){var e;null===(e=i._emitter)||void 0===e||e.emit(f.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new v.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)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,a=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,a=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,a=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=a),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){var t;null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),null===(t=this._emitter)||void 0===t||t.emit(f.default.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.default.STATISTICS_INFO,this.statisticsInfo)},e}();a.default.install();var B={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new v.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new v.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new w(i,t);default:return new I(i,t)}},isSupported:function(){return d.supportMSEH264Playback()},getFeatureList:function(){return d.getFeatureList()}};B.BaseLoader=l.BaseLoader,B.LoaderStatus=l.LoaderStatus,B.LoaderErrors=l.LoaderErrors,B.Events=f.default,B.ErrorTypes=g.ErrorTypes,B.ErrorDetails=g.ErrorDetails,B.MSEPlayer=w,B.NativePlayer=I,B.LoggingControl=M.default,Object.defineProperty(B,"version",{enumerable:!0,get:function(){return"1.8.2"}});var O=B},150:function(e,t,i){"use strict";i.r(t);var a=i(291),n=i(258),r=i(842),o=i(136),s=i(339),d=i(902),l=i(125),_=i(768),u=i(952);t.default=function(e){var t="PlayerEngineWorker",i=function(t,i){e.postMessage({msg:"logcat_callback",type:t,logcat:i})}.bind(void 0),c=null,h=null,f=null,p=null,m=!1,g=!1,v=0,y=0,S=!1;function E(){f&&(f.shutdown(),f.destroy(),f=null)}function A(){if(null==c||null==h)throw new r.IllegalStateException("Worker not initialized");if(p)throw new r.IllegalStateException("Transmuxer has been initialized");g||(!h.deferLoadAfterSourceOpen||m?((p=new d.default(c,h)).on(l.default.INIT_SEGMENT,function(e,t){f.appendInitSegment(t)}),p.on(l.default.MEDIA_SEGMENT,function(t,i){f.appendMediaSegment(i),e.postMessage({msg:"buffered_position_changed",buffered_position_milliseconds:i.info.endDts})}),p.on(l.default.LOADING_COMPLETE,function(){f.endOfStream(),e.postMessage({msg:"player_event",event:_.default.LOADING_COMPLETE})}),p.on(l.default.RECOVERED_EARLY_EOF,function(){e.postMessage({msg:"player_event",event:_.default.RECOVERED_EARLY_EOF})}),p.on(l.default.IO_ERROR,function(t,i){e.postMessage({msg:"player_event",event:_.default.ERROR,error_type:u.ErrorTypes.NETWORK_ERROR,error_detail:t,info:i})}),p.on(l.default.DEMUX_ERROR,function(t,i){e.postMessage({msg:"player_event",event:_.default.ERROR,error_type:u.ErrorTypes.MEDIA_ERROR,error_detail:t,info:i})}),p.on(l.default.MEDIA_INFO,function(e){D(l.default.MEDIA_INFO,e)}),p.on(l.default.STATISTICS_INFO,function(e){D(l.default.STATISTICS_INFO,e)}),p.on(l.default.RECOMMEND_SEEKPOINT,function(t){!function(t){e.postMessage({msg:"transmuxing_event",event:l.default.RECOMMEND_SEEKPOINT,milliseconds:t})}(t)}),p.on(l.default.METADATA_ARRIVED,function(e){M(_.default.METADATA_ARRIVED,e)}),p.on(l.default.SCRIPTDATA_ARRIVED,function(e){M(_.default.SCRIPTDATA_ARRIVED,e)}),p.on(l.default.TIMED_ID3_METADATA_ARRIVED,function(e){M(_.default.TIMED_ID3_METADATA_ARRIVED,e)}),p.on(l.default.PGS_SUBTITLE_ARRIVED,function(e){M(_.default.PGS_SUBTITLE_ARRIVED,e)}),p.on(l.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(e){M(_.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,e)}),p.on(l.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(e){M(_.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)}),p.on(l.default.SMPTE2038_METADATA_ARRIVED,function(e){M(_.default.SMPTE2038_METADATA_ARRIVED,e)}),p.on(l.default.SEI_ARRIVED,function(e){M(_.default.SEI_ARRIVED,e)}),p.on(l.default.SCTE35_METADATA_ARRIVED,function(e){M(_.default.SCTE35_METADATA_ARRIVED,e)}),p.on(l.default.PES_PRIVATE_DATA_DESCRIPTOR,function(e){M(_.default.PES_PRIVATE_DATA_DESCRIPTOR,e)}),p.on(l.default.PES_PRIVATE_DATA_ARRIVED,function(e){M(_.default.PES_PRIVATE_DATA_ARRIVED,e)}),p.open()):g=!0)}function b(){f&&f.flush(),p&&(p.close(),p.destroy(),p=null)}function R(){m=!0,g&&(g=!1,A())}function T(){e.postMessage({msg:"mse_event",event:o.default.UPDATE_END})}function L(){a.default.v(t,"MSE SourceBuffer is full, report to main thread"),e.postMessage({msg:"mse_event",event:o.default.BUFFER_FULL})}function k(t){e.postMessage({msg:"player_event",event:_.default.ERROR,error_type:u.ErrorTypes.MEDIA_ERROR,error_detail:u.ErrorTypes.MEDIA_MSE_ERROR,info:t})}function D(t,i){e.postMessage({msg:"transmuxing_event",event:t,info:i})}function M(t,i){e.postMessage({msg:"player_event",event:t,extraData:i})}e.addEventListener("message",function(r){if(!S){var d=r.data;switch(d.cmd){case"logging_config":var l=d;n.default.applyConfig(l.logging_config),!0===l.logging_config.enableCallback?n.default.addLogListener(i):n.default.removeLogListener(i);break;case"init":c=(l=d).media_data_source,h=l.config;break;case"destroy":p&&b(),f&&E(),S=!0,e.postMessage({msg:"destroyed"});break;case"initialize_mse":!function(){a.default.v(t,"Initializing MediaSource in DedicatedWorker"),(f=new s.default(h)).on(o.default.SOURCE_OPEN,R.bind(this)),f.on(o.default.UPDATE_END,T.bind(this)),f.on(o.default.BUFFER_FULL,L.bind(this)),f.on(o.default.ERROR,k.bind(this)),f.initialize({getCurrentTime:function(){return v},getReadyState:function(){return y}});var i=f.getHandle();e.postMessage({msg:"mse_init",handle:i},[i])}();break;case"shutdown_mse":E();break;case"load":A();break;case"unload":b();break;case"unbuffered_seek":l=d,f.flush(),p.seek(l.milliseconds);break;case"timeupdate":v=(l=d).current_time;break;case"readystatechange":y=(l=d).ready_state;break;case"pause_transmuxer":p.pause();break;case"resume_transmuxer":p.resume()}}})}},952:function(e,t,i){"use strict";i.r(t),i.d(t,{ErrorDetails:function(){return o},ErrorTypes:function(){return r}});var a=i(187),n=i(24),r={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},o={NETWORK_EXCEPTION:a.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:a.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:a.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:a.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:n.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:n.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:n.default.CODEC_UNSUPPORTED}},768:function(e,t,i){"use strict";var a;i.r(t),function(e){e.ERROR="error",e.LOADING_COMPLETE="loading_complete",e.RECOVERED_EARLY_EOF="recovered_early_eof",e.MEDIA_INFO="media_info",e.METADATA_ARRIVED="metadata_arrived",e.SCRIPTDATA_ARRIVED="scriptdata_arrived",e.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",e.PGS_SUBTITLE_ARRIVED="pgs_subtitle_arrived",e.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",e.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",e.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",e.SEI_ARRIVED="sei_arrived",e.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",e.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",e.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",e.STATISTICS_INFO="statistics_info",e.DESTROYING="destroying"}(a||(a={})),t.default=a},687:function(e,t,i){"use strict";i.r(t);var a={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},r={};if(n.browser){r[n.browser]=!0;var o=n.majorVersion.split(".");r.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(r.version.minor=parseInt(o[1],10)),o.length>2&&(r.version.build=parseInt(o[2],10))}if(n.platform&&(r[n.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),r.rv||r.iemobile){r.rv&&delete r.rv;var s="msie";n.browser=s,r[s]=!0}if(r.edge){delete r.edge;var d="msedge";n.browser=d,r[d]=!0}if(r.opr){var l="opera";n.browser=l,r[l]=!0}if(r.safari&&r.android){var _="android";n.browser=_,r[_]=!0}for(var u in r.name=n.browser,r.platform=n.platform,a)a.hasOwnProperty(u)&&delete a[u];Object.assign(a,r)}(),t.default=a},842:function(e,t,i){"use strict";i.r(t),i.d(t,{IllegalStateException:function(){return o},InvalidArgumentException:function(){return s},NotImplementedException:function(){return d},RuntimeException:function(){return r}});var a,n=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},a(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),r=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(r),s=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(r),d=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(r)},291:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","error",a),e.ENABLE_ERROR&&(console.error?console.error(a):console.warn?console.warn(a):console.log(a))},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","info",a),e.ENABLE_INFO&&(console.info?console.info(a):console.log(a))},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",a),e.ENABLE_WARN&&(console.warn?console.warn(a):console.log(a))},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",a),e.ENABLE_DEBUG&&(console.debug?console.debug(a):console.log(a))},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",a),e.ENABLE_VERBOSE&&console.log(a)},e}();r.GLOBAL_TAG="mpegts.js",r.FORCE_GLOBAL_TAG=!1,r.ENABLE_ERROR=!0,r.ENABLE_INFO=!0,r.ENABLE_WARN=!0,r.ENABLE_DEBUG=!0,r.ENABLE_VERBOSE=!0,r.ENABLE_CALLBACK=!1,r.emitter=new(n()),t.default=r},258:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=i(291),o=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return r.default.FORCE_GLOBAL_TAG},set:function(t){r.default.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return r.default.GLOBAL_TAG},set:function(t){r.default.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return r.default.ENABLE_VERBOSE&&r.default.ENABLE_DEBUG&&r.default.ENABLE_INFO&&r.default.ENABLE_WARN&&r.default.ENABLE_ERROR},set:function(t){r.default.ENABLE_VERBOSE=t,r.default.ENABLE_DEBUG=t,r.default.ENABLE_INFO=t,r.default.ENABLE_WARN=t,r.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return r.default.ENABLE_DEBUG},set:function(t){r.default.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return r.default.ENABLE_VERBOSE},set:function(t){r.default.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return r.default.ENABLE_INFO},set:function(t){r.default.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return r.default.ENABLE_WARN},set:function(t){r.default.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return r.default.ENABLE_ERROR},set:function(t){r.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:r.default.GLOBAL_TAG,forceGlobalTag:r.default.FORCE_GLOBAL_TAG,enableVerbose:r.default.ENABLE_VERBOSE,enableDebug:r.default.ENABLE_DEBUG,enableInfo:r.default.ENABLE_INFO,enableWarn:r.default.ENABLE_WARN,enableError:r.default.ENABLE_ERROR,enableCallback:r.default.ENABLE_CALLBACK}},e.applyConfig=function(e){r.default.GLOBAL_TAG=e.globalTag,r.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,r.default.ENABLE_VERBOSE=e.enableVerbose,r.default.ENABLE_DEBUG=e.enableDebug,r.default.ENABLE_INFO=e.enableInfo,r.default.ENABLE_WARN=e.enableWarn,r.default.ENABLE_ERROR=e.enableError,r.default.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){r.default.emitter.addListener("log",t),r.default.emitter.listenerCount("log")>0&&(r.default.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){r.default.emitter.removeListener("log",t),0===r.default.emitter.listenerCount("log")&&(r.default.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new(n()),t.default=o},760:function(e,t,i){"use strict";i.r(t);var a=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a)for(var n in a)a.hasOwnProperty(n)&&(t[n]=a[n])}return t},String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(e,t){var i=t>0?0|t:0;return this.substring(i,i+e.length)===e}}),"function"!=typeof self.Promise&&i(191).polyfill()},e}();a.install(),t.default=a},966:function(e,t,i){function a(e){var t={};function i(a){if(t[a])return t[a].exports;var n=t[a]={i:a,id:a,l:!1,loaded:!1,exports:{}};return e[a].call(n.exports,n,n.exports,i),n.l=!0,n.loaded=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t){for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof self)return self}}(),i.p="/";var a=i(ENTRY_MODULE);return a.default||a}var n="[\\.|\\-|\\+|\\w|/|@]+",r="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(e){return!isNaN(1*e)}function d(e,t,a){var d={};d[a]=[];var l=t.toString(),_=l.match(/^(?:function\s*\w*\s*)?\(\s*\w+\s*,\s*\w+\s*,\s*(\w+)\s*\)/);if(!_)return d;for(var u,c=_[1],h=new RegExp("(\\\\n|\\W)"+o(c)+r,"g");u=h.exec(l);)"dll-reference"!==u[3]&&d[a].push(u[3]);for(h=new RegExp("\\("+o(c)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+r,"g");u=h.exec(l);)e[u[2]]||(d[a].push(u[1]),e[u[2]]=i(u[1]).m),d[u[2]]=d[u[2]]||[],d[u[2]].push(u[4]);for(var f=Object.keys(d),p=0;p<f.length;p++)for(var m=0;m<d[f[p]].length;m++)s(d[f[p]][m])&&(d[f[p]][m]=1*d[f[p]][m]);return d}function l(e){return Object.keys(e).reduce(function(t,i){return t||e[i].length>0},!1)}e.exports=function(e,t){t=t||{};var n={main:i.m},r=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},a={main:[]},n={main:{}};l(i);)for(var r=Object.keys(i),o=0;o<r.length;o++){var s=r[o],_=i[s].pop();if(n[s]=n[s]||{},!n[s][_]&&e[s][_]){n[s][_]=!0,a[s]=a[s]||[],a[s].push(_);for(var u=d(e,e[s][_],s),c=Object.keys(u),h=0;h<c.length;h++)i[c[h]]=i[c[h]]||[],i[c[h]]=i[c[h]].concat(u[c[h]])}}return a}(n,e),o="";Object.keys(r).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;r[e][t];)t++;r[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+a.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+r[e].map(function(t){return JSON.stringify(t)+": "+n[e][t].toString()}).join(",")+"});\n"}),o=o+"new (("+a.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+r.main.map(function(e){return JSON.stringify(e)+": "+n.main[e].toString()}).join(",")+"}))(self);";var s=new self.Blob([o],{type:"text/javascript"});if(t.bare)return s;var _=(self.URL||self.webkitURL||self.mozURL||self.msURL).createObjectURL(s),u=new self.Worker(_);return u.objectURL=_,u}}},t={};function i(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,i),r.exports}return i.m=e,i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){if(Array.isArray(t))for(var a=0;a<t.length;){var n=t[a++],r=t[a++];i.o(e,n)?0===r&&a++:0===r?Object.defineProperty(e,n,{enumerable:!0,value:t[a++]}):Object.defineProperty(e,n,{enumerable:!0,get:r})}else for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(497)}()});
|
|
3
|
-
//# sourceMappingURL=mpegts.js.map
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mpegts=t():e.mpegts=t()}(typeof globalThis !== "undefined" ? globalThis : this,function(){return function(){var e={191:function(e,t,i){e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=0,n=void 0,r=void 0,o=function(e,t){h[a]=e,h[a+1]=t,2===(a+=2)&&(r?r(f):y())};var s="undefined"!=typeof window?window:void 0,d=s||{},l=d.MutationObserver||d.WebKitMutationObserver,_="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),u="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function c(){var e=setTimeout;return function(){return e(f,1)}}var h=new Array(1e3);function f(){for(var e=0;e<a;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;a=0}var p,m,g,v,y=void 0;function S(e,t){var i=this,a=new this.constructor(b);void 0===a[A]&&x(a);var n=i._state;if(n){var r=arguments[n-1];o(function(){return O(n,a,r,i._result)})}else I(i,a,e,t);return a}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return D(t,e),t}y=_?function(){return process.nextTick(f)}:l?(m=0,g=new l(f),v=document.createTextNode(""),g.observe(v,{characterData:!0}),function(){v.data=m=++m%2}):u?((p=new MessageChannel).port1.onmessage=f,function(){return p.port2.postMessage(0)}):void 0===s?function(){try{var e=Function("return this")().require("vertx");return void 0!==(n=e.runOnLoop||e.runOnContext)?function(){n(f)}:c()}catch(e){return c()}}():c();var A=Math.random().toString(36).substring(2);function b(){}var R=void 0,T=1,L=2;function k(t,i,a){i.constructor===t.constructor&&a===S&&i.constructor.resolve===E?function(e,t){t._state===T?C(e,t._result):t._state===L?w(e,t._result):I(t,void 0,function(t){return D(e,t)},function(t){return w(e,t)})}(t,i):void 0===a?C(t,i):e(a)?function(e,t,i){o(function(e){var a=!1,n=function(e,t,i,a){try{e.call(t,i,a)}catch(e){return e}}(i,t,function(i){a||(a=!0,t!==i?D(e,i):C(e,i))},function(t){a||(a=!0,w(e,t))},e._label);!a&&n&&(a=!0,w(e,n))},e)}(t,i,a):C(t,i)}function D(e,t){if(e===t)w(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(a=t),null===a||"object"!==n&&"function"!==n)C(e,t);else{var i=void 0;try{i=t.then}catch(t){return void w(e,t)}k(e,t,i)}var a,n}function M(e){e._onerror&&e._onerror(e._result),B(e)}function C(e,t){e._state===R&&(e._result=t,e._state=T,0!==e._subscribers.length&&o(B,e))}function w(e,t){e._state===R&&(e._state=L,e._result=t,o(M,e))}function I(e,t,i,a){var n=e._subscribers,r=n.length;e._onerror=null,n[r]=t,n[r+T]=i,n[r+L]=a,0===r&&e._state&&o(B,e)}function B(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var a=void 0,n=void 0,r=e._result,o=0;o<t.length;o+=3)a=t[o],n=t[o+i],a?O(i,a,n,r):n(r);e._subscribers.length=0}}function O(t,i,a,n){var r=e(a),o=void 0,s=void 0,d=!0;if(r){try{o=a(n)}catch(e){d=!1,s=e}if(i===o)return void w(i,new TypeError("A promises callback cannot return that same promise."))}else o=n;i._state!==R||(r&&d?D(i,o):!1===d?w(i,s):t===T?C(i,o):t===L&&w(i,o))}var P=0;function x(e){e[A]=P++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=function(){function e(e,i){this._instanceConstructor=e,this.promise=new e(b),this.promise[A]||x(this.promise),t(i)?(this.length=i.length,this._remaining=i.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(i),0===this._remaining&&C(this.promise,this._result))):w(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===R&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,a=i.resolve;if(a===E){var n=void 0,r=void 0,o=!1;try{n=e.then}catch(e){o=!0,r=e}if(n===S&&e._state!==R)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(i===N){var s=new i(b);o?w(s,r):k(s,e,n),this._willSettleAt(s,t)}else this._willSettleAt(new i(function(t){return t(e)}),t)}else this._willSettleAt(a(e),t)},e.prototype._settledAt=function(e,t,i){var a=this.promise;a._state===R&&(this._remaining--,e===L?w(a,i):this._result[t]=i),0===this._remaining&&C(a,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;I(e,void 0,function(e){return i._settledAt(T,t,e)},function(e){return i._settledAt(L,t,e)})},e}();var N=function(){function t(e){this[A]=P++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t(function(t){D(e,t)},function(t){w(e,t)})}catch(t){w(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var i=this,a=i.constructor;return e(t)?i.then(function(e){return a.resolve(t()).then(function(){return e})},function(e){return a.resolve(t()).then(function(){throw e})}):i.then(t,t)},t}();return N.prototype.then=S,N.all=function(e){return new U(this,e).promise},N.race=function(e){var i=this;return t(e)?new i(function(t,a){for(var n=e.length,r=0;r<n;r++)i.resolve(e[r]).then(t,a)}):new i(function(e,t){return t(new TypeError("You must pass an array to race."))})},N.resolve=E,N.reject=function(e){var t=new this(b);return w(t,e),t},N._setScheduler=function(e){r=e},N._setAsap=function(e){o=e},N._asap=o,N.polyfill=function(){var e=void 0;if(void 0!==i.g)e=i.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var a=null;try{a=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===a&&!t.cast)return}e.Promise=N},N.Promise=N,N}()},554:function(e){"use strict";var t,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise(function(i,a){function n(i){e.removeListener(t,r),a(i)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}p(e,t,r,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,n)})},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function l(e,t,i,a){var n,r,o,l;if(s(i),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),r=e._events),o=r[t]),void 0===o)o=r[t]=i,++e._eventsCount;else if("function"==typeof o?o=r[t]=a?[i,o]:[o,i]:a?o.unshift(i):o.push(i),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=o.length,l=_,console&&console.warn&&console.warn(l)}return e}function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,i){var a={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=_.bind(a);return n.listener=i,a.wrapFn=n,n}function c(e,t,i){var a=e._events;if(void 0===a)return[];var n=a[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):f(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function f(e,t){for(var i=new Array(t),a=0;a<t;++a)i[a]=e[a];return i}function p(e,t,i,a){if("function"==typeof e.on)a.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function n(r){a.once&&e.removeEventListener(t,n),i(r)})}}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),r.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},r.prototype.getMaxListeners=function(){return d(this)},r.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var d=r[e];if(void 0===d)return!1;if("function"==typeof d)a(d,this,t);else{var l=d.length,_=f(d,l);for(i=0;i<l;++i)a(_[i],this,t)}return!0},r.prototype.addListener=function(e,t){return l(this,e,t,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(e,t){return l(this,e,t,!0)},r.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},r.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},r.prototype.removeListener=function(e,t){var i,a,n,r,o;if(s(t),void 0===(a=this._events))return this;if(void 0===(i=a[e]))return this;if(i===t||i.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete a[e],a.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,r=i.length-1;r>=0;r--)if(i[r]===t||i[r].listener===t){o=i[r].listener,n=r;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(a[e]=i[0]),void 0!==a.removeListener&&this.emit("removeListener",e,o||t)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(e){var t,i,a;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,r=Object.keys(i);for(a=0;a<r.length;++a)"removeListener"!==(n=r[a])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(a=t.length-1;a>=0;a--)this.removeListener(e,t[a]);return this},r.prototype.listeners=function(e){return c(this,e,!0)},r.prototype.rawListeners=function(e){return c(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},r.prototype.listenerCount=h,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},106:function(e,t,i){"use strict";i.r(t);var a=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,a=e.length-1,n=0,r=0,o=a;for(t<e[0]&&(i=0,r=o+1);r<=o;){if((n=r+Math.floor((o-r)/2))===a||t>=e[n]&&t<e[n+1]){i=n;break}e[n]<t?r=n+1:o=n-1}return i},e}();t.default=a},14:function(e,t,i){"use strict";i.r(t),i.d(t,{IDRSampleList:function(){return r},MediaSegmentInfo:function(){return n},MediaSegmentInfoList:function(){return o},SampleInfo:function(){return a}});var a=function(e,t,i,a,n){this.dts=e,this.pts=t,this.duration=i,this.originalDts=a,this.isSyncPoint=n,this.fileposition=null},n=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),r=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,a=t.length-1,n=0,r=0,o=a;for(e<t[0].dts&&(i=0,r=o+1);r<=o;){if((n=r+Math.floor((o-r)/2))===a||e>=t[n].dts&&e<t[n+1].dts){i=n;break}t[n].dts<e?r=n+1:o=n-1}return this._list[i]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,a=0,n=0,r=i,o=0;if(e<t[0].originalBeginDts)return-1;for(;n<=r;){if((a=n+Math.floor((r-n)/2))===i||e>t[a].lastSample.originalDts&&e<t[a+1].originalBeginDts){o=a;break}t[a].originalBeginDts<e?n=a+1:r=a-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,a=this._lastAppendLocation,n=0;-1!==a&&a<t.length&&i.originalBeginDts>=t[a].lastSample.originalDts&&(a===t.length-1||a<t.length-1&&i.originalBeginDts<t[a+1].originalBeginDts)?n=a+1:t.length>0&&(n=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},339:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=i(291),o=i(687),s=i(136),d=i(842),l=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new(n()),this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),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="function"==typeof self.ManagedMediaSource&&!("function"==typeof self.MediaSource),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 e.prototype.destroy=function(){this._mediaSource&&this.shutdown(),this._mediaSourceObjectURL&&this.revokeObjectURL(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.initialize=function(e){if(this._mediaSource)throw new d.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");this._useManagedMediaSource&&r.default.v(this.TAG,"Using ManagedMediaSource");var t=this._mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(t.addEventListener("startstreaming",this.e.onStartStreaming),t.addEventListener("endstreaming",this.e.onEndStreaming),t.addEventListener("qualitychange",this.e.onQualityChange)),this._mediaElementProxy=e},e.prototype.shutdown=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var a=this._sourceBuffers[t];if(a){if("closed"!==e.readyState){try{e.removeSourceBuffer(a)}catch(e){r.default.e(this.TAG,e.message)}a.removeEventListener("error",this.e.onSourceBufferError),a.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){r.default.e(this.TAG,e.message)}this._mediaElementProxy=null,e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(e.removeEventListener("startstreaming",this.e.onStartStreaming),e.removeEventListener("endstreaming",this.e.onEndStreaming),e.removeEventListener("qualitychange",this.e.onQualityChange)),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._mediaSource=null}},e.prototype.isManagedMediaSource=function(){return this._useManagedMediaSource},e.prototype.getObject=function(){if(!this._mediaSource)throw new d.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSource},e.prototype.getHandle=function(){if(!this._mediaSource)throw new d.IllegalStateException("MediaSource has not been initialized yet!");return this._mediaSource.handle},e.prototype.getObjectURL=function(){if(!this._mediaSource)throw new d.IllegalStateException("MediaSource has not been initialized yet!");return null==this._mediaSourceObjectURL&&(this._mediaSourceObjectURL=URL.createObjectURL(this._mediaSource)),this._mediaSourceObjectURL},e.prototype.revokeObjectURL=function(){this._mediaSourceObjectURL&&(URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){var i;if(void 0===t&&(t=void 0),!this._mediaSource||"open"!==this._mediaSource.readyState||!1===this._mediaSource.streaming)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var a=e,n="".concat(a.container);a.codec&&a.codec.length>0&&("opus"===a.codec&&o.default.safari&&(a.codec="Opus"),n+=";codecs=".concat(a.codec));var d=!1;if(r.default.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[a.type]=a,n!==this._mimeTypes[a.type]){if(this._mimeTypes[a.type])r.default.v(this.TAG,"Notice: ".concat(a.type," mimeType changed, origin: ").concat(this._mimeTypes[a.type],", target: ").concat(n));else{d=!0;try{var l=this._sourceBuffers[a.type]=this._mediaSource.addSourceBuffer(n);l.addEventListener("error",this.e.onSourceBufferError),l.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return r.default.e(this.TAG,e.message),void(null===(i=this._emitter)||void 0===i||i.emit(s.default.ERROR,{code:e.code,msg:e.message}))}}this._mimeTypes[a.type]=n}t||this._pendingSegments[a.type].push(a),d||this._sourceBuffers[a.type]&&!this._sourceBuffers[a.type].updating&&this._doAppendSegments(),o.default.safari&&"audio/mpeg"===a.container&&a.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=a.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.flush=function(){for(var e in this._sourceBuffers)if(this._sourceBuffers[e]){var t=this._sourceBuffers[e];if("open"===this._mediaSource.readyState)try{t.abort()}catch(e){r.default.e(this.TAG,e.message)}var i=this._pendingSegments[e];if(i.splice(0,i.length),"closed"!==this._mediaSource.readyState){for(var a=0;a<t.buffered.length;a++){var n=t.buffered.start(a),s=t.buffered.end(a);this._pendingRemoveRanges[e].push({start:n,end:s})}if(t.updating||this._doRemoveRanges(),o.default.safari){var d=this._lastInitSegments[e];d&&(this._pendingSegments[e].push(d),t.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElementProxy.getCurrentTime();for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i)try{var a=i.buffered;if(a&&a.length>=1&&e-a.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}catch(e){}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElementProxy.getCurrentTime();for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var a=i.buffered,n=!1,r=0;r<a.length;r++){var o=a.start(r),s=a.end(r);if(o<=e&&e<s+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){n=!0;var d=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:d})}}else s<e&&(n=!0,this._pendingRemoveRanges[t].push({start:o,end:s}))}n&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElementProxy.getReadyState()&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(r.default.v(this.TAG,"Update MediaSource duration from ".concat(t," to ").concat(i)),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var a=i.shift();t.remove(a.start,a.end)}},e.prototype._doAppendSegments=function(){var e,t,i=this._pendingSegments;for(var a in i)if(this._sourceBuffers[a]&&!this._sourceBuffers[a].updating&&!1!==this._mediaSource.streaming&&i[a].length>0){var n=i[a].shift();if("number"==typeof n.timestampOffset&&isFinite(n.timestampOffset)){var o=this._sourceBuffers[a].timestampOffset,d=n.timestampOffset/1e3;Math.abs(o-d)>.1&&(r.default.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(o," to ").concat(d)),this._sourceBuffers[a].timestampOffset=d),delete n.timestampOffset}if(!n.data||0===n.data.byteLength)continue;try{this._sourceBuffers[a].appendBuffer(n.data),this._isBufferFull=!1}catch(i){this._pendingSegments[a].unshift(n),22===i.code?(this._isBufferFull||null===(e=this._emitter)||void 0===e||e.emit(s.default.BUFFER_FULL),this._isBufferFull=!0):(r.default.e(this.TAG,i.message),null===(t=this._emitter)||void 0===t||t.emit(s.default.ERROR,{code:i.code,msg:i.message}))}}},e.prototype._onSourceOpen=function(){var e;if(r.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var t=this._pendingSourceBufferInit;t.length;){var i=t.shift();this.appendInitSegment(i,!0)}this._hasPendingSegments()&&this._doAppendSegments(),null===(e=this._emitter)||void 0===e||e.emit(s.default.SOURCE_OPEN)},e.prototype._onStartStreaming=function(){var e;r.default.v(this.TAG,"ManagedMediaSource onStartStreaming"),null===(e=this._emitter)||void 0===e||e.emit(s.default.START_STREAMING)},e.prototype._onEndStreaming=function(){var e;r.default.v(this.TAG,"ManagedMediaSource onEndStreaming"),null===(e=this._emitter)||void 0===e||e.emit(s.default.END_STREAMING)},e.prototype._onQualityChange=function(){r.default.v(this.TAG,"ManagedMediaSource onQualityChange")},e.prototype._onSourceEnded=function(){r.default.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){r.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(this._mediaSource.removeEventListener("startstreaming",this.e.onStartStreaming),this._mediaSource.removeEventListener("endstreaming",this.e.onEndStreaming),this._mediaSource.removeEventListener("qualitychange",this.e.onQualityChange)))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){var e;this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),null===(e=this._emitter)||void 0===e||e.emit(s.default.UPDATE_END)},e.prototype._onSourceBufferError=function(e){r.default.e(this.TAG,"SourceBuffer Error: ".concat(e))},e}();t.default=l},136:function(e,t,i){"use strict";var a;i.r(t),function(e){e.ERROR="error",e.SOURCE_OPEN="source_open",e.UPDATE_END="update_end",e.BUFFER_FULL="buffer_full",e.START_STREAMING="start_streaming",e.END_STREAMING="end_streaming"}(a||(a={})),t.default=a},902:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=i(966),o=i.n(r),s=i(291),d=i(258),l=i(385),_=i(125),u=(i(944),i(106)),c=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new(n()),t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=o()(944),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},d.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:d.default.getConfig()})}catch(i){s.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new l.default(e,t)}else this._controller=new l.default(e,t);if(this._controller){var i=this._controller;i.on(_.default.IO_ERROR,this._onIOError.bind(this)),i.on(_.default.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(_.default.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(_.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(_.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(_.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(_.default.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(_.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(_.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(_.default.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),i.on(_.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,this._onSynchronousKLVMetadataArrived.bind(this)),i.on(_.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,this._onAsynchronousKLVMetadataArrived.bind(this)),i.on(_.default.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),i.on(_.default.SEI_ARRIVED,this._onSEIArrived.bind(this)),i.on(_.default.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),i.on(_.default.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),i.on(_.default.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),i.on(_.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(_.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),d.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.INIT_SEGMENT,e,t)})},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.MEDIA_SEGMENT,e,t)})},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then(function(){var t;null===(t=e._emitter)||void 0===t||t.emit(_.default.LOADING_COMPLETE)})},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then(function(){var t;null===(t=e._emitter)||void 0===t||t.emit(_.default.RECOVERED_EARLY_EOF)})},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.MEDIA_INFO,e)})},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.METADATA_ARRIVED,e)})},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SCRIPTDATA_ARRIVED,e)})},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.TIMED_ID3_METADATA_ARRIVED,e)})},e.prototype._onPGSSubtitleArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.PGS_SUBTITLE_ARRIVED,e)})},e.prototype._onSynchronousKLVMetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,e)})},e.prototype._onAsynchronousKLVMetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)})},e.prototype._onSMPTE2038MetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SMPTE2038_METADATA_ARRIVED,e)})},e.prototype._onSEIArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SEI_ARRIVED,e)})},e.prototype._onSCTE35MetadataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.SCTE35_METADATA_ARRIVED,e)})},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.PES_PRIVATE_DATA_DESCRIPTOR,e)})},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.PES_PRIVATE_DATA_ARRIVED,e)})},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.STATISTICS_INFO,e)})},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.IO_ERROR,e,t)})},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then(function(){var a;null===(a=i._emitter)||void 0===a||a.emit(_.default.DEMUX_ERROR,e,t)})},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){var i;null===(i=t._emitter)||void 0===i||i.emit(_.default.RECOMMEND_SEEKPOINT,e)})},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t,i,a,n,r,o,d=e.data,l=d.data;if("destroyed"===d.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(d.msg){case _.default.INIT_SEGMENT:case _.default.MEDIA_SEGMENT:null===(t=this._emitter)||void 0===t||t.emit(d.msg,l.type,l.data);break;case _.default.LOADING_COMPLETE:case _.default.RECOVERED_EARLY_EOF:null===(i=this._emitter)||void 0===i||i.emit(d.msg);break;case _.default.MEDIA_INFO:Object.setPrototypeOf(l,u.default.prototype),null===(a=this._emitter)||void 0===a||a.emit(d.msg,l);break;case _.default.METADATA_ARRIVED:case _.default.SCRIPTDATA_ARRIVED:case _.default.TIMED_ID3_METADATA_ARRIVED:case _.default.PGS_SUBTITLE_ARRIVED:case _.default.SYNCHRONOUS_KLV_METADATA_ARRIVED:case _.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED:case _.default.SMPTE2038_METADATA_ARRIVED:case _.default.SCTE35_METADATA_ARRIVED:case _.default.SEI_ARRIVED:case _.default.PES_PRIVATE_DATA_DESCRIPTOR:case _.default.PES_PRIVATE_DATA_ARRIVED:case _.default.STATISTICS_INFO:null===(n=this._emitter)||void 0===n||n.emit(d.msg,l);break;case _.default.IO_ERROR:case _.default.DEMUX_ERROR:null===(r=this._emitter)||void 0===r||r.emit(d.msg,l.type,l.info);break;case _.default.RECOMMEND_SEEKPOINT:null===(o=this._emitter)||void 0===o||o.emit(d.msg,l);break;case"logcat_callback":s.default.emitter.emit("log",l.type,l.logcat)}},e}();t.default=c},385:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return Ge}});var a=i(554),n=i.n(a),r=i(291),o=i(687),s=i(106);function d(e,t,i){var a=e;if(t+i<a.length){for(;i--;)if(128!=(192&a[++t]))return!1;return!0}return!1}var l,_=function(e){for(var t=[],i=e,a=0,n=e.length;a<n;)if(i[a]<128)t.push(String.fromCharCode(i[a])),++a;else{if(i[a]<192);else if(i[a]<224){if(d(i,a,1)&&(r=(31&i[a])<<6|63&i[a+1])>=128){t.push(String.fromCharCode(65535&r)),a+=2;continue}}else if(i[a]<240){if(d(i,a,2)&&(r=(15&i[a])<<12|(63&i[a+1])<<6|63&i[a+2])>=2048&&55296!=(63488&r)){t.push(String.fromCharCode(65535&r)),a+=3;continue}}else if(i[a]<248){var r;if(d(i,a,3)&&(r=(7&i[a])<<18|(63&i[a+1])<<12|(63&i[a+2])<<6|63&i[a+3])>65536&&r<1114112){r-=65536,t.push(String.fromCharCode(r>>>10|55296)),t.push(String.fromCharCode(1023&r|56320)),a+=4;continue}}t.push(String.fromCharCode(65533)),++a}return t.join("")},u=i(842),c=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]),h=function(){function e(){}return e.parseScriptData=function(t,i,a){var n={};try{var o=e.parseValue(t,i,a),s=e.parseValue(t,i+o.size,a-o.size);n[o.data]=s.data}catch(e){r.default.e("AMF",e.toString())}return n},e.parseObject=function(t,i,a){if(a<3)throw new u.IllegalStateException("Data not enough when parse ScriptDataObject");var n=e.parseString(t,i,a),r=e.parseValue(t,i+n.size,a-n.size),o=r.objectEnd;return{data:{name:n.data,value:r.data},size:n.size+r.size,objectEnd:o}},e.parseVariable=function(t,i,a){return e.parseObject(t,i,a)},e.parseString=function(e,t,i){if(i<2)throw new u.IllegalStateException("Data not enough when parse String");var a=new DataView(e,t,i).getUint16(0,!c);return{data:a>0?_(new Uint8Array(e,t+2,a)):"",size:2+a}},e.parseLongString=function(e,t,i){if(i<4)throw new u.IllegalStateException("Data not enough when parse LongString");var a=new DataView(e,t,i).getUint32(0,!c);return{data:a>0?_(new Uint8Array(e,t+4,a)):"",size:4+a}},e.parseDate=function(e,t,i){if(i<10)throw new u.IllegalStateException("Data size invalid when parse Date");var a=new DataView(e,t,i),n=a.getFloat64(0,!c),r=a.getInt16(8,!c);return{data:new Date(n+=60*r*1e3),size:10}},e.parseValue=function(t,i,a){if(a<1)throw new u.IllegalStateException("Data not enough when parse Value");var n,o=new DataView(t,i,a),s=1,d=o.getUint8(0),l=!1;try{switch(d){case 0:n=o.getFloat64(1,!c),s+=8;break;case 1:n=!!o.getUint8(1),s+=1;break;case 2:var _=e.parseString(t,i+1,a-1);n=_.data,s+=_.size;break;case 3:n={};var h=0;for(9==(16777215&o.getUint32(a-4,!c))&&(h=3);s<a-4;){var f=e.parseObject(t,i+s,a-s-h);if(f.objectEnd)break;n[f.data.name]=f.data.value,s+=f.size}s<=a-3&&9==(16777215&o.getUint32(s-1,!c))&&(s+=3);break;case 8:for(n={},s+=4,h=0,9==(16777215&o.getUint32(a-4,!c))&&(h=3);s<a-8;){var p=e.parseVariable(t,i+s,a-s-h);if(p.objectEnd)break;n[p.data.name]=p.data.value,s+=p.size}s<=a-3&&9==(16777215&o.getUint32(s-1,!c))&&(s+=3);break;case 9:n=void 0,s=1,l=!0;break;case 10:n=[];var m=o.getUint32(1,!c);s+=4;for(var g=0;g<m;g++){var v=e.parseValue(t,i+s,a-s);n.push(v.data),s+=v.size}break;case 11:var y=e.parseDate(t,i+1,a-1);n=y.data,s+=y.size;break;case 12:var S=e.parseString(t,i+1,a-1);n=S.data,s+=S.size;break;default:s=a,r.default.w("AMF","Unsupported AMF value type "+d)}}catch(e){r.default.e("AMF",e.toString())}return{data:n,size:s,objectEnd:l}},e}(),f=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new u.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new u.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var a=e-this._current_word_bits_left;this._fillCurrentWord();var n=Math.min(a,this._current_word_bits_left),r=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,i<<n|r},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(this._current_word&2147483648>>>e)return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),p=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)},e.parseSPS=function(t){for(var i=t.subarray(1,4),a="avc1.",n=0;n<3;n++){var r=i[n].toString(16);r.length<2&&(r="0"+r),a+=r}var o=e._ebsp2rbsp(t),s=new f(o);s.readByte();var d=s.readByte();s.readByte();var l=s.readByte();s.readUEG();var _=e.getProfileString(d),u=e.getLevelString(l),c=1,h=420,p=8,m=8;if((100===d||110===d||122===d||244===d||44===d||83===d||86===d||118===d||128===d||138===d||144===d)&&(3===(c=s.readUEG())&&s.readBits(1),c<=3&&(h=[0,420,422,444][c]),p=s.readUEG()+8,m=s.readUEG()+8,s.readBits(1),s.readBool()))for(var g=3!==c?8:12,v=0;v<g;v++)s.readBool()&&(v<6?e._skipScalingList(s,16):e._skipScalingList(s,64));s.readUEG();var y=s.readUEG();if(0===y)s.readUEG();else if(1===y){s.readBits(1),s.readSEG(),s.readSEG();var S=s.readUEG();for(v=0;v<S;v++)s.readSEG()}var E=s.readUEG();s.readBits(1);var A=s.readUEG(),b=s.readUEG(),R=s.readBits(1);0===R&&s.readBits(1),s.readBits(1);var T=0,L=0,k=0,D=0;s.readBool()&&(T=s.readUEG(),L=s.readUEG(),k=s.readUEG(),D=s.readUEG());var M=1,C=1,w=0,I=!0,B=0,O=0;if(s.readBool()){if(s.readBool()){var P=s.readByte();P>0&&P<16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][P-1],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][P-1]):255===P&&(M=s.readByte()<<8|s.readByte(),C=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 x=s.readBits(32),U=s.readBits(32);I=s.readBool(),w=(B=U)/(O=2*x)}}var N=1;1===M&&1===C||(N=M/C);var V=0,G=0;0===c?(V=1,G=2-R):(V=3===c?1:2,G=(1===c?2:1)*(2-R));var F=16*(A+1),j=16*(b+1)*(2-R);F-=(T+L)*V,j-=(k+D)*G;var z=Math.ceil(F*N);return s.destroy(),s=null,{codec_mimetype:a,profile_idc:d,level_idc:l,profile_string:_,level_string:u,chroma_format_idc:c,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:m,ref_frames:E,chroma_format:h,chroma_format_string:e.getChromaFormatString(h),frame_rate:{fixed:I,fps:w,fps_den:O,fps_num:B},sar_ratio:{width:M,height:C},codec_size:{width:F,height:j},present_size:{width:z,height:j}}},e._skipScalingList=function(e,t){for(var i=8,a=8,n=0;n<t;n++)0!==a&&(a=(i+e.readSEG()+256)%256),i=0===a?i:a},e.getProfileString=function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}(),m=i(24),g=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)},e.parseVPS=function(t){var i=e._ebsp2rbsp(t),a=new f(i);return a.readByte(),a.readByte(),a.readBits(4),a.readBits(2),a.readBits(6),{num_temporal_layers:a.readBits(3)+1,temporal_id_nested:a.readBool()}},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),a=new f(i);a.readByte(),a.readByte();for(var n=0,r=0,o=0,s=0,d=(a.readBits(4),a.readBits(3)),l=(a.readBool(),a.readBits(2)),_=a.readBool(),u=a.readBits(5),c=a.readByte(),h=a.readByte(),p=a.readByte(),m=a.readByte(),g=a.readByte(),v=a.readByte(),y=a.readByte(),S=a.readByte(),E=a.readByte(),A=a.readByte(),b=a.readByte(),R=[],T=[],L=0;L<d;L++)R.push(a.readBool()),T.push(a.readBool());if(d>0)for(L=d;L<8;L++)a.readBits(2);for(L=0;L<d;L++)R[L]&&(a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte(),a.readByte()),T[L]&&a.readByte();a.readUEG();var k=a.readUEG();3==k&&a.readBits(1);var D=a.readUEG(),M=a.readUEG();a.readBool()&&(n+=a.readUEG(),r+=a.readUEG(),o+=a.readUEG(),s+=a.readUEG());var C=a.readUEG(),w=a.readUEG(),I=a.readUEG();for(L=a.readBool()?0:d;L<=d;L++)a.readUEG(),a.readUEG(),a.readUEG();if(a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readBool()&&a.readBool())for(var B=0;B<4;B++)for(var O=0;O<(3===B?2:6);O++)if(a.readBool()){var P=Math.min(64,1<<4+(B<<1));for(B>1&&a.readSEG(),L=0;L<P;L++)a.readSEG()}else a.readUEG();a.readBool(),a.readBool(),a.readBool()&&(a.readByte(),a.readUEG(),a.readUEG(),a.readBool());var x=a.readUEG(),U=0;for(L=0;L<x;L++){var N=!1;if(0!==L&&(N=a.readBool()),N){L===x&&a.readUEG(),a.readBool(),a.readUEG();for(var V=0,G=0;G<=U;G++){var F=a.readBool(),j=!1;F||(j=a.readBool()),(F||j)&&V++}U=V}else{var z=a.readUEG(),H=a.readUEG();for(U=z+H,G=0;G<z;G++)a.readUEG(),a.readBool();for(G=0;G<H;G++)a.readUEG(),a.readBool()}}if(a.readBool()){var q=a.readUEG();for(L=0;L<q;L++){for(G=0;G<I+4;G++)a.readBits(1);a.readBits(1)}}var K=0,W=1,Y=1,X=!1,Q=1,J=1;if(a.readBool(),a.readBool(),a.readBool()){if(a.readBool()){var Z=a.readByte();Z>0&&Z<=16?(W=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][Z-1],Y=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][Z-1]):255===Z&&(W=a.readBits(16),Y=a.readBits(16))}if(a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(3),a.readBool(),a.readBool()&&(a.readByte(),a.readByte(),a.readByte())),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool(),a.readBool(),a.readBool(),a.readBool()&&(a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG()),a.readBool()&&(Q=a.readBits(32),J=a.readBits(32),a.readBool()&&a.readUEG(),a.readBool())){var $,ee,te=!1;for($=a.readBool(),ee=a.readBool(),($||ee)&&((te=a.readBool())&&(a.readByte(),a.readBits(5),a.readBool(),a.readBits(5)),a.readBits(4),a.readBits(4),te&&a.readBits(4),a.readBits(5),a.readBits(5),a.readBits(5)),L=0;L<=d;L++){var ie=a.readBool();X=ie;var ae=!0,ne=1;ie||(ae=a.readBool());var re=!1;if(ae?a.readUEG():re=a.readBool(),re||(ne=a.readUEG()+1),$){for(G=0;G<ne;G++)a.readUEG(),a.readUEG(),te&&(a.readUEG(),a.readUEG());a.readBool()}if(ee){for(G=0;G<ne;G++)a.readUEG(),a.readUEG(),te&&(a.readUEG(),a.readUEG());a.readBool()}}}a.readBool()&&(a.readBool(),a.readBool(),a.readBool(),K=a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG())}a.readBool();var oe="hvc1.".concat(u,".1.L").concat(b,".B0"),se=D-(n+r)*(1===k||2===k?2:1),de=M-(o+s)*(1===k?2:1),le=1;return 1!==W&&1!==Y&&(le=W/Y),a.destroy(),a=null,{codec_mimetype:oe,profile_string:e.getProfileString(u),level_string:e.getLevelString(b),profile_idc:u,bit_depth:C+8,ref_frames:1,chroma_format:k,chroma_format_string:e.getChromaFormatString(k),general_level_idc:b,general_profile_space:l,general_tier_flag:_,general_profile_idc:u,general_profile_compatibility_flags_1:c,general_profile_compatibility_flags_2:h,general_profile_compatibility_flags_3:p,general_profile_compatibility_flags_4:m,general_constraint_indicator_flags_1:g,general_constraint_indicator_flags_2:v,general_constraint_indicator_flags_3:y,general_constraint_indicator_flags_4:S,general_constraint_indicator_flags_5:E,general_constraint_indicator_flags_6:A,min_spatial_segmentation_idc:K,constant_frame_rate:0,chroma_format_idc:k,bit_depth_luma_minus8:C,bit_depth_chroma_minus8:w,frame_rate:{fixed:X,fps:J/Q,fps_den:Q,fps_num:J},sar_ratio:{width:W,height:Y},codec_size:{width:se,height:de},present_size:{width:se*le,height:de}}},e.parsePPS=function(t){var i=e._ebsp2rbsp(t),a=new f(i);a.readByte(),a.readByte(),a.readUEG(),a.readUEG(),a.readBool(),a.readBool(),a.readBits(3),a.readBool(),a.readBool(),a.readUEG(),a.readUEG(),a.readSEG(),a.readBool(),a.readBool(),a.readBool()&&a.readUEG(),a.readSEG(),a.readSEG(),a.readBool(),a.readBool(),a.readBool(),a.readBool();var n=a.readBool(),r=a.readBool(),o=1;return r&&n?o=0:r?o=3:n&&(o=2),{parallelismType:o}},e.getChromaFormatString=function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},e.getProfileString=function(e){switch(e){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}},e.getLevelString=function(e){return(e/30).toFixed(1)},e}();function v(e){return e.byteOffset%2==0&&e.byteLength%2==0}function y(e){return e.byteOffset%4==0&&e.byteLength%4==0}function S(e,t){for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}var E=function(e,t){return e.byteLength===t.byteLength&&(y(e)&&y(t)?function(e,t){return S(new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4),new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4))}(e,t):v(e)&&v(t)?function(e,t){return S(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2))}(e,t):function(e,t){return S(e,t)}(e,t))},A=function(){return A=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},A.apply(this,arguments)},b=function(){function e(){}return e.parseOBUs=function(t,i){for(var a=0;a<t.byteLength;){var n=a,r=(t[a],(120&t[a])>>3),o=!!(4&t[a]),s=!!(2&t[a]);t[a],a+=1,o&&(a+=1);var d=Number.POSITIVE_INFINITY;if(s){d=0;for(var l=0;;l++){var _=t[a++];if(d|=(127&_)<<7*l,!(128&_))break}}console.log(r),1===r?i=A(A({},e.parseSeuqneceHeader(t.subarray(a,a+d))),{sequence_header_data:t.subarray(n,a+d)}):(3==r&&i||6==r&&i)&&(i=e.parseOBUFrameHeader(t.subarray(a,a+d),0,0,i)),a+=d}return i},e.parseSeuqneceHeader=function(t){var i=new f(t),a=i.readBits(3),n=(i.readBool(),i.readBool()),r=!0,o=0,s=1,d=void 0,l=[];if(n)l.push({operating_point_idc:0,level:i.readBits(5),tier:0});else{if(i.readBool()){var _=i.readBits(32),u=i.readBits(32),c=i.readBool();if(c){for(var h=0;0===i.readBits(1);)h+=1;h>=32||i.readBits(h)}o=u,s=_,r=c,i.readBool()&&(i.readBits(5),i.readBits(32),d=i.readBits(5),i.readBits(5))}for(var p=i.readBool(),m=i.readBits(5),g=0;g<=m;g++){var v=i.readBits(12),y=i.readBits(5),S=y>7?i.readBits(1):0;l.push({operating_point_idc:v,level:y,tier:S}),p&&i.readBool()&&i.readBits(4)}}var E=l[0],A=E.level,b=E.tier,R=i.readBits(4),T=i.readBits(4),L=i.readBits(R+1)+1,k=i.readBits(T+1)+1,D=!1;n||(D=i.readBool()),D&&(i.readBits(4),i.readBits(4)),i.readBool(),i.readBool(),i.readBool();var M=!1,C=2,w=2,I=0;n||(i.readBool(),i.readBool(),i.readBool(),i.readBool(),(M=i.readBool())&&(i.readBool(),i.readBool()),w=(C=i.readBool()?2:i.readBits(1))?i.readBool()?2:i.readBits(1):2,I=M?i.readBits(3)+1:0);var B=i.readBool(),O=(i.readBool(),i.readBool(),i.readBool()),P=8;P=2===a&&O?i.readBool()?12:10:O?10:8;var x=!1;1!==a&&(x=i.readBool()),i.readBool()&&(i.readBits(8),i.readBits(8),i.readBits(8));var U=1,N=1;return x?(i.readBits(1),U=1,N=1):(i.readBits(1),0==a?(U=1,N=1):1==a?(U=0,N=0):12==P?i.readBits(1)&&i.readBits(1):(U=1,N=0),U&&N&&i.readBits(2),i.readBits(1)),i.readBool(),i.destroy(),i=null,{codec_mimetype:"av01.".concat(a,".").concat(e.getLevelString(A,b),".").concat(P.toString(10).padStart(2,"0")),level:A,tier:b,level_string:e.getLevelString(A,b),profile_idc:a,profile_string:"".concat(a),bit_depth:P,ref_frames:1,chroma_format:e.getChromaFormat(x,U,N),chroma_format_string:e.getChromaFormatString(x,U,N),sequence_header:{frame_id_numbers_present_flag:D,additional_frame_id_length_minus_1:void 0,delta_frame_id_length_minus_2:void 0,reduced_still_picture_header:n,decoder_model_info_present_flag:!1,operating_points:l,buffer_removal_time_length_minus_1:d,equal_picture_interval:r,seq_force_screen_content_tools:C,seq_force_integer_mv:w,enable_order_hint:M,order_hint_bits:I,enable_superres:B,frame_width_bit:R+1,frame_height_bit:T+1,max_frame_width:L,max_frame_height:k},keyframe:void 0,frame_rate:{fixed:r,fps:o/s,fps_den:s,fps_num:o}}},e.parseOBUFrameHeader=function(t,i,a,n){var r=n.sequence_header,o=new f(t),s=(r.max_frame_width,r.max_frame_height,0);r.frame_id_numbers_present_flag&&(s=r.additional_frame_id_length_minus_1+r.delta_frame_id_length_minus_2+3);var d=0,l=!0,_=!0,u=!1;if(!r.reduced_still_picture_header){if(o.readBool())return n;l=2===(d=o.readBits(2))||0===d,(_=o.readBool())&&r.decoder_model_info_present_flag&&r.equal_picture_interval,_&&o.readBool(),u=!!(3===d||0===d&&_)||o.readBool()}n.keyframe=l,o.readBool();var c=r.seq_force_screen_content_tools;2===r.seq_force_screen_content_tools&&(c=o.readBits(1)),c&&(r.seq_force_integer_mv,2==r.seq_force_integer_mv&&o.readBits(1)),r.frame_id_numbers_present_flag&&o.readBits(s);var h;if(h=3==d||!r.reduced_still_picture_header&&o.readBool(),o.readBits(r.order_hint_bits),l||u||o.readBits(3),r.decoder_model_info_present_flag&&o.readBool())for(var p=0;p<=r.operating_points_cnt_minus_1;p++)if(r.operating_points[p].decoder_model_present_for_this_op[p]){var m=r.operating_points[p].operating_point_idc;(0===m||m>>i&1&&m>>a+8&1)&&o.readBits(r.buffer_removal_time_length_minus_1+1)}var g=255;if(3===d||0==d&&_||(g=o.readBits(8)),(l||255!==g)&&u&&r.enable_order_hint)for(var v=0;v<8;v++)o.readBits(r.order_hint_bits);if(l){var y=e.frameSizeAndRenderSize(o,h,r);n.codec_size={width:y.FrameWidth,height:y.FrameHeight},n.present_size={width:y.RenderWidth,height:y.RenderHeight},n.sar_ratio={width:y.RenderWidth/y.FrameWidth,height:y.RenderHeight/y.FrameHeight}}return o.destroy(),o=null,n},e.frameSizeAndRenderSize=function(e,t,i){var a=i.max_frame_width,n=i.max_frame_height;t&&(a=e.readBits(i.frame_width_bit)+1,n=e.readBits(i.frame_height_bit)+1);var r=!1;i.enable_superres&&(r=e.readBool());var o=8;r&&(o=e.readBits(3)+9);var s=a;a=Math.floor((8*s+o/2)/o);var d=s,l=n;if(e.readBool()){var _=e.readBits(16)+1,u=e.readBits(16)+1;d=e.readBits(_)+1,l=e.readBits(u)+1}return{UpscaledWidth:s,FrameWidth:a,FrameHeight:n,RenderWidth:d,RenderHeight:l}},e.getLevelString=function(e,t){return"".concat(e.toString(10).padStart(2,"0")).concat(0===t?"M":"H")},e.getChromaFormat=function(e,t,i){return e?0:0===t&&0===i?3:1===t&&0===i?2:1===t&&1===i?1:Number.NaN},e.getChromaFormatString=function(e,t,i){return e?"4:0:0":0===t&&0===i?"4:4:4":1===t&&0===i?"4:2:2":1===t&&1===i?"4:2:0":"Unknown"},e}(),R=function(){};function T(e,t,i){if(!e||e.byteLength<2)return null;var a=1;"h265"===i&&(a=2);var n=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)}(e.subarray(a)),r=0;if(r===n.byteLength-1&&128===n[r])return null;for(var o=0;r<n.byteLength&&255===n[r];)o+=255,r++;if(r>=n.byteLength)return null;o+=n[r++];for(var s=0;r<n.byteLength&&255===n[r];)s+=255,r++;if(r>=n.byteLength)return null;if(s+=n[r++],r+s>n.byteLength)return null;var d=new R;d.type=o,d.size=s;var l=n.subarray(r,r+s);return 5===o&&s>=16&&(d.uuid=l.subarray(0,16),d.user_data=l.subarray(16)),void 0!==t&&(d.pts=t),d}var L,k=function(){function e(e,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=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new s.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=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return e.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},e.probe=function(e){var t=new Uint8Array(e);if(t.byteLength<9)return{needMoreData:!0};var i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var a,n=(4&t[4])>>>2!=0,r=!!(1&t[4]),o=(a=t)[5]<<24|a[6]<<16|a[7]<<8|a[8];return o<9?i:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:n,hasVideoTrack:r}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeiArrived",{get:function(){return this._onSeiArrived},set:function(e){this._onSeiArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new s.default},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new u.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var a=0,n=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;a=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+a!==this._dataOffset&&r.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(o=new DataView(t,a)).getUint32(0,!n)&&r.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),a+=4);a<t.byteLength;){this._dispatch=!0;var o=new DataView(t,a);if(a+11+4>t.byteLength)break;var s=o.getUint8(0),d=16777215&o.getUint32(0,!n);if(a+11+d+4>t.byteLength)break;if(8===s||9===s||18===s){var l=o.getUint8(4),_=o.getUint8(5),c=o.getUint8(6)|_<<8|l<<16|o.getUint8(7)<<24;16777215&o.getUint32(7,!n)&&r.default.w(this.TAG,"Meet tag which has StreamID != 0!");var h=a+11;switch(s){case 8:this._parseAudioData(t,h,d,c);break;case 9:this._parseVideoData(t,h,d,c,i+a);break;case 18:this._parseScriptData(t,h,d)}var f=o.getUint32(11+d,!n);f!==11+d&&r.default.w(this.TAG,"Invalid PrevTagSize ".concat(f)),a+=11+d+4}else r.default.w(this.TAG,"Unsupported tag type ".concat(s,", skipped")),a+=11+d+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),a},e.prototype._parseScriptData=function(e,t,i){var a=h.parseScriptData(e,t,i);if(a.hasOwnProperty("onMetaData")){if(null==a.onMetaData||"object"!=typeof a.onMetaData)return void r.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&r.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=a;var n=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},n)),"boolean"==typeof n.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=n.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof n.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=n.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof n.audiodatarate&&(this._mediaInfo.audioDataRate=n.audiodatarate),"number"==typeof n.videodatarate&&(this._mediaInfo.videoDataRate=n.videodatarate),"number"==typeof n.width&&(this._mediaInfo.width=n.width),"number"==typeof n.height&&(this._mediaInfo.height=n.height),"number"==typeof n.duration){if(!this._durationOverrided){var o=Math.floor(n.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if("number"==typeof n.framerate){var s=Math.floor(1e3*n.framerate);if(s>0){var d=s/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=d,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=d}}if("object"==typeof n.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var l=n.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),n.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=n,r.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))},e.prototype._parseSEIPayload=function(e,t,i){var a=T(e,t,i);a&&"function"==typeof this._onSeiArrived&&this._onSeiArrived(a)},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],a=1;a<e.times.length;a++){var n=this._timestampBase+Math.floor(1e3*e.times[a]);t.push(n),i.push(e.filepositions[a])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,a){if(i<=1)r.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var n=new DataView(e,t,i).getUint8(0),o=n>>>4;if(9!==o)if(2===o||3===o||10===o){var s=0,d=(12&n)>>>2;if(d>=0&&d<=4){s=this._flvSoundRateTable[d];var l=(2&n)>>>1,_=1&n,u=this._audioMetadata,c=this._audioTrack;if(u||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(u=this._audioMetadata={}).type="audio",u.id=c.id,u.timescale=this._timescale,u.duration=this._duration,u.audioSampleRate=s,u.channelCount=0===_?1:2),10===o){var h=this._parseAACAudioData(e,t+1,i-1);if(null==h)return;if(0===h.packetType){if(u.config){if(E(h.data.config,u.config))return;r.default.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var f=h.data;u.audioSampleRate=f.samplingRate,u.channelCount=f.channelCount,u.codec=f.codec,u.originalCodec=f.originalCodec,u.config=f.config,u.refSampleDuration=1024/u.audioSampleRate*u.timescale,r.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",u),(y=this._mediaInfo).audioCodec=u.originalCodec,y.audioSampleRate=u.audioSampleRate,y.audioChannelCount=u.channelCount,y.hasVideo?null!=y.videoCodec&&(y.mimeType='video/x-flv; codecs="'+y.videoCodec+","+y.audioCodec+'"'):y.mimeType='video/x-flv; codecs="'+y.audioCodec+'"',y.isComplete()&&this._onMediaInfo(y)}else if(1===h.packetType){var p=this._timestampBase+a,g={unit:h.data,length:h.data.byteLength,dts:p,pts:p};c.samples.push(g),c.length+=h.data.length}else r.default.e(this.TAG,"Flv: Unsupported AAC data type ".concat(h.packetType))}else if(2===o){if(!u.codec){if(null==(f=this._parseMP3AudioData(e,t+1,i-1,!0)))return;u.audioSampleRate=f.samplingRate,u.channelCount=f.channelCount,u.codec=f.codec,u.originalCodec=f.originalCodec,u.refSampleDuration=1152/u.audioSampleRate*u.timescale,r.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",u),(y=this._mediaInfo).audioCodec=u.codec,y.audioSampleRate=u.audioSampleRate,y.audioChannelCount=u.channelCount,y.audioDataRate=f.bitRate,y.hasVideo?null!=y.videoCodec&&(y.mimeType='video/x-flv; codecs="'+y.videoCodec+","+y.audioCodec+'"'):y.mimeType='video/x-flv; codecs="'+y.audioCodec+'"',y.isComplete()&&this._onMediaInfo(y)}if(null==(S=this._parseMP3AudioData(e,t+1,i-1,!1)))return;p=this._timestampBase+a;var v={unit:S,length:S.byteLength,dts:p,pts:p};c.samples.push(v),c.length+=S.length}else if(3===o){var y;u.codec||(u.audioSampleRate=s,u.sampleSize=8*(l+1),u.littleEndian=!0,u.codec="ipcm",u.originalCodec="ipcm",this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",u),(y=this._mediaInfo).audioCodec=u.codec,y.audioSampleRate=u.audioSampleRate,y.audioChannelCount=u.channelCount,y.audioDataRate=u.sampleSize*u.audioSampleRate,y.hasVideo?null!=y.videoCodec&&(y.mimeType='video/x-flv; codecs="'+y.videoCodec+","+y.audioCodec+'"'):y.mimeType='video/x-flv; codecs="'+y.audioCodec+'"',y.isComplete()&&this._onMediaInfo(y));var S=new Uint8Array(e,t+1,i-1),A=(p=this._timestampBase+a,{unit:S,length:S.byteLength,dts:p,pts:p});c.samples.push(A),c.length+=S.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: "+o);else{if(i<=5)return void r.default.w(this.TAG,"Flv: Invalid audio packet, missing AudioFourCC in Ehnanced FLV payload!");var b=15&n,R=String.fromCharCode.apply(String,new Uint8Array(e,t,i).slice(1,5));switch(R){case"Opus":this._parseOpusAudioPacket(e,t+5,i-5,a,b);break;case"fLaC":this._parseFlacAudioPacket(e,t+5,i-5,a,b);break;default:this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec: "+R)}}}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var a={},n=new Uint8Array(e,t,i);return a.packetType=n[0],0===n[0]?a.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):a.data=n.subarray(1),a}r.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var a,n,r=new Uint8Array(e,t,i),o=null,s=0,d=null;if(s=a=r[0]>>>3,(n=(7&r[0])<<1|r[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(m.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var l=this._mpegSamplingRates[n],_=(120&r[1])>>>3;if(!(_<0||_>=8)){5===s&&(d=(7&r[1])<<1|r[2]>>>7,r[2]);var u=self.navigator.userAgent.toLowerCase();return-1!==u.indexOf("firefox")?n>=6?(s=5,o=new Array(4),d=n-3):(s=2,o=new Array(2),d=n):-1!==u.indexOf("android")?(s=2,o=new Array(2),d=n):(s=5,d=n,o=new Array(4),n>=6?d=n-3:1===_&&(s=2,o=new Array(2),d=n)),o[0]=s<<3,o[0]|=(15&n)>>>1,o[1]=(15&n)<<7,o[1]|=(15&_)<<3,5===s&&(o[1]|=(15&d)>>>1,o[2]=(1&d)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:l,channelCount:_,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+a}}this._onError(m.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,a){if(!(i<4)){this._littleEndian;var n=new Uint8Array(e,t,i),o=null;if(a){if(255!==n[0])return;var s=n[1]>>>3&3,d=(6&n[1])>>1,l=(240&n[2])>>>4,_=(12&n[2])>>>2,u=3&~(n[3]>>>6)?2:1,c=0,h=0;switch(s){case 0:c=this._mpegAudioV25SampleRateTable[_];break;case 2:c=this._mpegAudioV20SampleRateTable[_];break;case 3:c=this._mpegAudioV10SampleRateTable[_]}switch(d){case 1:l<this._mpegAudioL3BitRateTable.length&&(h=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(h=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(h=this._mpegAudioL1BitRateTable[l])}o={bitRate:h,samplingRate:c,channelCount:u,codec:"mp3",originalCodec:"mp3"}}else o=n;return o}r.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseOpusAudioPacket=function(e,t,i,a,n){if(0===n)this._parseOpusSequenceHeader(e,t,i);else if(1===n)this._parseOpusAudioData(e,t,i,a);else if(2!==n)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(n))},e.prototype._parseOpusSequenceHeader=function(e,t,i){if(i<=16)r.default.w(this.TAG,"Flv: Invalid OpusSequenceHeader, lack of data!");else{var a=this._audioMetadata,n=this._audioTrack;a||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(a=this._audioMetadata={}).type="audio",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration);var o=new DataView(e,t,i);o.setUint8(8,0);var s=o.getUint8(9);o.setUint16(10,o.getUint16(10,!0),!1);var d=o.getUint32(12,!0);o.setUint32(12,o.getUint32(12,!0),!1);var l={config:new Uint8Array(e,t+8,i-8),channelCount:s,samplingFrequence:d,codec:"opus",originalCodec:"opus"};if(a.config){if(E(l.config,a.config))return;r.default.w(this.TAG,"OpusSequenceHeader has been changed, re-generate initialization segment")}a.audioSampleRate=l.samplingFrequence,a.channelCount=l.channelCount,a.codec=l.codec,a.originalCodec=l.originalCodec,a.config=l.config,a.refSampleDuration=20,r.default.v(this.TAG,"Parsed OpusSequenceHeader"),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 _=this._mediaInfo;_.audioCodec=a.originalCodec,_.audioSampleRate=a.audioSampleRate,_.audioChannelCount=a.channelCount,_.hasVideo?null!=_.videoCodec&&(_.mimeType='video/x-flv; codecs="'+_.videoCodec+","+_.audioCodec+'"'):_.mimeType='video/x-flv; codecs="'+_.audioCodec+'"',_.isComplete()&&this._onMediaInfo(_)}},e.prototype._parseOpusAudioData=function(e,t,i,a){var n=this._audioTrack,r=new Uint8Array(e,t,i),o=this._timestampBase+a,s={unit:r,length:r.byteLength,dts:o,pts:o};n.samples.push(s),n.length+=r.length},e.prototype._parseFlacAudioPacket=function(e,t,i,a,n){if(0===n)this._parseFlacSequenceHeader(e,t,i);else if(1===n)this._parseFlacAudioData(e,t,i,a);else if(2!==n)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid Flac audio packet type ".concat(n))},e.prototype._parseFlacSequenceHeader=function(e,t,i){var a=this._audioMetadata,n=this._audioTrack;a||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(a=this._audioMetadata={}).type="audio",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration);var o=new Uint8Array(e,t+4,i-4),s=new f(o),d=s.readBits(16),l=s.readBits(16),_=l===d?l:null;s.readBits(24),s.readBits(24);var u=s.readBits(20),c=s.readBits(3)+1,h=s.readBits(5)+1;s.destroy();var p=new Uint8Array(o.byteLength+4);p.set(o,4),p[0]=128,p[1]=o.byteLength>>>16&255,p[2]=o.byteLength>>>8&255,p[3]=o.byteLength>>>0&255;var m={config:p,channelCount:c,samplingFrequence:u,sampleSize:h,codec:"flac",originalCodec:"flac"};if(a.config){if(E(m.config,a.config))return;r.default.w(this.TAG,"FlacSequenceHeader has been changed, re-generate initialization segment")}a.audioSampleRate=m.samplingFrequence,a.channelCount=m.channelCount,a.sampleSize=m.sampleSize,a.codec=m.codec,a.originalCodec=m.originalCodec,a.config=m.config,a.refSampleDuration=null!=_?1e3*_/m.samplingFrequence:null,r.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 g=this._mediaInfo;g.audioCodec=a.originalCodec,g.audioSampleRate=a.audioSampleRate,g.audioChannelCount=a.channelCount,g.hasVideo?null!=g.videoCodec&&(g.mimeType='video/x-flv; codecs="'+g.videoCodec+","+g.audioCodec+'"'):g.mimeType='video/x-flv; codecs="'+g.audioCodec+'"',g.isComplete()&&this._onMediaInfo(g)},e.prototype._parseFlacAudioData=function(e,t,i,a){var n=this._audioTrack,r=new Uint8Array(e,t,i),o=this._timestampBase+a,s={unit:r,length:r.byteLength,dts:o,pts:o};n.samples.push(s),n.length+=r.length},e.prototype._parseVideoData=function(e,t,i,a,n){if(i<=1)r.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,i)[0],s=(112&o)>>>4;if(128&o){var d=15&o,l=String.fromCharCode.apply(String,new Uint8Array(e,t,i).slice(1,5));if("hvc1"===l)this._parseEnhancedHEVCVideoPacket(e,t+5,i-5,a,n,s,d);else{if("av01"!==l)return void this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(l));this._parseEnhancedAV1VideoPacket(e,t+5,i-5,a,n,s,d)}}else{var _=15&o;if(7===_)this._parseAVCVideoPacket(e,t+1,i-1,a,n,s);else{if(12!==_)return void this._onError(m.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(_));this._parseHEVCVideoPacket(e,t+1,i-1,a,n,s)}}}},e.prototype._parseAVCVideoPacket=function(e,t,i,a,n,o){if(i<4)r.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var s=this._littleEndian,d=new DataView(e,t,i),l=d.getUint8(0),_=(16777215&d.getUint32(0,!s))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseAVCVideoData(e,t+4,i-4,a,n,o,_);else if(2!==l)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}},e.prototype._parseHEVCVideoPacket=function(e,t,i,a,n,o){if(i<4)r.default.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var s=this._littleEndian,d=new DataView(e,t,i),l=d.getUint8(0),_=(16777215&d.getUint32(0,!s))<<8>>8;if(0===l)this._parseHEVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseHEVCVideoData(e,t+4,i-4,a,n,o,_);else if(2!==l)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}},e.prototype._parseEnhancedHEVCVideoPacket=function(e,t,i,a,n,r,o){var s=this._littleEndian,d=new DataView(e,t,i);if(0===o)this._parseHEVCDecoderConfigurationRecord(e,t,i);else if(1===o){var l=(4294967040&d.getUint32(0,!s))>>8;this._parseHEVCVideoData(e,t+3,i-3,a,n,r,l)}else if(3===o)this._parseHEVCVideoData(e,t,i,a,n,r,0);else if(2!==o)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(o))},e.prototype._parseEnhancedAV1VideoPacket=function(e,t,i,a,n,r,o){if(this._littleEndian,new DataView(e,t,i),0===o)this._parseAV1CodecConfigurationRecord(e,t,i);else if(1===o)this._parseAV1VideoData(e,t,i,a,n,r,0);else{if(5===o)return void this._onError(m.default.FORMAT_ERROR,"Flv: Not Supported MP2T AV1 video packet type ".concat(o));if(2!==o)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(o))}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)r.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var a=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,i);if(a){if(void 0!==a.avcc){var d=new Uint8Array(e,t,i);if(E(d,a.avcc))return;r.default.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(a=this._videoMetadata={}).type="video",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration;var l=s.getUint8(0),_=s.getUint8(1);if(s.getUint8(2),s.getUint8(3),1===l&&0!==_)if(this._naluLengthSize=1+(3&s.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var u=31&s.getUint8(5);if(0!==u){u>1&&r.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(u));for(var c=6,h=0;h<u;h++){var f=s.getUint16(c,!o);if(c+=2,0!==f){var g=new Uint8Array(e,t+c,f);c+=f;var v=p.parseSPS(g);if(0===h){a.codecWidth=v.codec_size.width,a.codecHeight=v.codec_size.height,a.presentWidth=v.present_size.width,a.presentHeight=v.present_size.height,a.profile=v.profile_string,a.level=v.level_string,a.bitDepth=v.bit_depth,a.chromaFormat=v.chroma_format,a.sarRatio=v.sar_ratio,a.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(a.frameRate=this._referenceFrameRate);var y=a.frameRate.fps_den,S=a.frameRate.fps_num;a.refSampleDuration=a.timescale*(y/S);for(var A=g.subarray(1,4),b="avc1.",R=0;R<3;R++){var T=A[R].toString(16);T.length<2&&(T="0"+T),b+=T}a.codec=b;var L=this._mediaInfo;L.width=a.codecWidth,L.height=a.codecHeight,L.fps=a.frameRate.fps,L.profile=a.profile,L.level=a.level,L.refFrames=v.ref_frames,L.chromaFormat=v.chroma_format_string,L.sarNum=a.sarRatio.width,L.sarDen=a.sarRatio.height,L.videoCodec=b,L.hasAudio?null!=L.audioCodec&&(L.mimeType='video/x-flv; codecs="'+L.videoCodec+","+L.audioCodec+'"'):L.mimeType='video/x-flv; codecs="'+L.videoCodec+'"',L.isComplete()&&this._onMediaInfo(L)}}}var k=s.getUint8(c);if(0!==k){for(k>1&&r.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(k)),c++,h=0;h<k;h++)f=s.getUint16(c,!o),c+=2,0!==f&&(c+=f);a.avcc=new Uint8Array(i),a.avcc.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",a)}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(m.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseHEVCDecoderConfigurationRecord=function(e,t,i){if(i<22)r.default.w(this.TAG,"Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!");else{var a=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,i);if(a){if(void 0!==a.hvcc){var d=new Uint8Array(e,t,i);if(E(d,a.hvcc))return;r.default.w(this.TAG,"HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(a=this._videoMetadata={}).type="video",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration;var l=s.getUint8(0),_=31&s.getUint8(1);if(0!==l&&1!==l||0===_)this._onError(m.default.FORMAT_ERROR,"Flv: Invalid HEVCDecoderConfigurationRecord");else if(this._naluLengthSize=1+(3&s.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var u=s.getUint8(22),c=0,h=23;c<u;c++){var f=63&s.getUint8(h+0),p=s.getUint16(h+1,!o);h+=3;for(var v=0;v<p;v++){var y=s.getUint16(h+0,!o);if(0===v)if(33===f){h+=2;var S=new Uint8Array(e,t+h,y),A=g.parseSPS(S);a.codecWidth=A.codec_size.width,a.codecHeight=A.codec_size.height,a.presentWidth=A.present_size.width,a.presentHeight=A.present_size.height,a.profile=A.profile_string,a.level=A.level_string,a.bitDepth=A.bit_depth,a.chromaFormat=A.chroma_format,a.sarRatio=A.sar_ratio,a.frameRate=A.frame_rate,!1!==A.frame_rate.fixed&&0!==A.frame_rate.fps_num&&0!==A.frame_rate.fps_den||(a.frameRate=this._referenceFrameRate);var b=a.frameRate.fps_den,R=a.frameRate.fps_num;a.refSampleDuration=a.timescale*(b/R),a.codec=A.codec_mimetype;var T=this._mediaInfo;T.width=a.codecWidth,T.height=a.codecHeight,T.fps=a.frameRate.fps,T.profile=a.profile,T.level=a.level,T.refFrames=A.ref_frames,T.chromaFormat=A.chroma_format_string,T.sarNum=a.sarRatio.width,T.sarDen=a.sarRatio.height,T.videoCodec=A.codec_mimetype,T.hasAudio?null!=T.audioCodec&&(T.mimeType='video/x-flv; codecs="'+T.videoCodec+","+T.audioCodec+'"'):T.mimeType='video/x-flv; codecs="'+T.videoCodec+'"',T.isComplete()&&this._onMediaInfo(T),h+=y}else h+=2+y;else h+=2+y}}a.hvcc=new Uint8Array(i),a.hvcc.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Parsed HEVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",a)}else this._onError(m.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1))}},e.prototype._parseAV1CodecConfigurationRecord=function(e,t,i){if(i<4)r.default.w(this.TAG,"Flv: Invalid AV1CodecConfigurationRecord, lack of data!");else{var a=this._videoMetadata,n=this._videoTrack,o=(this._littleEndian,new DataView(e,t,i));a?void 0!==a.av1c&&r.default.w(this.TAG,"Found another AV1CodecConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(a=this._videoMetadata={}).type="video",a.id=n.id,a.timescale=this._timescale,a.duration=this._duration);var s=127&o.getUint8(0);if(o.getUint8(1),o.getUint8(1),o.getUint8(2),1===s){var d=b.parseOBUs(new Uint8Array(e,t+4,i-4));if(null!=d){a.profile=d.profile_string,a.level=d.level_string,a.bitDepth=d.bit_depth,a.chromaFormat=d.chroma_format,a.frameRate=d.frame_rate,!1!==d.frame_rate.fixed&&0!==d.frame_rate.fps_num&&0!==d.frame_rate.fps_den||(a.frameRate=this._referenceFrameRate);var l=a.frameRate.fps_den,_=a.frameRate.fps_num;a.refSampleDuration=a.timescale*(l/_),a.codec=d.codec_mimetype,a.extra=d;var u=this._mediaInfo;u.fps=a.frameRate.fps,u.profile=a.profile,u.level=a.level,u.refFrames=d.ref_frames,u.chromaFormat=d.chroma_format_string,u.videoCodec=d.codec_mimetype,u.hasAudio?null!=u.audioCodec&&(u.mimeType='video/x-flv; codecs="'+u.videoCodec+","+u.audioCodec+'"'):u.mimeType='video/x-flv; codecs="'+u.videoCodec+'"',u.isComplete()&&this._onMediaInfo(u),a.av1c=new Uint8Array(i),a.av1c.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Preparing AV1CodecConfigurationRecord")}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}else this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,a,n,o,s){for(var d=this._littleEndian,l=new DataView(e,t,i),_=[],u=0,c=0,h=this._naluLengthSize,f=this._timestampBase+a,p=1===o;c<i;){if(c+4>=i){r.default.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(c,", dataSize = ").concat(i));break}var m=l.getUint32(c,!d);if(3===h&&(m>>>=8),m>i-h)return void r.default.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var g=31&l.getUint8(c+h);5===g&&(p=!0);var v=new Uint8Array(e,t+c,h+m),y={type:g,data:v};_.push(y),u+=v.byteLength,6===g&&this._parseSEIPayload(v.subarray(h),f+s,"h264"),c+=h+m}if(_.length){var S=this._videoTrack,E={units:_,length:u,isKeyframe:p,dts:f,cts:s,pts:f+s};p&&(E.fileposition=n),S.samples.push(E),S.length+=u}},e.prototype._parseHEVCVideoData=function(e,t,i,a,n,o,s){for(var d=this._littleEndian,l=new DataView(e,t,i),_=[],u=0,c=0,h=this._naluLengthSize,f=this._timestampBase+a,p=1===o;c<i;){if(c+4>=i){r.default.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(c,", dataSize = ").concat(i));break}var m=l.getUint32(c,!d);if(3===h&&(m>>>=8),m>i-h)return void r.default.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var g=l.getUint8(c+h)>>1&63;19!==g&&20!==g&&21!==g||(p=!0);var v=new Uint8Array(e,t+c,h+m),y={type:g,data:v};_.push(y),u+=v.byteLength,39!==g&&40!==g||this._parseSEIPayload(v.subarray(h),f+s,"h265"),c+=h+m}if(_.length){var S=this._videoTrack,E={units:_,length:u,isKeyframe:p,dts:f,cts:s,pts:f+s};p&&(E.fileposition=n),S.samples.push(E),S.length+=u}},e.prototype._parseAV1VideoData=function(e,t,i,a,n,o,s){this._littleEndian,new DataView(e,t,i);var d,l=[],_=this._timestampBase+a,u=1===o;if(u){var c=this._videoMetadata,h=b.parseOBUs(new Uint8Array(e,t,i),c.extra);if(null==h)return void this._onError(m.default.FORMAT_ERROR,"Flv: Invalid AV1 VideoData");console.log(h),c.codecWidth=h.codec_size.width,c.codecHeight=h.codec_size.height,c.presentWidth=h.present_size.width,c.presentHeight=h.present_size.height,c.sarRatio=h.sar_ratio;var f=this._mediaInfo;f.width=c.codecWidth,f.height=c.codecHeight,f.sarNum=c.sarRatio.width,f.sarDen=c.sarRatio.height,r.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",c)}if(d=i,l.push({unitType:0,data:new Uint8Array(e,t+0,i)}),l.length){var p=this._videoTrack,g={units:l,length:d,isKeyframe:u,dts:_,cts:s,pts:_+s};u&&(g.fileposition=n),p.samples.push(g),p.length+=d}},e}(),D=k,M=function(){function e(){}return e.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},e}(),C=function(){this.program_pmt_pid={}};!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kLOASAAC=17]="kLOASAAC",e[e.kAC3=129]="kAC3",e[e.kEAC3=135]="kEAC3",e[e.kMetadata=21]="kMetadata",e[e.kSCTE35=134]="kSCTE35",e[e.kPGS=144]="kPGS",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(L||(L={}));var w,I=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={}},B=function(){},O=function(){},P=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(w||(w={}));var x,U,N=function(){},V=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},G=function(){function e(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not find H264 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var a=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===a||1===n)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,a=31&e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3],n=(128&e[i])>>>7,r=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=r,!(a>=w.kReserved0)&&0===n){var o=e.subarray(i,r);(t=new N).type=a,t.data=o}}return t},e}(),F=function(){function e(e,t,i){var a=8+e.byteLength+1+2+t.byteLength,n=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(n=!0,a+=4);var r=this.data=new Uint8Array(a);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var o=e.byteLength;r[6]=o>>>8,r[7]=255&o;var s=8;r.set(e,8),r[s+=o]=1;var d=t.byteLength;r[s+1]=d>>>8,r[s+2]=255&d,r.set(t,s+3),s+=3+d,n&&(r[s]=252|i.chroma_format_idc,r[s+1]=248|i.bit_depth_luma-8,r[s+2]=248|i.bit_depth_chroma-8,r[s+3]=0,s+=4)}return e.prototype.getData=function(){return this.data},e}();!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(x||(x={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(U||(U={}));var j,z,H=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],q=(j=function(e,t){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},j(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}j(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),K=function(){},W=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return q(t,e),t}(K),Y=function(){function e(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found ADTS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=(8&e[i+1])>>>3,n=(6&e[i+1])>>>1,r=1&e[i+1],o=(192&e[i+2])>>>6,s=(60&e[i+2])>>>2,d=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var _=1===r?7:9,u=l-_;i+=_;var c=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=c,(0===a||1===a)&&0===n){var h=e.subarray(i,i+u);(t=new K).audio_object_type=o+1,t.sampling_freq_index=s,t.sampling_frequency=H[s],t.channel_config=d,t.data=h}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),X=function(){function e(e){this.TAG="AACLOASParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found LOAS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695==(i[t+0]<<3|i[t+1]>>>5))return t;t++}},e.prototype.getLATMValue=function(e){for(var t=e.readBits(2),i=0,a=0;a<=t;a++)i<<=8,i|=e.readByte();return i},e.prototype.readNextAACFrame=function(e){for(var t=this.data_,i=null;null==i&&!this.eof_flag_;){var a=this.current_syncword_offset_,n=(31&t[a+1])<<8|t[a+2];if(a+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var o=new f(t.subarray(a+3,a+3+n)),s=null;if(o.readBool()){if(null==e){r.default.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(a+3+n),o.destroy();continue}s=e}else{var d=o.readBool();if(d&&o.readBool()){r.default.e(this.TAG,"audioMuxVersionA is Not Supported"),o.destroy();break}if(d&&this.getLATMValue(o),!o.readBool()){r.default.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){r.default.e(this.TAG,"more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){r.default.e(this.TAG,"more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){r.default.e(this.TAG,"more than 2 numLayer Not Supported"),o.destroy();break}var l=d?this.getLATMValue(o):0,_=o.readBits(5);l-=5;var u=o.readBits(4);l-=4;var c=o.readBits(4);l-=4,o.readBits(3),(l-=3)>0&&o.readBits(l);var h=o.readBits(3);if(0!==h){r.default.e(this.TAG,"frameLengthType = ".concat(h,". Only frameLengthType = 0 Supported")),o.destroy();break}o.readByte();var p=o.readBool();if(p)if(d)this.getLATMValue(o);else{for(var m=0;;){m<<=8;var g=o.readBool();if(m+=o.readByte(),!g)break}console.log(m)}o.readBool()&&o.readByte(),(s=new W).audio_object_type=_,s.sampling_freq_index=u,s.sampling_frequency=H[s.sampling_freq_index],s.channel_config=c,s.other_data_present=p}for(var v=0;;){var y=o.readByte();if(v+=y,255!==y)break}for(var S=new Uint8Array(v),E=0;E<v;E++)S[E]=o.readByte();(i=new W).audio_object_type=s.audio_object_type,i.sampling_freq_index=s.sampling_freq_index,i.sampling_frequency=H[s.sampling_freq_index],i.channel_config=s.channel_config,i.other_data_present=s.other_data_present,i.data=S,this.current_syncword_offset_=this.findNextSyncwordOffset(a+3+n)}return i},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Q=function(e){var t=null,i=e.audio_object_type,a=e.audio_object_type,n=e.sampling_freq_index,r=e.channel_config,o=0,s=navigator.userAgent.toLowerCase();-1!==s.indexOf("firefox")?n>=6?(a=5,t=new Array(4),o=n-3):(a=2,t=new Array(2),o=n):-1!==s.indexOf("android")?(a=2,t=new Array(2),o=n):(a=5,o=n,t=new Array(4),n>=6?o=n-3:1===r&&(a=2,t=new Array(2),o=n)),t[0]=a<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&r)<<3,5===a&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=H[n],this.channel_count=r,this.codec_mimetype="mp4a.40."+a,this.original_codec_mimetype="mp4a.40."+i},J=function(){},Z=function(){};!function(e){e[e.kSpliceNull=0]="kSpliceNull",e[e.kSpliceSchedule=4]="kSpliceSchedule",e[e.kSpliceInsert=5]="kSpliceInsert",e[e.kTimeSignal=6]="kTimeSignal",e[e.kBandwidthReservation=7]="kBandwidthReservation",e[e.kPrivateCommand=255]="kPrivateCommand"}(z||(z={}));var $,ee=function(e){var t=e.readBool();return t?(e.readBits(6),{time_specified_flag:t,pts_time:4*e.readBits(31)+e.readBits(2)}):(e.readBits(7),{time_specified_flag:t})},te=function(e){var t=e.readBool();return e.readBits(6),{auto_return:t,duration:4*e.readBits(31)+e.readBits(2)}},ie=function(e,t){var i=t.readBits(8);return e?{component_tag:i}:{component_tag:i,splice_time:ee(t)}},ae=function(e){return{component_tag:e.readBits(8),utc_splice_time:e.readBits(32)}},ne=function(e){var t=e.readBits(32),i=e.readBool();e.readBits(7);var a={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return a;if(a.out_of_network_indicator=e.readBool(),a.program_splice_flag=e.readBool(),a.duration_flag=e.readBool(),e.readBits(5),a.program_splice_flag)a.utc_splice_time=e.readBits(32);else{a.component_count=e.readBits(8),a.components=[];for(var n=0;n<a.component_count;n++)a.components.push(ae(e))}return a.duration_flag&&(a.break_duration=te(e)),a.unique_program_id=e.readBits(16),a.avail_num=e.readBits(8),a.avails_expected=e.readBits(8),a},re=function(e,t,i,a){return{descriptor_tag:e,descriptor_length:t,identifier:i,provider_avail_id:a.readBits(32)}},oe=function(e,t,i,a){var n=a.readBits(8),r=a.readBits(3);a.readBits(5);for(var o="",s=0;s<r;s++)o+=String.fromCharCode(a.readBits(8));return{descriptor_tag:e,descriptor_length:t,identifier:i,preroll:n,dtmf_count:r,DTMF_char:o}},se=function(e){var t=e.readBits(8);return e.readBits(7),{component_tag:t,pts_offset:4*e.readBits(31)+e.readBits(2)}},de=function(e,t,i,a){var n=a.readBits(32),r=a.readBool();a.readBits(7);var o={descriptor_tag:e,descriptor_length:t,identifier:i,segmentation_event_id:n,segmentation_event_cancel_indicator:r};if(r)return o;if(o.program_segmentation_flag=a.readBool(),o.segmentation_duration_flag=a.readBool(),o.delivery_not_restricted_flag=a.readBool(),o.delivery_not_restricted_flag?a.readBits(5):(o.web_delivery_allowed_flag=a.readBool(),o.no_regional_blackout_flag=a.readBool(),o.archive_allowed_flag=a.readBool(),o.device_restrictions=a.readBits(2)),!o.program_segmentation_flag){o.component_count=a.readBits(8),o.components=[];for(var s=0;s<o.component_count;s++)o.components.push(se(a))}o.segmentation_duration_flag&&(o.segmentation_duration=a.readBits(40)),o.segmentation_upid_type=a.readBits(8),o.segmentation_upid_length=a.readBits(8);var d=new Uint8Array(o.segmentation_upid_length);for(s=0;s<o.segmentation_upid_length;s++)d[s]=a.readBits(8);return o.segmentation_upid=d.buffer,o.segmentation_type_id=a.readBits(8),o.segment_num=a.readBits(8),o.segments_expected=a.readBits(8),52!==o.segmentation_type_id&&54!==o.segmentation_type_id&&56!==o.segmentation_type_id&&58!==o.segmentation_type_id||(o.sub_segment_num=a.readBits(8),o.sub_segments_expected=a.readBits(8)),o},le=function(e,t,i,a){return{descriptor_tag:e,descriptor_length:t,identifier:i,TAI_seconds:a.readBits(48),TAI_ns:a.readBits(32),UTC_offset:a.readBits(16)}},_e=function(e){return{component_tag:e.readBits(8),ISO_code:String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8)),Bit_Stream_Mode:e.readBits(3),Num_Channels:e.readBits(4),Full_Srvc_Audio:e.readBool()}},ue=function(e,t,i,a){for(var n=a.readBits(4),r=[],o=0;o<n;o++)r.push(_e(a));return{descriptor_tag:e,descriptor_length:t,identifier:i,audio_count:n,components:r}};!function(e){e[e.kSliceIDR_W_RADL=19]="kSliceIDR_W_RADL",e[e.kSliceIDR_N_LP=20]="kSliceIDR_N_LP",e[e.kSliceCRA_NUT=21]="kSliceCRA_NUT",e[e.kSliceVPS=32]="kSliceVPS",e[e.kSliceSPS=33]="kSliceSPS",e[e.kSlicePPS=34]="kSlicePPS",e[e.kSliceAUD=35]="kSliceAUD",e[e.kSliceSEI=39]="kSliceSEI",e[e.kSliceSEISuffix=40]="kSliceSEISuffix"}($||($={}));var ce=function(){},he=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},fe=function(){function e(e){this.TAG="H265AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not find H265 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var a=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===a||1===n)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,a=e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3]>>1&63,n=(128&e[i])>>>7,r=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=r,0===n){var o=e.subarray(i,r);(t=new ce).type=a,t.data=o}}return t},e}(),pe=function(){function e(e,t,i,a){var n=23+(5+e.byteLength)+(5+t.byteLength)+(5+i.byteLength),r=this.data=new Uint8Array(n);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|$.kSliceVPS,r[24]=0,r[25]=1,r[26]=(65280&e.byteLength)>>8,r[27]=255&e.byteLength,r.set(e,28),r[23+(5+e.byteLength)+0]=128|$.kSliceSPS,r[23+(5+e.byteLength)+1]=0,r[23+(5+e.byteLength)+2]=1,r[23+(5+e.byteLength)+3]=(65280&t.byteLength)>>8,r[23+(5+e.byteLength)+4]=255&t.byteLength,r.set(t,23+(5+e.byteLength)+5),r[23+(5+e.byteLength+5+t.byteLength)+0]=128|$.kSlicePPS,r[23+(5+e.byteLength+5+t.byteLength)+1]=0,r[23+(5+e.byteLength+5+t.byteLength)+2]=1,r[23+(5+e.byteLength+5+t.byteLength)+3]=(65280&i.byteLength)>>8,r[23+(5+e.byteLength+5+t.byteLength)+4]=255&i.byteLength,r.set(i,23+(5+e.byteLength+5+t.byteLength)+5)}return e.prototype.getData=function(){return this.data},e}(),me=function(){},ge=function(){},ve=function(){},ye=[[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]],Se=function(){function e(e){this.TAG="AC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found AC3 syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]))return t;t++}},e.prototype.readNextAC3Frame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=e[i+4]>>6,n=[48e3,44200,33e3][a],r=63&e[i+4],o=2*ye[a][r];if(isNaN(o)||i+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var s=this.findNextSyncwordOffset(i+o);this.current_syncword_offset_=s;var d=e[i+5]>>3,l=7&e[i+5],_=e[i+6]>>5,u=0;1&_&&1!==_&&(u+=2),4&_&&(u+=2),2===_&&(u+=2);var c=(e[i+6]<<8|e[i+7])>>12-u&1,h=[2,1,2,3,3,4,4,5][_]+c;(t=new ve).sampling_frequency=n,t.channel_count=h,t.channel_mode=_,t.bit_stream_identification=d,t.low_frequency_effects_channel_on=c,t.bit_stream_mode=l,t.frame_size_code=r,t.data=e.subarray(i,i+o)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Ee=function(e){var t;t=[e.sampling_rate_code<<6|e.bit_stream_identification<<1|e.bit_stream_mode>>2,(3&e.bit_stream_mode)<<6|e.channel_mode<<3|e.low_frequency_effects_channel_on<<2|e.frame_size_code>>4,e.frame_size_code<<4&224],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.bit_stream_mode=e.bit_stream_mode,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"},Ae=function(){},be=function(){function e(e){this.TAG="EAC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not found AC3 syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]))return t;t++}},e.prototype.readNextEAC3Frame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=new f(e.subarray(i+2)),n=(a.readBits(2),a.readBits(3),a.readBits(11)+1<<1),r=a.readBits(2),o=null,s=null;3===r?(o=[24e3,22060,16e3][r=a.readBits(2)],s=3):(o=[48e3,44100,32e3][r],s=a.readBits(2));var d=a.readBits(3),l=a.readBits(1),_=a.readBits(5);if(i+n>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var u=this.findNextSyncwordOffset(i+n);this.current_syncword_offset_=u;var c=[2,1,2,3,3,4,4,5][d]+l;a.destroy(),(t=new Ae).sampling_frequency=o,t.channel_count=c,t.channel_mode=d,t.bit_stream_identification=_,t.low_frequency_effects_channel_on=l,t.frame_size=n,t.num_blks=[1,2,3,6][s],t.data=e.subarray(i,i+n)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Re=function(e){var t,i=Math.floor(e.frame_size*e.sampling_frequency/(16*e.num_blks));t=[255&i,248&i,e.sampling_rate_code<<6|e.bit_stream_identification<<1,e.channel_mode<<1|e.low_frequency_effects_channel_on,0],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.num_blks=e.num_blks,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"},Te=function(){},Le=function(){function e(e){this.TAG="AV1OBUInMpegTsParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.default.e(this.TAG,"Could not find AV1 startcode until payload end!")}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,a=new Uint8Array(i),n=0,r=0;r<i;r++)r>=2&&3===t[r]&&0===t[r-1]&&0===t[r-2]||(a[n]=t[r],n++);return new Uint8Array(a.buffer,0,n)},e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+2>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(1==(i[t+0]<<16|i[t+1]<<8|i[t+2]))return t;t++}},e.prototype.readNextOBUPayload=function(){for(var t=this.data_,i=null;null==i&&!this.eof_flag_;){var a=this.current_startcode_offset_+3,n=this.findNextStartCodeOffset(a);this.current_startcode_offset_=n,i=e._ebsp2rbsp(t.subarray(a,n))}return i},e}(),ke=function(){},De=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Me=function(){return Me=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Me.apply(this,arguments)},Ce=function(e){function t(t,i){var a=e.call(this)||this;return a.TAG="TSDemuxer",a.audio_disabled_=!1,a.first_parse_=!0,a.media_info_=new s.default,a.timescale_=90,a.duration_=0,a.current_pmt_pid_=-1,a.program_pmt_map_={},a.pes_slice_queues_={},a.section_slice_queues_={},a.video_metadata_={vps:void 0,sps:void 0,pps:void 0,av1c:void 0,details:void 0},a.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},a.last_pcr_base_=NaN,a.timestamp_offset_=0,a.audio_last_sample_pts_=void 0,a.aac_last_incomplete_data_=null,a.has_video_=!1,a.has_audio_=!1,a.video_init_segment_dispatched_=!1,a.audio_init_segment_dispatched_=!1,a.video_metadata_changed_=!1,a.audio_metadata_changed_=!1,a.loas_previous_frame=null,a.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},a.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},a.ts_packet_size_=t.ts_packet_size,a.sync_offset_=t.sync_offset,a.config_=i,a.audio_disabled_=Boolean(null==i?void 0:i.disableAudio),a}return De(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),i=-1,a=188;if(t.byteLength<=3*a)return{needMoreData:!0};for(;-1===i;){for(var n=Math.min(1e3,t.byteLength-3*a),o=0;o<n;){if(71===t[o]&&71===t[o+a]&&71===t[o+2*a]){i=o;break}o++}if(-1===i)if(188===a)a=192;else{if(192!==a)break;a=204}}return-1===i?{match:!1}:(192===a&&i>=4?(r.default.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===a&&r.default.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:a,sync_offset:i})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new s.default},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new u.IllegalStateException("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0;for(this.first_parse_&&(this.first_parse_=!1,i=this.sync_offset_);i+this.ts_packet_size_<=e.byteLength;){var a=t+i;192===this.ts_packet_size_&&(i+=4);var n=new Uint8Array(e,i,188),o=n[0];if(71!==o){r.default.e(this.TAG,"sync_byte = ".concat(o,", not 0x47"));break}var s=(64&n[1])>>>6,d=(n[1],(31&n[1])<<8|n[2]),l=(48&n[3])>>>4,_=15&n[3],c=!(!this.pmt_||this.pmt_.pcr_pid!==d),h={},f=4;if(2==l||3==l){var p=n[4];if(p>0&&(c||3==l)&&(h.discontinuity_indicator=(128&n[5])>>>7,h.random_access_indicator=(64&n[5])>>>6,h.elementary_stream_priority_indicator=(32&n[5])>>>5,(16&n[5])>>>4)){var m=300*this.getPcrBase(n)+((1&n[10])<<8|n[11]);this.last_pcr_=m}if(2==l||5+p===188){i+=188,204===this.ts_packet_size_&&(i+=16);continue}f=5+p}if(1==l||3==l)if(0===d||d===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[d]===L.kSCTE35){var g=188-f;this.handleSectionSlice(e,i+f,g,{pid:d,file_position:a,payload_unit_start_indicator:s,continuity_conunter:_,random_access_indicator:h.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[d]){g=188-f;var v=this.pmt_.pid_stream_type[d];d!==this.pmt_.common_pids.h264&&d!==this.pmt_.common_pids.h265&&d!==this.pmt_.common_pids.av1&&d!==this.pmt_.common_pids.adts_aac&&d!==this.pmt_.common_pids.loas_aac&&d!==this.pmt_.common_pids.ac3&&d!==this.pmt_.common_pids.eac3&&d!==this.pmt_.common_pids.opus&&d!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[d]&&!0!==this.pmt_.timed_id3_pids[d]&&!0!==this.pmt_.pgs_pids[d]&&!0!==this.pmt_.synchronous_klv_pids[d]&&!0!==this.pmt_.asynchronous_klv_pids[d]||this.handlePESSlice(e,i+f,g,{pid:d,stream_type:v,file_position:a,payload_unit_start_indicator:s,continuity_conunter:_,random_access_indicator:h.random_access_indicator})}i+=188,204===this.ts_packet_size_&&(i+=16)}return this.dispatchAudioVideoMediaSegment(),i},t.prototype.handleSectionSlice=function(e,t,i,a){var n=new Uint8Array(e,t,i),r=this.section_slice_queues_[a.pid];if(a.payload_unit_start_indicator){var o=n[0];if(null!=r&&0!==r.total_length){var s=new Uint8Array(e,t+1,Math.min(i,o));r.slices.push(s),r.total_length+=s.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,a):this.clearSlices(r,a)}for(var d=1+o;d<n.byteLength&&255!==n[d+0];){var l=(15&n[d+1])<<8|n[d+2];this.section_slice_queues_[a.pid]=new P,(r=this.section_slice_queues_[a.pid]).expected_length=l+3,r.file_position=a.file_position,r.random_access_indicator=a.random_access_indicator,s=new Uint8Array(e,t+d,Math.min(i-d,r.expected_length-r.total_length)),r.slices.push(s),r.total_length+=s.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,a):r.total_length>=r.expected_length&&this.clearSlices(r,a),d+=s.byteLength}}else null!=r&&0!==r.total_length&&(s=new Uint8Array(e,t,Math.min(i,r.expected_length-r.total_length)),r.slices.push(s),r.total_length+=s.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,a):r.total_length>=r.expected_length&&this.clearSlices(r,a))},t.prototype.handlePESSlice=function(e,t,i,a){var n=new Uint8Array(e,t,i),o=n[0]<<16|n[1]<<8|n[2],s=(n[3],n[4]<<8|n[5]);if(a.payload_unit_start_indicator){if(1!==o)return void r.default.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value ".concat(o));var d=this.pes_slice_queues_[a.pid];d&&(0===d.expected_length||d.expected_length===d.total_length?this.emitPESSlices(d,a):this.clearSlices(d,a)),this.pes_slice_queues_[a.pid]=new P,this.pes_slice_queues_[a.pid].file_position=a.file_position,this.pes_slice_queues_[a.pid].random_access_indicator=a.random_access_indicator}if(null!=this.pes_slice_queues_[a.pid]){var l=this.pes_slice_queues_[a.pid];l.slices.push(n),a.payload_unit_start_indicator&&(l.expected_length=0===s?0:s+6),l.total_length+=n.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,a):l.expected_length>0&&l.expected_length<l.total_length&&this.clearSlices(l,a)}},t.prototype.emitSectionSlices=function(e,t){for(var i=new Uint8Array(e.total_length),a=0,n=0;a<e.slices.length;a++){var r=e.slices[a];i.set(r,n),n+=r.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new O;o.pid=t.pid,o.data=i,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parseSection(o)},t.prototype.emitPESSlices=function(e,t){for(var i=new Uint8Array(e.total_length),a=0,n=0;a<e.slices.length;a++){var r=e.slices[a];i.set(r,n),n+=r.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new B;o.pid=t.pid,o.data=i,o.stream_type=t.stream_type,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parsePES(o)},t.prototype.clearSlices=function(e,t){e.slices=[],e.expected_length=-1,e.total_length=0},t.prototype.parseSection=function(e){var t=e.data,i=e.pid;0===i?this.parsePAT(t):i===this.current_pmt_pid_?this.parsePMT(t):null!=this.pmt_&&this.pmt_.scte_35_pids[i]&&this.parseSCTE35(t)},t.prototype.parsePES=function(e){var t=e.data,i=t[0]<<16|t[1]<<8|t[2],a=t[3],n=t[4]<<8|t[5];if(1===i)if(188!==a&&190!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a){t[6];var o=(192&t[7])>>>6,s=t[8],d=void 0,l=void 0;2!==o&&3!==o||(d=this.getTimestamp(t,9),l=3===o?this.getTimestamp(t,14):d);var _=9+s,u=void 0;if(0!==n){if(n<3+s)return void r.default.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");u=n-3-s}else u=t.byteLength-_;var c=t.subarray(_,_+u);switch(e.stream_type){case L.kMPEG1Audio:case L.kMPEG2Audio:this.parseMP3Payload(c,d);break;case L.kPESPrivateData:this.pmt_.common_pids.av1===e.pid?this.parseAV1Payload(c,d,l,e.file_position,e.random_access_indicator):this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(c,d):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(c,d):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(c,d):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(c,e.pid,a):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(c,d,l,e.pid,a):this.parsePESPrivateDataPayload(c,d,l,e.pid,a);break;case L.kADTSAAC:this.parseADTSAACPayload(c,d);break;case L.kLOASAAC:this.parseLOASAACPayload(c,d);break;case L.kAC3:this.parseAC3Payload(c,d);break;case L.kEAC3:this.parseEAC3Payload(c,d);break;case L.kMetadata:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(c,d,l,e.pid,a):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(c,d,l,e.pid,a);break;case L.kPGS:this.parsePGSPayload(c,d,l,e.pid,a,this.pmt_.pgs_langs[e.pid]);break;case L.kH264:this.parseH264Payload(c,d,l,e.file_position,e.random_access_indicator);break;case L.kH265:this.parseH265Payload(c,d,l,e.file_position,e.random_access_indicator)}}else 188!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a||e.stream_type!==L.kPESPrivateData||(_=6,u=void 0,u=0!==n?n:t.byteLength-_,c=t.subarray(_,_+u),this.parsePESPrivateDataPayload(c,void 0,void 0,e.pid,a));else r.default.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value ".concat(i))},t.prototype.parsePAT=function(e){var t=e[0];if(0===t){var i=(15&e[1])<<8|e[2],a=(e[3],e[4],(62&e[5])>>>1),n=1&e[5],o=e[6],s=(e[7],null);if(1===n&&0===o)(s=new C).version_number=a;else if(null==(s=this.pat_))return;for(var d=i-5-4,l=-1,_=-1,u=8;u<8+d;u+=4){var c=e[u]<<8|e[u+1],h=(31&e[u+2])<<8|e[u+3];0===c?s.network_pid=h:(s.program_pmt_pid[c]=h,-1===l&&(l=c),-1===_&&(_=h))}1===n&&0===o&&(null==this.pat_&&r.default.v(this.TAG,"Parsed first PAT: ".concat(JSON.stringify(s))),this.pat_=s,this.current_program_=l,this.current_pmt_pid_=_)}else r.default.e(this.TAG,"parsePAT: table_id ".concat(t," is not corresponded to PAT!"))},t.prototype.parsePMT=function(e){var t=e[0];if(2===t){var i=(15&e[1])<<8|e[2],a=e[3]<<8|e[4],n=(62&e[5])>>>1,o=1&e[5],s=e[6],d=(e[7],null);if(1===o&&0===s)(d=new I).program_number=a,d.version_number=n,this.program_pmt_map_[a]=d;else if(null==(d=this.program_pmt_map_[a]))return;d.pcr_pid=(31&e[8])<<8|e[9];for(var l=(15&e[10])<<8|e[11],_=12+l,u=i-9-l-4,c=_;c<_+u;){var h=e[c],f=(31&e[c+1])<<8|e[c+2],p=(15&e[c+3])<<8|e[c+4];d.pid_stream_type[f]=h;var m=d.common_pids.h264||d.common_pids.h265,g=d.common_pids.adts_aac||d.common_pids.loas_aac||d.common_pids.ac3||d.common_pids.eac3||d.common_pids.opus||d.common_pids.mp3;if(h!==L.kH264||m)if(h!==L.kH265||m)if(this.audio_disabled_||h!==L.kADTSAAC||g)if(this.audio_disabled_||h!==L.kLOASAAC||g)if(this.audio_disabled_||h!==L.kAC3||g)if(this.audio_disabled_||h!==L.kEAC3||g)if(this.audio_disabled_||h!==L.kMPEG1Audio&&h!==L.kMPEG2Audio||g){if(h===L.kPESPrivateData){if(d.pes_private_data_pids[f]=!0,p>0){for(var v=c+5;v<c+5+p;){var y=e[v+0],S=e[v+1];if(5===y){var E=String.fromCharCode.apply(String,Array.from(e.subarray(v+2,v+2+S)));"VANC"===E?d.smpte2038_pids[f]=!0:"AV01"===E?d.common_pids.av1=f:this.audio_disabled_||"Opus"!==E?"KLVA"===E&&(d.asynchronous_klv_pids[f]=!0):d.common_pids.opus=f}else if(127===y){if(f===d.common_pids.opus){var A=null;if(128===e[v+2]&&(A=e[v+3]),null==A){r.default.e(this.TAG,"Not Supported Opus channel count.");continue}var b={codec:"opus",channel_count:15&A?15&A:2,channel_config_code:A,sample_rate:48e3},R={codec:"opus",meta:b};0==this.audio_init_segment_dispatched_?(this.audio_metadata_=b,this.dispatchAudioInitSegment(R)):this.detectAudioMetadataChange(R)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(R))}}else 128===y&&f===d.common_pids.av1&&(this.video_metadata_.av1c=e.subarray(v+2,v+2+S));v+=2+S}var T=e.subarray(c+5,c+5+p);this.dispatchPESPrivateDataDescriptor(f,h,T)}}else if(h===L.kMetadata){if(p>0)for(v=c+5;v<c+5+p;){y=e[v+0];var k=e[v+1];if(38===y){var D=e[v+2]<<8|e[v+3],M=null;65535===D&&(M=String.fromCharCode.apply(String,Array.from(e.subarray(v+4,v+4+4))));var C=null;if(255===e[v+4+(65535===D?4:0)]){var w=4+(65535===D?4:0)+1;C=String.fromCharCode.apply(String,Array.from(e.subarray(v+w,v+w+4)))}"ID3 "===M&&"ID3 "===C?d.timed_id3_pids[f]=!0:"KLVA"===C&&(d.synchronous_klv_pids[f]=!0)}v+=2+k}}else if(h===L.kSCTE35)d.scte_35_pids[f]=!0;else if(h===L.kPGS){if(d.pgs_langs[f]="und",p>0)for(v=c+5;v<c+5+p;){y=e[v+0];var B=e[v+1];if(10===y){var O=String.fromCharCode.apply(String,Array.from(e.slice(v+2,v+5)));d.pgs_langs[f]=O}v+=2+B}d.pgs_pids[f]=!0}}else d.common_pids.mp3=f;else d.common_pids.eac3=f;else d.common_pids.ac3=f;else d.common_pids.loas_aac=f;else d.common_pids.adts_aac=f;else d.common_pids.h265=f;else d.common_pids.h264=f;c+=5+p}a===this.current_program_&&(null==this.pmt_&&r.default.v(this.TAG,"Parsed first PMT: ".concat(JSON.stringify(d))),this.pmt_=d,(d.common_pids.h264||d.common_pids.h265||d.common_pids.av1)&&(this.has_video_=!0),!this.audio_disabled_&&(d.common_pids.adts_aac||d.common_pids.loas_aac||d.common_pids.ac3||d.common_pids.opus||d.common_pids.mp3)&&(this.has_audio_=!0))}else r.default.e(this.TAG,"parsePMT: table_id ".concat(t," is not corresponded to PMT!"))},t.prototype.parseSCTE35=function(e){var t=function(e){var t=new f(e),i=t.readBits(8),a=t.readBool(),n=t.readBool();t.readBits(2);var r=t.readBits(12),o=t.readBits(8),s=t.readBool(),d=t.readBits(6),l=4*t.readBits(31)+t.readBits(2),_=t.readBits(8),u=t.readBits(12),c=t.readBits(12),h=t.readBits(8),p=null;h===z.kSpliceNull?p={}:h===z.kSpliceSchedule?p=function(e){for(var t=e.readBits(8),i=[],a=0;a<t;a++)i.push(ne(e));return{splice_count:t,events:i}}(t):h===z.kSpliceInsert?p=function(e){var t=e.readBits(32),i=e.readBool();e.readBits(7);var a={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return a;if(a.out_of_network_indicator=e.readBool(),a.program_splice_flag=e.readBool(),a.duration_flag=e.readBool(),a.splice_immediate_flag=e.readBool(),e.readBits(4),a.program_splice_flag&&!a.splice_immediate_flag&&(a.splice_time=ee(e)),!a.program_splice_flag){a.component_count=e.readBits(8),a.components=[];for(var n=0;n<a.component_count;n++)a.components.push(ie(a.splice_immediate_flag,e))}return a.duration_flag&&(a.break_duration=te(e)),a.unique_program_id=e.readBits(16),a.avail_num=e.readBits(8),a.avails_expected=e.readBits(8),a}(t):h===z.kTimeSignal?p=function(e){return{splice_time:ee(e)}}(t):h===z.kBandwidthReservation?p={}:h===z.kPrivateCommand?p=function(e,t){for(var i=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8)),a=new Uint8Array(e-4),n=0;n<e-4;n++)a[n]=t.readBits(8);return{identifier:i,private_data:a.buffer}}(c,t):t.readBits(8*c);for(var m=[],g=t.readBits(16),v=0;v<g;){var y=t.readBits(8),S=t.readBits(8),E=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8));0===y?m.push(re(y,S,E,t)):1===y?m.push(oe(y,S,E,t)):2===y?m.push(de(y,S,E,t)):3===y?m.push(le(y,S,E,t)):4===y?m.push(ue(y,S,E,t)):t.readBits(8*(S-4)),v+=2+S}var A={table_id:i,section_syntax_indicator:a,private_indicator:n,section_length:r,protocol_version:o,encrypted_packet:s,encryption_algorithm:d,pts_adjustment:l,cw_index:_,tier:u,splice_command_length:c,splice_command_type:h,splice_command:p,descriptor_loop_length:g,splice_descriptors:m,E_CRC32:s?t.readBits(32):void 0,CRC32:t.readBits(32)};if(h===z.kSpliceInsert){var b=p;if(b.splice_event_cancel_indicator)return{splice_command_type:h,detail:A,data:e};if(b.program_splice_flag&&!b.splice_immediate_flag){var R=b.duration_flag?b.break_duration.auto_return:void 0,T=b.duration_flag?b.break_duration.duration/90:void 0;return b.splice_time.time_specified_flag?{splice_command_type:h,pts:(l+b.splice_time.pts_time)%Math.pow(2,33),auto_return:R,duraiton:T,detail:A,data:e}:{splice_command_type:h,auto_return:R,duraiton:T,detail:A,data:e}}return{splice_command_type:h,auto_return:R=b.duration_flag?b.break_duration.auto_return:void 0,duraiton:T=b.duration_flag?b.break_duration.duration/90:void 0,detail:A,data:e}}if(h===z.kTimeSignal){var L=p;return L.splice_time.time_specified_flag?{splice_command_type:h,pts:(l+L.splice_time.pts_time)%Math.pow(2,33),detail:A,data:e}:{splice_command_type:h,detail:A,data:e}}return{splice_command_type:h,detail:A,data:e}}(e);if(null!=t.pts){var i=Math.floor(t.pts/this.timescale_);t.pts=i}else t.nearest_pts=this.getNearestTimestampMilliseconds();this.onSCTE35Metadata&&this.onSCTE35Metadata(t)},t.prototype.parseAV1Payload=function(e,t,i,a,n){for(var r=new Le(e),o=null,s=[],d=0,l=!1,_=null;null!=(o=r.readNextOBUPayload());){if((_=b.parseOBUs(o,this.video_metadata_.details))&&!0===_.keyframe)if(this.video_init_segment_dispatched_){if(!0===this.detectVideoMetadataChange(null,_)){var u;this.video_metadata_changed_=!0,this.dispatchVideoMediaSegment(),(u=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+_.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),u.set(_.sequence_header_data,this.video_metadata_.av1c.byteLength),_.av1c=u,this.dispatchVideoInitSegment()}}else(u=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+_.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),u.set(_.sequence_header_data,this.video_metadata_.av1c.byteLength),_.av1c=u,this.video_metadata_.details=_,this.dispatchVideoInitSegment();this.video_metadata_.details=_,l||(l=_.keyframe),s.push({data:o}),d+=o.byteLength}var c=Math.floor(t/this.timescale_),h=Math.floor(i/this.timescale_);if(s.length){var f=this.video_track_,p={units:s,length:d,isKeyframe:l,dts:h,pts:c,cts:c-h,file_position:a};f.samples.push(p),f.length+=d}},t.prototype.parseH264Payload=function(e,t,i,a,n){for(var o=new G(e),s=null,d=[],l=0,_=!1;null!=(s=o.readNextNaluPayload());){var u=new V(s);if(u.type===w.kSliceSPS){var c=p.parseSPS(s.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(u,c)&&(r.default.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:u,pps:void 0,av1c:void 0,details:c}):(this.video_metadata_.sps=u,this.video_metadata_.details=c)}else u.type===w.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=u,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):u.type===w.kSliceIDR||u.type===w.kSliceNonIDR&&1===n?_=!0:u.type===w.kSliceSEI&&this.parseSEIPayload(s.data,t,"h264");this.video_init_segment_dispatched_&&(d.push(u),l+=u.data.byteLength)}var h=Math.floor(t/this.timescale_),f=Math.floor(i/this.timescale_);if(d.length){var m=this.video_track_,g={units:d,length:l,isKeyframe:_,dts:f,pts:h,cts:h-f,file_position:a};m.samples.push(g),m.length+=l}},t.prototype.parseH265Payload=function(e,t,i,a,n){for(var o=new fe(e),s=null,d=[],l=0,_=!1;null!=(s=o.readNextNaluPayload());){var u=new he(s);if(u.type===$.kSliceVPS){if(!this.video_init_segment_dispatched_){var c=g.parseVPS(s.data);this.video_metadata_.vps=u,this.video_metadata_.details=Me(Me({},this.video_metadata_.details),c)}}else u.type===$.kSliceSPS?(c=g.parseSPS(s.data),this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(u,c)&&(r.default.v(this.TAG,"H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:u,pps:void 0,av1c:void 0,details:c}):(this.video_metadata_.sps=u,this.video_metadata_.details=Me(Me({},this.video_metadata_.details),c))):u.type===$.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(c=g.parsePPS(s.data),this.video_metadata_.pps=u,this.video_metadata_.details=Me(Me({},this.video_metadata_.details),c),this.video_metadata_.vps&&this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):u.type===$.kSliceIDR_W_RADL||u.type===$.kSliceIDR_N_LP||u.type===$.kSliceCRA_NUT?_=!0:u.type!==$.kSliceSEI&&u.type!==$.kSliceSEISuffix||this.parseSEIPayload(s.data,t,"h265");this.video_init_segment_dispatched_&&(d.push(u),l+=u.data.byteLength)}var h=Math.floor(t/this.timescale_),f=Math.floor(i/this.timescale_);if(d.length){var p=this.video_track_,m={units:d,length:l,isKeyframe:_,dts:f,pts:h,cts:h-f,file_position:a};p.samples.push(m),p.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(t.codec_mimetype!==this.video_metadata_.details.codec_mimetype)return r.default.v(this.TAG,"Video: Codec mimeType changed from "+"".concat(this.video_metadata_.details.codec_mimetype," to ").concat(t.codec_mimetype)),!0;if(t.codec_size.width!==this.video_metadata_.details.codec_size.width||t.codec_size.height!==this.video_metadata_.details.codec_size.height){var i=this.video_metadata_.details.codec_size,a=t.codec_size;return r.default.v(this.TAG,"Video: Coded Resolution changed from "+"".concat(i.width,"x").concat(i.height," to ").concat(a.width,"x").concat(a.height)),!0}return t.present_size.width!==this.video_metadata_.details.present_size.width&&(r.default.v(this.TAG,"Video: Present resolution width changed from "+"".concat(this.video_metadata_.details.present_size.width," to ").concat(t.present_size.width)),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.details,t={type:"video"};t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;var i=t.frameRate.fps_den,a=t.frameRate.fps_num;if(t.refSampleDuration=i/a*1e3,t.codec=e.codec_mimetype,this.video_metadata_.av1c)t.av1c=this.video_metadata_.av1c,0==this.video_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first AV1 for mimeType: ".concat(t.codec));else if(this.video_metadata_.vps){var n=this.video_metadata_.vps.data.subarray(4),o=this.video_metadata_.sps.data.subarray(4),s=this.video_metadata_.pps.data.subarray(4),d=new pe(n,o,s,e);t.hvcc=d.getData(),0==this.video_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first HEVCDecoderConfigurationRecord for mimeType: ".concat(t.codec))}else{o=this.video_metadata_.sps.data.subarray(4),s=this.video_metadata_.pps.data.subarray(4);var l=new F(o,s,e);t.avcc=l.getData(),0==this.video_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: ".concat(t.codec))}this.onTrackMetadata("video",t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var _=this.media_info_;_.hasVideo=!0,_.width=t.codecWidth,_.height=t.codecHeight,_.fps=t.frameRate.fps,_.profile=t.profile,_.level=t.level,_.refFrames=e.ref_frames,_.chromaFormat=e.chroma_format_string,_.sarNum=t.sarRatio.width,_.sarDen=t.sarRatio.height,_.videoCodec=t.codec,_.hasAudio&&_.audioCodec?_.mimeType='video/mp2t; codecs="'.concat(_.videoCodec,",").concat(_.audioCodec,'"'):_.mimeType='video/mp2t; codecs="'.concat(_.videoCodec,'"'),_.isComplete()&&this.onMediaInfo(_)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseADTSAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var i=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);i.set(this.aac_last_incomplete_data_,0),i.set(e,this.aac_last_incomplete_data_.byteLength),e=i}var a,n;if(null!=t&&(n=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)a=1024/this.audio_metadata_.sampling_frequency*1e3,n=this.audio_last_sample_pts_+a;else if(null==t)return void r.default.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){a=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.audio_last_sample_pts_+a;Math.abs(o-n)>1&&(r.default.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(o,"ms, PES pts: ").concat(n,"ms")),n=o)}}for(var s,d=new Y(e),l=null,_=n;null!=(l=d.readNextAACFrame());){a=1024/l.sampling_frequency*1e3;var u={codec:"aac",data:l};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u)),s=_;var c=Math.floor(_),h={unit:l.data,length:l.data.byteLength,pts:c,dts:c};this.audio_track_.samples.push(h),this.audio_track_.length+=l.data.byteLength,_+=a}d.hasIncompleteData()&&(this.aac_last_incomplete_data_=d.getIncompleteData()),s&&(this.audio_last_sample_pts_=s)}},t.prototype.parseLOASAACPayload=function(e,t){var i;if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var a=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);a.set(this.aac_last_incomplete_data_,0),a.set(e,this.aac_last_incomplete_data_.byteLength),e=a}var n,o;if(null!=t&&(o=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)n=1024/this.audio_metadata_.sampling_frequency*1e3,o=this.audio_last_sample_pts_+n;else if(null==t)return void r.default.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){n=1024/this.audio_metadata_.sampling_frequency*1e3;var s=this.audio_last_sample_pts_+n;Math.abs(s-o)>1&&(r.default.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(s,"ms, PES pts: ").concat(o,"ms")),o=s)}}for(var d,l=new X(e),_=null,u=o;null!=(_=l.readNextAACFrame(null!==(i=this.loas_previous_frame)&&void 0!==i?i:void 0));){this.loas_previous_frame=_,n=1024/_.sampling_frequency*1e3;var c={codec:"aac",data:_};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:_.audio_object_type,sampling_freq_index:_.sampling_freq_index,sampling_frequency:_.sampling_frequency,channel_config:_.channel_config},this.dispatchAudioInitSegment(c)):this.detectAudioMetadataChange(c)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(c)),d=u;var h=Math.floor(u),f={unit:_.data,length:_.data.byteLength,pts:h,dts:h};this.audio_track_.samples.push(f),this.audio_track_.length+=_.data.byteLength,u+=n}l.hasIncompleteData()&&(this.aac_last_incomplete_data_=l.getIncompleteData()),d&&(this.audio_last_sample_pts_=d)}},t.prototype.parseAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i,a;if(null!=t&&(a=t/this.timescale_),"ac-3"===this.audio_metadata_.codec)if(null==t&&null!=this.audio_last_sample_pts_)i=1536/this.audio_metadata_.sampling_frequency*1e3,a=this.audio_last_sample_pts_+i;else if(null==t)return void r.default.w(this.TAG,"AC3: Unknown pts");for(var n,o=new Se(e),s=null,d=a;null!=(s=o.readNextAC3Frame());){i=1536/s.sampling_frequency*1e3;var l={codec:"ac-3",data:s};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"ac-3",sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,bit_stream_mode:s.bit_stream_mode,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),n=d;var _=Math.floor(d),u={unit:s.data,length:s.data.byteLength,pts:_,dts:_};this.audio_track_.samples.push(u),this.audio_track_.length+=s.data.byteLength,d+=i}n&&(this.audio_last_sample_pts_=n)}},t.prototype.parseEAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i,a;if(null!=t&&(a=t/this.timescale_),"ec-3"===this.audio_metadata_.codec)if(null==t&&null!=this.audio_last_sample_pts_)i=256*this.audio_metadata_.num_blks/this.audio_metadata_.sampling_frequency*1e3,a=this.audio_last_sample_pts_+i;else if(null==t)return void r.default.w(this.TAG,"EAC3: Unknown pts");for(var n,o=new be(e),s=null,d=a;null!=(s=o.readNextEAC3Frame());){i=1536/s.sampling_frequency*1e3;var l={codec:"ec-3",data:s};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"ec-3",sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,num_blks:s.num_blks,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),n=d;var _=Math.floor(d),u={unit:s.data,length:s.data.byteLength,pts:_,dts:_};this.audio_track_.samples.push(u),this.audio_track_.length+=s.data.byteLength,d+=i}n&&(this.audio_last_sample_pts_=n)}},t.prototype.parseOpusPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i,a;if(null!=t&&(a=t/this.timescale_),"opus"===this.audio_metadata_.codec)if(null==t&&null!=this.audio_last_sample_pts_)i=20,a=this.audio_last_sample_pts_+i;else if(null==t)return void r.default.w(this.TAG,"Opus: Unknown pts");for(var n,o=a,s=0;s<e.length;){i=20;for(var d=!!(16&e[s+1]),l=!!(8&e[s+1]),_=s+2,u=0;255===e[_];)u+=255,_+=1;u+=e[_],_+=1,_+=d?2:0,_+=l?2:0,n=o;var c=Math.floor(o),h=e.slice(_,_+u),f={unit:h,length:h.byteLength,pts:c,dts:c};this.audio_track_.samples.push(f),this.audio_track_.length+=h.byteLength,o+=i,s=_+u}n&&(this.audio_last_sample_pts_=n)}},t.prototype.parseMP3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var i=e[1]>>>3&3,a=(6&e[1])>>1,n=(e[2],(12&e[2])>>>2),r=3&~(e[3]>>>6)?2:1,o=0,s=34;switch(i){case 0:o=[11025,12e3,8e3,0][n];break;case 2:o=[22050,24e3,16e3,0][n];break;case 3:o=[44100,48e3,32e3,0][n]}switch(a){case 1:s=34;break;case 2:s=33;break;case 3:s=32}var d=new ge;d.object_type=s,d.sample_rate=o,d.channel_count=r,d.data=e;var l={codec:"mp3",data:d};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:s,sample_rate:o,channel_count:r},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l));var _={unit:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_};this.audio_track_.samples.push(_),this.audio_track_.length+=e.byteLength}},t.prototype.detectAudioMetadataChange=function(e){if(e.codec!==this.audio_metadata_.codec)return r.default.v(this.TAG,"Audio: Audio Codecs changed from "+"".concat(this.audio_metadata_.codec," to ").concat(e.codec)),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){if((t=e.data).audio_object_type!==this.audio_metadata_.audio_object_type)return r.default.v(this.TAG,"AAC: AudioObjectType changed from "+"".concat(this.audio_metadata_.audio_object_type," to ").concat(t.audio_object_type)),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return r.default.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sampling_freq_index," to ").concat(t.sampling_freq_index)),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return r.default.v(this.TAG,"AAC: Channel configuration changed from "+"".concat(this.audio_metadata_.channel_config," to ").concat(t.channel_config)),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){var t;if((t=e.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return r.default.v(this.TAG,"AC3: Sampling Frequency changed from "+"".concat(this.audio_metadata_.sampling_frequency," to ").concat(t.sampling_frequency)),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return r.default.v(this.TAG,"AC3: Bit Stream Identification changed from "+"".concat(this.audio_metadata_.bit_stream_identification," to ").concat(t.bit_stream_identification)),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return r.default.v(this.TAG,"AC3: BitStream Mode changed from "+"".concat(this.audio_metadata_.bit_stream_mode," to ").concat(t.bit_stream_mode)),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return r.default.v(this.TAG,"AC3: Channel Mode changed from "+"".concat(this.audio_metadata_.channel_mode," to ").concat(t.channel_mode)),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return r.default.v(this.TAG,"AC3: Low Frequency Effects Channel On changed from "+"".concat(this.audio_metadata_.low_frequency_effects_channel_on," to ").concat(t.low_frequency_effects_channel_on)),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){if((i=e.meta).sample_rate!==this.audio_metadata_.sample_rate)return r.default.v(this.TAG,"Opus: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(i.sample_rate)),!0;if(i.channel_count!==this.audio_metadata_.channel_count)return r.default.v(this.TAG,"Opus: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(i.channel_count)),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){var i;if((i=e.data).object_type!==this.audio_metadata_.object_type)return r.default.v(this.TAG,"MP3: AudioObjectType changed from "+"".concat(this.audio_metadata_.object_type," to ").concat(i.object_type)),!0;if(i.sample_rate!==this.audio_metadata_.sample_rate)return r.default.v(this.TAG,"MP3: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(i.sample_rate)),!0;if(i.channel_count!==this.audio_metadata_.channel_count)return r.default.v(this.TAG,"MP3: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(i.channel_count)),!0}return!1},t.prototype.dispatchAudioInitSegment=function(e){var t={type:"audio"};if(t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_,"aac"===this.audio_metadata_.codec){var i="aac"===e.codec?e.data:null,a=new Q(i);t.audioSampleRate=a.sampling_rate,t.channelCount=a.channel_count,t.codec=a.codec_mimetype,t.originalCodec=a.original_codec_mimetype,t.config=a.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale}else if("ac-3"===this.audio_metadata_.codec){var n="ac-3"===e.codec?e.data:null,o=new Ee(n);t.audioSampleRate=o.sampling_rate,t.channelCount=o.channel_count,t.codec=o.codec_mimetype,t.originalCodec=o.original_codec_mimetype,t.config=o.config,t.refSampleDuration=1536/t.audioSampleRate*t.timescale}else if("ec-3"===this.audio_metadata_.codec){var s="ec-3"===e.codec?e.data:null,d=new Re(s);t.audioSampleRate=d.sampling_rate,t.channelCount=d.channel_count,t.codec=d.codec_mimetype,t.originalCodec=d.original_codec_mimetype,t.config=d.config,t.refSampleDuration=256*d.num_blks/t.audioSampleRate*t.timescale}else"opus"===this.audio_metadata_.codec?(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.channelConfigCode=this.audio_metadata_.channel_config_code,t.codec="opus",t.originalCodec="opus",t.config=void 0,t.refSampleDuration=20):"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==this.audio_init_segment_dispatched_&&r.default.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: ".concat(t.codec)),this.onTrackMetadata("audio",t),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var l=this.media_info_;l.hasAudio=!0,l.audioCodec=t.originalCodec,l.audioSampleRate=t.audioSampleRate,l.audioChannelCount=t.channelCount,l.hasVideo&&l.videoCodec?l.mimeType='video/mp2t; codecs="'.concat(l.videoCodec,",").concat(l.audioCodec,'"'):l.mimeType='video/mp2t; codecs="'.concat(l.audioCodec,'"'),l.isComplete()&&this.onMediaInfo(l)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,i){var a=new Z;a.pid=e,a.stream_type=t,a.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(a)},t.prototype.parsePESPrivateDataPayload=function(e,t,i,a,n){var r=new J;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}else r.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}this.onPESPrivateData&&this.onPESPrivateData(r)},t.prototype.parseTimedID3MetadataPayload=function(e,t,i,a,n){var r=new J;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}if(null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}this.onTimedID3Metadata&&this.onTimedID3Metadata(r)},t.prototype.parsePGSPayload=function(e,t,i,a,n,r){var o=new ke;if(o.pid=a,o.lang=r,o.stream_id=n,o.len=e.byteLength,o.data=e,null!=t){var s=Math.floor(t/this.timescale_);o.pts=s}if(null!=i){var d=Math.floor(i/this.timescale_);o.dts=d}this.onPGSSubtitleData&&this.onPGSSubtitleData(o)},t.prototype.parseSynchronousKLVMetadataPayload=function(e,t,i,a,n){var r=new Te;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}if(null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}r.access_units=function(e){for(var t=[],i=0;i+5<e.byteLength;){var a=e[i+0],n=e[i+1],r=e[i+2],o=e[i+3]<<8|e[i+4],s=e.slice(i+5,i+5+o);t.push({service_id:a,sequence_number:n,flags:r,data:s}),i+=5+o}return t}(e),this.onSynchronousKLVMetadata&&this.onSynchronousKLVMetadata(r)},t.prototype.parseAsynchronousKLVMetadataPayload=function(e,t,i){var a=new J;a.pid=t,a.stream_id=i,a.len=e.byteLength,a.data=e,this.onAsynchronousKLVMetadata&&this.onAsynchronousKLVMetadata(a)},t.prototype.parseSMPTE2038MetadataPayload=function(e,t,i,a,n){var r=new me;if(r.pid=a,r.stream_id=n,r.len=e.byteLength,r.data=e,null!=t){var o=Math.floor(t/this.timescale_);r.pts=o}if(r.nearest_pts=this.getNearestTimestampMilliseconds(),null!=i){var s=Math.floor(i/this.timescale_);r.dts=s}r.ancillaries=function(e){for(var t=new f(e),i=0,a=[];i+=6,0===t.readBits(6);){var n=t.readBool();i+=1;var r=t.readBits(11);i+=11;var o=t.readBits(12);i+=12;var s=255&t.readBits(10);i+=10;var d=255&t.readBits(10);i+=10;var l=255&t.readBits(10);i+=10;for(var _=new Uint8Array(l),u=0;u<l;u++){var c=255&t.readBits(10);i+=10,_[u]=c}t.readBits(10),i+=10;var h="User Defined";65===s?7===d&&(h="SCTE-104"):95===s?220===d?h="ARIB STD-B37 (1SEG)":221===d?h="ARIB STD-B37 (ANALOG)":222===d?h="ARIB STD-B37 (SD)":223===d&&(h="ARIB STD-B37 (HD)"):97===s&&(1===d?h="EIA-708":2===d&&(h="EIA-608")),a.push({yc_indicator:n,line_number:r,horizontal_offset:o,did:s,sdid:d,user_data:_,description:h,information:{}}),t.readBits(8-(i-Math.floor(i/8))%8),i+=(8-(i-Math.floor(i/8)))%8}return t.destroy(),t=null,a}(e),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(r)},t.prototype.parseSEIPayload=function(e,t,i){var a=T(e,null!=t?Math.floor(t/this.timescale_):void 0,i);a&&this.onSEI&&this.onSEI(a)},t.prototype.getNearestTimestampMilliseconds=function(){return null!=this.audio_last_sample_pts_?Math.floor(this.audio_last_sample_pts_):null!=this.last_pcr_?Math.floor(this.last_pcr_/300/this.timescale_):void 0},t.prototype.getPcrBase=function(e){var t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296<this.last_pcr_base_&&(t+=8589934592,this.timestamp_offset_+=8589934592),this.last_pcr_base_=t,t},t.prototype.getTimestamp=function(e,t){var i=536870912*(14&e[t])+4194304*(255&e[t+1])+16384*(254&e[t+2])+128*(255&e[t+3])+(254&e[t+4])/2+this.timestamp_offset_;return i+4294967296<this.last_pcr_base_&&(i+=8589934592),i},t}(M),we=Ce,Ie=function(e,t,i){if(i||2===arguments.length)for(var a,n=0,r=t.length;n<r;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},Be=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],av01:[],av1C:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],chnl:[],".mp3":[],Opus:[],dOps:[],fLaC:[],dfLa:[],ipcm:[],pcmC:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,a=Array.prototype.slice.call(arguments,1),n=a.length,r=0;r<n;r++)t+=a[r].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var o=8;for(r=0;r<n;r++)i.set(a[r],o),o+=a[r].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),a=e.moov(t),n=new Uint8Array(i.byteLength+a.byteLength);return n.set(i,0),n.set(a,i.byteLength),n},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),a=e.trak(t),n=e.mvex(t);return e.box(e.types.moov,i,a,n)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,a=t.duration,n=t.presentWidth,r=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,r>>>8&255,255&r,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,a=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,85,196,0,0]))},e.hdlr=function(t){var i;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):"ac-3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ac3(t)):"ec-3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ec3(t)):"opus"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.Opus(t)):"flac"==t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.fLaC(t)):"ipcm"==t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ipcm(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"video"===t.type&&t.codec.startsWith("hvc1")?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t)):"video"===t.type&&t.codec.startsWith("av01")?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.av01(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types[".mp3"],n)},e.mp4a=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.mp4a,n,e.esds(t))},e.ac3=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types["ac-3"],n,e.box(e.types.dac3,new Uint8Array(t.config)))},e.ec3=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types["ec-3"],n,e.box(e.types.dec3,new Uint8Array(t.config)))},e.esds=function(t){var i=t.config||[],a=i.length,n=new Uint8Array([0,0,0,0,3,23+a,0,1,0,4,15+a,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([a]).concat(i).concat([6,1,2]));return e.box(e.types.esds,n)},e.Opus=function(t){var i=t.channelCount,a=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.Opus,n,e.dOps(t))},e.dOps=function(t){var i=t.channelCount,a=t.channelConfigCode,n=t.audioSampleRate;if(t.config)return e.box(e.types.dOps,t.config);var r=[];switch(a){case 1:case 2:r=[0];break;case 0:r=[255,1,1,0,1];break;case 128:r=[255,2,0,0,1];break;case 3:r=[1,2,1,0,2,1];break;case 4:r=[1,2,2,0,1,2,3];break;case 5:r=[1,3,2,0,4,1,2,3];break;case 6:r=[1,4,2,0,4,1,2,3,5];break;case 7:r=[1,4,2,0,4,1,2,3,5,6];break;case 8:r=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:r=[1,1,2,0,1];break;case 131:r=[1,1,3,0,1,2];break;case 132:r=[1,1,4,0,1,2,3];break;case 133:r=[1,1,5,0,1,2,3,4];break;case 134:r=[1,1,6,0,1,2,3,4,5];break;case 135:r=[1,1,7,0,1,2,3,4,5,6];break;case 136:r=[1,1,8,0,1,2,3,4,5,6,7]}var o=new Uint8Array(Ie([0,i,0,0,n>>>24&255,n>>>17&255,n>>>8&255,n>>>0&255,0,0],r,!0));return e.box(e.types.dOps,o)},e.fLaC=function(t){var i=t.channelCount,a=Math.min(t.audioSampleRate,65535),n=t.sampleSize,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,n,0,0,0,0,a>>>8&255,255&a,0,0]);return e.box(e.types.fLaC,r,e.dfLa(t))},e.dfLa=function(t){var i=new Uint8Array(Ie([0,0,0,0],t.config,!0));return e.box(e.types.dfLa,i)},e.ipcm=function(t){var i=t.channelCount,a=Math.min(t.audioSampleRate,65535),n=t.sampleSize,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,n,0,0,0,0,a>>>8&255,255&a,0,0]);return 1===t.channelCount?e.box(e.types.ipcm,r,e.pcmC(t)):e.box(e.types.ipcm,r,e.chnl(t),e.pcmC(t))},e.chnl=function(t){var i=new Uint8Array([0,0,0,0,1,t.channelCount,0,0,0,0,0,0,0,0]);return e.box(e.types.chnl,i)},e.pcmC=function(t){var i=t.littleEndian?1:0,a=t.sampleSize,n=new Uint8Array([0,0,0,0,i,a]);return e.box(e.types.pcmC,n)},e.avc1=function(t){var i=t.avcc,a=t.codecWidth,n=t.codecHeight,r=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,a>>>8&255,255&a,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,r,e.box(e.types.avcC,i))},e.hvc1=function(t){var i=t.hvcc,a=t.codecWidth,n=t.codecHeight,r=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,a>>>8&255,255&a,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,r,e.box(e.types.hvcC,i))},e.av01=function(t){var i=t.av1c,a=t.codecWidth||192,n=t.codecHeight||108,r=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,a>>>8&255,255&a,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.av01,r,e.box(e.types.av1C,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,a=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,a)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var a=t.id,n=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a])),r=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,n,r,s,o)},e.sdtp=function(t){for(var i=t.samples||[],a=i.length,n=new Uint8Array(4+a),r=0;r<a;r++){var o=i[r].flags;n[r+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,n)},e.trun=function(t,i){var a=t.samples||[],n=a.length,r=12+16*n,o=new Uint8Array(r);i+=8+r,o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var s=0;s<n;s++){var d=a[s].duration,l=a[s].size,_=a[s].flags,u=a[s].cts;o.set([d>>>24&255,d>>>16&255,d>>>8&255,255&d,l>>>24&255,l>>>16&255,l>>>8&255,255&l,_.isLeading<<2|_.dependsOn,_.isDependedOn<<6|_.hasRedundancy<<4|_.isNonSync,0,0,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*s)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();Be.init();var Oe=Be,Pe=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)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(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),xe=i(14),Ue=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,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 xe.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new xe.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.default.chrome||!(o.default.version.major<50||50===o.default.version.major&&o.default.version.build<2661)),this._fillSilentAfterSeek=o.default.msedge||o.default.msie,this._mp3UseMpegAudio=!o.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.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},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new u.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,a="mp4",n=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(a="mpeg",n="",i=new Uint8Array):i=Oe.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=Oe.generateInitSegment(t)}if(!this._onInitSegment)throw new u.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:n,container:"".concat(e,"/").concat(a),mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.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)},e.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var a={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(a.samples.push(t),a.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(a,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,a=e,n=a.samples,o=void 0,s=-1,d=this._audioMeta.refSampleDuration,l="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,_=this._dtsBaseInited&&void 0===this._audioNextDts,u=!1;if(n&&0!==n.length&&(1!==n.length||t)){var c=0,h=null,f=0;l?(c=0,f=a.length):(c=8,f=8+a.length);var p=null;if(n.length>1&&(f-=(p=n.pop()).length),null!=this._audioStashedLastSample){var m=this._audioStashedLastSample;this._audioStashedLastSample=null,n.unshift(m),f+=m.length}null!=p&&(this._audioStashedLastSample=p);var g=n[0].dts-this._dtsBase;if(this._audioNextDts)o=g-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())o=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(u=!0);else{var v=this._audioSegmentInfoList.getLastSampleBefore(g);if(null!=v){var y=g-(v.originalDts+v.duration);y<=3&&(y=0),o=g-(v.dts+v.duration+y)}else o=0}if(u){var S=g-o,E=this._videoSegmentInfoList.getLastSegmentBefore(g);if(null!=E&&E.beginDts<S){if(I=Pe.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var A=E.beginDts,b=S-E.beginDts;r.default.v(this.TAG,"InsertPrefixSilentAudio: dts: ".concat(A,", duration: ").concat(b)),n.unshift({unit:I,dts:A,pts:A}),f+=I.byteLength}}else u=!1}for(var R=[],T=0;T<n.length;T++){var L=(m=n[T]).unit,k=m.dts-this._dtsBase,D=(A=k,!1),M=null,C=0;if(!(k<-.001)){if("mp3"!==this._audioMeta.codec&&null!=d){var w=k;if(this._audioNextDts&&(w=this._audioNextDts),(o=k-w)<=-3*d){r.default.w(this.TAG,"Dropping 1 audio frame (originalDts: ".concat(k," ms ,curRefDts: ").concat(w," ms) due to dtsCorrection: ").concat(o," ms overlap."));continue}if(o>=3*d&&this._fillAudioTimestampGap){D=!0;var I,B=Math.floor(o/d);r.default.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n"+"originalDts: ".concat(k," ms, curRefDts: ").concat(w," ms, ")+"dtsCorrection: ".concat(Math.round(o)," ms, generate: ").concat(B," frames")),A=Math.floor(w),C=Math.floor(w+d)-A,null==(I=Pe.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(r.default.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),I=L),M=[];for(var O=0;O<B;O++){w+=d;var P=Math.floor(w),x=Math.floor(w+d)-P,U={dts:P,pts:P,cts:0,unit:I,size:I.byteLength,duration:x,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};M.push(U),f+=U.size}this._audioNextDts=w+d}else A=Math.floor(w),C=Math.floor(w+d)-A,this._audioNextDts=w+d}else A=k-o,C=T!==n.length-1?n[T+1].dts-this._dtsBase-o-A:null!=p?p.dts-this._dtsBase-o-A:R.length>=1?R[R.length-1].duration:Math.floor(d),this._audioNextDts=A+C;-1===s&&(s=A),R.push({dts:A,pts:A,cts:0,unit:m.unit,size:m.unit.byteLength,duration:C,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),D&&R.push.apply(R,M)}}if(0===R.length)return a.samples=[],void(a.length=0);for(l?h=new Uint8Array(f):((h=new Uint8Array(f))[0]=f>>>24&255,h[1]=f>>>16&255,h[2]=f>>>8&255,h[3]=255&f,h.set(Oe.types.mdat,4)),T=0;T<R.length;T++)L=R[T].unit,h.set(L,c),c+=L.byteLength;var N=R[R.length-1];i=N.dts+N.duration;var V=new xe.MediaSegmentInfo;V.beginDts=s,V.endDts=i,V.beginPts=s,V.endPts=i,V.originalBeginDts=R[0].originalDts,V.originalEndDts=N.originalDts+N.duration,V.firstSample=new xe.SampleInfo(R[0].dts,R[0].pts,R[0].duration,R[0].originalDts,!1),V.lastSample=new xe.SampleInfo(N.dts,N.pts,N.duration,N.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(V),a.samples=R,a.sequenceNumber++;var G;G=l?new Uint8Array:Oe.moof(a,s),a.samples=[],a.length=0;var F={type:"audio",data:this._mergeBoxes(G,h).buffer,sampleCount:R.length,info:V};l&&_&&(F.timestampOffset=s),this._onMediaSegment("audio",F)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,a,n=e,r=n.samples,o=void 0,s=-1,d=-1;if(r&&0!==r.length&&(1!==r.length||t)){var l=8,_=null,u=8+e.length,c=null;if(r.length>1&&(u-=(c=r.pop()).length),null!=this._videoStashedLastSample){var h=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(h),u+=h.length}null!=c&&(this._videoStashedLastSample=c);var f=r[0].dts-this._dtsBase;if(this._videoNextDts)o=f-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var p=this._videoSegmentInfoList.getLastSampleBefore(f);if(null!=p){var m=f-(p.originalDts+p.duration);m<=3&&(m=0),o=f-(p.dts+p.duration+m)}else o=0}for(var g=new xe.MediaSegmentInfo,v=[],y=0;y<r.length;y++){var S=(h=r[y]).dts-this._dtsBase,E=h.isKeyframe,A=S-o,b=h.cts,R=A+b;-1===s&&(s=A,d=R);var T=0;if(T=y!==r.length-1?r[y+1].dts-this._dtsBase-o-A:null!=c?c.dts-this._dtsBase-o-A:v.length>=1?v[v.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),E){var L=new xe.SampleInfo(A,R,T,h.dts,!0);L.fileposition=h.fileposition,g.appendSyncPoint(L)}v.push({dts:A,pts:R,cts:b,units:h.units,size:h.length,isKeyframe:E,duration:T,originalDts:S,flags:{isLeading:0,dependsOn:E?2:1,isDependedOn:E?1:0,hasRedundancy:0,isNonSync:E?0:1}})}for((_=new Uint8Array(u))[0]=u>>>24&255,_[1]=u>>>16&255,_[2]=u>>>8&255,_[3]=255&u,_.set(Oe.types.mdat,4),y=0;y<v.length;y++)for(var k=v[y].units;k.length;){var D=k.shift().data;_.set(D,l),l+=D.byteLength}var M=v[v.length-1];if(i=M.dts+M.duration,a=M.pts+M.duration,this._videoNextDts=i,g.beginDts=s,g.endDts=i,g.beginPts=d,g.endPts=a,g.originalBeginDts=v[0].originalDts,g.originalEndDts=M.originalDts+M.duration,g.firstSample=new xe.SampleInfo(v[0].dts,v[0].pts,v[0].duration,v[0].originalDts,v[0].isKeyframe),g.lastSample=new xe.SampleInfo(M.dts,M.pts,M.duration,M.originalDts,M.isKeyframe),this._isLive||this._videoSegmentInfoList.append(g),n.samples=v,n.sequenceNumber++,this._forceFirstIDR){var C=v[0].flags;C.dependsOn=2,C.isNonSync=0}var w=Oe.moof(n,s);n.samples=[],n.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(w,_).buffer,sampleCount:v.length,info:g})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}(),Ne=i(74),Ve=i(125),Ge=(i(187),function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new(n()),this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach(function(a){a.timestampBase=i,i+=a.duration,a.cors=e.cors,a.withCredentials=e.withCredentials,t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy)}),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],a=this._ioctl=new Ne.default(i,this._config,e);a.onError=this._onIOException.bind(this),a.onSeeked=this._onIOSeeked.bind(this),a.onComplete=this._onIOComplete.bind(this),a.onRedirect=this._onIORedirect.bind(this),a.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):a.onDataArrival=this._onInitChunkArrival.bind(this),a.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var a=i.getNearestKeyframe(e);this._remuxer.seek(a.milliseconds),this._ioctl.seek(a.fileposition),this._pendingResolveSeekPoint=a.milliseconds}}else{var n=this._mediaInfo.segments[t];null==n?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(a=n.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,a.fileposition),this._pendingResolveSeekPoint=a.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,a=0;a<t.length;a++)if(e<t[a].timestampBase){i=a-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i,a=this,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else{var o=null;(o=D.probe(e)).match&&(this._setupFLVDemuxerRemuxer(o),n=this._demuxer.parseChunks(e,t)),o.match||o.needMoreData||(o=we.probe(e)).match&&(this._setupTSDemuxerRemuxer(o),n=this._demuxer.parseChunks(e,t)),o.match||o.needMoreData||(o=null,r.default.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then(function(){a._internalAbort()}),null===(i=this._emitter)||void 0===i||i.emit(Ve.default.DEMUX_ERROR,m.default.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return n},e.prototype._setupFLVDemuxerRemuxer=function(e){this._demuxer=new D(e,this._config),this._remuxer||(this._remuxer=new Ue(this._config));var t=this._mediaDataSource;null==t.duration||isNaN(t.duration)||(this._demuxer.overridedDuration=t.duration),"boolean"==typeof t.hasAudio&&(this._demuxer.overridedHasAudio=t.hasAudio),"boolean"==typeof t.hasVideo&&(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)},e.prototype._setupTSDemuxerRemuxer=function(e){var t=this._demuxer=new we(e,this._config);this._remuxer||(this._remuxer=new Ue(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)},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,s.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,s.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)})},e.prototype._onMetaDataArrived=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.TIMED_ID3_METADATA_ARRIVED,e))},e.prototype._onPGSSubtitle=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.PGS_SUBTITLE_ARRIVED,e))},e.prototype._onSynchronousKLVMetadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,e))},e.prototype._onAsynchronousKLVMetadata=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)},e.prototype._onSMPTE2038Metadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.dts&&(e.dts-=i),null!=e.nearest_pts&&(e.nearest_pts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SMPTE2038_METADATA_ARRIVED,e))},e.prototype._onSEI=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SEI_ARRIVED,e))},e.prototype._onSCTE35Metadata=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.nearest_pts&&(e.nearest_pts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.SCTE35_METADATA_ARRIVED,e))},e.prototype._onPESPrivateDataDescriptor=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(Ve.default.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t,i=this._remuxer.getTimestampBase();null!=i&&(null!=e.pts&&(e.pts-=i),null!=e.nearest_pts&&(e.nearest_pts-=i),null!=e.dts&&(e.dts-=i),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.PES_PRIVATE_DATA_ARRIVED,e))},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t,i=e+1;i<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(i)):(this._remuxer&&this._remuxer.flushStashedSamples(),null===(t=this._emitter)||void 0===t||t.emit(Ve.default.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(Ve.default.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){var i;r.default.e(this.TAG,"IOException: type = ".concat(e,", code = ").concat(t.code,", msg = ").concat(t.msg)),null===(i=this._emitter)||void 0===i||i.emit(Ve.default.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){var i;r.default.e(this.TAG,"DemuxException: type = ".concat(e,", info = ").concat(t)),null===(i=this._emitter)||void 0===i||i.emit(Ve.default.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){var i;null===(i=this._emitter)||void 0===i||i.emit(Ve.default.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){var i,a;if(null==this._pendingSeekTime&&(null===(i=this._emitter)||void 0===i||i.emit(Ve.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var n=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.default.safari&&n.length>0&&n[0].originalDts===r&&(r=n[0].pts),null===(a=this._emitter)||void 0===a||a.emit(Ve.default.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t,i=this._mediaInfo.segments[e],a=Object.assign({},i);a.duration=this._mediaInfo.duration,a.segmentCount=this._mediaInfo.segmentCount,delete a.segments,delete a.keyframesIndex,null===(t=this._emitter)||void 0===t||t.emit(Ve.default.MEDIA_INFO,a)},e.prototype._reportStatisticsInfo=function(){var e,t={};t.url=this._ioctl.currentURL,t.hasRedirect=this._ioctl.hasRedirect,t.hasRedirect&&(t.redirectedURL=this._ioctl.currentRedirectedURL),t.speed=this._ioctl.currentSpeed,t.loaderType=this._ioctl.loaderType,t.currentSegmentIndex=this._currentSegmentIndex,t.totalSegmentCount=this._mediaDataSource.segments.length,null===(e=this._emitter)||void 0===e||e.emit(Ve.default.STATISTICS_INFO,t)},e}())},125:function(e,t,i){"use strict";var a;i.r(t),function(e){e.IO_ERROR="io_error",e.DEMUX_ERROR="demux_error",e.INIT_SEGMENT="init_segment",e.MEDIA_SEGMENT="media_segment",e.LOADING_COMPLETE="loading_complete",e.RECOVERED_EARLY_EOF="recovered_early_eof",e.MEDIA_INFO="media_info",e.METADATA_ARRIVED="metadata_arrived",e.SCRIPTDATA_ARRIVED="scriptdata_arrived",e.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",e.PGS_SUBTITLE_ARRIVED="pgs_subtitle_arrived",e.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",e.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",e.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",e.SEI_ARRIVED="sei_arrived",e.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",e.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",e.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",e.STATISTICS_INFO="statistics_info",e.RECOMMEND_SEEKPOINT="recommend_seekpoint"}(a||(a={})),t.default=a},944:function(e,t,i){"use strict";i.r(t),i(291);var a=i(258),n=i(760),r=i(385),o=i(125);t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function s(t,i){var a={msg:o.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(a,[i.data])}function d(t,i){var a={msg:o.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(a,[i.data])}function l(){var t={msg:o.default.LOADING_COMPLETE};e.postMessage(t)}function _(){var t={msg:o.default.RECOVERED_EARLY_EOF};e.postMessage(t)}function u(t){var i={msg:o.default.MEDIA_INFO,data:t};e.postMessage(i)}function c(t){var i={msg:o.default.METADATA_ARRIVED,data:t};e.postMessage(i)}function h(t){var i={msg:o.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:o.default.TIMED_ID3_METADATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:o.default.PGS_SUBTITLE_ARRIVED,data:t};e.postMessage(i)}function m(t){var i={msg:o.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,data:t};e.postMessage(i)}function g(t){var i={msg:o.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,data:t};e.postMessage(i)}function v(t){var i={msg:o.default.SMPTE2038_METADATA_ARRIVED,data:t};e.postMessage(i)}function y(t){var i={msg:o.default.SEI_ARRIVED,data:t};e.postMessage(i)}function S(t){var i={msg:o.default.SCTE35_METADATA_ARRIVED,data:t};e.postMessage(i)}function E(t){var i={msg:o.default.PES_PRIVATE_DATA_DESCRIPTOR,data:t};e.postMessage(i)}function A(t){var i={msg:o.default.PES_PRIVATE_DATA_ARRIVED,data:t};e.postMessage(i)}function b(t){var i={msg:o.default.STATISTICS_INFO,data:t};e.postMessage(i)}function R(t,i){e.postMessage({msg:o.default.IO_ERROR,data:{type:t,info:i}})}function T(t,i){e.postMessage({msg:o.default.DEMUX_ERROR,data:{type:t,info:i}})}function L(t){e.postMessage({msg:o.default.RECOMMEND_SEEKPOINT,data:t})}n.default.install(),e.addEventListener("message",function(n){switch(n.data.cmd){case"init":(t=new r.default(n.data.param[0],n.data.param[1])).on(o.default.IO_ERROR,R.bind(this)),t.on(o.default.DEMUX_ERROR,T.bind(this)),t.on(o.default.INIT_SEGMENT,s.bind(this)),t.on(o.default.MEDIA_SEGMENT,d.bind(this)),t.on(o.default.LOADING_COMPLETE,l.bind(this)),t.on(o.default.RECOVERED_EARLY_EOF,_.bind(this)),t.on(o.default.MEDIA_INFO,u.bind(this)),t.on(o.default.METADATA_ARRIVED,c.bind(this)),t.on(o.default.SCRIPTDATA_ARRIVED,h.bind(this)),t.on(o.default.TIMED_ID3_METADATA_ARRIVED,f.bind(this)),t.on(o.default.PGS_SUBTITLE_ARRIVED,p.bind(this)),t.on(o.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,m.bind(this)),t.on(o.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,g.bind(this)),t.on(o.default.SMPTE2038_METADATA_ARRIVED,v.bind(this)),t.on(o.default.SEI_ARRIVED,y.bind(this)),t.on(o.default.SCTE35_METADATA_ARRIVED,S.bind(this)),t.on(o.default.PES_PRIVATE_DATA_DESCRIPTOR,E.bind(this)),t.on(o.default.PES_PRIVATE_DATA_ARRIVED,A.bind(this)),t.on(o.default.STATISTICS_INFO,b.bind(this)),t.on(o.default.RECOMMEND_SEEKPOINT,L.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var k=n.data.param;a.default.applyConfig(k),!0===k.enableCallback?a.default.addLogListener(i):a.default.removeLogListener(i)}})}},24:function(e,t,i){"use strict";i.r(t),t.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},497:function(e,t,i){e.exports=i(75).default},74:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return y}});var a,n=i(291),r=function(){function e(){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 e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}(),o=i(187),s=i(687),d=i(842),l=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},a(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),_=function(e){function t(t,i){var a=e.call(this,"fetch-stream-loader")||this;return a.TAG="FetchStreamLoader",a._seekHandler=t,a._config=i,a._needStash=!0,a._requestAbort=!1,a._abortController=null,a._contentLength=null,a._receivedLength=0,a}return l(t,e),t.isSupported=function(){try{var e=s.default.msedge&&s.default.version.minor>=15048,t=!s.default.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var a=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(a=e.redirectedURL);var n=this._seekHandler.getConfig(a,t),r=new self.Headers;if("object"==typeof n.headers){var s=n.headers;for(var l in s)s.hasOwnProperty(l)&&r.append(l,s[l])}var _={method:"GET",headers:r,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)r.append(l,this._config.headers[l]);!1===e.cors&&(_.mode="same-origin"),e.withCredentials&&(_.credentials="include"),e.referrerPolicy&&(_.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,_.signal=this._abortController.signal),this._status=o.LoaderStatus.kConnecting,self.fetch(n.url,_).then(function(e){if(i._requestAbort)return i._status=o.LoaderStatus.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==n.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var a=e.headers.get("Content-Length");return null!=a&&(i._contentLength=parseInt(a),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=o.LoaderStatus.kError,!i._onError)throw new d.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=o.LoaderStatus.kError,!i._onError)throw e;i._onError(o.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})}})},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.LoaderStatus.kBuffering||!s.default.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then(function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.LoaderStatus.kError;var a=o.LoaderErrors.EARLY_EOF,n={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new d.RuntimeException(n.msg);t._onError(a,n)}else t._status=o.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.LoaderStatus.kComplete);if(!0===t._requestAbort)return t._status=o.LoaderStatus.kComplete,e.cancel();t._status=o.LoaderStatus.kBuffering;var r=i.value.buffer,s=t._range.from+t._receivedLength;t._receivedLength+=r.byteLength,t._onDataArrival&&t._onDataArrival(r,s,t._receivedLength),t._pump(e)}}).catch(function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.LoaderStatus.kComplete;else if(11!==e.code||!s.default.msedge){t._status=o.LoaderStatus.kError;var i=0,a=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=o.LoaderErrors.EXCEPTION,a={code:e.code,msg:e.message}):(i=o.LoaderErrors.EARLY_EOF,a={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new d.RuntimeException(a.msg);t._onError(i,a)}})},t}(o.BaseLoader),u=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),c=function(e){function t(t,i){var a=e.call(this,"xhr-moz-chunked-loader")||this;return a.TAG="MozChunkedLoader",a._seekHandler=t,a._config=i,a._needStash=!0,a._xhr=null,a._requestAbort=!1,a._contentLength=null,a._receivedLength=0,a}return u(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return n.default.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var a=this._seekHandler.getConfig(i,t);this._requestURL=a.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",a.url,!0),n.responseType="moz-chunked-arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onloadend=this._onLoadEnd.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof a.headers){var r=a.headers;for(var s in r)r.hasOwnProperty(s)&&n.setRequestHeader(s,r[s])}if("object"==typeof this._config.headers)for(var s in r=this._config.headers)r.hasOwnProperty(s)&&n.setRequestHeader(s,r[s]);this._status=o.LoaderStatus.kConnecting,n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.LoaderStatus.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=o.LoaderStatus.kError,!this._onError)throw new d.RuntimeException("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.LoaderStatus.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.LoaderStatus.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.LoaderStatus.kError&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new d.RuntimeException(i.msg);this._onError(t,i)},t}(o.BaseLoader),h=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),f=function(e){function t(t,i){var a=e.call(this,"xhr-range-loader")||this;return a.TAG="RangeLoader",a._seekHandler=t,a._config=i,a._needStash=!1,a._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],a._currentChunkSizeKB=384,a._currentSpeedNormalized=0,a._zeroSpeedChunkCount=0,a._xhr=null,a._speedSampler=new r,a._requestAbort=!1,a._waitForTotalLength=!1,a._totalLengthReceived=!1,a._currentRequestURL=null,a._currentRedirectedURL=null,a._currentRequestRange=null,a._totalLength=null,a._contentLength=null,a._receivedLength=0,a._lastTimeLoaded=0,a}return h(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return n.default.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.LoaderStatus.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var a=this._seekHandler.getConfig(i,t);this._currentRequestURL=a.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",a.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof a.headers){var r=a.headers;for(var o in r)r.hasOwnProperty(o)&&n.setRequestHeader(o,r[o])}if("object"==typeof this._config.headers)for(var o in r=this._config.headers)r.hasOwnProperty(o)&&n.setRequestHeader(o,r[o]);n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.LoaderStatus.kComplete},t.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)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.LoaderStatus.kBuffering}else{if(this._status=o.LoaderStatus.kError,!this._onError)throw new d.RuntimeException("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.LoaderStatus.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var a=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(a)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,a=0,n=0,r=i;if(e<t[0])return t[0];for(;n<=r;){if((a=n+Math.floor((r-n)/2))===i||e>=t[a]&&e<t[a+1])return t[a];t[a]<e?n=a+1:r=a-1}},t.prototype._onLoad=function(e){if(this._status!==o.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var a=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=a.byteLength;var r=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():r=!0,this._onDataArrival&&this._onDataArrival(a,n,this._receivedLength),r&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new d.RuntimeException(i.msg);this._onError(t,i)},t}(o.BaseLoader),p=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),m=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return p(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=o.LoaderStatus.kConnecting}catch(e){this._status=o.LoaderStatus.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new d.RuntimeException(i.msg);this._onError(o.LoaderErrors.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=o.LoaderStatus.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=o.LoaderStatus.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=o.LoaderStatus.kError;var a={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new d.RuntimeException(a.msg);this._onError(o.LoaderErrors.EXCEPTION,a)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=o.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new d.RuntimeException(t.msg);this._onError(o.LoaderErrors.EXCEPTION,t)},t}(o.BaseLoader),g=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var a;a=-1!==t.to?"bytes=".concat(t.from.toString(),"-").concat(t.to.toString()):"bytes=".concat(t.from.toString(),"-"),i.Range=a}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}(),v=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var a=!0;-1===i.indexOf("?")&&(i+="?",a=!1),a&&(i+="&"),i+="".concat(this._startName,"=").concat(t.from.toString()),-1!==t.to&&(i+="&".concat(this._endName,"=").concat(t.to.toString()))}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,a=e.indexOf("?");-1!==a&&(i=e.substring(a+1));var n="";if(null!=i&&i.length>0)for(var r=i.split("&"),o=0;o<r.length;o++){var s=r[o].split("="),d=o>0;s[0]!==this._startName&&s[0]!==this._endName&&(d&&(n+="&"),n+=r[o])}return 0===n.length?t:t+"?"+n},e}(),y=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.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,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new r,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 e.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},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===f?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new g(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new v(t,i)}else{if("custom"!==e.seekType)throw new d.InvalidArgumentException("Invalid seekType in config: ".concat(e.seekType));if("function"!=typeof e.customSeekHandler)throw new d.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=m;else if(_.isSupported())this._loaderClass=_;else if(c.isSupported())this._loaderClass=c;else{if(!f.isSupported())throw new d.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=f}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new d.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var a=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(a,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,a=0,n=0,r=i;if(e<t[0])return t[0];for(;n<=r;){if((a=n+Math.floor((r-n)/2))===i||e>=t[a]&&e<t[a+1])return t[a];t[a]<e?n=a+1:r=a-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new d.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var a=this._speedSampler.lastSecondKBps;if(0!==a){var n=this._normalizeSpeed(a);this._speedNormalized!==n&&(this._speedNormalized=n,this._adjustStashSize(n))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(s=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(s=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var r=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(r,this._stashByteStart))<r.byteLength?l>0&&(_=new Uint8Array(r,l),s.set(_,0),this._stashUsed=_.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(o),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l);else if(0===this._stashUsed){var o;(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&this._expandBuffer(o),(s=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l)}else{var s,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(s=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var _=new Uint8Array(this._stashBuffer,l);s.set(_,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),a=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var r=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,i);r.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=i}return 0}n.default.w(this.TAG,"".concat(a," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,a}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(n.default.e(this.TAG,"Loader error, code = ".concat(t.code,", msg = ").concat(t.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case o.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=o.LoaderErrors.UNRECOVERABLE_EARLY_EOF;case o.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case o.LoaderErrors.CONNECTING_TIMEOUT:case o.LoaderErrors.HTTP_STATUS_CODE_INVALID:case o.LoaderErrors.EXCEPTION:}if(!this._onError)throw new d.RuntimeException("IOException: "+t.msg);this._onError(e,t)},e}()},187:function(e,t,i){"use strict";i.r(t),i.d(t,{BaseLoader:function(){return o},LoaderErrors:function(){return r},LoaderStatus:function(){return n}});var a=i(842),n={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},r={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},o=function(){function e(e){this._type=e||"undefined",this._status=n.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=n.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===n.kConnecting||this._status===n.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new a.NotImplementedException("Unimplemented abstract function!")},e.prototype.abort=function(){throw new a.NotImplementedException("Unimplemented abstract function!")},e}()},75:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return O}});var a=i(760),n=i(74),r={enableWorker:!1,enableWorkerForMSE:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyChasingOnPaused:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,liveSync:!1,liveSyncMaxLatency:1.2,liveSyncTargetLatency:.8,liveSyncPlaybackRate:1.2,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function o(){return Object.assign({},r)}var s=function(){function e(){}return e.supportMSEH264Playback=function(){var e='video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=self.MediaSource&&self.MediaSource.isTypeSupported(e),i=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported(e);return t||i},e.supportMSEH265Playback=function(){var e='video/mp4; codecs="hvc1.1.6.L93.B0"',t=self.MediaSource&&self.MediaSource.isTypeSupported(e),i=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported(e);return t||i},e.supportNetworkStreamIO=function(){var e=new n.default({},o()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.default({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.mseH265Playback=e.supportMSEH265Playback(),t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeMP4H265Playback=e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}(),d=s,l=i(187),_=i(291),u=i(554),c=i.n(u),h=i(339),f=i(768),p=i(902),m=i(136),g=i(952),v=i(842),y=i(125),S=i(687),E=i(14),A=function(){function e(e,t,i){this.TAG="SeekingHandler",this._config=null,this._media_element=null,this._always_seek_keyframe=!1,this._on_unbuffered_seek=null,this._request_set_current_time=!1,this._seek_request_record_clocktime=null,this._idr_sample_list=new E.IDRSampleList,this.e=null,this._config=e,this._media_element=t,this._on_unbuffered_seek=i,this.e={onMediaSeeking:this._onMediaSeeking.bind(this)};var a=S.default.chrome&&(S.default.version.major<50||50===S.default.version.major&&S.default.version.build<2661);this._always_seek_keyframe=!!(a||S.default.msedge||S.default.msie),this._always_seek_keyframe&&(this._config.accurateSeek=!1),this._media_element.addEventListener("seeking",this.e.onMediaSeeking)}return e.prototype.destroy=function(){this._idr_sample_list.clear(),this._idr_sample_list=null,this._media_element.removeEventListener("seeking",this.e.onMediaSeeking),this._media_element=null,this._on_unbuffered_seek=null},e.prototype.seek=function(e){var t=this._isPositionBuffered(e),i=!1;if(e<1&&this._media_element.buffered.length>0){var a=this._media_element.buffered.start(0);(a<1&&e<a||S.default.safari)&&(i=!0,e=S.default.safari?.1:a)}if(i)this.directSeek(e);else if(t)if(this._always_seek_keyframe){var n=this._getNearestKeyframe(Math.floor(1e3*e));null!=n&&(e=n.dts/1e3),this.directSeek(e)}else this.directSeek(e);else this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*e)),this._config.accurateSeek&&this.directSeek(e)},e.prototype.directSeek=function(e){this._request_set_current_time=!0,this._media_element.currentTime=e},e.prototype.appendSyncPoints=function(e){this._idr_sample_list.appendArray(e)},e.prototype._onMediaSeeking=function(t){if(this._request_set_current_time)this._request_set_current_time=!1;else{var i=this._media_element.currentTime,a=this._media_element.buffered;if(i<1&&a.length>0){var n=a.start(0);if(n<1&&i<n||S.default.safari){var r=S.default.safari?.1:n;return void this.directSeek(r)}}if(this._isPositionBuffered(i)){if(this._always_seek_keyframe){var o=this._getNearestKeyframe(Math.floor(1e3*i));null!=o&&(i=o.dts/1e3,this.directSeek(i))}}else this._seek_request_record_clocktime=e._getClockTime(),window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)}},e.prototype._pollAndApplyUnbufferedSeek=function(){if(null!=this._seek_request_record_clocktime)if(this._seek_request_record_clocktime<=e._getClockTime()-100){var t=this._media_element.currentTime;this._seek_request_record_clocktime=null,this._isPositionBuffered(t)||(this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*t)),this._config.accurateSeek&&this.directSeek(t))}else window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)},e.prototype._isPositionBuffered=function(e){for(var t=this._media_element.buffered,i=0;i<t.length;i++){var a=t.start(i),n=t.end(i);if(e>=a&&e<n)return!0}return!1},e.prototype._getNearestKeyframe=function(e){return this._idr_sample_list.getLastSyncPointBeforeDts(e)},e._getClockTime=function(){return self.performance&&self.performance.now?self.performance.now():Date.now()},e}(),b=function(){function e(e,t,i,a){this.TAG="LoadingController",this._config=null,this._media_element=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null,this._paused=!1,this.e=null,this._config=e,this._media_element=t,this._on_pause_transmuxer=i,this._on_resume_transmuxer=a,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)}}return e.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this.e=null,this._media_element=null,this._config=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null},e.prototype.notifyBufferedPositionChanged=function(e){!this._config.isLive&&this._config.lazyLoad&&(null==e?this._suspendTransmuxerIfNeeded():this._suspendTransmuxerIfBufferedPositionExceeded(e))},e.prototype._onMediaTimeUpdate=function(e){this._paused&&this._resumeTransmuxerIfNeeded()},e.prototype._suspendTransmuxerIfNeeded=function(){for(var e=this._media_element.buffered,t=this._media_element.currentTime,i=0,a=0;a<e.length;a++){var n=e.start(a),r=e.end(a);if(n<=t&&t<r){i=r;break}}i>0&&this._suspendTransmuxerIfBufferedPositionExceeded(i)},e.prototype._suspendTransmuxerIfBufferedPositionExceeded=function(e){e>=this._media_element.currentTime+this._config.lazyLoadMaxDuration&&!this._paused&&(_.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this.suspendTransmuxer(),this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate))},e.prototype.suspendTransmuxer=function(){this._paused=!0,this._on_pause_transmuxer()},e.prototype._resumeTransmuxerIfNeeded=function(){for(var e=this._media_element.buffered,t=this._media_element.currentTime,i=this._config.lazyLoadRecoverDuration,a=!1,n=0;n<e.length;n++){var r=e.start(n),o=e.end(n);if(t>=r&&t<o){t>=o-i&&(a=!0);break}}a&&(_.default.v(this.TAG,"Continue loading from paused position"),this.resumeTransmuxer(),this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate))},e.prototype.resumeTransmuxer=function(){this._paused=!1,this._on_resume_transmuxer()},e}(),R=function(){function e(e,t){this.TAG="StartupStallJumper",this._media_element=null,this._on_direct_seek=null,this._canplay_received=!1,this.e=null,this._media_element=e,this._on_direct_seek=t,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 e.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},e.prototype._onMediaCanPlay=function(e){this._canplay_received=!0,this._media_element.removeEventListener("canplay",this.e.onMediaCanPlay)},e.prototype._onMediaStalled=function(e){this._detectAndFixStuckPlayback(!0)},e.prototype._onMediaProgress=function(e){this._detectAndFixStuckPlayback()},e.prototype._detectAndFixStuckPlayback=function(e){var t=this._media_element,i=t.buffered;e||!this._canplay_received||t.readyState<2?i.length>0&&t.currentTime<i.start(0)&&(_.default.w(this.TAG,"Playback seems stuck at ".concat(t.currentTime,", seek to ").concat(i.start(0))),this._on_direct_seek(i.start(0)),this._media_element.removeEventListener("progress",this.e.onMediaProgress)):this._media_element.removeEventListener("progress",this.e.onMediaProgress)},e}(),T=function(){function e(e,t,i){this._config=null,this._media_element=null,this._on_direct_seek=null,this._config=e,this._media_element=t,this._on_direct_seek=i}return e.prototype.destroy=function(){this._on_direct_seek=null,this._media_element=null,this._config=null},e.prototype.notifyBufferedRangeUpdate=function(){this._chaseLiveLatency()},e.prototype._chaseLiveLatency=function(){var e=this._media_element.buffered,t=this._media_element.currentTime,i=this._media_element.paused;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&0!=e.length&&(this._config.liveBufferLatencyChasingOnPaused||!i)){var a=e.end(e.length-1);if(a>this._config.liveBufferLatencyMaxLatency&&a-t>this._config.liveBufferLatencyMaxLatency){var n=a-this._config.liveBufferLatencyMinRemain;this._on_direct_seek(n)}}},e}(),L=function(){function e(e,t){this._config=null,this._media_element=null,this.e=null,this._config=e,this._media_element=t,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)},this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate)}return e.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element=null,this._config=null},e.prototype._onMediaTimeUpdate=function(e){if(this._config.isLive&&this._config.liveSync){var t=this._getCurrentLatency();if(t>this._config.liveSyncMaxLatency){var i=Math.min(2,Math.max(1,this._config.liveSyncPlaybackRate));this._media_element.playbackRate=i}else t>this._config.liveSyncTargetLatency||1!==this._media_element.playbackRate&&0!==this._media_element.playbackRate&&(this._media_element.playbackRate=1)}},e.prototype._getCurrentLatency=function(){if(!this._media_element)return 0;var e=this._media_element.buffered,t=this._media_element.currentTime;return 0==e.length?0:e.end(e.length-1)-t},e}(),k=function(){function e(e,t){this.TAG="PlayerEngineMainThread",this._emitter=new u,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=e,this._config=o(),"object"==typeof t&&Object.assign(this._config,t),!0===e.isLive&&(this._config.isLive=!0),this.e={onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this)}}return e.prototype.destroy=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.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},e.prototype.on=function(e,t){var i=this;this._emitter.addListener(e,t),e===f.default.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.MEDIA_INFO,i.mediaInfo)}):e==f.default.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.STATISTICS_INFO,i.statisticsInfo)})},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;this._media_element=e,e.src="",e.removeAttribute("src"),e.srcObject=null,e.load(),e.addEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._mse_controller=new h.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 t._media_element.currentTime},getReadyState:function(){return t._media_element.readyState}}),this._mse_controller.isManagedMediaSource()?(e.disableRemotePlayback=!0,e.srcObject=this._mse_controller.getObject()):e.src=this._mse_controller.getObjectURL()},e.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)},e.prototype.load=function(){var e=this;if(!this._media_element)throw new v.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new v.IllegalStateException("load() has been called, please call unload() first!");this._has_pending_load||(!this._config.deferLoadAfterSourceOpen||this._mse_source_opened?(this._transmuxer=new p.default(this._media_data_source,this._config),this._transmuxer.on(y.default.INIT_SEGMENT,function(t,i){e._mse_controller.appendInitSegment(i)}),this._transmuxer.on(y.default.MEDIA_SEGMENT,function(t,i){var a;e._mse_controller.appendMediaSegment(i),!e._config.isLive&&"video"===t&&i.data&&i.data.byteLength>0&&"info"in i&&e._seeking_handler.appendSyncPoints(i.info.syncPoints),null===(a=e._loading_controller)||void 0===a||a.notifyBufferedPositionChanged(i.info.endDts/1e3)}),this._transmuxer.on(y.default.LOADING_COMPLETE,function(){var t;e._mse_controller.endOfStream(),null===(t=e._emitter)||void 0===t||t.emit(f.default.LOADING_COMPLETE)}),this._transmuxer.on(y.default.RECOVERED_EARLY_EOF,function(){var t;null===(t=e._emitter)||void 0===t||t.emit(f.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(y.default.IO_ERROR,function(t,i){var a;null===(a=e._emitter)||void 0===a||a.emit(f.default.ERROR,g.ErrorTypes.NETWORK_ERROR,t,i)}),this._transmuxer.on(y.default.DEMUX_ERROR,function(t,i){var a;null===(a=e._emitter)||void 0===a||a.emit(f.default.ERROR,g.ErrorTypes.MEDIA_ERROR,t,i)}),this._transmuxer.on(y.default.MEDIA_INFO,function(t){var i;e._media_info=t,null===(i=e._emitter)||void 0===i||i.emit(f.default.MEDIA_INFO,Object.assign({},t))}),this._transmuxer.on(y.default.STATISTICS_INFO,function(t){var i;e._statistics_info=e._fillStatisticsInfo(t),null===(i=e._emitter)||void 0===i||i.emit(f.default.STATISTICS_INFO,Object.assign({},t))}),this._transmuxer.on(y.default.RECOMMEND_SEEKPOINT,function(t){e._media_element&&!e._config.accurateSeek&&e._seeking_handler.directSeek(t/1e3)}),this._transmuxer.on(y.default.METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.SCRIPTDATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SCRIPTDATA_ARRIVED,t)}),this._transmuxer.on(y.default.TIMED_ID3_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.TIMED_ID3_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.PGS_SUBTITLE_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.PGS_SUBTITLE_ARRIVED,t)}),this._transmuxer.on(y.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.SMPTE2038_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SMPTE2038_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.SEI_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SEI_ARRIVED,t)}),this._transmuxer.on(y.default.SCTE35_METADATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.SCTE35_METADATA_ARRIVED,t)}),this._transmuxer.on(y.default.PES_PRIVATE_DATA_DESCRIPTOR,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.PES_PRIVATE_DATA_DESCRIPTOR,t)}),this._transmuxer.on(y.default.PES_PRIVATE_DATA_ARRIVED,function(t){var i;null===(i=e._emitter)||void 0===i||i.emit(f.default.PES_PRIVATE_DATA_ARRIVED,t)}),this._seeking_handler=new A(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new b(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new R(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new T(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new L(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0),this._transmuxer.open()):this._has_pending_load=!0)},e.prototype.unload=function(){var e,t,i,a,n,r,o,s,d;null===(e=this._media_element)||void 0===e||e.pause(),null===(t=this._live_latency_synchronizer)||void 0===t||t.destroy(),this._live_latency_synchronizer=null,null===(i=this._live_latency_chaser)||void 0===i||i.destroy(),this._live_latency_chaser=null,null===(a=this._startup_stall_jumper)||void 0===a||a.destroy(),this._startup_stall_jumper=null,null===(n=this._loading_controller)||void 0===n||n.destroy(),this._loading_controller=null,null===(r=this._seeking_handler)||void 0===r||r.destroy(),this._seeking_handler=null,null===(o=this._mse_controller)||void 0===o||o.flush(),null===(s=this._transmuxer)||void 0===s||s.close(),null===(d=this._transmuxer)||void 0===d||d.destroy(),this._transmuxer=null},e.prototype.play=function(){return this._media_element.play()},e.prototype.pause=function(){this._media_element.pause()},e.prototype.seek=function(e){this._media_element&&this._seeking_handler?this._seeking_handler.seek(e):this._pending_seek_time=e},Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),e.prototype._onMSESourceOpen=function(){this._mse_source_opened=!0,this._has_pending_load&&(this._has_pending_load=!1,this.load())},e.prototype._onMSEUpdateEnd=function(){var e;this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),null===(e=this._loading_controller)||void 0===e||e.notifyBufferedPositionChanged()},e.prototype._onMSEBufferFull=function(){_.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},e.prototype._onMSEError=function(e){var t;null===(t=this._emitter)||void 0===t||t.emit(f.default.ERROR,g.ErrorTypes.MEDIA_ERROR,g.ErrorDetails.MEDIA_MSE_ERROR,e)},e.prototype._onMSEStartStreaming=function(){this._loaded_metadata_received&&(this._config.isLive||(_.default.v(this.TAG,"Resume transmuxing task due to ManagedMediaSource onStartStreaming"),this._loading_controller.resumeTransmuxer()))},e.prototype._onMSEEndStreaming=function(){this._config.isLive||(_.default.v(this.TAG,"Suspend transmuxing task due to ManagedMediaSource onEndStreaming"),this._loading_controller.suspendTransmuxer())},e.prototype._onMediaLoadedMetadata=function(e){this._loaded_metadata_received=!0,null!=this._pending_seek_time&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},e.prototype._onRequestDirectSeek=function(e){this._seeking_handler.directSeek(e)},e.prototype._onRequiredUnbufferedSeek=function(e){this._mse_controller.flush(),this._transmuxer.seek(e)},e.prototype._onRequestPauseTransmuxer=function(){this._transmuxer.pause()},e.prototype._onRequestResumeTransmuxer=function(){this._transmuxer.resume()},e.prototype._fillStatisticsInfo=function(e){if(e.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return e;var t=!0,i=0,a=0;if(this._media_element.getVideoPlaybackQuality){var n=this._media_element.getVideoPlaybackQuality();i=n.totalVideoFrames,a=n.droppedVideoFrames}else null!=this._media_element.webkitDecodedFrameCount?(i=this._media_element.webkitDecodedFrameCount,a=this._media_element.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=a),e},e}(),D=i(966),M=i(258),C=function(){function e(e,t){this.TAG="PlayerEngineDedicatedThread",this._emitter=new u,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=e,this._config=o(),"object"==typeof t&&Object.assign(this._config,t),!0===e.isLive&&(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)},M.default.registerListener(this.e.onLoggingConfigChanged),this._worker=D(150,{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:M.default.getConfig()})}return e.isSupported=function(){return!!(self.Worker&&(self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker||self.ManagedMediaSource&&"canConstructInDedicatedWorker"in self.ManagedMediaSource&&!0===self.ManagedMediaSource.canConstructInDedicatedWorker))},e.prototype.destroy=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.default.DESTROYING),this.unload(),this.detachMediaElement(),this._worker_destroying=!0,this._worker.postMessage({cmd:"destroy"}),M.default.removeListener(this.e.onLoggingConfigChanged),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;this._emitter.addListener(e,t),e===f.default.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.MEDIA_INFO,i.mediaInfo)}):e==f.default.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){var e;return null===(e=i._emitter)||void 0===e?void 0:e.emit(f.default.STATISTICS_INFO,i.statisticsInfo)})},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){this._media_element=e,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"})},e.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)},e.prototype.load=function(){this._worker.postMessage({cmd:"load"}),this._seeking_handler=new A(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new b(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new R(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new T(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new L(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0)},e.prototype.unload=function(){var e,t,i,a,n,r;null===(e=this._media_element)||void 0===e||e.pause(),this._worker.postMessage({cmd:"unload"}),null===(t=this._live_latency_synchronizer)||void 0===t||t.destroy(),this._live_latency_synchronizer=null,null===(i=this._live_latency_chaser)||void 0===i||i.destroy(),this._live_latency_chaser=null,null===(a=this._startup_stall_jumper)||void 0===a||a.destroy(),this._startup_stall_jumper=null,null===(n=this._loading_controller)||void 0===n||n.destroy(),this._loading_controller=null,null===(r=this._seeking_handler)||void 0===r||r.destroy(),this._seeking_handler=null},e.prototype.play=function(){return this._media_element.play()},e.prototype.pause=function(){this._media_element.pause()},e.prototype.seek=function(e){this._media_element&&this._seeking_handler?this._seeking_handler.seek(e):this._pending_seek_time=e},Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),e.prototype._onLoggingConfigChanged=function(e){var t;null===(t=this._worker)||void 0===t||t.postMessage({cmd:"logging_config",logging_config:e})},e.prototype._onMSEUpdateEnd=function(){var e;this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),null===(e=this._loading_controller)||void 0===e||e.notifyBufferedPositionChanged()},e.prototype._onMSEBufferFull=function(){_.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},e.prototype._onMediaLoadedMetadata=function(e){null!=this._pending_seek_time&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},e.prototype._onRequestDirectSeek=function(e){this._seeking_handler.directSeek(e)},e.prototype._onRequiredUnbufferedSeek=function(e){this._worker.postMessage({cmd:"unbuffered_seek",milliseconds:e})},e.prototype._onRequestPauseTransmuxer=function(){this._worker.postMessage({cmd:"pause_transmuxer"})},e.prototype._onRequestResumeTransmuxer=function(){this._worker.postMessage({cmd:"resume_transmuxer"})},e.prototype._onMediaTimeUpdate=function(e){this._worker.postMessage({cmd:"timeupdate",current_time:e.target.currentTime})},e.prototype._onMediaReadyStateChange=function(e){this._worker.postMessage({cmd:"readystatechange",ready_state:e.target.readyState})},e.prototype._onWorkerMessage=function(e){var t,i,a,n,r,o,s=e.data,d=s.msg;if("destroyed"==d||this._worker_destroying)return this._worker_destroying=!1,null===(t=this._worker)||void 0===t||t.terminate(),void(this._worker=null);switch(d){case"mse_init":var l=s;"function"==typeof self.ManagedMediaSource&&!("function"==typeof self.MediaSource)&&(this._media_element.disableRemotePlayback=!0),this._media_element.srcObject=l.handle;break;case"mse_event":(l=s).event==m.default.UPDATE_END?this._onMSEUpdateEnd():l.event==m.default.BUFFER_FULL&&this._onMSEBufferFull();break;case"transmuxing_event":if((l=s).event==y.default.MEDIA_INFO){var u=s;this._media_info=u.info,null===(i=this._emitter)||void 0===i||i.emit(f.default.MEDIA_INFO,Object.assign({},u.info))}else if(l.event==y.default.STATISTICS_INFO){var c=s;this._statistics_info=this._fillStatisticsInfo(c.info),null===(a=this._emitter)||void 0===a||a.emit(f.default.STATISTICS_INFO,Object.assign({},c.info))}else if(l.event==y.default.RECOMMEND_SEEKPOINT){var h=s;this._media_element&&!this._config.accurateSeek&&this._seeking_handler.directSeek(h.milliseconds/1e3)}break;case"player_event":if((l=s).event==f.default.ERROR){var p=s;null===(n=this._emitter)||void 0===n||n.emit(f.default.ERROR,p.error_type,p.error_detail,p.info)}else if("extraData"in l){var g=s;null===(r=this._emitter)||void 0===r||r.emit(g.event,g.extraData)}break;case"logcat_callback":l=s,_.default.emitter.emit("log",l.type,l.logcat);break;case"buffered_position_changed":l=s,null===(o=this._loading_controller)||void 0===o||o.notifyBufferedPositionChanged(l.buffered_position_milliseconds/1e3)}},e.prototype._fillStatisticsInfo=function(e){if(e.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return e;var t=!0,i=0,a=0;if(this._media_element.getVideoPlaybackQuality){var n=this._media_element.getVideoPlaybackQuality();i=n.totalVideoFrames,a=n.droppedVideoFrames}else null!=this._media_element.webkitDecodedFrameCount?(i=this._media_element.webkitDecodedFrameCount,a=this._media_element.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=a),e},e}(),w=function(){function e(e,t){this.TAG="MSEPlayer",this._type="MSEPlayer",this._media_element=null,this._player_engine=null;var i=e.type.toLowerCase();if("mse"!==i&&"mpegts"!==i&&"m2ts"!==i&&"flv"!==i)throw new v.InvalidArgumentException("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");if(t&&t.enableWorkerForMSE&&C.isSupported())try{this._player_engine=new C(e,t)}catch(i){_.default.e(this.TAG,"Error while initializing PlayerEngineDedicatedThread, fallback to PlayerEngineMainThread"),this._player_engine=new k(e,t)}else this._player_engine=new k(e,t)}return e.prototype.destroy=function(){this._player_engine.destroy(),this._player_engine=null,this._media_element=null},e.prototype.on=function(e,t){this._player_engine.on(e,t)},e.prototype.off=function(e,t){this._player_engine.off(e,t)},e.prototype.attachMediaElement=function(e){this._media_element=e,this._player_engine.attachMediaElement(e)},e.prototype.detachMediaElement=function(){this._media_element=null,this._player_engine.detachMediaElement()},e.prototype.load=function(){this._player_engine.load()},e.prototype.unload=function(){this._player_engine.unload()},e.prototype.play=function(){return this._player_engine.play()},e.prototype.pause=function(){this._player_engine.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._media_element.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._media_element.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._media_element.volume},set:function(e){this._media_element.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._media_element.muted},set:function(e){this._media_element.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._media_element?this._media_element.currentTime:0},set:function(e){this._player_engine.seek(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return this._player_engine.mediaInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return this._player_engine.statisticsInfo},enumerable:!1,configurable:!0}),e}(),I=function(){function e(e,t){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(c()),this._config=o(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"===i||"mpegts"===i||"m2ts"===i||"flv"===i)throw new v.InvalidArgumentException("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new v.InvalidArgumentException("NativePlayer(".concat(e.type,") doesn't support multipart playback!"));this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.default.DESTROYING),this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===f.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){var e;null===(e=i._emitter)||void 0===e||e.emit(f.default.MEDIA_INFO,i.mediaInfo)}):e===f.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){var e;null===(e=i._emitter)||void 0===e||e.emit(f.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new v.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)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,a=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,a=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,a=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=a),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){var t;null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),null===(t=this._emitter)||void 0===t||t.emit(f.default.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){var e;null===(e=this._emitter)||void 0===e||e.emit(f.default.STATISTICS_INFO,this.statisticsInfo)},e}();a.default.install();var B={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new v.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new v.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new w(i,t);default:return new I(i,t)}},isSupported:function(){return d.supportMSEH264Playback()},getFeatureList:function(){return d.getFeatureList()}};B.BaseLoader=l.BaseLoader,B.LoaderStatus=l.LoaderStatus,B.LoaderErrors=l.LoaderErrors,B.Events=f.default,B.ErrorTypes=g.ErrorTypes,B.ErrorDetails=g.ErrorDetails,B.MSEPlayer=w,B.NativePlayer=I,B.LoggingControl=M.default,Object.defineProperty(B,"version",{enumerable:!0,get:function(){return"1.8.2"}});var O=B},150:function(e,t,i){"use strict";i.r(t);var a=i(291),n=i(258),r=i(842),o=i(136),s=i(339),d=i(902),l=i(125),_=i(768),u=i(952);t.default=function(e){var t="PlayerEngineWorker",i=function(t,i){e.postMessage({msg:"logcat_callback",type:t,logcat:i})}.bind(void 0),c=null,h=null,f=null,p=null,m=!1,g=!1,v=0,y=0,S=!1;function E(){f&&(f.shutdown(),f.destroy(),f=null)}function A(){if(null==c||null==h)throw new r.IllegalStateException("Worker not initialized");if(p)throw new r.IllegalStateException("Transmuxer has been initialized");g||(!h.deferLoadAfterSourceOpen||m?((p=new d.default(c,h)).on(l.default.INIT_SEGMENT,function(e,t){f.appendInitSegment(t)}),p.on(l.default.MEDIA_SEGMENT,function(t,i){f.appendMediaSegment(i),e.postMessage({msg:"buffered_position_changed",buffered_position_milliseconds:i.info.endDts})}),p.on(l.default.LOADING_COMPLETE,function(){f.endOfStream(),e.postMessage({msg:"player_event",event:_.default.LOADING_COMPLETE})}),p.on(l.default.RECOVERED_EARLY_EOF,function(){e.postMessage({msg:"player_event",event:_.default.RECOVERED_EARLY_EOF})}),p.on(l.default.IO_ERROR,function(t,i){e.postMessage({msg:"player_event",event:_.default.ERROR,error_type:u.ErrorTypes.NETWORK_ERROR,error_detail:t,info:i})}),p.on(l.default.DEMUX_ERROR,function(t,i){e.postMessage({msg:"player_event",event:_.default.ERROR,error_type:u.ErrorTypes.MEDIA_ERROR,error_detail:t,info:i})}),p.on(l.default.MEDIA_INFO,function(e){D(l.default.MEDIA_INFO,e)}),p.on(l.default.STATISTICS_INFO,function(e){D(l.default.STATISTICS_INFO,e)}),p.on(l.default.RECOMMEND_SEEKPOINT,function(t){!function(t){e.postMessage({msg:"transmuxing_event",event:l.default.RECOMMEND_SEEKPOINT,milliseconds:t})}(t)}),p.on(l.default.METADATA_ARRIVED,function(e){M(_.default.METADATA_ARRIVED,e)}),p.on(l.default.SCRIPTDATA_ARRIVED,function(e){M(_.default.SCRIPTDATA_ARRIVED,e)}),p.on(l.default.TIMED_ID3_METADATA_ARRIVED,function(e){M(_.default.TIMED_ID3_METADATA_ARRIVED,e)}),p.on(l.default.PGS_SUBTITLE_ARRIVED,function(e){M(_.default.PGS_SUBTITLE_ARRIVED,e)}),p.on(l.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(e){M(_.default.SYNCHRONOUS_KLV_METADATA_ARRIVED,e)}),p.on(l.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(e){M(_.default.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)}),p.on(l.default.SMPTE2038_METADATA_ARRIVED,function(e){M(_.default.SMPTE2038_METADATA_ARRIVED,e)}),p.on(l.default.SEI_ARRIVED,function(e){M(_.default.SEI_ARRIVED,e)}),p.on(l.default.SCTE35_METADATA_ARRIVED,function(e){M(_.default.SCTE35_METADATA_ARRIVED,e)}),p.on(l.default.PES_PRIVATE_DATA_DESCRIPTOR,function(e){M(_.default.PES_PRIVATE_DATA_DESCRIPTOR,e)}),p.on(l.default.PES_PRIVATE_DATA_ARRIVED,function(e){M(_.default.PES_PRIVATE_DATA_ARRIVED,e)}),p.open()):g=!0)}function b(){f&&f.flush(),p&&(p.close(),p.destroy(),p=null)}function R(){m=!0,g&&(g=!1,A())}function T(){e.postMessage({msg:"mse_event",event:o.default.UPDATE_END})}function L(){a.default.v(t,"MSE SourceBuffer is full, report to main thread"),e.postMessage({msg:"mse_event",event:o.default.BUFFER_FULL})}function k(t){e.postMessage({msg:"player_event",event:_.default.ERROR,error_type:u.ErrorTypes.MEDIA_ERROR,error_detail:u.ErrorTypes.MEDIA_MSE_ERROR,info:t})}function D(t,i){e.postMessage({msg:"transmuxing_event",event:t,info:i})}function M(t,i){e.postMessage({msg:"player_event",event:t,extraData:i})}e.addEventListener("message",function(r){if(!S){var d=r.data;switch(d.cmd){case"logging_config":var l=d;n.default.applyConfig(l.logging_config),!0===l.logging_config.enableCallback?n.default.addLogListener(i):n.default.removeLogListener(i);break;case"init":c=(l=d).media_data_source,h=l.config;break;case"destroy":p&&b(),f&&E(),S=!0,e.postMessage({msg:"destroyed"});break;case"initialize_mse":!function(){a.default.v(t,"Initializing MediaSource in DedicatedWorker"),(f=new s.default(h)).on(o.default.SOURCE_OPEN,R.bind(this)),f.on(o.default.UPDATE_END,T.bind(this)),f.on(o.default.BUFFER_FULL,L.bind(this)),f.on(o.default.ERROR,k.bind(this)),f.initialize({getCurrentTime:function(){return v},getReadyState:function(){return y}});var i=f.getHandle();e.postMessage({msg:"mse_init",handle:i},[i])}();break;case"shutdown_mse":E();break;case"load":A();break;case"unload":b();break;case"unbuffered_seek":l=d,f.flush(),p.seek(l.milliseconds);break;case"timeupdate":v=(l=d).current_time;break;case"readystatechange":y=(l=d).ready_state;break;case"pause_transmuxer":p.pause();break;case"resume_transmuxer":p.resume()}}})}},952:function(e,t,i){"use strict";i.r(t),i.d(t,{ErrorDetails:function(){return o},ErrorTypes:function(){return r}});var a=i(187),n=i(24),r={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},o={NETWORK_EXCEPTION:a.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:a.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:a.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:a.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:n.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:n.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:n.default.CODEC_UNSUPPORTED}},768:function(e,t,i){"use strict";var a;i.r(t),function(e){e.ERROR="error",e.LOADING_COMPLETE="loading_complete",e.RECOVERED_EARLY_EOF="recovered_early_eof",e.MEDIA_INFO="media_info",e.METADATA_ARRIVED="metadata_arrived",e.SCRIPTDATA_ARRIVED="scriptdata_arrived",e.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",e.PGS_SUBTITLE_ARRIVED="pgs_subtitle_arrived",e.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",e.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",e.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",e.SEI_ARRIVED="sei_arrived",e.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",e.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",e.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",e.STATISTICS_INFO="statistics_info",e.DESTROYING="destroying"}(a||(a={})),t.default=a},687:function(e,t,i){"use strict";i.r(t);var a={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},r={};if(n.browser){r[n.browser]=!0;var o=n.majorVersion.split(".");r.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(r.version.minor=parseInt(o[1],10)),o.length>2&&(r.version.build=parseInt(o[2],10))}if(n.platform&&(r[n.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),r.rv||r.iemobile){r.rv&&delete r.rv;var s="msie";n.browser=s,r[s]=!0}if(r.edge){delete r.edge;var d="msedge";n.browser=d,r[d]=!0}if(r.opr){var l="opera";n.browser=l,r[l]=!0}if(r.safari&&r.android){var _="android";n.browser=_,r[_]=!0}for(var u in r.name=n.browser,r.platform=n.platform,a)a.hasOwnProperty(u)&&delete a[u];Object.assign(a,r)}(),t.default=a},842:function(e,t,i){"use strict";i.r(t),i.d(t,{IllegalStateException:function(){return o},InvalidArgumentException:function(){return s},NotImplementedException:function(){return d},RuntimeException:function(){return r}});var a,n=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},a(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),r=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(r),s=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(r),d=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(r)},291:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","error",a),e.ENABLE_ERROR&&(console.error?console.error(a):console.warn?console.warn(a):console.log(a))},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","info",a),e.ENABLE_INFO&&(console.info?console.info(a):console.log(a))},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",a),e.ENABLE_WARN&&(console.warn?console.warn(a):console.log(a))},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",a),e.ENABLE_DEBUG&&(console.debug?console.debug(a):console.log(a))},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var a="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",a),e.ENABLE_VERBOSE&&console.log(a)},e}();r.GLOBAL_TAG="mpegts.js",r.FORCE_GLOBAL_TAG=!1,r.ENABLE_ERROR=!0,r.ENABLE_INFO=!0,r.ENABLE_WARN=!0,r.ENABLE_DEBUG=!0,r.ENABLE_VERBOSE=!0,r.ENABLE_CALLBACK=!1,r.emitter=new(n()),t.default=r},258:function(e,t,i){"use strict";i.r(t);var a=i(554),n=i.n(a),r=i(291),o=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return r.default.FORCE_GLOBAL_TAG},set:function(t){r.default.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return r.default.GLOBAL_TAG},set:function(t){r.default.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return r.default.ENABLE_VERBOSE&&r.default.ENABLE_DEBUG&&r.default.ENABLE_INFO&&r.default.ENABLE_WARN&&r.default.ENABLE_ERROR},set:function(t){r.default.ENABLE_VERBOSE=t,r.default.ENABLE_DEBUG=t,r.default.ENABLE_INFO=t,r.default.ENABLE_WARN=t,r.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return r.default.ENABLE_DEBUG},set:function(t){r.default.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return r.default.ENABLE_VERBOSE},set:function(t){r.default.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return r.default.ENABLE_INFO},set:function(t){r.default.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return r.default.ENABLE_WARN},set:function(t){r.default.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return r.default.ENABLE_ERROR},set:function(t){r.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:r.default.GLOBAL_TAG,forceGlobalTag:r.default.FORCE_GLOBAL_TAG,enableVerbose:r.default.ENABLE_VERBOSE,enableDebug:r.default.ENABLE_DEBUG,enableInfo:r.default.ENABLE_INFO,enableWarn:r.default.ENABLE_WARN,enableError:r.default.ENABLE_ERROR,enableCallback:r.default.ENABLE_CALLBACK}},e.applyConfig=function(e){r.default.GLOBAL_TAG=e.globalTag,r.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,r.default.ENABLE_VERBOSE=e.enableVerbose,r.default.ENABLE_DEBUG=e.enableDebug,r.default.ENABLE_INFO=e.enableInfo,r.default.ENABLE_WARN=e.enableWarn,r.default.ENABLE_ERROR=e.enableError,r.default.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){r.default.emitter.addListener("log",t),r.default.emitter.listenerCount("log")>0&&(r.default.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){r.default.emitter.removeListener("log",t),0===r.default.emitter.listenerCount("log")&&(r.default.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new(n()),t.default=o},760:function(e,t,i){"use strict";i.r(t);var a=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a)for(var n in a)a.hasOwnProperty(n)&&(t[n]=a[n])}return t},String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(e,t){var i=t>0?0|t:0;return this.substring(i,i+e.length)===e}}),"function"!=typeof self.Promise&&i(191).polyfill()},e}();a.install(),t.default=a},966:function(e,t,i){function a(e){var t={};function i(a){if(t[a])return t[a].exports;var n=t[a]={i:a,id:a,l:!1,loaded:!1,exports:{}};return e[a].call(n.exports,n,n.exports,i),n.l=!0,n.loaded=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t){for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof self)return self}}(),i.p="/";var a=i(ENTRY_MODULE);return a.default||a}var n="[\\.|\\-|\\+|\\w|/|@]+",r="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(e){return!isNaN(1*e)}function d(e,t,a){var d={};d[a]=[];var l=t.toString(),_=l.match(/^(?:function\s*\w*\s*)?\(\s*\w+\s*,\s*\w+\s*,\s*(\w+)\s*\)/);if(!_)return d;for(var u,c=_[1],h=new RegExp("(\\\\n|\\W)"+o(c)+r,"g");u=h.exec(l);)"dll-reference"!==u[3]&&d[a].push(u[3]);for(h=new RegExp("\\("+o(c)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+r,"g");u=h.exec(l);)e[u[2]]||(d[a].push(u[1]),e[u[2]]=i(u[1]).m),d[u[2]]=d[u[2]]||[],d[u[2]].push(u[4]);for(var f=Object.keys(d),p=0;p<f.length;p++)for(var m=0;m<d[f[p]].length;m++)s(d[f[p]][m])&&(d[f[p]][m]=1*d[f[p]][m]);return d}function l(e){return Object.keys(e).reduce(function(t,i){return t||e[i].length>0},!1)}e.exports=function(e,t){t=t||{};var n={main:i.m},r=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},a={main:[]},n={main:{}};l(i);)for(var r=Object.keys(i),o=0;o<r.length;o++){var s=r[o],_=i[s].pop();if(n[s]=n[s]||{},!n[s][_]&&e[s][_]){n[s][_]=!0,a[s]=a[s]||[],a[s].push(_);for(var u=d(e,e[s][_],s),c=Object.keys(u),h=0;h<c.length;h++)i[c[h]]=i[c[h]]||[],i[c[h]]=i[c[h]].concat(u[c[h]])}}return a}(n,e),o="";Object.keys(r).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;r[e][t];)t++;r[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+a.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+r[e].map(function(t){return JSON.stringify(t)+": "+n[e][t].toString()}).join(",")+"});\n"}),o=o+"new (("+a.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+r.main.map(function(e){return JSON.stringify(e)+": "+n.main[e].toString()}).join(",")+"}))(self);";var s=new self.Blob([o],{type:"text/javascript"});if(t.bare)return s;var _=(self.URL||self.webkitURL||self.mozURL||self.msURL).createObjectURL(s),u=new self.Worker(_);return u.objectURL=_,u}}},t={};function i(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,i),r.exports}return i.m=e,i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){if(Array.isArray(t))for(var a=0;a<t.length;){var n=t[a++],r=t[a++];i.o(e,n)?0===r&&a++:0===r?Object.defineProperty(e,n,{enumerable:!0,value:t[a++]}):Object.defineProperty(e,n,{enumerable:!0,get:r})}else for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(497)}()});
|
|
3
|
+
//# sourceMappingURL=mpegts.js.map
|
|
4
|
+
export default (typeof globalThis !== "undefined" ? globalThis.mpegts : undefined);
|