flv-h265
Version:
HTML5 FLV Player
1 lines • 159 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.flvjs=t():e.flvjs=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},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.p="",i(i.s=14)}([function(e,t,i){"use strict";var n=i(6),r=i.n(n),o=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&(console.info?console.info(n):console.log(n))},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&(console.warn?console.warn(n):console.log(n))},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",n),e.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",n),e.ENABLE_VERBOSE&&console.log(n)},e}();o.GLOBAL_TAG="flv.js",o.FORCE_GLOBAL_TAG=!1,o.ENABLE_ERROR=!0,o.ENABLE_INFO=!0,o.ENABLE_WARN=!0,o.ENABLE_DEBUG=!0,o.ENABLE_VERBOSE=!0,o.ENABLE_CALLBACK=!1,o.emitter=new r.a,t.a=o},function(e,t,i){"use strict";t.a={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},function(e,t,i){"use strict";i.d(t,"c",(function(){return r})),i.d(t,"b",(function(){return o})),i.d(t,"a",(function(){return s}));var n=i(3),r={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},o={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},s=function(){function e(e){this._type=e||"undefined",this._status=r.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=r.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===r.kConnecting||this._status===r.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 n.c("Unimplemented abstract function!")},e.prototype.abort=function(){throw new n.c("Unimplemented abstract function!")},e}()},function(e,t,i){"use strict";i.d(t,"d",(function(){return o})),i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return h}));var n,r=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=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}(),s=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(o),a=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(o),h=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(o)},function(e,t,i){"use strict";var n={};!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)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},o={};if(r.browser){o[r.browser]=!0;var s=r.majorVersion.split(".");o.version={major:parseInt(r.majorVersion,10),string:r.version},s.length>1&&(o.version.minor=parseInt(s[1],10)),s.length>2&&(o.version.build=parseInt(s[2],10))}if(r.platform&&(o[r.platform]=!0),(o.chrome||o.opr||o.safari)&&(o.webkit=!0),o.rv||o.iemobile){o.rv&&delete o.rv;r.browser="msie",o.msie=!0}if(o.edge){delete o.edge;r.browser="msedge",o.msedge=!0}if(o.opr){r.browser="opera",o.opera=!0}if(o.safari&&o.android){r.browser="android",o.android=!0}for(var a in o.name=r.browser,o.platform=r.platform,n)n.hasOwnProperty(a)&&delete n[a];Object.assign(n,o)}(),t.a=n},function(e,t,i){"use strict";t.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(e,t,i){"use strict";var n,r="object"==typeof Reflect?Reflect:null,o=r&&"function"==typeof r.apply?r.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};n=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,o),n(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&g(e,"error",t,i)}(e,r,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var h=10;function u(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?a.defaultMaxListeners:e._maxListeners}function l(e,t,i,n){var r,o,s,a;if(u(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),s=o[t]),void 0===s)s=o[t]=i,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=d(e))>0&&s.length>r&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=s.length,a=h,console&&console.warn&&console.warn(a)}return e}function c(){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 f(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=c.bind(n);return r.listener=i,n.wrapFn=r,r}function _(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]: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}(r):m(r,r.length)}function p(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 m(e,t){for(var i=new Array(t),n=0;n<t;++n)i[n]=e[n];return i}function g(e,t,i,n){if("function"==typeof e.on)n.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 r(o){n.once&&e.removeEventListener(t,r),i(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");h=e}}),a.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},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(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},a.prototype.getMaxListeners=function(){return d(this)},a.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 s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var h=r[e];if(void 0===h)return!1;if("function"==typeof h)o(h,this,t);else{var u=h.length,d=m(h,u);for(i=0;i<u;++i)o(d[i],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,f(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,f(this,e,t)),this},a.prototype.removeListener=function(e,t){var i,n,r,o,s;if(u(t),void 0===(n=this._events))return this;if(void 0===(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,r),1===i.length&&(n[e]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,i,n;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 r,o=Object.keys(i);for(n=0;n<o.length;++n)"removeListener"!==(r=o[n])&&this.removeAllListeners(r);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(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return _(this,e,!0)},a.prototype.rawListeners=function(e){return _(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,i){"use strict";i.d(t,"d",(function(){return n})),i.d(t,"b",(function(){return r})),i.d(t,"a",(function(){return o})),i.d(t,"c",(function(){return s}));var n=function(e,t,i,n,r){this.dts=e,this.pts=t,this.duration=i,this.originalDts=n,this.isSyncPoint=r,this.fileposition=null},r=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}(),o=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,n=t.length-1,r=0,o=0,s=n;for(e<t[0].dts&&(i=0,o=s+1);o<=s;){if((r=o+Math.floor((s-o)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?o=r+1:s=r-1}return this._list[i]},e}(),s=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,n=0,r=0,o=i,s=0;if(e<t[0].originalBeginDts)return s=-1;for(;r<=o;){if((n=r+Math.floor((o-r)/2))===i||e>t[n].lastSample.originalDts&&e<t[n+1].originalBeginDts){s=n;break}t[n].originalBeginDts<e?r=n+1:o=n-1}return s},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,n=this._lastAppendLocation,r=0;-1!==n&&n<t.length&&i.originalBeginDts>=t[n].lastSample.originalDts&&(n===t.length-1||n<t.length-1&&i.originalBeginDts<t[n+1].originalBeginDts)?r=n+1:t.length>0&&(r=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,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}()},function(e,t,i){"use strict";var n=i(6),r=i.n(n),o=i(0),s=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return o.a.FORCE_GLOBAL_TAG},set:function(t){o.a.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return o.a.GLOBAL_TAG},set:function(t){o.a.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return o.a.ENABLE_VERBOSE&&o.a.ENABLE_DEBUG&&o.a.ENABLE_INFO&&o.a.ENABLE_WARN&&o.a.ENABLE_ERROR},set:function(t){o.a.ENABLE_VERBOSE=t,o.a.ENABLE_DEBUG=t,o.a.ENABLE_INFO=t,o.a.ENABLE_WARN=t,o.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return o.a.ENABLE_DEBUG},set:function(t){o.a.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return o.a.ENABLE_VERBOSE},set:function(t){o.a.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return o.a.ENABLE_INFO},set:function(t){o.a.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return o.a.ENABLE_WARN},set:function(t){o.a.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return o.a.ENABLE_ERROR},set:function(t){o.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:o.a.GLOBAL_TAG,forceGlobalTag:o.a.FORCE_GLOBAL_TAG,enableVerbose:o.a.ENABLE_VERBOSE,enableDebug:o.a.ENABLE_DEBUG,enableInfo:o.a.ENABLE_INFO,enableWarn:o.a.ENABLE_WARN,enableError:o.a.ENABLE_ERROR,enableCallback:o.a.ENABLE_CALLBACK}},e.applyConfig=function(e){o.a.GLOBAL_TAG=e.globalTag,o.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,o.a.ENABLE_VERBOSE=e.enableVerbose,o.a.ENABLE_DEBUG=e.enableDebug,o.a.ENABLE_INFO=e.enableInfo,o.a.ENABLE_WARN=e.enableWarn,o.a.ENABLE_ERROR=e.enableError,o.a.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){o.a.emitter.addListener("log",t),o.a.emitter.listenerCount("log")>0&&(o.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){o.a.emitter.removeListener("log",t),0===o.a.emitter.listenerCount("log")&&(o.a.ENABLE_CALLBACK=!1,e._notifyChange())},e}();s.emitter=new r.a,t.a=s},function(e,t,i){"use strict";var n=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&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&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,n=e.length-1,r=0,o=0,s=n;for(t<e[0]&&(i=0,o=s+1);o<=s;){if((r=o+Math.floor((s-o)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?o=r+1:s=r-1}return i},e}();t.a=n},function(e,t,i){"use strict";var n=i(6),r=i.n(n),o=i(0),s=i(4),a=i(9);function h(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}var u,d=function(e){for(var t=[],i=e,n=0,r=e.length;n<r;)if(i[n]<128)t.push(String.fromCharCode(i[n])),++n;else{if(i[n]<192);else if(i[n]<224){if(h(i,n,1))if((o=(31&i[n])<<6|63&i[n+1])>=128){t.push(String.fromCharCode(65535&o)),n+=2;continue}}else if(i[n]<240){if(h(i,n,2))if((o=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2])>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),n+=3;continue}}else if(i[n]<248){var o;if(h(i,n,3))if((o=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3])>65536&&o<1114112){o-=65536,t.push(String.fromCharCode(o>>>10|55296)),t.push(String.fromCharCode(1023&o|56320)),n+=4;continue}}t.push(String.fromCharCode(65533)),++n}return t.join("")},l=i(3),c=(u=new ArrayBuffer(2),new DataView(u).setInt16(0,256,!0),256===new Int16Array(u)[0]),f=function(){function e(){}return e.parseScriptData=function(t,i,n){var r={};try{var s=e.parseValue(t,i,n),a=e.parseValue(t,i+s.size,n-s.size);r[s.data]=a.data}catch(e){o.a.e("AMF",e.toString())}return r},e.parseObject=function(t,i,n){if(n<3)throw new l.a("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),o=e.parseValue(t,i+r.size,n-r.size),s=o.objectEnd;return{data:{name:r.data,value:o.data},size:r.size+o.size,objectEnd:s}},e.parseVariable=function(t,i,n){return e.parseObject(t,i,n)},e.parseString=function(e,t,i){if(i<2)throw new l.a("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!c);return{data:n>0?d(new Uint8Array(e,t+2,n)):"",size:2+n}},e.parseLongString=function(e,t,i){if(i<4)throw new l.a("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!c);return{data:n>0?d(new Uint8Array(e,t+4,n)):"",size:4+n}},e.parseDate=function(e,t,i){if(i<10)throw new l.a("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!c),o=n.getInt16(8,!c);return{data:new Date(r+=60*o*1e3),size:10}},e.parseValue=function(t,i,n){if(n<1)throw new l.a("Data not enough when parse Value");var r,s=new DataView(t,i,n),a=1,h=s.getUint8(0),u=!1;try{switch(h){case 0:r=s.getFloat64(1,!c),a+=8;break;case 1:r=!!s.getUint8(1),a+=1;break;case 2:var d=e.parseString(t,i+1,n-1);r=d.data,a+=d.size;break;case 3:r={};var f=0;for(9==(16777215&s.getUint32(n-4,!c))&&(f=3);a<n-4;){var _=e.parseObject(t,i+a,n-a-f);if(_.objectEnd)break;r[_.data.name]=_.data.value,a+=_.size}if(a<=n-3)9===(16777215&s.getUint32(a-1,!c))&&(a+=3);break;case 8:r={},a+=4;f=0;for(9==(16777215&s.getUint32(n-4,!c))&&(f=3);a<n-8;){var p=e.parseVariable(t,i+a,n-a-f);if(p.objectEnd)break;r[p.data.name]=p.data.value,a+=p.size}if(a<=n-3)9===(16777215&s.getUint32(a-1,!c))&&(a+=3);break;case 9:r=void 0,a=1,u=!0;break;case 10:r=[];var m=s.getUint32(1,!c);a+=4;for(var g=0;g<m;g++){var v=e.parseValue(t,i+a,n-a);r.push(v.data),a+=v.size}break;case 11:var y=e.parseDate(t,i+1,n-1);r=y.data,a+=y.size;break;case 12:var b=e.parseString(t,i+1,n-1);r=b.data,a+=b.size;break;default:a=n,o.a.w("AMF","Unsupported AMF value type "+h)}}catch(e){o.a.e("AMF",e.toString())}return{data:r,size:a,objectEnd:u}},e}(),_=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 l.a("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 l.b("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 n=e-this._current_word_bits_left;this._fillCurrentWord();var r=Math.min(n,this._current_word_bits_left),o=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,i=i<<r|o},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(0!=(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,n=new Uint8Array(i),r=0,o=0;o<i;o++)o>=2&&3===t[o]&&0===t[o-1]&&0===t[o-2]||(n[r]=t[o],r++);return new Uint8Array(n.buffer,0,r)},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),n=new _(i);n.readByte();var r=n.readByte();n.readByte();var o=n.readByte();n.readUEG();var s=e.getProfileString(r),a=e.getLevelString(o),h=1,u=420,d=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(3===(h=n.readUEG())&&n.readBits(1),h<=3&&(u=[0,420,422,444][h]),d=n.readUEG()+8,n.readUEG(),n.readBits(1),n.readBool()))for(var l=3!==h?8:12,c=0;c<l;c++)n.readBool()&&(c<6?e._skipScalingList(n,16):e._skipScalingList(n,64));n.readUEG();var f=n.readUEG();if(0===f)n.readUEG();else if(1===f){n.readBits(1),n.readSEG(),n.readSEG();var p=n.readUEG();for(c=0;c<p;c++)n.readSEG()}var m=n.readUEG();n.readBits(1);var g=n.readUEG(),v=n.readUEG(),y=n.readBits(1);0===y&&n.readBits(1),n.readBits(1);var b=0,E=0,S=0,A=0;n.readBool()&&(b=n.readUEG(),E=n.readUEG(),S=n.readUEG(),A=n.readUEG());var R=1,L=1,w=0,T=!0,O=0,C=0;if(n.readBool()){if(n.readBool()){var k=n.readByte();k>0&&k<16?(R=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][k-1],L=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][k-1]):255===k&&(R=n.readByte()<<8|n.readByte(),L=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){var B=n.readBits(32),D=n.readBits(32);T=n.readBool(),w=(O=D)/(C=2*B)}}var I=1;1===R&&1===L||(I=R/L);var M=0,U=0;0===h?(M=1,U=2-y):(M=3===h?1:2,U=(1===h?2:1)*(2-y));var P=16*(g+1),x=16*(v+1)*(2-y);P-=(b+E)*M,x-=(S+A)*U;var N=Math.ceil(P*I);return n.destroy(),n=null,{profile_string:s,level_string:a,bit_depth:d,ref_frames:m,chroma_format:u,chroma_format_string:e.getChromaFormatString(u),frame_rate:{fixed:T,fps:w,fps_den:C,fps_num:O},sar_ratio:{width:R,height:L},codec_size:{width:P,height:x},present_size:{width:N,height:x}}},e._skipScalingList=function(e,t){for(var i=8,n=8,r=0;r<t;r++)0!==n&&(n=(i+e.readSEG()+256)%256),i=0===n?i:n},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(5),g=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,o=0;o<i;o++)o>=2&&3===t[o]&&0===t[o-1]&&0===t[o-2]||(n[r]=t[o],r++);return new Uint8Array(n.buffer,0,r)},e.parseVPS=function(t){var i=e._ebsp2rbsp(t),n=new _(i);n.readByte(),n.readByte();n.readBits(4);n.readBits(2);n.readBits(6);return{num_temporal_layers:n.readBits(3)+1,temporal_id_nested:n.readBool()}},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),n=new _(i);n.readByte(),n.readByte();n.readBits(4);for(var r=n.readBits(3),o=(n.readBool(),n.readBits(2)),s=n.readBool(),a=n.readBits(5),h=n.readByte(),u=n.readByte(),d=n.readByte(),l=n.readByte(),c=n.readByte(),f=n.readByte(),p=n.readByte(),m=n.readByte(),g=n.readByte(),v=n.readByte(),y=n.readByte(),b=[],E=[],S=0;S<r;S++)b.push(n.readBool()),E.push(n.readBool());if(r>0)for(S=r;S<8;S++)n.readBits(2);for(S=0;S<r;S++)b[S]&&(n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte()),E[S]&&n.readByte();n.readUEG();var A=n.readUEG();3==A&&n.readBits(1);var R=n.readUEG(),L=n.readUEG();n.readBool()&&(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG());var w=n.readUEG(),T=n.readUEG(),O=n.readUEG();for(S=n.readBool()?0:r;S<=r;S++)n.readUEG(),n.readUEG(),n.readUEG();n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG();if(n.readBool()&&n.readBool())for(var C=0;C<4;C++)for(var k=0;k<(3===C?2:6);k++){if(n.readBool()){var B=Math.min(64,1<<4+(C<<1));C>1&&n.readSEG();for(S=0;S<B;S++)n.readSEG()}else n.readUEG()}n.readBool(),n.readBool();n.readBool()&&(n.readByte(),n.readUEG(),n.readUEG(),n.readBool());var D=n.readUEG(),I=0;for(S=0;S<D;S++){var M=!1;if(0!==S&&(M=n.readBool()),M){S===D&&n.readUEG(),n.readBool(),n.readUEG();for(var U=0,P=0;P<=I;P++){var x=n.readBool(),N=!1;x||(N=n.readBool()),(x||N)&&U++}I=U}else{var G=n.readUEG(),F=n.readUEG();I=G+F;for(P=0;P<G;P++)n.readUEG(),n.readBool();for(P=0;P<F;P++)n.readUEG(),n.readBool()}}if(n.readBool()){var j=n.readUEG();for(S=0;S<j;S++){for(P=0;P<O+4;P++)n.readBits(1);n.readBits(1)}}var V=0,z=1,H=1,K=!1,W=1,q=1;n.readBool(),n.readBool();if(n.readBool()){if(n.readBool()){var X=n.readByte();X>0&&X<16?(z=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][X-1],H=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][X-1]):255===X&&(z=n.readBits(16),H=n.readBits(16))}if(n.readBool()&&n.readBool(),n.readBool())n.readBits(3),n.readBool(),n.readBool()&&(n.readByte(),n.readByte(),n.readByte());n.readBool()&&(n.readUEG(),n.readUEG());n.readBool(),n.readBool(),n.readBool();if(n.readBool()&&(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG()),n.readBool())if(W=n.readBits(32),q=n.readBits(32),n.readBool())if(n.readUEG(),n.readBool()){var Y=!1,Z=!1,J=!1;if(Y=n.readBool(),Z=n.readBool(),Y||Z){(J=n.readBool())&&(n.readByte(),n.readBits(5),n.readBool(),n.readBits(5));n.readBits(4),n.readBits(4);J&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5)}for(S=0;S<=r;S++){var Q=n.readBool();K=Q;var $=!1,ee=1;Q||($=n.readBool());var te=!1;if($?n.readSEG():te=n.readBool(),te||(ee=n.readUEG()+1),Y)for(P=0;P<ee;P++)n.readUEG(),n.readUEG(),J&&(n.readUEG(),n.readUEG());if(Z)for(P=0;P<ee;P++)n.readUEG(),n.readUEG(),J&&(n.readUEG(),n.readUEG())}}if(n.readBool()){n.readBool(),n.readBool(),n.readBool();V=n.readUEG();n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG()}}n.readBool();var ie="hvc1."+a+".1.L"+y+".B0",ne=R,re=L,oe=1;return 1!==z&&1!==H&&(oe=z/H),n.destroy(),n=null,{codec_mimetype:ie,level_string:e.getLevelString(y),profile_idc:a,bit_depth:w+8,ref_frames:1,chroma_format:A,chroma_format_string:e.getChromaFormatString(A),general_level_idc:y,general_profile_space:o,general_tier_flag:s,general_profile_idc:a,general_profile_compatibility_flags_1:h,general_profile_compatibility_flags_2:u,general_profile_compatibility_flags_3:d,general_profile_compatibility_flags_4:l,general_constraint_indicator_flags_1:c,general_constraint_indicator_flags_2:f,general_constraint_indicator_flags_3:p,general_constraint_indicator_flags_4:m,general_constraint_indicator_flags_5:g,general_constraint_indicator_flags_6:v,min_spatial_segmentation_idc:V,constant_frame_rate:0,chroma_format_idc:A,bit_depth_luma_minus8:w,bit_depth_chroma_minus8:T,frame_rate:{fixed:K,fps:q/W,fps_den:W,fps_num:q},sar_ratio:{width:z,height:H},codec_size:{width:ne,height:re},present_size:{width:ne*oe,height:re}}},e.parsePPS=function(t){var i=e._ebsp2rbsp(t),n=new _(i);n.readByte(),n.readByte();n.readUEG(),n.readUEG(),n.readBool(),n.readBool(),n.readBits(3),n.readBool(),n.readBool(),n.readUEG(),n.readUEG(),n.readSEG(),n.readBool(),n.readBool();if(n.readBool())n.readUEG();n.readSEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool(),n.readBool();var r=n.readBool(),o=n.readBool(),s=1;return o&&r?s=0:o?s=3:r&&(s=2),{parallelismType:s}},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 b(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 b(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 b(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2))}(e,t):function(e,t){return b(e,t)}(e,t))};var S=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._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 a.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),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},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 n,r,o=(4&t[4])>>>2!=0,s=0!=(1&t[4]),a=(n=t)[r=5]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3];return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:o,hasVideoTrack:s}},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,"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 a.a},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 l.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0,r=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;n=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,i+n!==this._dataOffset&&o.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(s=new DataView(t,n)).getUint32(0,!r)&&o.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),n+=4);for(;n<t.byteLength;){this._dispatch=!0;var s=new DataView(t,n);if(n+11+4>t.byteLength)break;var a=s.getUint8(0),h=16777215&s.getUint32(0,!r);if(n+11+h+4>t.byteLength)break;if(8===a||9===a||18===a){var u=s.getUint8(4),d=s.getUint8(5),c=s.getUint8(6)|d<<8|u<<16|s.getUint8(7)<<24;0!==(16777215&s.getUint32(7,!r))&&o.a.w(this.TAG,"Meet tag which has StreamID != 0!");var f=n+11;switch(a){case 8:this._parseAudioData(t,f,h,c);break;case 9:this._parseVideoData(t,f,h,c,i+n);break;case 18:this._parseScriptData(t,f,h,c)}var _=s.getUint32(11+h,!r);_!==11+h&&o.a.w(this.TAG,"Invalid PrevTagSize "+_),n+=11+h+4}else o.a.w(this.TAG,"Unsupported tag type "+a+", skipped"),n+=11+h+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),n},e.prototype._parseScriptData=function(e,t,i,n){var r=f.parseScriptData(e,t,i);if(r.hasOwnProperty("onMetaData")){if(null==r.onMetaData||"object"!=typeof r.onMetaData)return void o.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&o.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=r;var s=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},s)),"boolean"==typeof s.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=s.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof s.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=s.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof s.audiodatarate&&(this._mediaInfo.audioDataRate=s.audiodatarate),"number"==typeof s.videodatarate&&(this._mediaInfo.videoDataRate=s.videodatarate),"number"==typeof s.width&&(this._mediaInfo.width=s.width),"number"==typeof s.height&&(this._mediaInfo.height=s.height),"number"==typeof s.duration){if(!this._durationOverrided){var a=Math.floor(s.duration*this._timescale);this._duration=a,this._mediaInfo.duration=a}}else this._mediaInfo.duration=0;if("number"==typeof s.framerate){var h=Math.floor(1e3*s.framerate);if(h>0){var u=h/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=u,this._referenceFrameRate.fps_num=h,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=u}}if("object"==typeof s.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var d=s.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(d),s.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=s,o.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(r).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},r,{timestamp:n}))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],n=1;n<e.times.length;n++){var r=this._timestampBase+Math.floor(1e3*e.times[n]);t.push(r),i.push(e.filepositions[n])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,n){if(i<=1)o.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var r=new DataView(e,t,i).getUint8(0),s=r>>>4;if(2===s||10===s){var a=0,h=(12&r)>>>2;if(h>=0&&h<=4){a=this._flvSoundRateTable[h];var u=1&r,d=this._audioMetadata,l=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=l.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=a,d.channelCount=0===u?1:2),10===s){var c=this._parseAACAudioData(e,t+1,i-1);if(null==c)return;if(0===c.packetType){if(d.config){if(E(c.data.config,d.config))return;o.a.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var f=c.data;d.audioSampleRate=f.samplingRate,d.channelCount=f.channelCount,d.codec=f.codec,d.originalCodec=f.originalCodec,d.config=f.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,o.a.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d),(g=this._mediaInfo).audioCodec=d.originalCodec,g.audioSampleRate=d.audioSampleRate,g.audioChannelCount=d.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)}else if(1===c.packetType){var _=this._timestampBase+n,p={unit:c.data,length:c.data.byteLength,dts:_,pts:_};l.samples.push(p),l.length+=c.data.length}else o.a.e(this.TAG,"Flv: Unsupported AAC data type "+c.packetType)}else if(2===s){if(!d.codec){var g;if(null==(f=this._parseMP3AudioData(e,t+1,i-1,!0)))return;d.audioSampleRate=f.samplingRate,d.channelCount=f.channelCount,d.codec=f.codec,d.originalCodec=f.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,o.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d),(g=this._mediaInfo).audioCodec=d.codec,g.audioSampleRate=d.audioSampleRate,g.audioChannelCount=d.channelCount,g.audioDataRate=f.bitRate,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)}var v=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==v)return;_=this._timestampBase+n;var y={unit:v,length:v.byteLength,dts:_,pts:_};l.samples.push(y),l.length+=v.length}}else this._onError(m.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+h)}else this._onError(m.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+s)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var n={},r=new Uint8Array(e,t,i);return n.packetType=r[0],0===r[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=r.subarray(1),n}o.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var n,r,o=new Uint8Array(e,t,i),s=null,a=0,h=null;if(a=n=o[0]>>>3,(r=(7&o[0])<<1|o[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(m.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var u=this._mpegSamplingRates[r],d=(120&o[1])>>>3;if(!(d<0||d>=8)){5===a&&(h=(7&o[1])<<1|o[2]>>>7,(124&o[2])>>>2);var l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?r>=6?(a=5,s=new Array(4),h=r-3):(a=2,s=new Array(2),h=r):-1!==l.indexOf("android")?(a=2,s=new Array(2),h=r):(a=5,h=r,s=new Array(4),r>=6?h=r-3:1===d&&(a=2,s=new Array(2),h=r)),s[0]=a<<3,s[0]|=(15&r)>>>1,s[1]=(15&r)<<7,s[1]|=(15&d)<<3,5===a&&(s[1]|=(15&h)>>>1,s[2]=(1&h)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:u,channelCount:d,codec:"mp4a.40."+a,originalCodec:"mp4a.40."+n}}this._onError(m.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,n){if(!(i<4)){this._littleEndian;var r=new Uint8Array(e,t,i),s=null;if(n){if(255!==r[0])return;var a=r[1]>>>3&3,h=(6&r[1])>>1,u=(240&r[2])>>>4,d=(12&r[2])>>>2,l=3!==(r[3]>>>6&3)?2:1,c=0,f=0;switch(a){case 0:c=this._mpegAudioV25SampleRateTable[d];break;case 2:c=this._mpegAudioV20SampleRateTable[d];break;case 3:c=this._mpegAudioV10SampleRateTable[d]}switch(h){case 1:34,u<this._mpegAudioL3BitRateTable.length&&(f=this._mpegAudioL3BitRateTable[u]);break;case 2:33,u<this._mpegAudioL2BitRateTable.length&&(f=this._mpegAudioL2BitRateTable[u]);break;case 3:32,u<this._mpegAudioL1BitRateTable.length&&(f=this._mpegAudioL1BitRateTable[u])}s={bitRate:f,samplingRate:c,channelCount:l,codec:"mp3",originalCodec:"mp3"}}else s=r;return s}o.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,n,r){if(i<=1)o.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var s=new Uint8Array(e,t,i)[0],a=(240&s)>>>4,h=15&s;if(7===h)this._parseAVCVideoPacket(e,t+1,i-1,n,r,a);else{if(12!==h)return void this._onError(m.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+h);this._parseHEVCVideoPacket(e,t+1,i-1,n,r,a)}}},e.prototype._parseAVCVideoPacket=function(e,t,i,n,r,s){if(i<4)o.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var a=this._littleEndian,h=new DataView(e,t,i),u=h.getUint8(0),d=(16777215&h.getUint32(0,!a))<<8>>8;if(0===u)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===u)this._parseAVCVideoData(e,t+4,i-4,n,r,s,d);else if(2!==u)return void this._onError(m.a.FORMAT_ERROR,"Flv: Invalid video packet type "+u)}},e.prototype._parseHEVCVideoPacket=function(e,t,i,n,r,s){if(i<4)o.a.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var a=this._littleEndian,h=new DataView(e,t,i),u=h.getUint8(0),d=(16777215&h.getUint32(0,!a))<<8>>8;if(0===u)this._parseHEVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===u)this._parseHEVCVideoData(e,t+4,i-4,n,r,s,d);else if(2!==u)return void this._onError(m.a.FORMAT_ERROR,"Flv: Invalid video packet type "+u)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)o.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,r=this._videoTrack,s=this._littleEndian,a=new DataView(e,t,i);if(n){if(void 0!==n.avcc){var h=new Uint8Array(e,t,i);if(E(h,n.avcc))return;o.a.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),(n=this._videoMetadata={}).type="video",n.id=r.id,n.timescale=this._timescale,n.duration=this._duration;var u=a.getUint8(0),d=a.getUint8(1);a.getUint8(2),a.getUint8(3);if(1===u&&0!==d)if(this._naluLengthSize=1+(3&a.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var l=31&a.getUint8(5);if(0!==l){l>1&&o.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+l);for(var c=6,f=0;f<l;f++){var _=a.getUint16(c,!s);if(c+=2,0!==_){var g=new Uint8Array(e,t+c,_);c+=_;var v=p.parseSPS(g);if(0===f){n.codecWidth=v.codec_size.width,n.codecHeight=v.codec_size.height,n.presentWidth=v.present_size.width,n.presentHeight=v.present_size.height