2 lines
182 KiB
JavaScript
2 lines
182 KiB
JavaScript
"undefined"!=typeof window&&function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Hls=t():e.Hls=t()}(this,function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(i,a,function(t){return e[t]}.bind(null,a));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s=24)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(6);function a(){}var n={trace:a,debug:a,log:a,warn:a,info:a,error:a},o=n;var s=i.getSelfScope();function l(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];t.forEach(function(t){o[t]=e[t]?e[t].bind(e):function(e){var t=s.console[e];return t?function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];r[0]&&(r[0]=function(e,t){return t="["+e+"] > "+t}(e,r[0])),t.apply(s.console,r)}:a}(t)})}t.enableLogs=function(e){if(!0===e||"object"==typeof e){l(e,"debug","log","info","warn","error");try{o.log()}catch(e){o=n}}else o=n},t.logger=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(6).getSelfScope().Number;t.Number=i,i.isFinite=i.isFinite||function(e){return"number"==typeof e&&isFinite(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",KEY_SYSTEM_ERROR:"keySystemError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},t.ErrorDetails={KEY_SYSTEM_NO_KEYS:"keySystemNoKeys",KEY_SYSTEM_NO_ACCESS:"keySystemNoAccess",KEY_SYSTEM_NO_SESSION:"keySystemNoSession",KEY_SYSTEM_LICENSE_REQUEST_FAILED:"keySystemLicenseRequestFailed",MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),n=r(1),o={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},s=function(){function e(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.hls=e,this.onEvent=this.onEvent.bind(this),this.handledEvents=t,this.useGenericHandler=!0,this.registerListeners()}return e.prototype.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},e.prototype.onHandlerDestroying=function(){},e.prototype.onHandlerDestroyed=function(){},e.prototype.isEventHandler=function(){return"object"==typeof this.handledEvents&&this.handledEvents.length&&"function"==typeof this.onEvent},e.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if(o[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)},this)},e.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)},this)},e.prototype.onEvent=function(e,t){this.onEventGeneric(e,t)},e.prototype.onEventGeneric=function(e,t){try{(function(e,t){var r="on"+e.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,t)}).call(this,e,t).call()}catch(t){i.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(n.default.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},e}();t.default=s},function(e,t){e.exports=void 0},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSelfScope=function(){return"undefined"==typeof window?self:window}},function(e,t,r){!function(t){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");return a.path=o.normalizePath(a.path),o.buildURLFromParts(a)}var n=o.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=o.normalizePath(n.path),o.buildURLFromParts(n)):t;var s=o.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=i.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var u={scheme:s.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(u.netLoc=s.netLoc,"/"!==n.path[0]))if(n.path){var d=s.path,f=d.substring(0,d.lastIndexOf("/")+1)+n.path;u.path=o.normalizePath(f)}else u.path=s.path,n.params||(u.params=s.params,n.query||(u.query=s.query));return null===u.path&&(u.path=r.alwaysNormalize?o.normalizePath(n.path):n.path),o.buildURLFromParts(u)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var r=e.buffered,i=0;i<r.length;i++)if(t>=r.start(i)&&t<=r.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,r){try{if(e){var i=e.buffered,a=[],n=void 0;for(n=0;n<i.length;n++)a.push({start:i.start(n),end:i.end(n)});return this.bufferedInfo(a,t,r)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},e.bufferedInfo=function(e,t,r){var i,a,n,o,s,l=[];for(e.sort(function(e,t){var r=e.start-t.start;return r||t.end-e.end}),s=0;s<e.length;s++){var u=l.length;if(u){var d=l[u-1].end;e[s].start-d<r?e[s].end>d&&(l[u-1].end=e[s].end):l.push(e[s])}else l.push(e[s])}for(s=0,i=0,a=n=t;s<l.length;s++){var f=l[s].start,c=l[s].end;if(t+r>=f&&t<c)a=f,i=(n=c)-t;else if(t+r<f){o=f;break}}return{len:i,start:a,end:n,nextStart:o}},e}();t.BufferHelper=i},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(4),n=r(1);t.FragmentState={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};var o=function(r){function o(e){var t=r.call(this,e,n.default.BUFFER_APPENDED,n.default.FRAG_BUFFERED,n.default.FRAG_LOADED)||this;return t.bufferPadding=.2,t.fragments=Object.create(null),t.timeRanges=Object.create(null),t.config=e.config,t}return i(o,r),o.prototype.destroy=function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,a.default.prototype.destroy.call(this),r.prototype.destroy.call(this)},o.prototype.getBufferedFrag=function(e,t){var r=this.fragments,i=Object.keys(r).filter(function(i){var a=r[i];if(a.body.type!==t)return!1;if(!a.buffered)return!1;var n=a.body;return n.startPTS<=e&&e<=n.endPTS});if(0===i.length)return null;var a=i.pop();return r[a].body},o.prototype.detectEvictedFragments=function(e,t){var r,i,a=this;Object.keys(this.fragments).forEach(function(n){var o=a.fragments[n];if(!0===o.buffered){var s=o.range[e];if(s){r=s.time;for(var l=0;l<r.length;l++)if(i=r[l],!1===a.isTimeBuffered(i.startPTS,i.endPTS,t)){a.removeFragment(o.body);break}}}})},o.prototype.detectPartialFragments=function(e){var t=this,r=this.getFragmentKey(e),i=this.fragments[r];i&&(i.buffered=!0,Object.keys(this.timeRanges).forEach(function(r){if(e.hasElementaryStream(r)){var a=t.timeRanges[r];i.range[r]=t.getBufferedTimes(e.startPTS,e.endPTS,a)}}))},o.prototype.getBufferedTimes=function(e,t,r){for(var i,a,n=[],o=!1,s=0;s<r.length;s++){if(i=r.start(s)-this.bufferPadding,a=r.end(s)+this.bufferPadding,e>=i&&t<=a){n.push({startPTS:Math.max(e,r.start(s)),endPTS:Math.min(t,r.end(s))});break}if(e<a&&t>i)n.push({startPTS:Math.max(e,r.start(s)),endPTS:Math.min(t,r.end(s))}),o=!0;else if(t<=i)break}return{time:n,partial:o}},o.prototype.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},o.prototype.getPartialFragment=function(e){var t,r,i,a=this,n=null,o=0;return Object.keys(this.fragments).forEach(function(s){var l=a.fragments[s];a.isPartial(l)&&(r=l.body.startPTS-a.bufferPadding,i=l.body.endPTS+a.bufferPadding,e>=r&&e<=i&&(t=Math.min(e-r,i-e),o<=t&&(n=l.body,o=t)))}),n},o.prototype.getState=function(e){var r=this.getFragmentKey(e),i=this.fragments[r],a=t.FragmentState.NOT_LOADED;return void 0!==i&&(a=i.buffered?!0===this.isPartial(i)?t.FragmentState.PARTIAL:t.FragmentState.OK:t.FragmentState.APPENDING),a},o.prototype.isPartial=function(e){return!0===e.buffered&&(void 0!==e.range.video&&!0===e.range.video.partial||void 0!==e.range.audio&&!0===e.range.audio.partial)},o.prototype.isTimeBuffered=function(e,t,r){for(var i,a,n=0;n<r.length;n++){if(i=r.start(n)-this.bufferPadding,a=r.end(n)+this.bufferPadding,e>=i&&t<=a)return!0;if(t<=i)return!1}return!1},o.prototype.onFragLoaded=function(t){var r=t.frag;e.isFinite(r.sn)&&!r.bitrateTest&&(this.fragments[this.getFragmentKey(r)]={body:r,range:Object.create(null),buffered:!1})},o.prototype.onBufferAppended=function(e){var t=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach(function(e){var r=t.timeRanges[e];t.detectEvictedFragments(e,r)})},o.prototype.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},o.prototype.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},o.prototype.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},o.prototype.removeAllFragments=function(){this.fragments=Object.create(null)},o}(a.default);t.FragmentTracker=o}).call(this,r(2).Number)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={search:function(e,t){for(var r=0,i=e.length-1,a=null,n=null;r<=i;){var o=t(n=e[a=(r+i)/2|0]);if(o>0)r=a+1;else{if(!(o<0))return n;i=a-1}}return null}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.isHeader=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.isFooter=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.getID3Data=function(t,r){for(var i=r,a=0;e.isHeader(t,r);){a+=10,a+=e._readSize(t,r+6),e.isFooter(t,r+10)&&(a+=10),r+=a}if(a>0)return t.subarray(i,i+a)},e._readSize=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},e.getTimeStamp=function(t){for(var r=e.getID3Frames(t),i=0;i<r.length;i++){var a=r[i];if(e.isTimeStampFrame(a))return e._readTimeStamp(a)}},e.isTimeStampFrame=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},e._getFrameData=function(t){var r=String.fromCharCode(t[0],t[1],t[2],t[3]),i=e._readSize(t,4);return{type:r,size:i,data:t.subarray(10,10+i)}},e.getID3Frames=function(t){for(var r=0,i=[];e.isHeader(t,r);){for(var a=e._readSize(t,r+6),n=(r+=10)+a;r+8<n;){var o=e._getFrameData(t.subarray(r)),s=e._decodeFrame(o);s&&i.push(s),r+=o.size+10}e.isFooter(t,r)&&(r+=10)}return i},e._decodeFrame=function(t){return"PRIV"===t.type?e._decodePrivFrame(t):"T"===t.type[0]?e._decodeTextFrame(t):"W"===t.type[0]?e._decodeURLFrame(t):void 0},e._readTimeStamp=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},e._decodePrivFrame=function(t){if(!(t.size<2)){var r=e._utf8ArrayToStr(t.data,!0),i=new Uint8Array(t.data.subarray(r.length+1));return{key:t.type,info:r,data:i.buffer}}},e._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var r=1,i=e._utf8ArrayToStr(t.data.subarray(r));r+=i.length+1;var a=e._utf8ArrayToStr(t.data.subarray(r));return{key:t.type,info:i,data:a}}var n=e._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:n}}},e._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var r=1,i=e._utf8ArrayToStr(t.data.subarray(r));r+=i.length+1;var a=e._utf8ArrayToStr(t.data.subarray(r));return{key:t.type,info:i,data:a}}var n=e._utf8ArrayToStr(t.data);return{key:t.type,data:n}},e._utf8ArrayToStr=function(e,t){void 0===t&&(t=!1);for(var r,i,a,n=e.length,o="",s=0;s<n;){if(0===(r=e[s++])&&t)return o;if(0!==r&&3!==r)switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:i=e[s++],o+=String.fromCharCode((31&r)<<6|63&i);break;case 14:i=e[s++],a=e[s++],o+=String.fromCharCode((15&r)<<12|(63&i)<<6|(63&a)<<0)}}return o},e}(),a=i._utf8ArrayToStr;t.utf8ArrayToStr=a,t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMediaSource=function(){if("undefined"!=typeof window)return window.MediaSource||window.WebKitMediaSource}},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(3),s=r(0),l=r(14),u=r(25),d=window.performance,f={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},c={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},h=function(t){function r(e){var r=t.call(this,e,a.default.MANIFEST_LOADING,a.default.LEVEL_LOADING,a.default.AUDIO_TRACK_LOADING,a.default.SUBTITLE_TRACK_LOADING)||this;return r.loaders={},r}return i(r,t),Object.defineProperty(r,"ContextType",{get:function(){return f},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LevelType",{get:function(){return c},enumerable:!0,configurable:!0}),r.canHaveQualityLevels=function(e){return e!==f.AUDIO_TRACK&&e!==f.SUBTITLE_TRACK},r.mapContextToLevelType=function(e){switch(e.type){case f.AUDIO_TRACK:return c.AUDIO;case f.SUBTITLE_TRACK:return c.SUBTITLE;default:return c.MAIN}},r.getResponseUrl=function(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r},r.prototype.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,a=new(r||i)(t);return e.loader=a,this.loaders[e.type]=a,a},r.prototype.getInternalLoader=function(e){return this.loaders[e.type]},r.prototype.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},r.prototype.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},r.prototype.destroy=function(){this.destroyInternalLoaders(),t.prototype.destroy.call(this)},r.prototype.onManifestLoading=function(e){this.load(e.url,{type:f.MANIFEST,level:0,id:null})},r.prototype.onLevelLoading=function(e){this.load(e.url,{type:f.LEVEL,level:e.level,id:e.id})},r.prototype.onAudioTrackLoading=function(e){this.load(e.url,{type:f.AUDIO_TRACK,level:null,id:e.id})},r.prototype.onSubtitleTrackLoading=function(e){this.load(e.url,{type:f.SUBTITLE_TRACK,level:null,id:e.id})},r.prototype.load=function(e,t){var r=this.hls.config;s.logger.debug("Loading playlist of type "+t.type+", level: "+t.level+", id: "+t.id);var i,a,n,o,l=this.getInternalLoader(t);if(l){var u=l.context;if(u&&u.url===e)return s.logger.trace("playlist request ongoing"),!1;s.logger.warn("aborting previous loader for type: "+t.type),l.abort()}switch(t.type){case f.MANIFEST:i=r.manifestLoadingMaxRetry,a=r.manifestLoadingTimeOut,n=r.manifestLoadingRetryDelay,o=r.manifestLoadingMaxRetryTimeout;break;case f.LEVEL:i=0,a=r.levelLoadingTimeOut;break;default:i=r.levelLoadingMaxRetry,a=r.levelLoadingTimeOut,n=r.levelLoadingRetryDelay,o=r.levelLoadingMaxRetryTimeout}l=this.createInternalLoader(t),t.url=e,t.responseType=t.responseType||"";var d={timeout:a,maxRetry:i,retryDelay:n,maxRetryDelay:o},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return s.logger.debug("Calling internal loader delegate for URL: "+e),l.load(t,d,c),!0},r.prototype.loadsuccess=function(e,t,r,i){if(void 0===i&&(i=null),r.isSidxRequest)return this._handleSidxRequest(e,r),void this._handlePlaylistLoaded(e,t,r,i);this.resetInternalLoader(r.type);var a=e.data;t.tload=d.now(),0===a.indexOf("#EXTM3U")?a.indexOf("#EXTINF:")>0||a.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,r,i):this._handleMasterPlaylist(e,t,r,i):this._handleManifestParsingError(e,r,"no EXTM3U delimiter",i)},r.prototype.loaderror=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!1,e)},r.prototype.loadtimeout=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!0)},r.prototype._handleMasterPlaylist=function(e,t,i,n){var o=this.hls,l=e.data,d=r.getResponseUrl(e,i),f=u.default.parseMasterPlaylist(l,d);if(f.length){var c=f.map(function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}}),h=u.default.parseMasterPlaylistMedia(l,d,"AUDIO",c),p=u.default.parseMasterPlaylistMedia(l,d,"SUBTITLES");if(h.length){var g=!1;h.forEach(function(e){e.url||(g=!0)}),!1===g&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(s.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main"}))}o.trigger(a.default.MANIFEST_LOADED,{levels:f,audioTracks:h,subtitles:p,url:d,stats:t,networkDetails:n})}else this._handleManifestParsingError(e,i,"no level found in manifest",n)},r.prototype._handleTrackOrLevelPlaylist=function(t,i,n,o){var s=this.hls,l=n.id,c=n.level,h=n.type,p=r.getResponseUrl(t,n),g=e.isFinite(l)?l:0,v=e.isFinite(c)?c:g,m=r.mapContextToLevelType(n),y=u.default.parseLevelPlaylist(t.data,p,v,m,g);if(y.tload=i.tload,h===f.MANIFEST){var _={url:p,details:y};s.trigger(a.default.MANIFEST_LOADED,{levels:[_],audioTracks:[],url:p,stats:i,networkDetails:o})}if(i.tparsed=d.now(),y.needSidxRanges){var E=y.initSegment.url;this.load(E,{isSidxRequest:!0,type:h,level:c,levelDetails:y,id:l,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else n.levelDetails=y,this._handlePlaylistLoaded(t,i,n,o)},r.prototype._handleSidxRequest=function(e,t){var r=l.default.parseSegmentIndex(new Uint8Array(e.data));if(r){var i=r.references,a=t.levelDetails;i.forEach(function(e,t){var r=e.info,i=a.fragments[t];0===i.byteRange.length&&(i.rawByteRange=String(1+r.end-r.start)+"@"+String(r.start))}),a.initSegment.rawByteRange=String(r.moovEndOffset)+"@0"}},r.prototype._handleManifestParsingError=function(e,t,r,i){this.hls.trigger(a.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:r,networkDetails:i})},r.prototype._handleNetworkError=function(e,t,r,i){var n,l;void 0===r&&(r=!1),void 0===i&&(i=null),s.logger.info("A network error occured while loading a "+e.type+"-type playlist");var u=this.getInternalLoader(e);switch(e.type){case f.MANIFEST:n=r?o.ErrorDetails.MANIFEST_LOAD_TIMEOUT:o.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case f.LEVEL:n=r?o.ErrorDetails.LEVEL_LOAD_TIMEOUT:o.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case f.AUDIO_TRACK:n=r?o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;default:l=!1}u&&(u.abort(),this.resetInternalLoader(e.type));var d={type:o.ErrorTypes.NETWORK_ERROR,details:n,fatal:l,url:u.url,loader:u,context:e,networkDetails:t};i&&(d.response=i),this.hls.trigger(a.default.ERROR,d)},r.prototype._handlePlaylistLoaded=function(e,t,i,n){var o=i.type,s=i.level,l=i.id,u=i.levelDetails;if(u.targetduration)if(r.canHaveQualityLevels(i.type))this.hls.trigger(a.default.LEVEL_LOADED,{details:u,level:s||0,id:l||0,stats:t,networkDetails:n});else switch(o){case f.AUDIO_TRACK:this.hls.trigger(a.default.AUDIO_TRACK_LOADED,{details:u,id:l,stats:t,networkDetails:n});break;case f.SUBTITLE_TRACK:this.hls.trigger(a.default.SUBTITLE_TRACK_LOADED,{details:u,id:l,stats:t,networkDetails:n})}else this._handleManifestParsingError(e,i,"invalid target duration",n)},r}(n.default);t.default=h}).call(this,r(2).Number)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(1),n=Math.pow(2,32)-1,o=function(){function e(e,t){this.observer=e,this.remuxer=t}return e.prototype.resetTimeStamp=function(e){this.initPTS=e},e.prototype.resetInitSegment=function(t,r,i,n){if(t&&t.byteLength){var o=this.initData=e.parseInitSegment(t);null==r&&(r="mp4a.40.5"),null==i&&(i="avc1.42e01e");var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:r+","+i,initSegment:n?t:null}:(o.audio&&(s.audio={container:"audio/mp4",codec:r,initSegment:n?t:null}),o.video&&(s.video={container:"video/mp4",codec:i,initSegment:n?t:null})),this.observer.trigger(a.default.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else r&&(this.audioCodec=r),i&&(this.videoCodec=i)},e.probe=function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.bin2str=function(e){return String.fromCharCode.apply(null,e)},e.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<8|e[t+1];return r<0?65536+r:r},e.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r},e.writeUint32=function(e,t,r){e.data&&(t+=e.start,e=e.data),e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},e.findBox=function(t,r){var i,a,n,o,s,l,u,d=[];if(t.data?(l=t.start,o=t.end,t=t.data):(l=0,o=t.byteLength),!r.length)return null;for(i=l;i<o;)a=e.readUint32(t,i),n=e.bin2str(t.subarray(i+4,i+8)),u=a>1?i+a:o,n===r[0]&&(1===r.length?d.push({data:t,start:i+8,end:u}):(s=e.findBox({data:t,start:i+8,end:u},r.slice(1))).length&&(d=d.concat(s))),i=u;return d},e.parseSegmentIndex=function(t){var r,i=e.findBox(t,["moov"])[0],a=i?i.end:null,n=0,o=e.findBox(t,["sidx"]);if(!o||!o[0])return null;r=[];var s=(o=o[0]).data[0];n=0===s?8:16;var l=e.readUint32(o,n);n+=4;n+=0===s?8:16,n+=2;var u=o.end+0,d=e.readUint16(o,n);n+=2;for(var f=0;f<d;f++){var c=n,h=e.readUint32(o,c);c+=4;var p=2147483647&h;if(1===(2147483648&h)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var g=e.readUint32(o,c);c+=4,r.push({referenceSize:p,subsegmentDuration:g,info:{duration:g/l,start:u,end:u+p-1}}),u+=p,n=c+=4}return{earliestPresentationTime:0,timescale:l,version:s,referencesCount:d,references:r,moovEndOffset:a}},e.parseInitSegment=function(t){var r=[];return e.findBox(t,["moov","trak"]).forEach(function(t){var a=e.findBox(t,["tkhd"])[0];if(a){var n=a.data[a.start],o=0===n?12:20,s=e.readUint32(a,o),l=e.findBox(t,["mdia","mdhd"])[0];if(l){o=0===(n=l.data[l.start])?12:20;var u=e.readUint32(l,o),d=e.findBox(t,["mdia","hdlr"])[0];if(d){var f={soun:"audio",vide:"video"}[e.bin2str(d.data.subarray(d.start+8,d.start+12))];if(f){var c=e.findBox(t,["mdia","minf","stbl","stsd"]);if(c.length){c=c[0];var h=e.bin2str(c.data.subarray(c.start+12,c.start+16));i.logger.log("MP4Demuxer:"+f+":"+h+" found")}r[s]={timescale:u,type:f},r[f]={timescale:u,id:s}}}}}}),r},e.getStartDTS=function(t,r){var i,a,n;return i=e.findBox(r,["moof","traf"]),a=[].concat.apply([],i.map(function(r){return e.findBox(r,["tfhd"]).map(function(i){var a,n;return a=e.readUint32(i,4),n=t[a].timescale||9e4,e.findBox(r,["tfdt"]).map(function(t){var r,i;return r=t.data[t.start],i=e.readUint32(t,4),1===r&&(i*=Math.pow(2,32),i+=e.readUint32(t,8)),i})[0]/n})})),n=Math.min.apply(null,a),isFinite(n)?n:0},e.offsetStartDTS=function(t,r,i){e.findBox(r,["moof","traf"]).map(function(r){return e.findBox(r,["tfhd"]).map(function(a){var o=e.readUint32(a,4),s=t[o].timescale||9e4;e.findBox(r,["tfdt"]).map(function(t){var r=t.data[t.start],a=e.readUint32(t,4);if(0===r)e.writeUint32(t,4,a-i*s);else{a*=Math.pow(2,32),a+=e.readUint32(t,8),a-=i*s,a=Math.max(a,0);var o=Math.floor(a/(n+1)),l=Math.floor(a%(n+1));e.writeUint32(t,4,o),e.writeUint32(t,8,l)}})})})},e.prototype.append=function(t,r,i,n){var o=this.initData;o||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),o=this.initData);var s,l=this.initPTS;if(void 0===l){var u=e.getStartDTS(o,t);this.initPTS=l=u-r,this.observer.trigger(a.default.INIT_PTS_FOUND,{initPTS:l})}e.offsetStartDTS(o,t,l),s=e.getStartDTS(o,t),this.remuxer.remux(o.audio,o.video,null,null,s,i,n,t)},e.prototype.destroy=function(){},e}();t.default=o},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),a=r(16),n=function(){function t(){var e;this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[],this.programDateTime=null,this.rawProgramDateTime=null,this._elementaryStreams=((e={})[t.ElementaryStreamTypes.AUDIO]=!1,e[t.ElementaryStreamTypes.VIDEO]=!1,e)}return Object.defineProperty(t,"ElementaryStreamTypes",{get:function(){return{AUDIO:"audio",VIDEO:"video"}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return!this._url&&this.relurl&&(this._url=i.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"byteRange",{get:function(){if(!this._byteRange&&!this.rawByteRange)return[];if(this._byteRange)return this._byteRange;var e=[];if(this.rawByteRange){var t=this.rawByteRange.split("@",2);if(1===t.length){var r=this.lastByteRangeEndOffset;e[0]=r||0}else e[0]=parseInt(t[1]);e[1]=parseInt(t[0])+e[0],this._byteRange=e}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"byteRangeStartOffset",{get:function(){return this.byteRange[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"byteRangeEndOffset",{get:function(){return this.byteRange[1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"decryptdata",{get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"endProgramDateTime",{get:function(){if(!e.isFinite(this.programDateTime))return null;var t=e.isFinite(this.duration)?this.duration:0;return this.programDateTime+1e3*t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"encrypted",{get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)},enumerable:!0,configurable:!0}),t.prototype.addElementaryStream=function(e){this._elementaryStreams[e]=!0},t.prototype.hasElementaryStream=function(e){return!0===this._elementaryStreams[e]},t.prototype.createInitializationVector=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t},t.prototype.fragmentDecryptdataFromLevelkey=function(e,t){var r=e;return e&&e.method&&e.uri&&!e.iv&&((r=new a.default).method=e.method,r.baseuri=e.baseuri,r.reluri=e.reluri,r.iv=this.createInitializationVector(t)),r},t}();t.default=n}).call(this,r(2).Number)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),a=function(){function e(){this.method=null,this.key=null,this.iv=null,this._uri=null}return Object.defineProperty(e.prototype,"uri",{get:function(){return!this._uri&&this.reluri&&(this._uri=i.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri},enumerable:!0,configurable:!0}),e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};t.isCodecType=function(e,t){var r=i[t];return!!r&&!0===r[e.slice(0,4)]},t.isCodecSupportedInMp4=function(e,t){return window.MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,a=r(1),n=r(3),o=r(19),s=r(36),l=r(14),u=r(37),d=r(40),f=r(41),c=r(44),h=r(6),p=r(0),g=h.getSelfScope();try{i=g.performance.now.bind(g.performance)}catch(e){p.logger.debug("Unable to use Performance API on this environment"),i=g.Date.now}var v=function(){function e(e,t,r,i){this.observer=e,this.typeSupported=t,this.config=r,this.vendor=i}return e.prototype.destroy=function(){var e=this.demuxer;e&&e.destroy()},e.prototype.push=function(e,t,r,n,s,l,u,d,f,c,h,p){var g=this;if(e.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method){var v=this.decrypter;null==v&&(v=this.decrypter=new o.default(this.observer,this.config));var m=i();v.decrypt(e,t.key.buffer,t.iv.buffer,function(e){var o=i();g.observer.trigger(a.default.FRAG_DECRYPTED,{stats:{tstart:m,tdecrypt:o}}),g.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),n,s,l,u,d,f,c,h,p)})}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),n,s,l,u,d,f,c,h,p)},e.prototype.pushDecrypted=function(e,t,r,i,o,h,p,g,v,m,y,_){var E=this.demuxer;if(!E||(p||g)&&!this.probe(e)){for(var b=this.observer,S=this.typeSupported,T=this.config,A=[{demux:u.default,remux:f.default},{demux:l.default,remux:c.default},{demux:s.default,remux:f.default},{demux:d.default,remux:f.default}],R=0,L=A.length;R<L;R++){var D=A[R],O=D.demux.probe;if(O(e)){var w=this.remuxer=new D.remux(b,T,S,this.vendor);E=new D.demux(b,w,T,S),this.probe=O;break}}if(!E)return void b.trigger(a.default.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=E}var P=this.remuxer;(p||g)&&(E.resetInitSegment(r,i,o,m),P.resetInitSegment()),p&&(E.resetTimeStamp(_),P.resetTimeStamp(_)),"function"==typeof E.setDecryptData&&E.setDecryptData(t),E.append(e,h,v,y)},e}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(33),a=r(34),n=r(35),o=r(3),s=r(0),l=r(1),u=r(6).getSelfScope(),d=function(){function e(e,t,r){var i=(void 0===r?{}:r).removePKCS7Padding,a=void 0===i||i;if(this.logEnabled=!0,this.observer=e,this.config=t,this.removePKCS7Padding=a,a)try{var n=u.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(e){}this.disableWebCrypto=!this.subtle}return e.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},e.prototype.decrypt=function(e,t,r,o){var l=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(s.logger.log("JS AES decrypt"),this.logEnabled=!1);var u=this.decryptor;u||(this.decryptor=u=new n.default),u.expandKey(t),o(u.decrypt(e,0,r,this.removePKCS7Padding))}else{this.logEnabled&&(s.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var d=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new a.default(d,t)),this.fastAesKey.expandKey().then(function(a){new i.default(d,r).decrypt(e,a).catch(function(i){l.onWebCryptoError(i,e,t,r,o)}).then(function(e){o(e)})}).catch(function(i){l.onWebCryptoError(i,e,t,r,o)})}},e.prototype.onWebCryptoError=function(e,t,r,i,a){this.config.enableSoftwareAES?(s.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,r,i,a)):(s.logger.error("decrypting error : "+e.message),this.observer.trigger(l.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))},e.prototype.destroy=function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)},e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),n=r(1);function o(e,t,r,o){var s,l,u,d,f,c=navigator.userAgent.toLowerCase(),h=o,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(s=1+((192&t[r+2])>>>6),!((l=(60&t[r+2])>>>2)>p.length-1))return d=(1&t[r+2])<<2,d|=(192&t[r+3])>>>6,i.logger.log("manifest codec:"+o+",ADTS data:type:"+s+",sampleingIndex:"+l+"["+p[l]+"Hz],channelConfig:"+d),/firefox/i.test(c)?l>=6?(s=5,f=new Array(4),u=l-3):(s=2,f=new Array(2),u=l):-1!==c.indexOf("android")?(s=2,f=new Array(2),u=l):(s=5,f=new Array(4),o&&(-1!==o.indexOf("mp4a.40.29")||-1!==o.indexOf("mp4a.40.5"))||!o&&l>=6?u=l-3:((o&&-1!==o.indexOf("mp4a.40.2")&&(l>=6&&1===d||/vivaldi/i.test(c))||!o&&1===d)&&(s=2,f=new Array(2)),u=l)),f[0]=s<<3,f[0]|=(14&l)>>1,f[1]|=(1&l)<<7,f[1]|=d<<3,5===s&&(f[1]|=(14&u)>>1,f[2]=(1&u)<<7,f[2]|=8,f[3]=0),{config:f,samplerate:p[l],channelCount:d,codec:"mp4a.40."+s,manifestCodec:h};e.trigger(n.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+l})}function s(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function u(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function d(e){return 9216e4/e}function f(e,t,r,i,a){var n,o,s=e.length;if(n=l(e,t),o=u(e,t),(o-=n)>0&&t+n+o<=s)return{headerLength:n,frameLength:o,stamp:r+i*a}}t.getAudioConfig=o,t.isHeaderPattern=s,t.getHeaderLength=l,t.getFullFrameLength=u,t.isHeader=function(e,t){return!!(t+1<e.length&&s(e,t))},t.probe=function(e,t){if(t+1<e.length&&s(e,t)){var r=l(e,t);t+5<e.length&&(r=u(e,t));var i=t+r;if(i===e.length||i+1<e.length&&s(e,i))return!0}return!1},t.initTrackConfig=function(e,t,r,a,n){if(!e.samplerate){var s=o(t,r,a,n);e.config=s.config,e.samplerate=s.samplerate,e.channelCount=s.channelCount,e.codec=s.codec,e.manifestCodec=s.manifestCodec,i.logger.log("parsed codec:"+e.codec+",rate:"+s.samplerate+",nb channel:"+s.channelCount)}},t.getFrameDuration=d,t.parseFrameHeader=f,t.appendFrame=function(e,t,r,i,a){var n=f(t,r,i,a,d(e.samplerate));if(n){var o=n.stamp,s=n.headerLength,l=n.frameLength,u={unit:t.subarray(r+s,r+s+l),pts:o,dts:o};return e.samples.push(u),e.len+=l,{sample:u,length:l+s}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(e,t,r,i,a){if(!(r+24>t.length)){var n=this.parseHeader(t,r);if(n&&r+n.frameLength<=t.length){var o=i+a*(9e4*n.samplesPerFrame/n.sampleRate),s={unit:t.subarray(r,r+n.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(s),e.len+=n.frameLength,{sample:s,length:n.frameLength}}}},parseHeader:function(e,t){var r=e[t+1]>>3&3,a=e[t+1]>>1&3,n=e[t+2]>>4&15,o=e[t+2]>>2&3,s=e[t+2]>>1&1;if(1!==r&&0!==n&&15!==n&&3!==o){var l=3===r?3-a:3===a?3:4,u=1e3*i.BitratesMap[14*l+n-1],d=3===r?0:2===r?1:2,f=i.SamplingRateMap[3*d+o],c=e[t+3]>>6==3?1:2,h=i.SamplesCoefficients[r][a],p=i.BytesInSlot[a],g=8*h*p;return{sampleRate:f,channelCount:c,frameLength:parseInt(h*u/f+s,10)*p,samplesPerFrame:g}}},isHeaderPattern:function(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])},isHeader:function(e,t){return!!(t+1<e.length&&this.isHeaderPattern(e,t))},probe:function(e,t){if(t+1<e.length&&this.isHeaderPattern(e,t)){var r=this.parseHeader(e,t),i=4;r&&r.frameLength&&(i=r.frameLength);var a=t+i;if(a===e.length||a+1<e.length&&this.isHeaderPattern(e,a))return!0}return!1}};t.default=i},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.trigger=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.emit.apply(this,[e,e].concat(t))},t}(r(45).EventEmitter);t.Observer=a},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);function a(t,r,a){var n=t[r],o=t[a],s=o.startPTS;e.isFinite(s)?a>r?(n.duration=s-n.start,n.duration<0&&i.logger.warn("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!")):(o.duration=n.start-s,o.duration<0&&i.logger.warn("negative duration computed for frag "+o.sn+",level "+o.level+", there should be some duration drift between playlist and fragment!")):o.start=a>r?n.start+n.duration:Math.max(n.start-o.duration,0)}function n(t,r,i,n,o,s){var l=i;if(e.isFinite(r.startPTS)){var u=Math.abs(r.startPTS-i);e.isFinite(r.deltaPTS)?r.deltaPTS=Math.max(u,r.deltaPTS):r.deltaPTS=u,l=Math.max(i,r.startPTS),i=Math.min(i,r.startPTS),n=Math.max(n,r.endPTS),o=Math.min(o,r.startDTS),s=Math.max(s,r.endDTS)}var d=i-r.start;r.start=r.startPTS=i,r.maxStartPTS=l,r.endPTS=n,r.startDTS=o,r.endDTS=s,r.duration=n-i;var f,c,h,p=r.sn;if(!t||p<t.startSN||p>t.endSN)return 0;for(f=p-t.startSN,(c=t.fragments)[f]=r,h=f;h>0;h--)a(c,h,h-1);for(h=f;h<c.length-1;h++)a(c,h,h+1);return t.PTSKnown=!0,d}function o(e,t,r){if(e&&t)for(var i=Math.max(e.startSN,t.startSN)-t.startSN,a=Math.min(e.endSN,t.endSN)-t.startSN,n=t.startSN-e.startSN,o=i;o<=a;o++){var s=e.fragments[n+o],l=t.fragments[o];if(!s||!l)break;r(s,l,o)}}function s(e,t){var r=t.startSN-e.startSN,i=e.fragments,a=t.fragments;if(!(r<0||r>i.length))for(var n=0;n<a.length;n++)a[n].start+=i[r].start}t.addGroupId=function(e,t,r){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(r);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(r)}},t.updatePTS=a,t.updateFragPTSDTS=n,t.mergeDetails=function(t,r){r.initSegment&&t.initSegment&&(r.initSegment=t.initSegment);var a,l=0;if(o(t,r,function(t,i){l=t.cc-i.cc,e.isFinite(t.startPTS)&&(i.start=i.startPTS=t.startPTS,i.endPTS=t.endPTS,i.duration=t.duration,i.backtracked=t.backtracked,i.dropped=t.dropped,a=i),r.PTSKnown=!0}),r.PTSKnown){if(l){i.logger.log("discontinuity sliding from playlist, take drift into account");for(var u=r.fragments,d=0;d<u.length;d++)u[d].cc+=l}a?n(r,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):s(t,r),r.PTSKnown=t.PTSKnown}},t.mergeSubtitlePlaylists=function(e,t,r){void 0===r&&(r=0);var i=-1;o(e,t,function(e,t,r){t.start=e.start,i=r});var a=t.fragments;if(i<0)a.forEach(function(e){e.start+=r});else for(var n=i+1;n<a.length;n++)a[n].start=a[n-1].start+a[n-1].duration},t.mapFragmentIntersection=o,t.adjustSliding=s,t.computeReloadInterval=function(e,t,r){var i=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),a=i/2;return e&&t.endSN===e.endSN&&(i=a),r&&(i=Math.max(a,i-(window.performance.now()-r))),Math.round(i)}}).call(this,r(2).Number)},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(7),n=r(3),o=r(13),s=r(28),l=r(29),u=r(9),d=r(30),f=r(54),c=r(55),h=r(57),p=r(0),g=r(58),v=r(1),m=function(e){function t(r){void 0===r&&(r={});var i=e.call(this)||this,a=t.DefaultConfig;if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var n in a)n in r||(r[n]=a[n]);if(void 0!==r.liveMaxLatencyDurationCount&&r.liveMaxLatencyDurationCount<=r.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==r.liveMaxLatencyDuration&&(r.liveMaxLatencyDuration<=r.liveSyncDuration||void 0===r.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');p.enableLogs(r.debug),i.config=r,i._autoLevelCapping=-1;var h=i.abrController=new r.abrController(i),g=new r.bufferController(i),v=new r.capLevelController(i),m=new r.fpsController(i),y=new o.default(i),_=new s.default(i),E=new l.default(i),b=new c.default(i),S=i.levelController=new f.default(i),T=new u.FragmentTracker(i),A=[S,i.streamController=new d.default(i,T)],R=r.audioStreamController;R&&A.push(new R(i,T)),i.networkControllers=A;var L=[y,_,E,h,g,v,m,b,T];if(R=r.audioTrackController){var D=new R(i);i.audioTrackController=D,L.push(D)}if(R=r.subtitleTrackController){var O=new R(i);i.subtitleTrackController=O,A.push(O)}if(R=r.emeController){var w=new R(i);i.emeController=w,L.push(w)}return(R=r.subtitleStreamController)&&A.push(new R(i,T)),(R=r.timelineController)&&L.push(new R(i)),i.coreComponents=L,i}return i(t,e),Object.defineProperty(t,"version",{get:function(){return"0.12.4"},enumerable:!0,configurable:!0}),t.isSupported=function(){return h.isSupported()},Object.defineProperty(t,"Events",{get:function(){return v.default},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ErrorTypes",{get:function(){return n.ErrorTypes},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ErrorDetails",{get:function(){return n.ErrorDetails},enumerable:!0,configurable:!0}),Object.defineProperty(t,"DefaultConfig",{get:function(){return t.defaultConfig?t.defaultConfig:g.hlsDefaultConfig},set:function(e){t.defaultConfig=e},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){p.logger.log("destroy"),this.trigger(v.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach(function(e){e.destroy()}),this.url=null,this.removeAllListeners(),this._autoLevelCapping=-1},t.prototype.attachMedia=function(e){p.logger.log("attachMedia"),this.media=e,this.trigger(v.default.MEDIA_ATTACHING,{media:e})},t.prototype.detachMedia=function(){p.logger.log("detachMedia"),this.trigger(v.default.MEDIA_DETACHING),this.media=null},t.prototype.loadSource=function(e){e=a.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),p.logger.log("loadSource:"+e),this.url=e,this.trigger(v.default.MANIFEST_LOADING,{url:e})},t.prototype.startLoad=function(e){void 0===e&&(e=-1),p.logger.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},t.prototype.stopLoad=function(){p.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},t.prototype.swapAudioCodec=function(){p.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.prototype.recoverMediaError=function(){p.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),this.attachMedia(e)},Object.defineProperty(t.prototype,"levels",{get:function(){return this.levelController.levels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentLevel",{get:function(){return this.streamController.currentLevel},set:function(e){p.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextLevel",{get:function(){return this.streamController.nextLevel},set:function(e){p.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadLevel",{get:function(){return this.levelController.level},set:function(e){p.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextLoadLevel",{get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstLevel",{get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){p.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"startLevel",{get:function(){return this.levelController.startLevel},set:function(e){p.logger.log("set startLevel:"+e);-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoLevelCapping",{get:function(){return this._autoLevelCapping},set:function(e){p.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoLevelEnabled",{get:function(){return-1===this.levelController.manualLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"manualLevel",{get:function(){return this.levelController.manualLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minAutoLevel",{get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,r=e?e.length:0,i=0;i<r;i++){if((e[i].realBitrate?Math.max(e[i].realBitrate,e[i].bitrate):e[i].bitrate)>t)return i}return 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxAutoLevel",{get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextAutoLevel",{get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"audioTracks",{get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"audioTrack",{get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"liveSyncPosition",{get:function(){return this.streamController.liveSyncPosition},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subtitleTracks",{get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subtitleTrack",{get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subtitleDisplay",{get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)},enumerable:!0,configurable:!0}),t}(r(22).Observer);t.default=m},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),a=r(15),n=r(26),o=r(16),s=r(27),l=r(0),u=r(17),d=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,f=/#EXT-X-MEDIA:(.*)/g,c=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),h=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,p=/\.(mp4|m4s|m4v|m4a)$/i,g=function(){function t(){}return t.findGroup=function(e,t){if(!e)return null;for(var r=null,i=0;i<e.length;i++){var a=e[i];a.id===t&&(r=a)}return r},t.convertAVC1ToAVCOTI=function(e){var t,r=e.split(".");return r.length>2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t},t.resolve=function(e,t){return i.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,r){var i,a=[];function n(e,t){["video","audio"].forEach(function(r){var i=e.filter(function(e){return u.isCodecType(e,r)});if(i.length){var a=i.filter(function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)});t[r+"Codec"]=a.length>0?a[0]:i[0],e=e.filter(function(e){return-1===i.indexOf(e)})}}),t.unknownCodecs=e}for(d.lastIndex=0;null!=(i=d.exec(e));){var o={},l=o.attrs=new s.default(i[1]);o.url=t.resolve(i[2],r);var f=l.decimalResolution("RESOLUTION");f&&(o.width=f.width,o.height=f.height),o.bitrate=l.decimalInteger("AVERAGE-BANDWIDTH")||l.decimalInteger("BANDWIDTH"),o.name=l.NAME,n([].concat((l.CODECS||"").split(/[ ,]+/)),o),o.videoCodec&&-1!==o.videoCodec.indexOf("avc1")&&(o.videoCodec=t.convertAVC1ToAVCOTI(o.videoCodec)),a.push(o)}return a},t.parseMasterPlaylistMedia=function(e,r,i,a){var n;void 0===a&&(a=[]);var o=[],l=0;for(f.lastIndex=0;null!==(n=f.exec(e));){var u={},d=new s.default(n[1]);if(d.TYPE===i){if(u.groupId=d["GROUP-ID"],u.name=d.NAME,u.type=i,u.default="YES"===d.DEFAULT,u.autoselect="YES"===d.AUTOSELECT,u.forced="YES"===d.FORCED,d.URI&&(u.url=t.resolve(d.URI,r)),u.lang=d.LANGUAGE,u.name||(u.name=u.lang),a.length){var c=t.findGroup(a,u.groupId);u.audioCodec=c?c.codec:a[0].codec}u.id=l++,o.push(u)}}return o},t.parseLevelPlaylist=function(t,r,i,u,d){var f,g,m=0,y=0,_=new n.default(r),E=new o.default,b=0,S=null,T=new a.default,A=null;for(c.lastIndex=0;null!==(f=c.exec(t));){var R=f[1];if(R){T.duration=parseFloat(R);var L=(" "+f[2]).slice(1);T.title=L||null,T.tagList.push(L?["INF",R,L]:["INF",R])}else if(f[3]){if(e.isFinite(T.duration)){var D=m++;T.type=u,T.start=y,T.levelkey=E,T.sn=D,T.level=i,T.cc=b,T.urlId=d,T.baseurl=r,T.relurl=(" "+f[3]).slice(1),v(T,S),_.fragments.push(T),S=T,y+=T.duration,T=new a.default}}else if(f[4]){if(T.rawByteRange=(" "+f[4]).slice(1),S){var O=S.byteRangeEndOffset;O&&(T.lastByteRangeEndOffset=O)}}else if(f[5])T.rawProgramDateTime=(" "+f[5]).slice(1),T.tagList.push(["PROGRAM-DATE-TIME",T.rawProgramDateTime]),null===A&&(A=_.fragments.length);else{for(f=f[0].match(h),g=1;g<f.length&&void 0===f[g];g++);var w=(" "+f[g+1]).slice(1),P=(" "+f[g+2]).slice(1);switch(f[g]){case"#":T.tagList.push(P?[w,P]:[w]);break;case"PLAYLIST-TYPE":_.type=w.toUpperCase();break;case"MEDIA-SEQUENCE":m=_.startSN=parseInt(w);break;case"TARGETDURATION":_.targetduration=parseFloat(w);break;case"VERSION":_.version=parseInt(w);break;case"EXTM3U":break;case"ENDLIST":_.live=!1;break;case"DIS":b++,T.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":b=parseInt(w);break;case"KEY":var I=w,x=new s.default(I),F=x.enumeratedString("METHOD"),k=x.URI,C=x.hexadecimalInteger("IV");F&&(E=new o.default,k&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(F)>=0&&(E.method=F,E.baseuri=r,E.reluri=k,E.key=null,E.iv=C));break;case"START":var M=w,N=new s.default(M).decimalFloatingPoint("TIME-OFFSET");e.isFinite(N)&&(_.startTimeOffset=N);break;case"MAP":var U=new s.default(w);T.relurl=U.URI,T.rawByteRange=U.BYTERANGE,T.baseurl=r,T.level=i,T.type=u,T.sn="initSegment",_.initSegment=T,(T=new a.default).rawProgramDateTime=_.initSegment.rawProgramDateTime;break;default:l.logger.warn("line parsed but not handled: "+f)}}}return(T=S)&&!T.relurl&&(_.fragments.pop(),y-=T.duration),_.totalduration=y,_.averagetargetduration=y/_.fragments.length,_.endSN=m-1,_.startCC=_.fragments[0]?_.fragments[0].cc:0,_.endCC=b,!_.initSegment&&_.fragments.length&&_.fragments.every(function(e){return p.test(e.relurl)})&&(l.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(T=new a.default).relurl=_.fragments[0].relurl,T.baseurl=r,T.level=i,T.type=u,T.sn="initSegment",_.initSegment=T,_.needSidxRanges=!0),A&&function(e,t){for(var r=e[t],i=t-1;i>=0;i--){var a=e[i];a.programDateTime=r.programDateTime-1e3*a.duration,r=a}}(_.fragments,A),_},t}();function v(t,r){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):r&&r.programDateTime&&(t.programDateTime=r.endProgramDateTime),e.isFinite(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}t.default=g}).call(this,r(2).Number)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function t(e){this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=e,this.version=null}return Object.defineProperty(t.prototype,"hasProgramDateTime",{get:function(){return!(!this.fragments[0]||!e.isFinite(this.fragments[0].programDateTime))},enumerable:!0,configurable:!0}),t}();t.default=r}).call(this,r(2).Number)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=/^(\d+)x(\d+)$/,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=function(){function t(e){for(var r in"string"==typeof e&&(e=t.parseAttrList(e)),e)e.hasOwnProperty(r)&&(this[r]=e[r])}return t.prototype.decimalInteger=function(t){var r=parseInt(this[t],10);return r>e.MAX_SAFE_INTEGER?1/0:r},t.prototype.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null},t.prototype.hexadecimalIntegerAsNumber=function(t){var r=parseInt(this[t],16);return r>e.MAX_SAFE_INTEGER?1/0:r},t.prototype.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.prototype.enumeratedString=function(e){return this[e]},t.prototype.decimalResolution=function(e){var t=r.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},t.parseAttrList=function(e){var t,r={};for(i.lastIndex=0;null!==(t=i.exec(e));){var a=t[2];0===a.indexOf('"')&&a.lastIndexOf('"')===a.length-1&&(a=a.slice(1,-1)),r[t[1]]=a}return r},t}();t.default=a}).call(this,r(2).Number)},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(3),s=r(0),l=function(t){function r(e){var r=t.call(this,e,a.default.FRAG_LOADING)||this;return r.loaders={},r}return i(r,t),r.prototype.destroy=function(){var e=this.loaders;for(var r in e){var i=e[r];i&&i.destroy()}this.loaders={},t.prototype.destroy.call(this)},r.prototype.onFragLoading=function(t){var r=t.frag,i=r.type,a=this.loaders,n=this.hls.config,o=n.fLoader,l=n.loader;r.loaded=0;var u,d,f,c=a[i];c&&(s.logger.warn("abort previous fragment loader for type: "+i),c.abort()),c=a[i]=r.loader=n.fLoader?new o(n):new l(n),u={url:r.url,frag:r,responseType:"arraybuffer",progressData:!1};var h=r.byteRangeStartOffset,p=r.byteRangeEndOffset;e.isFinite(h)&&e.isFinite(p)&&(u.rangeStart=h,u.rangeEnd=p),d={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},c.load(u,d,f)},r.prototype.loadsuccess=function(e,t,r,i){void 0===i&&(i=null);var n=e.data,o=r.frag;o.loader=void 0,this.loaders[o.type]=void 0,this.hls.trigger(a.default.FRAG_LOADED,{payload:n,frag:o,stats:t,networkDetails:i})},r.prototype.loaderror=function(e,t,r){void 0===r&&(r=null);var i=t.frag,n=i.loader;n&&n.abort(),this.loaders[i.type]=void 0,this.hls.trigger(a.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:r})},r.prototype.loadtimeout=function(e,t,r){void 0===r&&(r=null);var i=t.frag,n=i.loader;n&&n.abort(),this.loaders[i.type]=void 0,this.hls.trigger(a.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:r})},r.prototype.loadprogress=function(e,t,r,i){void 0===i&&(i=null);var n=t.frag;n.loaded=e.loaded,this.hls.trigger(a.default.FRAG_LOAD_PROGRESS,{frag:n,stats:e,networkDetails:i})},r}(n.default);t.default=l}).call(this,r(2).Number)},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(3),s=r(0),l=function(e){function t(t){var r=e.call(this,t,a.default.KEY_LOADING)||this;return r.loaders={},r.decryptkey=null,r.decrypturl=null,r}return i(t,e),t.prototype.destroy=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},n.default.prototype.destroy.call(this)},t.prototype.onKeyLoading=function(e){var t=e.frag,r=t.type,i=this.loaders[r],n=t.decryptdata,o=n.uri;if(o!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;i&&(s.logger.warn("abort previous key loader for type:"+r),i.abort()),t.loader=this.loaders[r]=new l.loader(l),this.decrypturl=o,this.decryptkey=null;var u,d,f;u={url:o,frag:t,responseType:"arraybuffer"},d={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},t.loader.load(u,d,f)}else this.decryptkey&&(n.key=this.decryptkey,this.hls.trigger(a.default.KEY_LOADED,{frag:t}))},t.prototype.loadsuccess=function(e,t,r){var i=r.frag;this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(a.default.KEY_LOADED,{frag:i})},t.prototype.loaderror=function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[t.type]=void 0,this.hls.trigger(a.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})},t.prototype.loadtimeout=function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[t.type]=void 0,this.hls.trigger(a.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},t}(n.default);t.default=l},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(10),n=r(8),o=r(31),s=r(1),l=r(9),u=r(15),d=r(13),f=r(23),c=r(48),h=r(3),p=r(0),g=r(49),v=r(50),m=r(51),y=r(52),_=function(t){function r(e,r){var i=t.call(this,e,s.default.MEDIA_ATTACHED,s.default.MEDIA_DETACHING,s.default.MANIFEST_LOADING,s.default.MANIFEST_PARSED,s.default.LEVEL_LOADED,s.default.KEY_LOADED,s.default.FRAG_LOADED,s.default.FRAG_LOAD_EMERGENCY_ABORTED,s.default.FRAG_PARSING_INIT_SEGMENT,s.default.FRAG_PARSING_DATA,s.default.FRAG_PARSED,s.default.ERROR,s.default.AUDIO_TRACK_SWITCHING,s.default.AUDIO_TRACK_SWITCHED,s.default.BUFFER_CREATED,s.default.BUFFER_APPENDED,s.default.BUFFER_FLUSHED)||this;return i.fragmentTracker=r,i.config=e.config,i.audioCodecSwap=!1,i._state=y.State.STOPPED,i.stallReported=!1,i.gapController=null,i}return i(r,t),r.prototype.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=r.startLevel;-1===i&&(i=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&-1===e&&(p.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=y.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=y.State.STOPPED},r.prototype.stopLoad=function(){this.forceStartLoad=!1,t.prototype.stopLoad.call(this)},r.prototype.doTick=function(){switch(this.state){case y.State.BUFFER_FLUSHING:this.fragLoadError=0;break;case y.State.IDLE:this._doTickIdle();break;case y.State.WAITING_LEVEL:var e=this.levels[this.level];e&&e.details&&(this.state=y.State.IDLE);break;case y.State.FRAG_LOADING_WAITING_RETRY:var t=window.performance.now(),r=this.retryDate;(!r||t>=r||this.media&&this.media.seeking)&&(p.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=y.State.IDLE);break;case y.State.ERROR:case y.State.STOPPED:case y.State.FRAG_LOADING:case y.State.PARSING:case y.State.PARSED:case y.State.ENDED:}this._checkBuffer(),this._checkFragmentChanged()},r.prototype._doTickIdle=function(){var e=this.hls,t=e.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&t.startFragPrefetch)){var i;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var a=e.nextLoadLevel,o=this.levels[a];if(o){var l,u=o.bitrate;l=u?Math.max(8*t.maxBufferSize/u,t.maxBufferLength):t.maxBufferLength,l=Math.min(l,t.maxMaxBufferLength);var d=n.BufferHelper.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,t.maxBufferHole),f=d.len;if(!(f>=l)){p.logger.trace("buffer length of "+f.toFixed(3)+" is below max of "+l.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=a;var c=o.details;if(!c||c.live&&this.levelLastLoaded!==a)this.state=y.State.WAITING_LEVEL;else{if(this._streamEnded(d,c)){var h={};return this.altAudio&&(h.type="video"),this.hls.trigger(s.default.BUFFER_EOS,h),void(this.state=y.State.ENDED)}this._fetchPayloadOrEos(i,d,c)}}}}},r.prototype._fetchPayloadOrEos=function(e,t,r){var i=this.fragPrevious,a=this.level,n=r.fragments,o=n.length;if(0!==o){var s,l=n[0].start,u=n[o-1].start+n[o-1].duration,d=t.end;if(r.initSegment&&!r.initSegment.data)s=r.initSegment;else if(r.live){var f=this.config.initialLiveManifestSize;if(o<f)return void p.logger.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+f);if(null===(s=this._ensureFragmentAtLivePoint(r,d,l,u,i,n,o)))return}else d<l&&(s=n[0]);s||(s=this._findFragment(l,i,o,n,d,u,r)),s&&(s.encrypted?(p.logger.log("Loading key for "+s.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+a),this._loadKey(s)):(p.logger.log("Loading "+s.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+a+", currentTime:"+e.toFixed(3)+",bufferEnd:"+d.toFixed(3)),this._loadFragment(s)))}},r.prototype._ensureFragmentAtLivePoint=function(e,t,r,i,n,o,s){var l,u=this.hls.config,d=this.media,f=void 0!==u.liveMaxLatencyDuration?u.liveMaxLatencyDuration:u.liveMaxLatencyDurationCount*e.targetduration;if(t<Math.max(r-u.maxFragLookUpTolerance,i-f)){var c=this.liveSyncPosition=this.computeLivePosition(r,e);p.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+c.toFixed(3)),t=c,d&&d.readyState&&d.duration>c&&(d.currentTime=c),this.nextLoadPosition=c}if(e.PTSKnown&&t>i&&d&&d.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(n)if(e.hasProgramDateTime)p.logger.log("live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),l=v.findFragmentByPDT(o,n.endProgramDateTime,u.maxFragLookUpTolerance);else{var h=n.sn+1;if(h>=e.startSN&&h<=e.endSN){var g=o[h-e.startSN];n.cc===g.cc&&(l=g,p.logger.log("live playlist, switching playlist, load frag with next SN: "+l.sn))}l||(l=a.default.search(o,function(e){return n.cc-e.cc}))&&p.logger.log("live playlist, switching playlist, load frag with same CC: "+l.sn)}l||(l=o[Math.min(s-1,Math.round(s/2))],p.logger.log("live playlist, switching playlist, unknown, load middle frag : "+l.sn))}return l},r.prototype._findFragment=function(e,t,r,i,a,n,o){var s,l=this.hls.config;if(a<n){var u=a>n-l.maxFragLookUpTolerance?0:l.maxFragLookUpTolerance;s=v.findFragmentByPTS(t,i,a,u)}else s=i[r-1];if(s){var d=s.sn-o.startSN,f=t&&s.level===t.level,c=i[d-1],h=i[d+1];if(t&&s.sn===t.sn)if(f&&!s.backtracked)if(s.sn<o.endSN){var g=t.deltaPTS;g&&g>l.maxBufferHole&&t.dropped&&d?(s=c,p.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this")):(s=h,p.logger.log("SN just loaded, load next one: "+s.sn,s))}else s=null;else s.backtracked&&(h&&h.backtracked?(p.logger.warn("Already backtracked from fragment "+h.sn+", will not backtrack to fragment "+s.sn+". Loading fragment "+h.sn),s=h):(p.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),s.dropped=0,c?(s=c).backtracked=!0:d&&(s=null)))}return s},r.prototype._loadKey=function(e){this.state=y.State.KEY_LOADING,this.hls.trigger(s.default.KEY_LOADING,{frag:e})},r.prototype._loadFragment=function(t){var r=this.fragmentTracker.getState(t);this.fragCurrent=t,this.startFragRequested=!0,e.isFinite(t.sn)&&!t.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),t.backtracked||r===l.FragmentState.NOT_LOADED||r===l.FragmentState.PARTIAL?(t.autoLevel=this.hls.autoLevelEnabled,t.bitrateTest=this.bitrateTest,this.hls.trigger(s.default.FRAG_LOADING,{frag:t}),this.demuxer||(this.demuxer=new o.default(this.hls,"main")),this.state=y.State.FRAG_LOADING):r===l.FragmentState.APPENDING&&this._reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t)},Object.defineProperty(r.prototype,"state",{get:function(){return this._state},set:function(e){if(this.state!==e){var t=this.state;this._state=e,p.logger.log("main stream:"+t+"->"+e),this.hls.trigger(s.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},enumerable:!0,configurable:!0}),r.prototype.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,d.default.LevelType.MAIN)},Object.defineProperty(r.prototype,"currentLevel",{get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"nextBufferedFrag",{get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null},enumerable:!0,configurable:!0}),r.prototype.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},Object.defineProperty(r.prototype,"nextLevel",{get:function(){var e=this.nextBufferedFrag;return e?e.level:-1},enumerable:!0,configurable:!0}),r.prototype._checkFragmentChanged=function(){var e,t,r=this.media;if(r&&r.readyState&&!1===r.seeking&&((t=r.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=t),n.BufferHelper.isBuffered(r,t)?e=this.getBufferedFrag(t):n.BufferHelper.isBuffered(r,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var i=e;if(i!==this.fragPlaying){this.hls.trigger(s.default.FRAG_CHANGED,{frag:i});var a=i.level;this.fragPlaying&&this.fragPlaying.level===a||this.hls.trigger(s.default.LEVEL_SWITCHED,{level:a}),this.fragPlaying=i}}},r.prototype.immediateLevelSwitch=function(){if(p.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var t=this.media,r=void 0;t?(r=t.paused,t.pause()):r=!0,this.previouslyPaused=r}var i=this.fragCurrent;i&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,e.POSITIVE_INFINITY)},r.prototype.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,n.BufferHelper.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},r.prototype.nextLevelSwitch=function(){var t=this.media;if(t&&t.readyState){var r,i=void 0,a=void 0;if((r=this.getBufferedFrag(t.currentTime))&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),t.paused)i=0;else{var n=this.hls.nextLoadLevel,o=this.levels[n],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*o.bitrate/(1e3*s)+1:0}if((a=this.getBufferedFrag(t.currentTime+i))&&(a=this.followingBufferedFrag(a))){var l=this.fragCurrent;l&&l.loader&&l.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(a.maxStartPTS,e.POSITIVE_INFINITY)}}},r.prototype.flushMainBuffer=function(e,t){this.state=y.State.BUFFER_FLUSHING;var r={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(s.default.BUFFER_FLUSHING,r)},r.prototype.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition),this.gapController=new m.default(r,t,this.fragmentTracker,this.hls)},r.prototype.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(p.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.backtracked=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},r.prototype.onMediaSeeked=function(){var t=this.media,r=t?t.currentTime:void 0;e.isFinite(r)&&p.logger.log("media seeked to "+r.toFixed(3)),this.tick()},r.prototype.onManifestLoading=function(){p.logger.log("trigger BUFFER_RESET"),this.hls.trigger(s.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},r.prototype.onManifestParsed=function(e){var t,r=!1,i=!1;e.levels.forEach(function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(r=!0),-1!==t.indexOf("mp4a.40.5")&&(i=!0))}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&p.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1;var a=this.config;(a.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(a.startPosition)},r.prototype.onLevelLoaded=function(t){var r=t.details,i=t.level,a=this.levels[this.levelLastLoaded],n=this.levels[i],o=r.totalduration,l=0;if(p.logger.log("level "+i+" loaded ["+r.startSN+","+r.endSN+"],duration:"+o),r.live){var u=n.details;u&&r.fragments.length>0?(f.mergeDetails(u,r),l=r.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(l,u),r.PTSKnown&&e.isFinite(l)?p.logger.log("live playlist sliding:"+l.toFixed(3)):(p.logger.log("live playlist - outdated PTS, unknown sliding"),g.alignStream(this.fragPrevious,a,r))):(p.logger.log("live playlist - first load, unknown sliding"),r.PTSKnown=!1,g.alignStream(this.fragPrevious,a,r))}else r.PTSKnown=!1;if(n.details=r,this.levelLastLoaded=i,this.hls.trigger(s.default.LEVEL_UPDATED,{details:r,level:i}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var d=r.startTimeOffset;e.isFinite(d)?(d<0&&(p.logger.log("negative start time offset "+d+", count from end of last fragment"),d=l+o+d),p.logger.log("start time offset found in playlist, adjust startPosition to "+d),this.startPosition=d):r.live?(this.startPosition=this.computeLivePosition(l,r),p.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===y.State.WAITING_LEVEL&&(this.state=y.State.IDLE),this.tick()},r.prototype.onKeyLoaded=function(){this.state===y.State.KEY_LOADING&&(this.state=y.State.IDLE,this.tick())},r.prototype.onFragLoaded=function(e){var t=this.fragCurrent,r=this.hls,i=this.levels,a=this.media,n=e.frag;if(this.state===y.State.FRAG_LOADING&&t&&"main"===n.type&&n.level===t.level&&n.sn===t.sn){var l=e.stats,u=i[t.level],d=u.details;if(this.bitrateTest=!1,this.stats=l,p.logger.log("Loaded "+t.sn+" of ["+d.startSN+" ,"+d.endSN+"],level "+t.level),n.bitrateTest&&r.nextLoadLevel)this.state=y.State.IDLE,this.startFragRequested=!1,l.tparsed=l.tbuffered=window.performance.now(),r.trigger(s.default.FRAG_BUFFERED,{stats:l,frag:t,id:"main"}),this.tick();else if("initSegment"===n.sn)this.state=y.State.IDLE,l.tparsed=l.tbuffered=window.performance.now(),d.initSegment.data=e.payload,r.trigger(s.default.FRAG_BUFFERED,{stats:l,frag:t,id:"main"}),this.tick();else{p.logger.log("Parsing "+t.sn+" of ["+d.startSN+" ,"+d.endSN+"],level "+t.level+", cc "+t.cc),this.state=y.State.PARSING,this.pendingBuffering=!0,this.appended=!1,n.bitrateTest&&(n.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:n}));var f=!(a&&a.seeking)&&(d.PTSKnown||!d.live),c=d.initSegment?d.initSegment.data:[],h=this._getAudioCodec(u);(this.demuxer=this.demuxer||new o.default(this.hls,"main")).push(e.payload,c,h,u.videoCodec,t,d.totalduration,f)}}this.fragLoadError=0},r.prototype.onFragParsingInitSegment=function(e){var t=this.fragCurrent,r=e.frag;if(t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===y.State.PARSING){var i=e.tracks,a=void 0,n=void 0;if(i.audio&&this.altAudio&&delete i.audio,n=i.audio){var o=this.levels[this.level].audioCodec,l=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(p.logger.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==n.metadata.channelCount&&-1===l.indexOf("firefox")&&(o="mp4a.40.5"),-1!==l.indexOf("android")&&"audio/mpeg"!==n.container&&(o="mp4a.40.2",p.logger.log("Android: force audio codec to "+o)),n.levelCodec=o,n.id=e.id}for(a in(n=i.video)&&(n.levelCodec=this.levels[this.level].videoCodec,n.id=e.id),this.hls.trigger(s.default.BUFFER_CODECS,i),i){n=i[a],p.logger.log("main track:"+a+",container:"+n.container+",codecs[level/parsed]=["+n.levelCodec+"/"+n.codec+"]");var u=n.initSegment;u&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(s.default.BUFFER_APPENDING,{type:a,data:u,parent:"main",content:"initSegment"}))}this.tick()}},r.prototype.onFragParsingData=function(t){var r=this,i=this.fragCurrent,a=t.frag;if(i&&"main"===t.id&&a.sn===i.sn&&a.level===i.level&&("audio"!==t.type||!this.altAudio)&&this.state===y.State.PARSING){var n=this.levels[this.level],o=i;if(e.isFinite(t.endPTS)||(t.endPTS=t.startPTS+i.duration,t.endDTS=t.startDTS+i.duration),!0===t.hasAudio&&o.addElementaryStream(u.default.ElementaryStreamTypes.AUDIO),!0===t.hasVideo&&o.addElementaryStream(u.default.ElementaryStreamTypes.VIDEO),p.logger.log("Parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb+",dropped:"+(t.dropped||0)),"video"===t.type)if(o.dropped=t.dropped,o.dropped)if(o.backtracked)p.logger.warn("Already backtracked on this fragment, appending with the gap",o.sn);else{var l=n.details;if(!l||o.sn!==l.startSN)return p.logger.warn("missing video frame(s), backtracking fragment",o.sn),this.fragmentTracker.removeFragment(o),o.backtracked=!0,this.nextLoadPosition=t.startPTS,this.state=y.State.IDLE,this.fragPrevious=o,void this.tick();p.logger.warn("missing video frame(s) on first frag, appending with gap",o.sn)}else o.backtracked=!1;var d=f.updateFragPTSDTS(n.details,o,t.startPTS,t.endPTS,t.startDTS,t.endDTS),c=this.hls;c.trigger(s.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:d,type:t.type,start:t.startPTS,end:t.endPTS}),[t.data1,t.data2].forEach(function(e){e&&e.length&&r.state===y.State.PARSING&&(r.appended=!0,r.pendingBuffering=!0,c.trigger(s.default.BUFFER_APPENDING,{type:t.type,data:e,parent:"main",content:"data"}))}),this.tick()}},r.prototype.onFragParsed=function(e){var t=this.fragCurrent,r=e.frag;t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===y.State.PARSING&&(this.stats.tparsed=window.performance.now(),this.state=y.State.PARSED,this._checkAppendedParsed())},r.prototype.onAudioTrackSwitching=function(t){var r=!!t.url,i=t.id;if(!r){if(this.mediaBuffer!==this.media){p.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;a.loader&&(p.logger.log("switching to main audio track, cancel main fragment load"),a.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=y.State.IDLE}var n=this.hls;n.trigger(s.default.BUFFER_FLUSHING,{startOffset:0,endOffset:e.POSITIVE_INFINITY,type:"audio"}),n.trigger(s.default.AUDIO_TRACK_SWITCHED,{id:i}),this.altAudio=!1}},r.prototype.onAudioTrackSwitched=function(e){var t=e.id,r=!!this.hls.audioTracks[t].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(p.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},r.prototype.onBufferCreated=function(e){var t,r,i=e.tracks,a=!1;for(var n in i){var o=i[n];"main"===o.id?(r=n,t=o,"video"===n&&(this.videoBuffer=i[n].buffer)):a=!0}a&&t?(p.logger.log("alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=t.buffer):this.mediaBuffer=this.media},r.prototype.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==y.State.PARSING&&t!==y.State.PARSED||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},r.prototype._checkAppendedParsed=function(){if(!(this.state!==y.State.PARSED||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;p.logger.log("main buffered : "+c.default.toString(t.buffered)),this.fragPrevious=e;var r=this.stats;r.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*r.total/(r.tbuffered-r.tfirst)),this.hls.trigger(s.default.FRAG_BUFFERED,{stats:r,frag:e,id:"main"}),this.state=y.State.IDLE}this.tick()}},r.prototype.onError=function(t){var r=t.frag||this.fragCurrent;if(!r||"main"===r.type){var i=!!this.media&&n.BufferHelper.isBuffered(this.media,this.media.currentTime)&&n.BufferHelper.isBuffered(this.media,this.media.currentTime+.5);switch(t.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:if(!t.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var a=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);p.logger.warn("mediaController: frag loading failed, retry in "+a+" ms"),this.retryDate=window.performance.now()+a,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=y.State.FRAG_LOADING_WAITING_RETRY}else p.logger.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=y.State.ERROR;break;case h.ErrorDetails.LEVEL_LOAD_ERROR:case h.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==y.State.ERROR&&(t.fatal?(this.state=y.State.ERROR,p.logger.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==y.State.WAITING_LEVEL||(this.state=y.State.IDLE));break;case h.ErrorDetails.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==y.State.PARSING&&this.state!==y.State.PARSED||(i?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=y.State.IDLE):(p.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,e.POSITIVE_INFINITY)))}}},r.prototype._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,p.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},r.prototype._checkBuffer=function(){var e=this.media;if(e&&0!==e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,t)}},r.prototype.onFragLoadEmergencyAborted=function(){this.state=y.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},r.prototype.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;e&&this.fragmentTracker.detectEvictedFragments(u.default.ElementaryStreamTypes.VIDEO,e.buffered),this.state=y.State.IDLE,this.fragPrevious=null},r.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},r.prototype.computeLivePosition=function(e,t){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-r)},r.prototype._seekToStartPos=function(){var e=this.media,t=e.currentTime,r=e.seeking?t:this.startPosition;t!==r&&(p.logger.log("target start position not buffered, seek to buffered.start(0) "+r+" from current time "+t+" "),e.currentTime=r)},r.prototype._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&(p.logger.log("swapping playlist audio codec"),t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),t},Object.defineProperty(r.prototype,"liveSyncPosition",{get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e},enumerable:!0,configurable:!0}),r}(y.default);t.default=_}).call(this,r(2).Number)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(32),a=r(1),n=r(18),o=r(0),s=r(3),l=r(12),u=r(6),d=r(22),f=u.getSelfScope(),c=l.getMediaSource(),h=function(){function t(e,t){var r=this;this.hls=e,this.id=t;var l=this.observer=new d.Observer,u=e.config,h=function(t,i){(i=i||{}).frag=r.frag,i.id=r.id,e.trigger(t,i)};l.on(a.default.FRAG_DECRYPTED,h),l.on(a.default.FRAG_PARSING_INIT_SEGMENT,h),l.on(a.default.FRAG_PARSING_DATA,h),l.on(a.default.FRAG_PARSED,h),l.on(a.default.ERROR,h),l.on(a.default.FRAG_PARSING_METADATA,h),l.on(a.default.FRAG_PARSING_USERDATA,h),l.on(a.default.INIT_PTS_FOUND,h);var p={mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(u.enableWorker&&"undefined"!=typeof Worker){o.logger.log("demuxing in webworker");var v=void 0;try{v=this.w=i(46),this.onwmsg=this.onWorkerMessage.bind(this),v.addEventListener("message",this.onwmsg),v.onerror=function(t){e.trigger(a.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},v.postMessage({cmd:"init",typeSupported:p,vendor:g,id:t,config:JSON.stringify(u)})}catch(e){o.logger.warn("Error in worker:",e),o.logger.error("Error while initializing DemuxerWorker, fallback on DemuxerInline"),v&&f.URL.revokeObjectURL(v.objectURL),this.demuxer=new n.default(l,p,u,g),this.w=void 0}}else this.demuxer=new n.default(l,p,u,g)}return t.prototype.destroy=function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var r=this.observer;r&&(r.removeAllListeners(),this.observer=null)},t.prototype.push=function(t,r,i,a,n,s,l,u){var d=this.w,f=e.isFinite(n.startPTS)?n.startPTS:n.start,c=n.decryptdata,h=this.frag,p=!(h&&n.cc===h.cc),g=!(h&&n.level===h.level),v=h&&n.sn===h.sn+1,m=!g&&v;if(p&&o.logger.log(this.id+":discontinuity detected"),g&&o.logger.log(this.id+":switch detected"),this.frag=n,d)d.postMessage({cmd:"demux",data:t,decryptdata:c,initSegment:r,audioCodec:i,videoCodec:a,timeOffset:f,discontinuity:p,trackSwitch:g,contiguous:m,duration:s,accurateTimeOffset:l,defaultInitPTS:u},t instanceof ArrayBuffer?[t]:[]);else{var y=this.demuxer;y&&y.push(t,c,r,i,a,f,p,g,m,s,l,u)}},t.prototype.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":f.URL.revokeObjectURL(this.w.objectURL);break;case a.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data2&&(t.data.data2=new Uint8Array(t.data2));default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}},t}();t.default=h}).call(this,r(2).Number)},function(e,t,r){function i(e){var t={};function r(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r.oe=function(e){throw console.error(e),e};var i=r(r.s=ENTRY_MODULE);return i.default||i}var a="[\\.|\\-|\\+|\\w|/|@]+",n="\\((/\\*.*?\\*/)?s?.*?("+a+").*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(e){return!isNaN(1*e)}function l(e,t,i){var l={};l[i]=[];var u=t.toString(),d=u.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return l;for(var f,c=d[1],h=new RegExp("(\\\\n|\\W)"+o(c)+n,"g");f=h.exec(u);)"dll-reference"!==f[3]&&l[i].push(f[3]);for(h=new RegExp("\\("+o(c)+'\\("(dll-reference\\s('+a+'))"\\)\\)'+n,"g");f=h.exec(u);)e[f[2]]||(l[i].push(f[1]),e[f[2]]=r(f[1]).m),l[f[2]]=l[f[2]]||[],l[f[2]].push(f[4]);for(var p=Object.keys(l),g=0;g<p.length;g++)for(var v=0;v<l[p[g]].length;v++)s(l[p[g]][v])&&(l[p[g]][v]=1*l[p[g]][v]);return l}function u(e){return Object.keys(e).reduce(function(t,r){return t||e[r].length>0},!1)}e.exports=function(e,t){t=t||{};var a={main:r.m},n=t.all?{main:Object.keys(a.main)}:function(e,t){for(var r={main:[t]},i={main:[]},a={main:{}};u(r);)for(var n=Object.keys(r),o=0;o<n.length;o++){var s=n[o],d=r[s].pop();if(a[s]=a[s]||{},!a[s][d]&&e[s][d]){a[s][d]=!0,i[s]=i[s]||[],i[s].push(d);for(var f=l(e,e[s][d],s),c=Object.keys(f),h=0;h<c.length;h++)r[c[h]]=r[c[h]]||[],r[c[h]]=r[c[h]].concat(f[c[h]])}}return i}(a,e),o="";Object.keys(n).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;n[e][t];)t++;n[e].push(t),a[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+n[e].map(function(t){return JSON.stringify(t)+": "+a[e][t].toString()}).join(",")+"});\n"}),o=o+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+n.main.map(function(e){return JSON.stringify(e)+": "+a.main[e].toString()}).join(",")+"}))(self);";var s=new window.Blob([o],{type:"text/javascript"});if(t.bare)return s;var d=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(s),f=new window.Worker(d);return f.objectURL=d,f}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}();t.default=i},function(e,t,r){"use strict";function i(e){var t=e.byteLength,r=t&&new DataView(e).getUint8(t-1);return r?e.slice(0,t-r):e}Object.defineProperty(t,"__esModule",{value:!0}),t.removePadding=i;var a=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return e.prototype.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r},e.prototype.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],d=s[2],f=s[3],c=new Uint32Array(256),h=0,p=0,g=0;for(g=0;g<256;g++)c[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,e[h]=v,t[v]=h;var m=c[h],y=c[m],_=c[y],E=257*c[v]^16843008*v;i[h]=E<<24|E>>>8,a[h]=E<<16|E>>>16,n[h]=E<<8|E>>>24,o[h]=E,E=16843009*_^65537*y^257*m^16843008*h,l[v]=E<<24|E>>>8,u[v]=E<<16|E>>>16,d[v]=E<<8|E>>>24,f[v]=E,h?(h=m^c[c[c[_^m]]],p^=c[c[p]]):h=p=1}},e.prototype.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var n,o,s,l,u=this.ksRows=4*(a+6+1),d=this.keySchedule=new Uint32Array(u),f=this.invKeySchedule=new Uint32Array(u),c=this.sBox,h=this.rcon,p=this.invSubMix,g=p[0],v=p[1],m=p[2],y=p[3];for(n=0;n<u;n++)n<a?s=d[n]=t[n]:(l=s,n%a==0?(l=c[(l=l<<8|l>>>24)>>>24]<<24|c[l>>>16&255]<<16|c[l>>>8&255]<<8|c[255&l],l^=h[n/a|0]<<24):a>6&&n%a==4&&(l=c[l>>>24]<<24|c[l>>>16&255]<<16|c[l>>>8&255]<<8|c[255&l]),d[n]=s=(d[n-a]^l)>>>0);for(o=0;o<u;o++)n=u-o,l=3&o?d[n]:d[n-4],f[o]=o<4||n<=4?l:g[c[l>>>24]]^v[c[l>>>16&255]]^m[c[l>>>8&255]]^y[c[255&l]],f[o]=f[o]>>>0}},e.prototype.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},e.prototype.decrypt=function(e,t,r,a){for(var n,o,s,l,u,d,f,c,h,p,g,v,m,y,_=this.keySize+6,E=this.invKeySchedule,b=this.invSBox,S=this.invSubMix,T=S[0],A=S[1],R=S[2],L=S[3],D=this.uint8ArrayToUint32Array_(r),O=D[0],w=D[1],P=D[2],I=D[3],x=new Int32Array(e),F=new Int32Array(x.length),k=this.networkToHostOrderSwap;t<x.length;){for(h=k(x[t]),p=k(x[t+1]),g=k(x[t+2]),v=k(x[t+3]),u=h^E[0],d=v^E[1],f=g^E[2],c=p^E[3],m=4,y=1;y<_;y++)n=T[u>>>24]^A[d>>16&255]^R[f>>8&255]^L[255&c]^E[m],o=T[d>>>24]^A[f>>16&255]^R[c>>8&255]^L[255&u]^E[m+1],s=T[f>>>24]^A[c>>16&255]^R[u>>8&255]^L[255&d]^E[m+2],l=T[c>>>24]^A[u>>16&255]^R[d>>8&255]^L[255&f]^E[m+3],u=n,d=o,f=s,c=l,m+=4;n=b[u>>>24]<<24^b[d>>16&255]<<16^b[f>>8&255]<<8^b[255&c]^E[m],o=b[d>>>24]<<24^b[f>>16&255]<<16^b[c>>8&255]<<8^b[255&u]^E[m+1],s=b[f>>>24]<<24^b[c>>16&255]<<16^b[u>>8&255]<<8^b[255&d]^E[m+2],l=b[c>>>24]<<24^b[u>>16&255]<<16^b[d>>8&255]<<8^b[255&f]^E[m+3],m+=3,F[t]=k(n^O),F[t+1]=k(l^w),F[t+2]=k(s^P),F[t+3]=k(o^I),O=h,w=p,P=g,I=v,t+=4}return a?i(F.buffer):F.buffer},e.prototype.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},e}();t.default=a},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(20),a=r(0),n=r(11),o=function(){function t(e,t,r){this.observer=e,this.config=r,this.remuxer=t}return t.prototype.resetInitSegment=function(e,t,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(e){if(!e)return!1;for(var t=(n.default.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(i.probe(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},t.prototype.append=function(t,r,o,s){for(var l=this._audioTrack,u=n.default.getID3Data(t,0)||[],d=n.default.getTimeStamp(u),f=e.isFinite(d)?90*d:9e4*r,c=0,h=f,p=t.length,g=u.length,v=[{pts:h,dts:h,data:u}];g<p-1;)if(i.isHeader(t,g)&&g+5<p){i.initTrackConfig(l,this.observer,t,g,l.manifestCodec);var m=i.appendFrame(l,t,g,f,c);if(!m){a.logger.log("Unable to parse AAC frame");break}g+=m.length,h=m.sample.pts,c++}else n.default.isHeader(t,g)?(u=n.default.getID3Data(t,g),v.push({pts:h,dts:h,data:u}),g+=u.length):g++;this.remuxer.remux(l,{samples:[]},{samples:v,inputTimeScale:9e4},{samples:[]},r,o,s)},t.prototype.destroy=function(){},t}();t.default=o}).call(this,r(2).Number)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(20),a=r(21),n=r(1),o=r(38),s=r(39),l=r(0),u=r(3),d={video:1,audio:2,id3:3,text:4},f=function(){function e(e,t,r,i){this.observer=e,this.config=r,this.typeSupported=i,this.remuxer=t,this.sampleAes=null}return e.prototype.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new s.default(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},e.probe=function(t){var r=e._syncOffset(t);return!(r<0)&&(r&&l.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),!0)},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:d[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0}},e.prototype.resetInitSegment=function(t,r,i,a){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",a),this._audioTrack=e.createTrack("audio",a),this._id3Track=e.createTrack("id3",a),this._txtTrack=e.createTrack("text",a),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=r,this.videoCodec=i,this._duration=a},e.prototype.resetTimeStamp=function(){},e.prototype.append=function(t,r,i,a){var o,s,d,f,c,h=t.length,p=!1;this.contiguous=i;var g=this.pmtParsed,v=this._avcTrack,m=this._audioTrack,y=this._id3Track,_=v.pid,E=m.pid,b=y.pid,S=this._pmtId,T=v.pesData,A=m.pesData,R=y.pesData,L=this._parsePAT,D=this._parsePMT,O=this._parsePES,w=this._parseAVCPES.bind(this),P=this._parseAACPES.bind(this),I=this._parseMPEGPES.bind(this),x=this._parseID3PES.bind(this),F=e._syncOffset(t);for(h-=(h+F)%188,o=F;o<h;o+=188)if(71===t[o]){if(s=!!(64&t[o+1]),d=((31&t[o+1])<<8)+t[o+2],(48&t[o+3])>>4>1){if((f=o+5+t[o+4])===o+188)continue}else f=o+4;switch(d){case _:s&&(T&&(c=O(T))&&void 0!==c.pts&&w(c,!1),T={data:[],size:0}),T&&(T.data.push(t.subarray(f,o+188)),T.size+=o+188-f);break;case E:s&&(A&&(c=O(A))&&void 0!==c.pts&&(m.isAAC?P(c):I(c)),A={data:[],size:0}),A&&(A.data.push(t.subarray(f,o+188)),A.size+=o+188-f);break;case b:s&&(R&&(c=O(R))&&void 0!==c.pts&&x(c),R={data:[],size:0}),R&&(R.data.push(t.subarray(f,o+188)),R.size+=o+188-f);break;case 0:s&&(f+=t[f]+1),S=this._pmtId=L(t,f);break;case S:s&&(f+=t[f]+1);var k=D(t,f,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);(_=k.avc)>0&&(v.pid=_),(E=k.audio)>0&&(m.pid=E,m.isAAC=k.isAAC),(b=k.id3)>0&&(y.pid=b),p&&!g&&(l.logger.log("reparse from beginning"),p=!1,o=F-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(n.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T&&(c=O(T))&&void 0!==c.pts?(w(c,!0),v.pesData=null):v.pesData=T,A&&(c=O(A))&&void 0!==c.pts?(m.isAAC?P(c):I(c),m.pesData=null):(A&&A.size&&l.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=A),R&&(c=O(R))&&void 0!==c.pts?(x(c),y.pesData=null):y.pesData=R,null==this.sampleAes?this.remuxer.remux(m,v,y,this._txtTrack,r,i,a):this.decryptAndRemux(m,v,y,this._txtTrack,r,i,a)},e.prototype.decryptAndRemux=function(e,t,r,i,a,n,o){if(e.samples&&e.isAAC){var s=this;this.sampleAes.decryptAacSamples(e.samples,0,function(){s.decryptAndRemuxAvc(e,t,r,i,a,n,o)})}else this.decryptAndRemuxAvc(e,t,r,i,a,n,o)},e.prototype.decryptAndRemuxAvc=function(e,t,r,i,a,n,o){if(t.samples){var s=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,function(){s.remuxer.remux(e,t,r,i,a,n,o)})}else this.remuxer.remux(e,t,r,i,a,n,o)},e.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},e.prototype._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},e.prototype._parsePMT=function(e,t,r,i){var a,n,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){switch(n=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!i){l.logger.log("unkown stream type:"+e[t]);break}case 15:-1===o.audio&&(o.audio=n);break;case 21:-1===o.id3&&(o.id3=n);break;case 219:if(!i){l.logger.log("unkown stream type:"+e[t]);break}case 27:-1===o.avc&&(o.avc=n);break;case 3:case 4:r?-1===o.audio&&(o.audio=n,o.isAAC=!1):l.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:l.logger.warn("HEVC stream type found, not supported for now");break;default:l.logger.log("unkown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return o},e.prototype._parsePES=function(e){var t,r,i,a,n,o,s,u,d=0,f=e.data;if(!e||0===e.size)return null;for(;f[0].length<19&&f.length>1;){var c=new Uint8Array(f[0].length+f[1].length);c.set(f[0]),c.set(f[1],f[0].length),f[0]=c,f.splice(1,1)}if(1===((t=f[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;192&(r=t[7])&&((o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2)>4294967295&&(o-=8589934592),64&r?((s=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>4294967295&&(s-=8589934592),o-s>54e5&&(l.logger.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),u=(a=t[8])+9,e.size-=u,n=new Uint8Array(e.size);for(var h=0,p=f.length;h<p;h++){var g=(t=f[h]).byteLength;if(u){if(u>g){u-=g;continue}t=t.subarray(u),g-=u,u=0}n.set(t,d),d+=g}return i&&(i-=a+3),{data:n,pts:o,dts:s,len:i}}return null},e.prototype.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var r=t.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(i||this.contiguous)?(e.id=i,r.push(e)):t.dropped++}e.debug.length&&l.logger.log(e.pts+"/"+e.dts+":"+e.debug)},e.prototype._parseAVCPES=function(e,t){var r,i,a,n=this,s=this._avcTrack,l=this._parseAVCNALu(e.data),u=this.avcSample,d=!1,f=this.pushAccesUnit.bind(this),c=function(e,t,r,i){return{key:e,pts:t,dts:r,units:[],debug:i}};e.data=null,u&&l.length&&!s.audFound&&(f(u,s),u=this.avcSample=c(!1,e.pts,e.dts,"")),l.forEach(function(t){switch(t.type){case 1:i=!0,u||(u=n.avcSample=c(!0,e.pts,e.dts,"")),u.frame=!0;var l=t.data;if(d&&l.length>4){var h=new o.default(l).readSliceType();2!==h&&4!==h&&7!==h&&9!==h||(u.key=!0)}break;case 5:i=!0,u||(u=n.avcSample=c(!0,e.pts,e.dts,"")),u.key=!0,u.frame=!0;break;case 6:i=!0,(r=new o.default(n.discardEPB(t.data))).readUByte();for(var p=0,g=0,v=!1,m=0;!v&&r.bytesAvailable>1;){p=0;do{p+=m=r.readUByte()}while(255===m);g=0;do{g+=m=r.readUByte()}while(255===m);if(4===p&&0!==r.bytesAvailable){if(v=!0,181===r.readUByte())if(49===r.readUShort())if(1195456820===r.readUInt())if(3===r.readUByte()){var y=r.readUByte(),_=31&y,E=[y,r.readUByte()];for(a=0;a<_;a++)E.push(r.readUByte()),E.push(r.readUByte()),E.push(r.readUByte());n._insertSampleInOrder(n._txtTrack.samples,{type:3,pts:e.pts,bytes:E})}}else if(g<r.bytesAvailable)for(a=0;a<g;a++)r.readUByte()}break;case 7:if(i=!0,d=!0,!s.sps){var b=(r=new o.default(t.data)).readSPS();s.width=b.width,s.height=b.height,s.pixelRatio=b.pixelRatio,s.sps=[t.data],s.duration=n._duration;var S=t.data.subarray(1,4),T="avc1.";for(a=0;a<3;a++){var A=S[a].toString(16);A.length<2&&(A="0"+A),T+=A}s.codec=T}break;case 8:i=!0,s.pps||(s.pps=[t.data]);break;case 9:i=!1,s.audFound=!0,u&&f(u,s),u=n.avcSample=c(!1,e.pts,e.dts,"");break;case 12:i=!1;break;default:i=!1,u&&(u.debug+="unknown NAL "+t.type+" ")}u&&i&&u.units.push(t)}),t&&u&&(f(u,s),this.avcSample=null)},e.prototype._insertSampleInOrder=function(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var i=r-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)},e.prototype._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var r=this._avcTrack.samples;t=r[r.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},e.prototype._parseAVCNALu=function(e){var t,r,i,a,n=0,o=e.byteLength,s=this._avcTrack,l=s.naluState||0,u=l,d=[],f=-1;for(-1===l&&(f=0,a=31&e[0],l=0,n=1);n<o;)if(t=e[n++],l)if(1!==l)if(t)if(1===t){var c,h;if(f>=0)i={data:e.subarray(f,n-l-1),type:a},d.push(i);else if(c=this._getLastNalUnit())if(u&&n<=4-u&&c.state&&(c.data=c.data.subarray(0,c.data.byteLength-u)),(r=n-l-1)>0)(h=new Uint8Array(c.data.byteLength+r)).set(c.data,0),h.set(e.subarray(0,r),c.data.byteLength),c.data=h;n<o?(f=n,a=31&e[n],l=0):l=-1}else l=0;else l=3;else l=t?0:2;else l=t?0:1;(f>=0&&l>=0&&(i={data:e.subarray(f,o),type:a,state:l},d.push(i)),0===d.length)&&((c=this._getLastNalUnit())&&((h=new Uint8Array(c.data.byteLength+e.byteLength)).set(c.data,0),h.set(e,c.data.byteLength),c.data=h));return s.naluState=l,d},e.prototype.discardEPB=function(e){for(var t,r,i=e.byteLength,a=[],n=1;n<i-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)return e;t=i-a.length,r=new Uint8Array(t);var o=0;for(n=0;n<t;o++,n++)o===a[0]&&(o++,a.shift()),r[n]=e[o];return r},e.prototype._parseAACPES=function(e){var t,r,a,o,s,d=this._audioTrack,f=e.data,c=e.pts,h=this.aacOverFlow,p=this.aacLastPTS;if(h){var g=new Uint8Array(h.byteLength+f.byteLength);g.set(h,0),g.set(f,h.byteLength),f=g}for(a=0,s=f.length;a<s-1&&!i.isHeader(f,a);a++);if(a){var v=void 0,m=void 0;if(a<s-1?(v="AAC PES did not start with ADTS header,offset:"+a,m=!1):(v="no ADTS header found in AAC PES",m=!0),l.logger.warn("parsing error:"+v),this.observer.trigger(n.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_PARSING_ERROR,fatal:m,reason:v}),m)return}if(i.initTrackConfig(d,this.observer,f,a,this.audioCodec),r=0,t=i.getFrameDuration(d.samplerate),h&&p){var y=p+t;Math.abs(y-c)>1&&(l.logger.log("AAC: align PTS for overlapping frames by "+Math.round((y-c)/90)),c=y)}for(;a<s;)if(i.isHeader(f,a)&&a+5<s){var _=i.appendFrame(d,f,a,c,r);if(!_)break;a+=_.length,o=_.sample.pts,r++}else a++;h=a<s?f.subarray(a,s):null,this.aacOverFlow=h,this.aacLastPTS=o},e.prototype._parseMPEGPES=function(e){for(var t=e.data,r=t.length,i=0,n=0,o=e.pts;n<r;)if(a.default.isHeader(t,n)){var s=a.default.appendFrame(this._audioTrack,t,n,o,i);if(!s)break;n+=s.length,i++}else n++},e.prototype._parseID3PES=function(e){this._id3Track.samples.push(e)},e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=function(){function e(e){this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}return e.prototype.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");i.set(e.subarray(r,r+a)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a},e.prototype.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},e.prototype.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&i.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},e.prototype.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},e.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},e.prototype.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},e.prototype.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},e.prototype.readBoolean=function(){return 1===this.readBits(1)},e.prototype.readUByte=function(){return this.readBits(8)},e.prototype.readUShort=function(){return this.readBits(16)},e.prototype.readUInt=function(){return this.readBits(32)},e.prototype.skipScalingList=function(e){var t,r=8,i=8;for(t=0;t<e;t++)0!==i&&(i=(r+this.readEG()+256)%256),r=0===i?r:i},e.prototype.readSPS=function(){var e,t,r,i,a,n,o,s=0,l=0,u=0,d=0,f=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),p=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),m=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);if(f(),e=f(),c(5),g(3),f(),m(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var _=h();if(3===_&&g(1),m(),m(),g(1),p())for(n=3!==_?8:12,o=0;o<n;o++)p()&&y(o<6?16:64)}m();var E=h();if(0===E)h();else if(1===E)for(g(1),v(),v(),t=h(),o=0;o<t;o++)v();m(),g(1),r=h(),i=h(),0===(a=c(1))&&g(1),g(1),p()&&(s=h(),l=h(),u=h(),d=h());var b=[1,1];if(p()&&p())switch(f()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:b=[f()<<8|f(),f()<<8|f()]}return{width:Math.ceil(16*(r+1)-2*s-2*l),height:(2-a)*(i+1)*16-(a?2:4)*(u+d),pixelRatio:b}},e.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(19),a=function(){function e(e,t,r,a){this.decryptdata=r,this.discardEPB=a,this.decrypter=new i.default(e,t,{removePKCS7Padding:!1})}return e.prototype.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},e.prototype.decryptAacSample=function(e,t,r,i){var a=e[t].unit,n=a.subarray(16,a.length-a.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),s=this;this.decryptBuffer(o,function(n){n=new Uint8Array(n),a.set(n,16),i||s.decryptAacSamples(e,t+1,r)})},e.prototype.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,i),!i)return}}},e.prototype.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,a=32;a<=e.length-16;a+=160,i+=16)r.set(e.subarray(a,a+16),i);return r},e.prototype.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var r=0,i=32;i<=e.length-16;i+=160,r+=16)e.set(t.subarray(r,r+16),i);return e},e.prototype.decryptAvcSample=function(e,t,r,i,a,n){var o=this.discardEPB(a.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,function(s){a.data=l.getAvcDecryptedUnit(o,s),n||l.decryptAvcSamples(e,t,r+1,i)})},e.prototype.decryptAvcSamples=function(e,t,r,i){for(;;t++,r=0){if(t>=e.length)return void i();for(var a=e[t].units;!(r>=a.length);r++){var n=a[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,i,n,o),!o)return}}}},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(11),a=r(0),n=r(21),o=function(){function e(e,t,r){this.observer=e,this.config=r,this.remuxer=t}return e.prototype.resetInitSegment=function(e,t,r,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},e.prototype.resetTimeStamp=function(){},e.probe=function(e){var t,r,o=i.default.getID3Data(e,0);if(o&&void 0!==i.default.getTimeStamp(o))for(t=o.length,r=Math.min(e.length-1,t+100);t<r;t++)if(n.default.probe(e,t))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},e.prototype.append=function(e,t,r,a){for(var o=i.default.getID3Data(e,0),s=i.default.getTimeStamp(o),l=s?90*s:9e4*t,u=o.length,d=e.length,f=0,c=0,h=this._audioTrack,p=[{pts:l,dts:l,data:o}];u<d;)if(n.default.isHeader(e,u)){var g=n.default.appendFrame(h,e,u,l,f);if(!g)break;u+=g.length,c=g.sample.pts,f++}else i.default.isHeader(e,u)?(o=i.default.getID3Data(e,u),p.push({pts:c,dts:c,data:o}),u+=o.length):u++;this.remuxer.remux(h,{samples:[]},{samples:p,inputTimeScale:9e4},{samples:[]},t,r,a)},e.prototype.destroy=function(){},e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(42),a=r(43),n=r(1),o=r(3),s=r(0),l=function(){function e(e,t,r,i){this.observer=e,this.config=t,this.typeSupported=r;var a=navigator.userAgent;this.isSafari=i&&i.indexOf("Apple")>-1&&a&&!a.match("CriOS"),this.ISGenerated=!1}return e.prototype.destroy=function(){},e.prototype.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},e.prototype.resetInitSegment=function(){this.ISGenerated=!1},e.prototype.remux=function(e,t,r,i,a,o,l){if(this.ISGenerated||this.generateIS(e,t,a),this.ISGenerated){var u=e.samples.length,d=t.samples.length,f=a,c=a;if(u&&d){var h=(e.samples[0].pts-t.samples[0].pts)/t.inputTimeScale;f+=Math.max(0,h),c+=Math.max(0,-h)}if(u){e.timescale||(s.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,a));var p=this.remuxAudio(e,f,o,l);if(d){var g=void 0;p&&(g=p.endPTS-p.startPTS),t.timescale||(s.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,a)),this.remuxVideo(t,c,o,g,l)}}else if(d){var v=this.remuxVideo(t,c,o,0,l);v&&e.codec&&this.remuxEmptyAudio(e,f,o,v)}}r.samples.length&&this.remuxID3(r,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(n.default.FRAG_PARSED)},e.prototype.generateIS=function(e,t,r){var i,l,u=this.observer,d=e.samples,f=t.samples,c=this.typeSupported,h="audio/mp4",p={},g={tracks:p},v=void 0===this._initPTS;if(v&&(i=l=1/0),e.config&&d.length&&(e.timescale=e.samplerate,s.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(c.mpeg?(h="audio/mpeg",e.codec=""):c.mp3&&(e.codec="mp3")),p.audio={container:h,codec:e.codec,initSegment:!e.isAAC&&c.mpeg?new Uint8Array:a.default.initSegment([e]),metadata:{channelCount:e.channelCount}},v&&(i=l=d[0].pts-e.inputTimeScale*r)),t.sps&&t.pps&&f.length){var m=t.inputTimeScale;t.timescale=m,p.video={container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},v&&(i=Math.min(i,f[0].pts-m*r),l=Math.min(l,f[0].dts-m*r),this.observer.trigger(n.default.INIT_PTS_FOUND,{initPTS:i}))}Object.keys(p).length?(u.trigger(n.default.FRAG_PARSING_INIT_SEGMENT,g),this.ISGenerated=!0,v&&(this._initPTS=i,this._initDTS=l)):u.trigger(n.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},e.prototype.remuxVideo=function(e,t,r,i,l){var u,d,f,c,h,p,g,v=8,m=e.timescale,y=e.samples,_=[],E=y.length,b=this._PTSNormalize,S=this._initPTS,T=this.nextAvcDts,A=this.isSafari;if(0!==E){A&&(r|=y.length&&T&&(l&&Math.abs(t-T/m)<.1||Math.abs(y[0].pts-T-S)<m/5)),r||(T=t*m),y.forEach(function(e){e.pts=b(e.pts-S,T),e.dts=b(e.dts-S,T)}),y.sort(function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i||e.id-t.id});var R=y.reduce(function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-18e3)},0);if(R<0){s.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(R/90)+" ms to overcome this issue");for(var L=0;L<y.length;L++)y[L].dts+=R}var D=y[0];h=Math.max(D.dts,0),c=Math.max(D.pts,0);var O=Math.round((h-T)/90);r&&O&&(O>1?s.logger.log("AVC:"+O+" ms hole between fragments detected,filling it"):O<-1&&s.logger.log("AVC:"+-O+" ms overlapping between fragments detected"),h=T,y[0].dts=h,c=Math.max(c-O,T),y[0].pts=c,s.logger.log("Video/PTS/DTS adjusted: "+Math.round(c/90)+"/"+Math.round(h/90)+",delta:"+O+" ms")),D=y[y.length-1],g=Math.max(D.dts,0),p=Math.max(D.pts,0,g),A&&(u=Math.round((g-h)/(y.length-1)));var w=0,P=0;for(L=0;L<E;L++){for(var I=y[L],x=I.units,F=x.length,k=0,C=0;C<F;C++)k+=x[C].data.length;P+=k,w+=F,I.length=k,I.dts=A?h+L*u:Math.max(I.dts,h),I.pts=Math.max(I.pts,I.dts)}var M=P+4*w+8;try{d=new Uint8Array(M)}catch(e){return void this.observer.trigger(n.default.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:M,reason:"fail allocating video mdat "+M})}var N=new DataView(d.buffer);N.setUint32(0,M),d.set(a.default.types.mdat,4);for(L=0;L<E;L++){var U=y[L],B=U.units,G=0,j=void 0;for(C=0,F=B.length;C<F;C++){var H=B[C],K=H.data,V=H.data.byteLength;N.setUint32(v,V),v+=4,d.set(K,v),v+=V,G+=4+V}if(A)j=Math.max(0,u*Math.round((U.pts-U.dts)/u));else{if(L<E-1)u=y[L+1].dts-U.dts;else{var W=this.config,Y=U.dts-y[L>0?L-1:L].dts;if(W.stretchShortVideoTrack){var z=W.maxBufferHole,X=Math.floor(z*m),q=(i?c+i*m:this.nextAudioPts)-U.pts;q>X?((u=q-Y)<0&&(u=Y),s.logger.log("It is approximately "+q/90+" ms to the next segment; using duration "+u/90+" ms for the last video frame.")):u=Y}else u=Y}j=Math.round(U.pts-U.dts)}_.push({size:G,duration:u,cts:j,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:U.key?2:1,isNonSync:U.key?0:1}})}this.nextAvcDts=g+u;var Q=e.dropped;if(e.len=0,e.nbNalu=0,e.dropped=0,_.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var Z=_[0].flags;Z.dependsOn=2,Z.isNonSync=0}e.samples=_,f=a.default.moof(e.sequenceNumber++,h,e),e.samples=[];var J={data1:f,data2:d,startPTS:c/m,endPTS:(p+u)/m,startDTS:h/m,endDTS:this.nextAvcDts/m,type:"video",hasAudio:!1,hasVideo:!0,nb:_.length,dropped:Q};return this.observer.trigger(n.default.FRAG_PARSING_DATA,J),J}},e.prototype.remuxAudio=function(e,t,r,l){var u,d,f,c,h,p,g,v=e.inputTimeScale,m=e.timescale,y=v/m,_=(e.isAAC?1024:1152)*y,E=this._PTSNormalize,b=this._initPTS,S=!e.isAAC&&this.typeSupported.mpeg,T=e.samples,A=[],R=this.nextAudioPts;if(r|=T.length&&R&&(l&&Math.abs(t-R/v)<.1||Math.abs(T[0].pts-R-b)<20*_),T.forEach(function(e){e.pts=e.dts=E(e.pts-b,t*v)}),0!==(T=T.filter(function(e){return e.pts>=0})).length){if(r||(R=l?t*v:T[0].pts),e.isAAC)for(var L=this.config.maxAudioFramesDrift,D=0,O=R;D<T.length;){var w,P=T[D];w=(U=P.pts)-O;var I=Math.abs(1e3*w/v);if(w<=-L*_)s.logger.warn("Dropping 1 audio frame @ "+(O/v).toFixed(3)+"s due to "+Math.round(I)+" ms overlap."),T.splice(D,1),e.len-=P.unit.length;else if(w>=L*_&&I<1e4&&O){var x=Math.round(w/_);s.logger.warn("Injecting "+x+" audio frame @ "+(O/v).toFixed(3)+"s due to "+Math.round(1e3*w/v)+" ms gap.");for(var F=0;F<x;F++){var k=Math.max(O,0);(f=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),f=P.unit.subarray()),T.splice(D,0,{unit:f,pts:k,dts:k}),e.len+=f.length,O+=_,D++}P.pts=P.dts=O,O+=_,D++}else Math.abs(w),P.pts=P.dts=O,O+=_,D++}F=0;for(var C=T.length;F<C;F++){var M=T[F],N=M.unit,U=M.pts;if(void 0!==g)d.duration=Math.round((U-g)/y);else{var B=Math.round(1e3*(U-R)/v),G=0;if(r&&e.isAAC&&B){if(B>0&&B<1e4)G=Math.round((U-R)/_),s.logger.log(B+" ms hole between AAC samples detected,filling it"),G>0&&((f=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(f=N.subarray()),e.len+=G*f.length);else if(B<-12){s.logger.log("drop overlapping AAC sample, expected/parsed/delta:"+(R/v).toFixed(3)+"s/"+(U/v).toFixed(3)+"s/"+-B+"ms"),e.len-=N.byteLength;continue}U=R}if(p=U,!(e.len>0))return;var j=S?e.len:e.len+8;u=S?0:8;try{c=new Uint8Array(j)}catch(e){return void this.observer.trigger(n.default.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:j,reason:"fail allocating audio mdat "+j})}S||(new DataView(c.buffer).setUint32(0,j),c.set(a.default.types.mdat,4));for(D=0;D<G;D++)(f=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),f=N.subarray()),c.set(f,u),u+=f.byteLength,d={size:f.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},A.push(d)}c.set(N,u);var H=N.byteLength;u+=H,d={size:H,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},A.push(d),g=U}var K=0,V=A.length;if(V>=2&&(K=A[V-2].duration,d.duration=K),V){this.nextAudioPts=R=g+y*K,e.len=0,e.samples=A,h=S?new Uint8Array:a.default.moof(e.sequenceNumber++,p/y,e),e.samples=[];var W=p/v,Y=R/v,z={data1:h,data2:c,startPTS:W,endPTS:Y,startDTS:W,endDTS:Y,type:"audio",hasAudio:!0,hasVideo:!1,nb:V};return this.observer.trigger(n.default.FRAG_PARSING_DATA,z),z}return null}},e.prototype.remuxEmptyAudio=function(e,t,r,a){var n=e.inputTimeScale,o=n/(e.samplerate?e.samplerate:n),l=this.nextAudioPts,u=(void 0!==l?l:a.startDTS*n)+this._initDTS,d=a.endDTS*n+this._initDTS,f=1024*o,c=Math.ceil((d-u)/f),h=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(s.logger.warn("remux empty Audio"),h){for(var p=[],g=0;g<c;g++){var v=u+g*f;p.push({unit:h,pts:v,dts:v}),e.len+=h.length}e.samples=p,this.remuxAudio(e,t,r)}else s.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},e.prototype.remuxID3=function(e){var t,r=e.samples.length,i=e.inputTimeScale,a=this._initPTS,o=this._initDTS;if(r){for(var s=0;s<r;s++)(t=e.samples[s]).pts=(t.pts-a)/i,t.dts=(t.dts-o)/i;this.observer.trigger(n.default.FRAG_PARSING_METADATA,{samples:e.samples})}e.samples=[]},e.prototype.remuxText=function(e){e.samples.sort(function(e,t){return e.pts-t.pts});var t,r=e.samples.length,i=e.inputTimeScale,a=this._initPTS;if(r){for(var o=0;o<r;o++)(t=e.samples[o]).pts=(t.pts-a)/i;this.observer.trigger(n.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[]},e.prototype._PTSNormalize=function(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e},e}();t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":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]);break;default: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}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Math.pow(2,32)-1,a=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=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=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]);e.HDLR_TYPES={video:r,audio:i};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=n,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,l,o,s),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,a))},e.box=function(e){for(var t,r=Array.prototype.slice.call(arguments,1),i=8,a=r.length,n=a;a--;)i+=r[a].byteLength;for((t=new Uint8Array(i))[0]=i>>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),a=0,i=8;a<n;a++)t.set(r[a],i),i+=r[a].byteLength;return t},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,r){r*=t;var a=Math.floor(r/(i+1)),n=Math.floor(r%(i+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,a>>24,a>>16&255,a>>8&255,255&a,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))},e.moov=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,r){r*=t;var a=Math.floor(r/(i+1)),n=Math.floor(r%(i+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,a>>24,a>>16&255,a>>8&255,255&a,n>>24,n>>16&255,n>>8&255,255&n,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]);return e.box(e.types.mvhd,o)},e.sdtp=function(t){var r,i,a=t.samples||[],n=new Uint8Array(4+a.length);for(i=0;i<a.length;i++)r=a[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,n)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var r,i,a,n=[],o=[];for(r=0;r<t.sps.length;r++)a=(i=t.sps[r]).byteLength,n.push(a>>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)a=(i=t.pps[r]).byteLength,o.push(a>>>8&255),o.push(255&a),o=o.concat(Array.prototype.slice.call(i));var s=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(o))),l=t.width,u=t.height,d=t.pixelRatio[0],f=t.pixelRatio[1];return e.box(e.types.avc1,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,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,f>>24,f>>16&255,f>>8&255,255&f])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var r=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var r=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var r=t.id,a=t.duration*t.timescale,n=t.width,o=t.height,s=Math.floor(a/(i+1)),l=Math.floor(a%(i+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,l>>24,l>>16&255,l>>8&255,255&l,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,o>>8&255,255&o,0,0]))},e.traf=function(t,r){var a=e.sdtp(t),n=t.id,o=Math.floor(r/(i+1)),s=Math.floor(r%(i+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s])),e.trun(t,a.length+16+20+8+16+8+8),a)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var i,a,n,o,s,l,u=t.samples||[],d=u.length,f=12+16*d,c=new Uint8Array(f);for(r+=8+f,c.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<d;i++)n=(a=u[i]).duration,o=a.size,s=a.flags,l=a.cts,c.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,c)},e.initSegment=function(t){e.types||e.init();var r,i=e.moov(t);return(r=new Uint8Array(e.FTYP.byteLength+i.byteLength)).set(e.FTYP),r.set(i,e.FTYP.byteLength),r},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=function(){function e(e){this.observer=e}return e.prototype.destroy=function(){},e.prototype.resetTimeStamp=function(){},e.prototype.resetInitSegment=function(){},e.prototype.remux=function(e,t,r,a,n,o,s,l){var u=this.observer,d="";e&&(d+="audio"),t&&(d+="video"),u.trigger(i.default.FRAG_PARSING_DATA,{data1:l,startPTS:n,startDTS:n,type:d,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),u.trigger(i.default.FRAG_PARSED)},e}();t.default=a},function(e,t,r){"use strict";var i=Object.prototype.hasOwnProperty,a="~";function n(){}function o(e,t,r,i,n){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new function(e,t,r){this.fn=e,this.context=t,this.once=r||!1}(r,i||e,n),s=a?a+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],o]:e._events[s].push(o):(e._events[s]=o,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function l(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(a=!1)),l.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)i.call(e,t)&&r.push(a?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},l.prototype.listeners=function(e){var t=a?a+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,n=r.length,o=new Array(n);i<n;i++)o[i]=r[i].fn;return o},l.prototype.listenerCount=function(e){var t=a?a+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,i,n,o){var s=a?a+e:e;if(!this._events[s])return!1;var l,u,d=this._events[s],f=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),f){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,n),!0;case 6:return d.fn.call(d.context,t,r,i,n,o),!0}for(u=1,l=new Array(f-1);u<f;u++)l[u-1]=arguments[u];d.fn.apply(d.context,l)}else{var c,h=d.length;for(u=0;u<h;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),f){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,i);break;default:if(!l)for(c=1,l=new Array(f-1);c<f;c++)l[c-1]=arguments[c];d[u].fn.apply(d[u].context,l)}}return!0},l.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},l.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},l.prototype.removeListener=function(e,t,r,i){var n=a?a+e:e;if(!this._events[n])return this;if(!t)return s(this,n),this;var o=this._events[n];if(o.fn)o.fn!==t||i&&!o.once||r&&o.context!==r||s(this,n);else{for(var l=0,u=[],d=o.length;l<d;l++)(o[l].fn!==t||i&&!o[l].once||r&&o[l].context!==r)&&u.push(o[l]);u.length?this._events[n]=1===u.length?u[0]:u:s(this,n)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=a?a+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=a,l.EventEmitter=l,e.exports=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(18),a=r(1),n=r(0),o=r(47);t.default=function(e){var t=new o.EventEmitter;t.trigger=function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];t.emit.apply(t,[e,e].concat(r))},t.off=function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];t.removeListener.apply(t,[e].concat(r))};var r=function(t,r){e.postMessage({event:t,data:r})};e.addEventListener("message",function(a){var o=a.data;switch(o.cmd){case"init":var s=JSON.parse(o.config);e.demuxer=new i.default(t,o.typeSupported,s,o.vendor),n.enableLogs(s.debug),r("init",null);break;case"demux":e.demuxer.push(o.data,o.decryptdata,o.initSegment,o.audioCodec,o.videoCodec,o.timeOffset,o.discontinuity,o.trackSwitch,o.contiguous,o.duration,o.accurateTimeOffset,o.defaultInitPTS)}}),t.on(a.default.FRAG_DECRYPTED,r),t.on(a.default.FRAG_PARSING_INIT_SEGMENT,r),t.on(a.default.FRAG_PARSED,r),t.on(a.default.ERROR,r),t.on(a.default.FRAG_PARSING_METADATA,r),t.on(a.default.FRAG_PARSING_USERDATA,r),t.on(a.default.INIT_PTS_FOUND,r),t.on(a.default.FRAG_PARSING_DATA,function(t,r){var i=[],a={event:t,data:r};r.data1&&(a.data1=r.data1.buffer,i.push(r.data1.buffer),delete r.data1),r.data2&&(a.data2=r.data2.buffer,i.push(r.data2.buffer),delete r.data2),e.postMessage(a,i)})}},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function a(e){return"object"==typeof e&&null!==e}function n(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,o,s,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var d=new Error('Uncaught, unspecified "error" event. ('+t+")");throw d.context=t,d}if(n(r=this._events[e]))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),o=(u=r.slice()).length,l=0;l<o;l++)u[l].apply(this,s);return!0},r.prototype.addListener=function(e,t){var o;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(o=n(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&o>0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var r=!1;function a(){this.removeListener(e,a),r||(r=!0,t.apply(this,arguments))}return a.listener=t,this.on(e,a),this},r.prototype.removeListener=function(e,t){var r,n,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(r=this._events[e]).length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(s=o;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={toString:function(e){for(var t="",r=e.length,i=0;i<r;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(10),a=r(0);function n(e,t){for(var r=null,i=0;i<e.length;i+=1){var a=e[i];if(a&&a.cc===t){r=a;break}}return r}function o(e,t,r){var i=!1;return t&&t.details&&r&&(r.endCC>r.startCC||e&&e.cc<r.startCC)&&(i=!0),i}function s(e,t){var r=e.fragments,i=t.fragments;if(i.length&&r.length){var o=n(r,i[0].cc);if(o&&(!o||o.startPTS))return o;a.logger.log("No frag in previous level to align on")}else a.logger.log("No fragments to align")}function l(e,t){t.fragments.forEach(function(t){if(t){var r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}}),t.PTSKnown=!0}function u(e,t,r){if(o(e,r,t)){var i=s(r.details,t);i&&(a.logger.log("Adjusting PTS using last level due to CC increase within current level"),l(i.start,t))}}function d(t,r){if(r&&r.fragments.length){if(!t.hasProgramDateTime||!r.hasProgramDateTime)return;var i=r.fragments[0].programDateTime,n=(t.fragments[0].programDateTime-i)/1e3+r.fragments[0].start;e.isFinite(n)&&(a.logger.log("adjusting PTS using programDateTime delta, sliding:"+n.toFixed(3)),l(n,t))}}t.findFirstFragWithCC=n,t.findFragWithCC=function(e,t){return i.default.search(e,function(e){return e.cc<t?1:e.cc>t?-1:0})},t.shouldAlignOnDiscontinuities=o,t.findDiscontinuousReferenceFrag=s,t.adjustPts=l,t.alignStream=function(e,t,r){u(e,r,t),!r.PTSKnown&&t&&d(r,t.details)},t.alignDiscontinuities=u,t.alignPDT=d}).call(this,r(2).Number)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(10);function a(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0);var i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function n(e,t,r){var i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.endProgramDateTime-i>e}t.findFragmentByPDT=function(t,r,i){if(!Array.isArray(t)||!t.length||!e.isFinite(r))return null;if(r<t[0].programDateTime)return null;if(r>=t[t.length-1].endProgramDateTime)return null;i=i||0;for(var a=0;a<t.length;++a){var o=t[a];if(n(r,i,o))return o}return null},t.findFragmentByPTS=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var o=e?t[e.sn-t[0].sn+1]:null;return o&&!a(r,n,o)?o:i.default.search(t,a.bind(null,r,n))},t.fragmentWithinToleranceTest=a,t.pdtWithinToleranceTest=n}).call(this,r(2).Number)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(8),a=r(3),n=r(1),o=r(0),s=function(){function e(e,t,r,i){this.config=e,this.media=t,this.fragmentTracker=r,this.hls=i,this.stallReported=!1}return e.prototype.poll=function(e,t){var r=this.config,a=this.media,n=a.currentTime,s=window.performance.now();if(n!==e)return this.stallReported&&(o.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(s-this.stalled)+"ms"),this.stallReported=!1),this.stalled=null,void(this.nudgeRetry=0);if(!(a.ended||!a.buffered.length||a.readyState>2||a.seeking&&i.BufferHelper.isBuffered(a,n))){var l=s-this.stalled,u=i.BufferHelper.bufferInfo(a,n,r.maxBufferHole);this.stalled?(l>=1e3&&this._reportStall(u.len),this._tryFixBufferStall(u,l)):this.stalled=s}},e.prototype._tryFixBufferStall=function(e,t){var r=this.config,i=this.fragmentTracker,a=this.media.currentTime,n=i.getPartialFragment(a);n&&this._trySkipBufferHole(n),e.len>.5&&t>1e3*r.highBufferWatchdogPeriod&&(this.stalled=null,this._tryNudgeBuffer())},e.prototype._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,o.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer"),t.trigger(n.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},e.prototype._trySkipBufferHole=function(e){for(var t=this.hls,r=this.media,i=r.currentTime,s=0,l=0;l<r.buffered.length;l++){var u=r.buffered.start(l);if(i>=s&&i<u)return r.currentTime=Math.max(u,r.currentTime+.1),o.logger.warn("skipping hole, adjusting currentTime from "+i+" to "+r.currentTime),this.stalled=null,void t.trigger(n.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+r.currentTime,frag:e});s=r.buffered.end(l)}},e.prototype._tryNudgeBuffer=function(){var e=this.config,t=this.hls,r=this.media,i=r.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<e.nudgeMaxRetry){var l=i+s*e.nudgeOffset;o.logger.log("adjust currentTime from "+i+" to "+l),r.currentTime=l,t.trigger(n.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else o.logger.error("still stuck in high buffer @"+i+" after "+e.nudgeMaxRetry+", raise fatal error"),t.trigger(n.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}();t.default=s},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(53),n=r(9),o=r(8),s=r(0);t.State={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};var l=function(r){function a(){return null!==r&&r.apply(this,arguments)||this}return i(a,r),a.prototype.doTick=function(){},a.prototype.startLoad=function(){},a.prototype.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e)),this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=t.State.STOPPED},a.prototype._streamEnded=function(e,t){var r=this.fragCurrent,i=this.fragmentTracker;if(!t.live&&r&&!r.backtracked&&r.sn===t.endSN&&!e.nextStart){var a=i.getState(r);return a===n.FragmentState.PARTIAL||a===n.FragmentState.OK}return!1},a.prototype.onMediaSeeking=function(){var r=this.config,i=this.media,a=this.mediaBuffer,n=this.state,l=i?i.currentTime:null,u=o.BufferHelper.bufferInfo(a||i,l,this.config.maxBufferHole);if(e.isFinite(l)&&s.logger.log("media seeking to "+l.toFixed(3)),n===t.State.FRAG_LOADING){var d=this.fragCurrent;if(0===u.len&&d){var f=r.maxFragLookUpTolerance,c=d.start-f,h=d.start+d.duration+f;l<c||l>h?(d.loader&&(s.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),d.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=t.State.IDLE):s.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else n===t.State.ENDED&&(0===u.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=t.State.IDLE);i&&(this.lastCurrentTime=l),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=l),this.tick()},a.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.prototype.onHandlerDestroying=function(){this.stopLoad(),r.prototype.onHandlerDestroying.call(this)},a.prototype.onHandlerDestroyed=function(){this.state=t.State.STOPPED,this.fragmentTracker=null},a}(a.default);t.default=l}).call(this,r(2).Number)},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var a=e.apply(this,[t].concat(r))||this;return a._tickInterval=null,a._tickTimer=null,a._tickCallCount=0,a._boundTick=a.tick.bind(a),a}return i(t,e),t.prototype.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.prototype.hasInterval=function(){return!!this._tickInterval},t.prototype.hasNextTick=function(){return!!this._tickTimer},t.prototype.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=setInterval(this._boundTick,e),!0)},t.prototype.clearInterval=function(){return!!this._tickInterval&&(clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.prototype.clearNextTick=function(){return!!this._tickTimer&&(clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.prototype.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=setTimeout(this._boundTick,0)),this._tickCallCount=0)},t.prototype.doTick=function(){},t}(r(4).default);t.default=a},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a,n=r(1),o=r(4),s=r(0),l=r(3),u=r(17),d=r(23),f=(window.performance,function(e){function t(t){var r=e.call(this,t,n.default.MANIFEST_LOADED,n.default.LEVEL_LOADED,n.default.AUDIO_TRACK_SWITCHED,n.default.FRAG_LOADED,n.default.ERROR)||this;return r.canload=!1,r.currentLevelIndex=null,r.manualLevelIndex=-1,r.timer=null,a=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),r}return i(t,e),t.prototype.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},t.prototype.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.startLoad=function(){var e=this._levels;this.canload=!0,this.levelRetryCount=0,e&&e.forEach(function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)}),null!==this.timer&&this.loadLevel()},t.prototype.stopLoad=function(){this.canload=!1},t.prototype.onManifestLoaded=function(e){var t,r=[],i=[],o={},f=null,c=!1,h=!1;if(e.levels.forEach(function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,c=c||!!e.videoCodec,h=h||!!e.audioCodec,a&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(f=o[e.bitrate])?f.url.push(e.url):(e.url=[e.url],e.urlId=0,o[e.bitrate]=e,r.push(e)),t&&(t.AUDIO&&(h=!0,d.addGroupId(f||e,"audio",t.AUDIO)),t.SUBTITLES&&d.addGroupId(f||e,"text",t.SUBTITLES))}),c&&h&&(r=r.filter(function(e){return!!e.videoCodec})),r=r.filter(function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||u.isCodecSupportedInMp4(t,"audio"))&&(!r||u.isCodecSupportedInMp4(r,"video"))}),e.audioTracks&&(i=e.audioTracks.filter(function(e){return!e.audioCodec||u.isCodecSupportedInMp4(e.audioCodec,"audio")})).forEach(function(e,t){e.id=t}),r.length>0){t=r[0].bitrate,r.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=r;for(var p=0;p<r.length;p++)if(r[p].bitrate===t){this._firstLevel=p,s.logger.log("manifest loaded,"+r.length+" level(s) found, first bitrate:"+t);break}this.hls.trigger(n.default.MANIFEST_PARSED,{levels:r,audioTracks:i,firstLevel:this._firstLevel,stats:e.stats,audio:h,video:c,altAudio:i.some(function(e){return!!e.url})})}else this.hls.trigger(n.default.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,details:l.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},Object.defineProperty(t.prototype,"levels",{get:function(){return this._levels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"level",{get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;t&&(e=Math.min(e,t.length-1),this.currentLevelIndex===e&&t[e].details||this.setLevelInternal(e))},enumerable:!0,configurable:!0}),t.prototype.setLevelInternal=function(e){var t=this._levels,r=this.hls;if(e>=0&&e<t.length){if(this.clearTimer(),this.currentLevelIndex!==e){s.logger.log("switching to level "+e),this.currentLevelIndex=e;var i=t[e];i.level=e,r.trigger(n.default.LEVEL_SWITCHING,i)}var a=t[e],o=a.details;if(!o||o.live){var u=a.urlId;r.trigger(n.default.LEVEL_LOADING,{url:a.url[u],level:e,id:u})}}else r.trigger(n.default.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})},Object.defineProperty(t.prototype,"manualLevel",{get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstLevel",{get:function(){return this._firstLevel},set:function(e){this._firstLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"startLevel",{get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e},enumerable:!0,configurable:!0}),t.prototype.onError=function(e){if(e.fatal)e.type===l.ErrorTypes.NETWORK_ERROR&&this.clearTimer();else{var t,r=!1,i=!1;switch(e.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:t=e.frag.level,i=!0;break;case l.ErrorDetails.LEVEL_LOAD_ERROR:case l.ErrorDetails.LEVEL_LOAD_TIMEOUT:t=e.context.level,r=!0;break;case l.ErrorDetails.REMUX_ALLOC_ERROR:t=e.level,r=!0}void 0!==t&&this.recoverLevel(e,t,r,i)}},t.prototype.recoverLevel=function(e,t,r,i){var a,n,o,l=this,u=this.hls.config,d=e.details,f=this._levels[t];if(f.loadError++,f.fragmentError=i,r){if(!(this.levelRetryCount+1<=u.levelLoadingMaxRetry))return s.logger.error("level controller, cannot recover from "+d+" error"),this.currentLevelIndex=null,this.clearTimer(),void(e.fatal=!0);n=Math.min(Math.pow(2,this.levelRetryCount)*u.levelLoadingRetryDelay,u.levelLoadingMaxRetryTimeout),this.timer=setTimeout(function(){return l.loadLevel()},n),e.levelRetry=!0,this.levelRetryCount++,s.logger.warn("level controller, "+d+", retry in "+n+" ms, current retry count is "+this.levelRetryCount)}(r||i)&&((a=f.url.length)>1&&f.loadError<a?(f.urlId=(f.urlId+1)%a,f.details=void 0,s.logger.warn("level controller, "+d+" for level "+t+": switching to redundant URL-id "+f.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,s.logger.warn("level controller, "+d+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):i&&(s.logger.warn("level controller, "+d+": reload a fragment"),this.currentLevelIndex=null))},t.prototype.onFragLoaded=function(e){var t=e.frag;if(void 0!==t&&"main"===t.type){var r=this._levels[t.level];void 0!==r&&(r.fragmentError=!1,r.loadError=0,this.levelRetryCount=0)}},t.prototype.onLevelLoaded=function(e){var t=this,r=e.level,i=e.details;if(r===this.currentLevelIndex){var a=this._levels[r];if(a.fragmentError||(a.loadError=0,this.levelRetryCount=0),i.live){var n=d.computeReloadInterval(a.details,i,e.stats.trequest);s.logger.log("live playlist, reload in "+Math.round(n)+" ms"),this.timer=setTimeout(function(){return t.loadLevel()},n)}else this.clearTimer()}},t.prototype.onAudioTrackSwitched=function(e){var t=this.hls.audioTracks[e.id].groupId,r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){for(var i=-1,a=0;a<r.audioGroupIds.length;a++)if(r.audioGroupIds[a]===t){i=a;break}i!==r.urlId&&(r.urlId=i,this.startLoad())}},t.prototype.loadLevel=function(){if(s.logger.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var e=this._levels[this.currentLevelIndex];if("object"==typeof e&&e.url.length>0){var t=this.currentLevelIndex,r=e.urlId,i=e.url[r];s.logger.log("Attempt loading level index "+t+" with URL-id "+r),this.hls.trigger(n.default.LEVEL_LOADING,{url:i,level:t,id:r})}}},Object.defineProperty(t.prototype,"nextLoadLevel",{get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)},enumerable:!0,configurable:!0}),t}(o.default));t.default=f},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(11),s=r(56),l=function(e){function t(t){var r=e.call(this,t,a.default.MEDIA_ATTACHED,a.default.MEDIA_DETACHING,a.default.FRAG_PARSING_METADATA)||this;return r.id3Track=void 0,r.media=void 0,r}return i(t,e),t.prototype.destroy=function(){n.default.prototype.destroy.call(this)},t.prototype.onMediaAttached=function(e){this.media=e.media,this.media},t.prototype.onMediaDetaching=function(){s.clearCurrentCues(this.id3Track),this.id3Track=void 0,this.media=void 0},t.prototype.getID3Track=function(e){for(var t=0;t<e.length;t++){var r=e[t];if("metadata"===r.kind&&"id3"===r.label)return s.sendAddTrackEvent(r,this.media),r}return this.media.addTextTrack("metadata","id3")},t.prototype.onFragParsingMetadata=function(e){var t=e.frag,r=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,a=0;a<r.length;a++){var n=o.default.getID3Frames(r[a].data);if(n){var s=r[a].pts,l=a<r.length-1?r[a+1].pts:t.endPTS;s===l&&(l+=1e-4);for(var u=0;u<n.length;u++){var d=n[u];if(!o.default.isTimeStampFrame(d)){var f=new i(s,l,"");f.value=d,this.id3Track.addCue(f)}}}}},t}(n.default);t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendAddTrackEvent=function(e,t){var r=null;try{r=new window.Event("addtrack")}catch(e){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)},t.clearCurrentCues=function(e){if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);t.isSupported=function(){var e=i.getMediaSource(),t=window.SourceBuffer||window.WebKitSourceBuffer,r=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!r&&!!a}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(59),a=r(62),n=r(63),o=r(64),s=r(65),l=(r(5),r(5),r(5),r(5),r(5),r(5),r(5),r(66));t.hlsDefaultConfig={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,liveBackBufferLength:1/0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:s.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:i.default,bufferController:a.default,capLevelController:n.default,fpsController:o.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,requestMediaKeySystemAccessFunc:l.requestMediaKeySystemAccess}},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(8),s=r(3),l=r(0),u=r(60),d=window.performance,f=function(t){function r(e){var r=t.call(this,e,a.default.FRAG_LOADING,a.default.FRAG_LOADED,a.default.FRAG_BUFFERED,a.default.ERROR)||this;return r.lastLoadedFragLevel=0,r._nextAutoLevel=-1,r.hls=e,r.timer=null,r._bwEstimator=null,r.onCheck=r._abandonRulesCheck.bind(r),r}return i(r,t),r.prototype.destroy=function(){this.clearTimer(),n.default.prototype.destroy.call(this)},r.prototype.onFragLoading=function(e){var t=e.frag;if("main"===t.type&&(this.timer||(this.fragCurrent=t,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var r=this.hls,i=r.config,a=t.level,n=void 0,o=void 0;r.levels[a].details.live?(n=i.abrEwmaFastLive,o=i.abrEwmaSlowLive):(n=i.abrEwmaFastVoD,o=i.abrEwmaSlowVoD),this._bwEstimator=new u.default(r,o,n,i.abrEwmaDefaultEstimate)}},r.prototype._abandonRulesCheck=function(){var e=this.hls,t=e.media,r=this.fragCurrent;if(r){var i=r.loader,n=e.minAutoLevel;if(!i||i.stats&&i.stats.aborted)return l.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var s=i.stats;if(t&&s&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var u=d.now()-s.trequest,f=Math.abs(t.playbackRate);if(u>500*r.duration/f){var c=e.levels,h=Math.max(1,s.bw?s.bw/8:1e3*s.loaded/u),p=c[r.level],g=p.realBitrate?Math.max(p.realBitrate,p.bitrate):p.bitrate,v=s.total?s.total:Math.max(s.loaded,Math.round(r.duration*g/8)),m=t.currentTime,y=(v-s.loaded)/h,_=(o.BufferHelper.bufferInfo(t,m,e.config.maxBufferHole).end-m)/f;if(_<2*r.duration/f&&y>_){var E=void 0,b=void 0;for(b=r.level-1;b>n;b--){var S=c[b].realBitrate?Math.max(c[b].realBitrate,c[b].bitrate):c[b].bitrate;if((E=r.duration*S/(6.4*h))<_)break}E<y&&(l.logger.warn("loading too slow, abort fragment loading and switch to level "+b+":fragLoadedDelay["+b+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+E.toFixed(1)+"<"+y.toFixed(1)+":"+_.toFixed(1)),e.nextLoadLevel=b,this._bwEstimator.sample(u,s.loaded),i.abort(),this.clearTimer(),e.trigger(a.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:s}))}}}}},r.prototype.onFragLoaded=function(t){var r=t.frag;if("main"===r.type&&e.isFinite(r.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=r.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var i=this.hls.levels[r.level],a=(i.loaded?i.loaded.bytes:0)+t.stats.loaded,n=(i.loaded?i.loaded.duration:0)+t.frag.duration;i.loaded={bytes:a,duration:n},i.realBitrate=Math.round(8*a/n)}if(t.frag.bitrateTest){var o=t.stats;o.tparsed=o.tbuffered=o.tload,this.onFragBuffered(t)}}},r.prototype.onFragBuffered=function(t){var r=t.stats,i=t.frag;if(!0!==r.aborted&&"main"===i.type&&e.isFinite(i.sn)&&(!i.bitrateTest||r.tload===r.tbuffered)){var a=r.tparsed-r.trequest;l.logger.log("latency/loading/parsing/append/kbps:"+Math.round(r.tfirst-r.trequest)+"/"+Math.round(r.tload-r.tfirst)+"/"+Math.round(r.tparsed-r.tload)+"/"+Math.round(r.tbuffered-r.tparsed)+"/"+Math.round(8*r.loaded/(r.tbuffered-r.trequest))),this._bwEstimator.sample(a,r.loaded),r.bwEstimate=this._bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},r.prototype.onError=function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},r.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},Object.defineProperty(r.prototype,"nextAutoLevel",{get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var r=this._nextABRAutoLevel;return-1!==e&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_nextABRAutoLevel",{get:function(){var e=this.hls,t=e.maxAutoLevel,r=e.levels,i=e.config,a=e.minAutoLevel,n=e.media,s=this.lastLoadedFragLevel,u=this.fragCurrent?this.fragCurrent.duration:0,d=n?n.currentTime:0,f=n&&0!==n.playbackRate?Math.abs(n.playbackRate):1,c=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(o.BufferHelper.bufferInfo(n,d,i.maxBufferHole).end-d)/f,p=this._findBestLevel(s,u,c,a,t,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(p>=0)return p;l.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var g=u?Math.min(u,i.maxStarvationDelay):i.maxStarvationDelay,v=i.abrBandWidthFactor,m=i.abrBandWidthUpFactor;if(0===h){var y=this.bitrateTestDelay;if(y)g=(u?Math.min(u,i.maxLoadingDelay):i.maxLoadingDelay)-y,l.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),v=m=1}return p=this._findBestLevel(s,u,c,a,t,h+g,v,m,r),Math.max(p,0)},enumerable:!0,configurable:!0}),r.prototype._findBestLevel=function(e,t,r,i,a,n,o,s,u){for(var d=a;d>=i;d--){var f=u[d];if(f){var c=f.details,h=c?c.totalduration/c.fragments.length:t,p=!!c&&c.live,g=void 0;g=d<=e?o*r:s*r;var v=u[d].realBitrate?Math.max(u[d].realBitrate,u[d].bitrate):u[d].bitrate,m=v*h/g;if(l.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+d+"/"+Math.round(g)+"/"+v+"/"+h+"/"+n+"/"+m),g>v&&(!m||p&&!this.bitrateTestDelay||m<n))return d}}return-1},r}(n.default);t.default=f}).call(this,r(2).Number)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(61),a=function(){function e(e,t,r,a){this.hls=e,this.defaultEstimate_=a,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new i.default(t),this.fast_=new i.default(r)}return e.prototype.sample=function(e,t){var r=8e3*t/(e=Math.max(e,this.minDelayMs_)),i=e/1e3;this.fast_.sample(i,r),this.slow_.sample(i,r)},e.prototype.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},e.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.prototype.destroy=function(){},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}return e.prototype.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},e.prototype.getTotalWeight=function(){return this.totalWeight_},e.prototype.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_},e}();t.default=i},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(0),s=r(3),l=r(12).getMediaSource(),u=function(t){function r(e){var r=t.call(this,e,a.default.MEDIA_ATTACHING,a.default.MEDIA_DETACHING,a.default.MANIFEST_PARSED,a.default.BUFFER_RESET,a.default.BUFFER_APPENDING,a.default.BUFFER_CODECS,a.default.BUFFER_EOS,a.default.BUFFER_FLUSHING,a.default.LEVEL_PTS_UPDATED,a.default.LEVEL_UPDATED)||this;return r._msDuration=null,r._levelDuration=null,r._levelTargetDuration=10,r._live=null,r._objectUrl=null,r.bufferCodecEventsExpected=0,r.onsbue=r.onSBUpdateEnd.bind(r),r.onsbe=r.onSBUpdateError.bind(r),r.pendingTracks={},r.tracks={},r}return i(r,t),r.prototype.destroy=function(){n.default.prototype.destroy.call(this)},r.prototype.onLevelPtsUpdated=function(e){var t=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(Math.abs(i.timestampOffset-e.start)>.1){var a=i.updating;try{i.abort()}catch(e){o.logger.warn("can not abort audio buffer: "+e)}a?this.audioTimestampOffset=e.start:(o.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}},r.prototype.onManifestParsed=function(e){this.bufferCodecEventsExpected=e.altAudio?2:1,o.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},r.prototype.onMediaAttaching=function(e){var t=this.media=e.media;if(t){var r=this.mediaSource=new l;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),t.src=window.URL.createObjectURL(r),this._objectUrl=t.src}},r.prototype.onMediaDetaching=function(){o.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){o.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this.onmso),e.removeEventListener("sourceended",this.onmse),e.removeEventListener("sourceclose",this.onmsc),this.media&&(window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):o.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(a.default.MEDIA_DETACHED)},r.prototype.onMediaSourceOpen=function(){o.logger.log("media source opened"),this.hls.trigger(a.default.MEDIA_ATTACHED,{media:this.media});var e=this.mediaSource;e&&e.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},r.prototype.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,r=Object.keys(t).length;(r&&!e||2===r)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},r.prototype.onMediaSourceClose=function(){o.logger.log("media source closed")},r.prototype.onMediaSourceEnded=function(){o.logger.log("media source ended")},r.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var e=this.sourceBuffer.audio;o.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+this.audioTimestampOffset),e.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var t=this.parent,r=this.segments.reduce(function(e,r){return r.parent===t?e+1:e},0),i={},n=this.sourceBuffer;for(var s in n)i[s]=n[s].buffered;this.hls.trigger(a.default.BUFFER_APPENDED,{parent:t,pending:r,timeRanges:i}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration(),0===r&&this.flushLiveBackBuffer()},r.prototype.onSBUpdateError=function(e){o.logger.error("sourceBuffer error:",e),this.hls.trigger(a.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},r.prototype.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},r.prototype.onBufferCodecs=function(e){var t=this;if(!Object.keys(this.sourceBuffer).length){Object.keys(e).forEach(function(r){t.pendingTracks[r]=e[r]});var r=this.mediaSource;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),r&&"open"===r.readyState&&this.checkPendingTracks()}},r.prototype.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;for(var i in e)if(!t[i]){var n=e[i],l=n.levelCodec||n.codec,u=n.container+";codecs="+l;o.logger.log("creating sourceBuffer("+u+")");try{var d=t[i]=r.addSourceBuffer(u);d.addEventListener("updateend",this.onsbue),d.addEventListener("error",this.onsbe),this.tracks[i]={codec:l,container:n.container},n.buffer=d}catch(e){o.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(a.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:u})}}this.hls.trigger(a.default.BUFFER_CREATED,{tracks:e})},r.prototype.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},r.prototype.onBufferAppendFail=function(e){o.logger.error("sourceBuffer error:",e.event),this.hls.trigger(a.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},r.prototype.onBufferEos=function(e){var t=this.sourceBuffer,r=e.type;for(var i in t)r&&i!==r||t[i].ended||(t[i].ended=!0,o.logger.log(i+" sourceBuffer now EOS"));this.checkEos()},r.prototype.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(t&&"open"===t.readyState){for(var r in e){var i=e[r];if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}o.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){o.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},r.prototype.onBufferFlushing=function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}),this.flushBufferCounter=0,this.doFlush()},r.prototype.flushLiveBackBuffer=function(){if(this._live){var e=this.hls.config.liveBackBufferLength;if(isFinite(e)&&!(e<0))for(var t=this.media.currentTime,r=this.sourceBuffer,i=Object.keys(r),a=t-Math.max(e,this._levelTargetDuration),n=i.length-1;n>=0;n--){var o=i[n],s=r[o].buffered;s.length>0&&a>s.start(0)&&this.removeBufferRange(o,r[o],0,a)}}},r.prototype.onLevelUpdated=function(e){var t=e.details;t.fragments.length>0&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},r.prototype.updateMediaElementDuration=function(){var t,r=this.hls.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var i in this.sourceBuffer)if(!0===this.sourceBuffer[i].updating)return;t=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===r.liveDurationInfinity?(o.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>t||!e.isFinite(t))&&(o.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},r.prototype.doFlush=function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;try{for(var i in r)t+=r[i].buffered.length}catch(e){o.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(a.default.BUFFER_FLUSHED)}},r.prototype.doAppending=function(){var e=this.hls,t=this.segments,r=this.sourceBuffer;if(Object.keys(r).length){if(this.media.error)return this.segments=[],void o.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(t&&t.length){var i=t.shift();try{var n=r[i.type];n?n.updating?t.unshift(i):(n.ended=!1,this.parent=i.parent,n.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(r){o.logger.error("error while trying to append buffer:"+r.message),t.unshift(i);var l={type:s.ErrorTypes.MEDIA_ERROR,parent:i.parent};22!==r.code?(this.appendError?this.appendError++:this.appendError=1,l.details=s.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.config.appendErrorMaxRetry?(o.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],l.fatal=!0,e.trigger(a.default.ERROR,l)):(l.fatal=!1,e.trigger(a.default.ERROR,l))):(this.segments=[],l.details=s.ErrorDetails.BUFFER_FULL_ERROR,l.fatal=!1,e.trigger(a.default.ERROR,l))}}}},r.prototype.flushBuffer=function(e,t,r){var i,a=this.sourceBuffer;if(Object.keys(a).length){if(o.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+e+"/"+t),this.flushBufferCounter<this.appended){for(var n in a)if(!r||n===r){if((i=a[n]).ended=!1,i.updating)return o.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(n,i,e,t))return this.flushBufferCounter++,!1}}else o.logger.warn("abort flushing too many retries");o.logger.log("buffer flushed")}return!0},r.prototype.removeBufferRange=function(e,t,r,i){try{for(var a=0;a<t.buffered.length;a++){var n=t.buffered.start(a),s=t.buffered.end(a),l=Math.max(n,r),u=Math.min(s,i);if(Math.min(u,s)-l>.5)return o.logger.log("sb remove "+e+" ["+l+","+u+"], of ["+n+","+s+"], pos:"+this.media.currentTime),t.remove(l,u),!0}}catch(e){o.logger.warn("removeBufferRange failed",e)}return!1},r}(n.default);t.default=u}).call(this,r(2).Number)},function(e,t,r){"use strict";(function(e){var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=function(t){function r(r){var i=t.call(this,r,a.default.FPS_DROP_LEVEL_CAPPING,a.default.MEDIA_ATTACHING,a.default.MANIFEST_PARSED,a.default.BUFFER_CODECS,a.default.MEDIA_DETACHING)||this;return i.autoLevelCapping=e.POSITIVE_INFINITY,i.firstLevel=null,i.levels=[],i.media=null,i.restrictedLevels=[],i.timer=null,i}return i(r,t),r.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this._stopCapping())},r.prototype.onFpsDropLevelCapping=function(e){r.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},r.prototype.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},r.prototype.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this._startCapping()},r.prototype.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this._startCapping()},r.prototype.onLevelsUpdated=function(e){this.levels=e.levels},r.prototype.onMediaDetaching=function(){this._stopCapping()},r.prototype.detectPlayerSize=function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},r.prototype.getMaxLevel=function(e){var t=this;if(!this.levels)return-1;var i=this.levels.filter(function(i,a){return r.isLevelAllowed(a,t.restrictedLevels)&&a<=e});return r.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},r.prototype._startCapping=function(){this.timer||(this.autoLevelCapping=e.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},r.prototype._stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=e.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},Object.defineProperty(r.prototype,"mediaWidth",{get:function(){var e,t=this.media;return t&&(e=t.width||t.clientWidth||t.offsetWidth,e*=r.contentScaleFactor),e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"mediaHeight",{get:function(){var e,t=this.media;return t&&(e=t.height||t.clientHeight||t.offsetHeight,e*=r.contentScaleFactor),e},enumerable:!0,configurable:!0}),Object.defineProperty(r,"contentScaleFactor",{get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e},enumerable:!0,configurable:!0}),r.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},r.getMaxLevelByMediaSize=function(e,t,r){if(!e||e&&!e.length)return-1;for(var i=function(e,t){return!t||(e.width!==t.width||e.height!==t.height)},a=e.length-1,n=0;n<e.length;n+=1){var o=e[n];if((o.width>=t||o.height>=r)&&i(o,e[n+1])){a=n;break}}return a},r}(r(4).default);t.default=n}).call(this,r(2).Number)},function(e,t,r){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),n=r(4),o=r(0),s=window.performance,l=function(e){function t(t){return e.call(this,t,a.default.MEDIA_ATTACHING)||this}return i(t,e),t.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},t.prototype.onMediaAttaching=function(e){var t=this.hls.config;t.capLevelOnFPSDrop&&("function"==typeof(this.video=e.media instanceof window.HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod))},t.prototype.checkFPS=function(e,t,r){var i=s.now();if(t){if(this.lastTime){var n=i-this.lastTime,l=r-this.lastDroppedFrames,u=t-this.lastDecodedFrames,d=1e3*l/n,f=this.hls;if(f.trigger(a.default.FPS_DROP,{currentDropped:l,currentDecoded:u,totalDroppedFrames:r}),d>0&&l>f.config.fpsDroppedMonitoringThreshold*u){var c=f.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(-1===f.autoLevelCapping||f.autoLevelCapping>=c)&&(c-=1,f.trigger(a.default.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:f.currentLevel}),f.autoLevelCapping=c,f.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},t.prototype.checkFPSInterval=function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},t}(n.default);t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=window.performance,n=window.XMLHttpRequest,o=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return e.prototype.destroy=function(){this.abort(),this.loader=null},e.prototype.abort=function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},e.prototype.load=function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:a.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},e.prototype.loadInternal=function(){var e,t=this.context;e=this.loader=new n;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,t.url)}catch(r){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(r){return void this.callbacks.onError({code:e.status,text:r.message},t,e)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},e.prototype.readystatechange=function(e){var t=e.currentTarget,r=t.readyState,n=this.stats,o=this.context,s=this.config;if(!n.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===n.tfirst&&(n.tfirst=Math.max(a.now(),n.trequest)),4===r){var l=t.status;if(l>=200&&l<300){n.tload=Math.max(n.tfirst,a.now());var u=void 0,d=void 0;d="arraybuffer"===o.responseType?(u=t.response).byteLength:(u=t.responseText).length,n.loaded=n.total=d;var f={url:t.responseURL,data:u};this.callbacks.onSuccess(f,n,o,t)}else n.retry>=s.maxRetry||l>=400&&l<499?(i.logger.error(l+" while loading "+o.url),this.callbacks.onError({code:l,text:t.statusText},o,t)):(i.logger.warn(l+" while loading "+o.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),n.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout)},e.prototype.loadtimeout=function(){i.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},e.prototype.loadprogress=function(e){var t=e.currentTarget,r=this.stats;r.loaded=e.loaded,e.lengthComputable&&(r.total=e.total);var i=this.callbacks.onProgress;i&&i(r,this.context,null,t)},e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null;t.requestMediaKeySystemAccess=i}]).default});
|
|
//# sourceMappingURL=hls.light.min.js.map
|