UNPKG

zx-player

Version:
1 lines 746 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["zx-player"]=t():e["zx-player"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},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(r.s="e225")}({"0117":function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},"0288":function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(n){"object"===typeof window&&(r=window)}e.exports=r},"13d0":function(e,t,r){var n=r("35a9"),i=r("30cf"),a=r("ef69");e.exports=n?function(e,t,r){return i.f(e,t,a(1,r))}:function(e,t,r){return e[t]=r,e}},"18ff":function(e,t,r){var n=r("efd0"),i=r("13d0");e.exports=function(e,t){try{i(n,e,t)}catch(r){n[e]=t}return t}},"1b38":function(e,t,r){var n=r("aad0"),i=/#|\.prototype\./,a=function(e,t){var r=s[o(e)];return r==u||r!=l&&("function"==typeof t?n(t):!!t)},o=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},s=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},"1bbe":function(e,t,r){var n=r("28a9"),i=r("7a85"),a=n("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},2092:function(e,t,r){var n=r("0117"),i=r("3274"),a=r("af7d").indexOf,o=r("be34");e.exports=function(e,t){var r,s=i(e),l=0,u=[];for(r in s)!n(o,r)&&n(s,r)&&u.push(r);while(t.length>l)n(s,r=t[l++])&&(~a(u,r)||u.push(r));return u}},"21e0":function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},2308:function(e,t,r){(function(t,n){e.exports=n(r("47fc"))})(window,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},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(r.s=31)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logger=t.enableLogs=void 0;var n="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(5);function a(){}var o={trace:a,debug:a,log:a,warn:a,info:a,error:a},s=o;function l(e,t){return t="["+e+"] > "+t,t}var u=(0,i.getSelfScope)();function d(e){var t=u.console[e];return t?function(){for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];n[0]&&(n[0]=l(e,n[0])),t.apply(u.console,n)}:a}function c(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];r.forEach((function(t){s[t]=e[t]?e[t].bind(e):d(t)}))}t.enableLogs=function(e){if(!0===e||"object"===("undefined"===typeof e?"undefined":n(e))){c(e,"debug","log","info","warn","error");try{s.log()}catch(t){s=o}}else s=o},t.logger=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={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"};t.default=n,e.exports=t["default"]},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 n="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(0),o=r(2),s=r(1),l=u(s);function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},f=function(){function e(t){d(this,e),this.hls=t,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}return i(e,[{key:"destroy",value:function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()}},{key:"onHandlerDestroying",value:function(){}},{key:"onHandlerDestroyed",value:function(){}},{key:"isEventHandler",value:function(){return"object"===n(this.handledEvents)&&this.handledEvents.length&&"function"===typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){if(c[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)}),this)}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.hls.off(e,this.onEvent)}),this)}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var r=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)};try{r.call(this,e,t).call()}catch(n){a.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),this.hls.trigger(l.default.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:n})}}}]),e}();t.default=f,e.exports=t["default"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.BufferHelper=function(){function e(){i(this,e)}return n(e,null,[{key:"isBuffered",value:function(e,t){try{if(e)for(var r=e.buffered,n=0;n<r.length;n++)if(t>=r.start(n)&&t<=r.end(n))return!0}catch(i){}return!1}},{key:"bufferInfo",value:function(e,t,r){try{if(e){var n=e.buffered,i=[],a=void 0;for(a=0;a<n.length;a++)i.push({start:n.start(a),end:n.end(a)});return this.bufferedInfo(i,t,r)}}catch(o){}return{len:0,start:t,end:t,nextStart:void 0}}},{key:"bufferedInfo",value:function(e,t,r){var n=[],i=void 0,a=void 0,o=void 0,s=void 0,l=void 0;for(e.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end})),l=0;l<e.length;l++){var u=n.length;if(u){var d=n[u-1].end;e[l].start-d<r?e[l].end>d&&(n[u-1].end=e[l].end):n.push(e[l])}else n.push(e[l])}for(l=0,i=0,a=o=t;l<n.length;l++){var c=n[l].start,f=n[l].end;if(t+r>=c&&t<f)a=c,o=f,i=o-t;else if(t+r<c){s=c;break}}return{len:i,start:a,end:o,nextStart:s}}}]),e}()},function(e,t,r){"use strict";function n(){return"undefined"===typeof window?self:window}Object.defineProperty(t,"__esModule",{value:!0}),t.getSelfScope=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FragmentTracker=t.FragmentState=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0},a=r(3),o=u(a),s=r(1),l=u(s);function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function f(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=t.FragmentState={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};t.FragmentTracker=function(e){function t(e){d(this,t);var r=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,l.default.BUFFER_APPENDED,l.default.FRAG_BUFFERED,l.default.FRAG_LOADED));return r.bufferPadding=.2,r.fragments=Object.create(null),r.timeRanges=Object.create(null),r.config=e.config,r}return f(t,e),n(t,[{key:"destroy",value:function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,o.default.prototype.destroy.call(this),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"getBufferedFrag",value:function(e,t){var r=this.fragments,n=Object.keys(r).filter((function(n){var i=r[n];if(i.body.type!==t)return!1;if(!i.buffered)return!1;var a=i.body;return a.startPTS<=e&&e<=a.endPTS}));if(0===n.length)return null;var i=n.pop();return r[i].body}},{key:"detectEvictedFragments",value:function(e,t){var r=this,n=void 0,i=void 0;Object.keys(this.fragments).forEach((function(a){var o=r.fragments[a];if(!0===o.buffered){var s=o.range[e];if(s){n=s.time;for(var l=0;l<n.length;l++)if(i=n[l],!1===r.isTimeBuffered(i.startPTS,i.endPTS,t)){r.removeFragment(o.body);break}}}}))}},{key:"detectPartialFragments",value:function(e){var t=this,r=this.getFragmentKey(e),n=this.fragments[r];n&&(n.buffered=!0,Object.keys(this.timeRanges).forEach((function(r){if(e.hasElementaryStream(r)){var i=t.timeRanges[r];n.range[r]=t.getBufferedTimes(e.startPTS,e.endPTS,i)}})))}},{key:"getBufferedTimes",value:function(e,t,r){for(var n=[],i=void 0,a=void 0,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}}},{key:"getFragmentKey",value:function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},{key:"getPartialFragment",value:function(e){var t=this,r=void 0,n=void 0,i=void 0,a=null,o=0;return Object.keys(this.fragments).forEach((function(s){var l=t.fragments[s];t.isPartial(l)&&(n=l.body.startPTS-t.bufferPadding,i=l.body.endPTS+t.bufferPadding,e>=n&&e<=i&&(r=Math.min(e-n,i-e),o<=r&&(a=l.body,o=r)))})),a}},{key:"getState",value:function(e){var t=this.getFragmentKey(e),r=this.fragments[t],n=h.NOT_LOADED;return void 0!==r&&(n=r.buffered?!0===this.isPartial(r)?h.PARTIAL:h.OK:h.APPENDING),n}},{key:"isPartial",value: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)}},{key:"isTimeBuffered",value:function(e,t,r){for(var n=void 0,i=void 0,a=0;a<r.length;a++){if(n=r.start(a)-this.bufferPadding,i=r.end(a)+this.bufferPadding,e>=n&&t<=i)return!0;if(t<=n)return!1}return!1}},{key:"onFragLoaded",value:function(e){var t=e.frag;Number.isFinite(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})}},{key:"onBufferAppended",value: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)}))}},{key:"onFragBuffered",value:function(e){this.detectPartialFragments(e.frag)}},{key:"hasFragment",value:function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]}},{key:"removeFragment",value:function(e){var t=this.getFragmentKey(e);delete this.fragments[t]}},{key:"removeAllFragments",value:function(){this.fragments=Object.create(null)}}]),t}(o.default)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addGroupId=i,t.updatePTS=a,t.updateFragPTSDTS=o,t.mergeDetails=s,t.mergeSubtitlePlaylists=l,t.mapFragmentIntersection=u,t.adjustSliding=d,t.computeReloadInterval=c;var n=r(0);function i(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);break}}function a(e,t,r){var i=e[t],a=e[r],o=a.startPTS;Number.isFinite(o)?r>t?(i.duration=o-i.start,i.duration<0&&n.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-o,a.duration<0&&n.logger.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!")):a.start=r>t?i.start+i.duration:Math.max(i.start-a.duration,0)}function o(e,t,r,n,i,o){var s=r;if(Number.isFinite(t.startPTS)){var l=Math.abs(t.startPTS-r);Number.isFinite(t.deltaPTS)?t.deltaPTS=Math.max(l,t.deltaPTS):t.deltaPTS=l,s=Math.max(r,t.startPTS),r=Math.min(r,t.startPTS),n=Math.max(n,t.endPTS),i=Math.min(i,t.startDTS),o=Math.max(o,t.endDTS)}var u=r-t.start;t.start=t.startPTS=r,t.maxStartPTS=s,t.endPTS=n,t.startDTS=i,t.endDTS=o,t.duration=n-r;var d=t.sn;if(!e||d<e.startSN||d>e.endSN)return 0;var c=void 0,f=void 0,h=void 0;for(c=d-e.startSN,f=e.fragments,f[c]=t,h=c;h>0;h--)a(f,h,h-1);for(h=c;h<f.length-1;h++)a(f,h,h+1);return e.PTSKnown=!0,u}function s(e,t){t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment);var r=0,i=void 0;if(u(e,t,(function(e,n){r=e.cc-n.cc,Number.isFinite(e.startPTS)&&(n.start=n.startPTS=e.startPTS,n.endPTS=e.endPTS,n.duration=e.duration,n.backtracked=e.backtracked,n.dropped=e.dropped,i=n),t.PTSKnown=!0})),t.PTSKnown){if(r){n.logger.log("discontinuity sliding from playlist, take drift into account");for(var a=t.fragments,s=0;s<a.length;s++)a[s].cc+=r}i?o(t,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):d(e,t),t.PTSKnown=e.PTSKnown}}function l(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1;u(e,t,(function(e,t,r){t.start=e.start,n=r}));var i=t.fragments;if(n<0)i.forEach((function(e){e.start+=r}));else for(var a=n+1;a<i.length;a++)i[a].start=i[a-1].start+i[a-1].duration}function u(e,t,r){if(e&&t)for(var n=Math.max(e.startSN,t.startSN)-t.startSN,i=Math.min(e.endSN,t.endSN)-t.startSN,a=t.startSN-e.startSN,o=n;o<=i;o++){var s=e.fragments[a+o],l=t.fragments[o];if(!s||!l)break;r(s,l,o)}}function d(e,t){var r=t.startSN-e.startSN,n=e.fragments,i=t.fragments;if(!(r<0||r>n.length))for(var a=0;a<i.length;a++)i[a].start+=n[r].start}function c(e,t,r){var n=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),i=n/2;return e&&t.endSN===e.endSN&&(n=i),r&&(n=Math.max(i,n-(window.performance.now()-r))),Math.round(n)}},function(e,t,r){(function(t){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),t=t.trim(),!t){if(!r.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):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=n.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var u={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var d=s.path,c=d.substring(0,d.lastIndexOf("/")+1)+a.path;u.path=o.normalizePath(c)}else u.path=s.path,a.params||(u.params=s.params,a.query||(u.query=s.query));return null===u.path&&(u.path=r.alwaysNormalize?o.normalizePath(a.path):a.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){e=e.split("").reverse().join("").replace(i,"");while(e.length!==(e=e.replace(a,"")).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 n={search:function(e,t){var r=0,n=e.length-1,i=null,a=null;while(r<=n){i=(r+n)/2|0,a=e[i];var o=t(a);if(o>0)r=i+1;else{if(!(o<0))return a;n=i-1}}return null}};t.default=n,e.exports=t["default"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function(){function e(){i(this,e)}return n(e,null,[{key:"isHeader",value: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}},{key:"isFooter",value: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}},{key:"getID3Data",value:function(t,r){var n=r,i=0;while(e.isHeader(t,r)){i+=10;var a=e._readSize(t,r+6);i+=a,e.isFooter(t,r+10)&&(i+=10),r+=i}if(i>0)return t.subarray(n,n+i)}},{key:"_readSize",value: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],r}},{key:"getTimeStamp",value:function(t){for(var r=e.getID3Frames(t),n=0;n<r.length;n++){var i=r[n];if(e.isTimeStampFrame(i))return e._readTimeStamp(i)}}},{key:"isTimeStampFrame",value:function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}},{key:"_getFrameData",value:function(t){var r=String.fromCharCode(t[0],t[1],t[2],t[3]),n=e._readSize(t,4),i=10;return{type:r,size:n,data:t.subarray(i,i+n)}}},{key:"getID3Frames",value:function(t){var r=0,n=[];while(e.isHeader(t,r)){var i=e._readSize(t,r+6);r+=10;var a=r+i;while(r+8<a){var o=e._getFrameData(t.subarray(r)),s=e._decodeFrame(o);s&&n.push(s),r+=o.size+10}e.isFooter(t,r)&&(r+=10)}return n}},{key:"_decodeFrame",value: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}},{key:"_readTimeStamp",value:function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}}},{key:"_decodePrivFrame",value:function(t){if(!(t.size<2)){var r=e._utf8ArrayToStr(t.data,!0),n=new Uint8Array(t.data.subarray(r.length+1));return{key:t.type,info:r,data:n.buffer}}}},{key:"_decodeTextFrame",value:function(t){if(!(t.size<2)){if("TXXX"===t.type){var r=1,n=e._utf8ArrayToStr(t.data.subarray(r));r+=n.length+1;var i=e._utf8ArrayToStr(t.data.subarray(r));return{key:t.type,info:n,data:i}}var a=e._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:a}}}},{key:"_decodeURLFrame",value:function(t){if("WXXX"===t.type){if(t.size<2)return;var r=1,n=e._utf8ArrayToStr(t.data.subarray(r));r+=n.length+1;var i=e._utf8ArrayToStr(t.data.subarray(r));return{key:t.type,info:n,data:i}}var a=e._utf8ArrayToStr(t.data);return{key:t.type,data:a}}},{key:"_utf8ArrayToStr",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.length,n=void 0,i=void 0,a=void 0,o="",s=0;while(s<r){if(n=e[s++],0===n&&t)return o;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(n);break;case 12:case 13:i=e[s++],o+=String.fromCharCode((31&n)<<6|63&i);break;case 14:i=e[s++],a=e[s++],o+=String.fromCharCode((15&n)<<12|(63&i)<<6|(63&a)<<0);break;default:}}return o}}]),e}(),o=a._utf8ArrayToStr;t.default=a,t.utf8ArrayToStr=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(8),a=u(i),o=r(17),s=l(o);function l(e){return e&&e.__esModule?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=function(){function e(){var t;c(this,e),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[],this.programDateTime=null,this.rawProgramDateTime=null,this._elementaryStreams=(t={},d(t,e.ElementaryStreamTypes.AUDIO,!1),d(t,e.ElementaryStreamTypes.VIDEO,!1),t)}return n(e,[{key:"addElementaryStream",value:function(e){this._elementaryStreams[e]=!0}},{key:"hasElementaryStream",value:function(e){return!0===this._elementaryStreams[e]}},{key:"createInitializationVector",value:function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,t){var r=e;return e&&e.method&&e.uri&&!e.iv&&(r=new s.default,r.method=e.method,r.baseuri=e.baseuri,r.reluri=e.reluri,r.iv=this.createInitializationVector(t)),r}},{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=a.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"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}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata}},{key:"endProgramDateTime",get:function(){if(!Number.isFinite(this.programDateTime))return null;var e=Number.isFinite(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}],[{key:"ElementaryStreamTypes",get:function(){return{AUDIO:"audio",VIDEO:"video"}}}]),e}();t.default=f,e.exports=t["default"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(42),a=g(i),o=r(43),s=g(o),l=r(44),u=g(l),d=r(2),c=r(0),f=r(1),h=g(f),p=r(5);function g(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var v=(0,p.getSelfScope)(),m=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.removePKCS7Padding,a=void 0===i||i;if(y(this,e),this.logEnabled=!0,this.observer=t,this.config=r,this.removePKCS7Padding=a,a)try{var o=v.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch(s){}this.disableWebCrypto=!this.subtle}return n(e,[{key:"isSync",value:function(){return this.disableWebCrypto&&this.config.enableSoftwareAES}},{key:"decrypt",value:function(e,t,r,n){var i=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(c.logger.log("JS AES decrypt"),this.logEnabled=!1);var o=this.decryptor;o||(this.decryptor=o=new u.default),o.expandKey(t),n(o.decrypt(e,0,r,this.removePKCS7Padding))}else{this.logEnabled&&(c.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var l=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new s.default(l,t)),this.fastAesKey.expandKey().then((function(o){var s=new a.default(l,r);s.decrypt(e,o).catch((function(a){i.onWebCryptoError(a,e,t,r,n)})).then((function(e){n(e)}))})).catch((function(a){i.onWebCryptoError(a,e,t,r,n)}))}}},{key:"onWebCryptoError",value:function(e,t,r,n,i){this.config.enableSoftwareAES?(c.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,r,n,i)):(c.logger.error("decrypting error : "+e.message),this.observer.trigger(h.default.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))}},{key:"destroy",value:function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)}}]),e}();t.default=m,e.exports=t["default"]},function(e,t,r){"use strict";function n(){if("undefined"!==typeof window)return window.MediaSource||window.WebKitMediaSource}Object.defineProperty(t,"__esModule",{value:!0}),t.getMediaSource=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.State=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0},a=r(28),o=d(a),s=r(6),l=r(4),u=r(0);function d(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function h(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var p=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"},g=function(e){function t(){return c(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),n(t,[{key:"doTick",value:function(){}},{key:"startLoad",value:function(){}},{key:"stopLoad",value: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=p.STOPPED}},{key:"_streamEnded",value:function(e,t){var r=this.fragCurrent,n=this.fragmentTracker;if(!t.live&&r&&!r.backtracked&&r.sn===t.endSN&&!e.nextStart){var i=n.getState(r);return i===s.FragmentState.PARTIAL||i===s.FragmentState.OK}return!1}},{key:"onMediaSeeking",value:function(){var e=this.config,t=this.media,r=this.mediaBuffer,n=this.state,i=t?t.currentTime:null,a=l.BufferHelper.bufferInfo(r||t,i,this.config.maxBufferHole);if(Number.isFinite(i)&&u.logger.log("media seeking to "+i.toFixed(3)),n===p.FRAG_LOADING){var o=this.fragCurrent;if(0===a.len&&o){var s=e.maxFragLookUpTolerance,d=o.start-s,c=o.start+o.duration+s;i<d||i>c?(o.loader&&(u.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=p.IDLE):u.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else n===p.ENDED&&(0===a.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=p.IDLE);t&&(this.lastCurrentTime=i),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=i),this.tick()}},{key:"onMediaEnded",value:function(){this.startPosition=this.lastCurrentTime=0}},{key:"onHandlerDestroying",value:function(){this.stopLoad(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onHandlerDestroying",this).call(this)}},{key:"onHandlerDestroyed",value:function(){this.state=p.STOPPED,this.fragmentTracker=null}}]),t}(o.default);t.default=g},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0},a=r(1),o=g(a),s=r(3),l=g(s),u=r(2),d=r(0),c=r(16),f=g(c),h=r(35),p=g(h);function g(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function m(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _=window,b=_.performance,x={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},k={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},E=function(e){function t(e){y(this,t);var r=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o.default.MANIFEST_LOADING,o.default.LEVEL_LOADING,o.default.AUDIO_TRACK_LOADING,o.default.SUBTITLE_TRACK_LOADING));return r.loaders={},r}return m(t,e),n(t,[{key:"createInternalLoader",value:function(e){var t=this.hls.config,r=t.pLoader,n=t.loader,i=r||n,a=new i(t);return e.loader=a,this.loaders[e.type]=a,a}},{key:"getInternalLoader",value:function(e){return this.loaders[e.type]}},{key:"resetInternalLoader",value:function(e){this.loaders[e]&&delete this.loaders[e]}},{key:"destroyInternalLoaders",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}},{key:"destroy",value:function(){this.destroyInternalLoaders(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,{type:x.MANIFEST,level:0,id:null})}},{key:"onLevelLoading",value:function(e){this.load(e.url,{type:x.LEVEL,level:e.level,id:e.id})}},{key:"onAudioTrackLoading",value:function(e){this.load(e.url,{type:x.AUDIO_TRACK,level:null,id:e.id})}},{key:"onSubtitleTrackLoading",value:function(e){this.load(e.url,{type:x.SUBTITLE_TRACK,level:null,id:e.id})}},{key:"load",value:function(e,t){var r=this.hls.config;d.logger.debug("Loading playlist of type "+t.type+", level: "+t.level+", id: "+t.id);var n=this.getInternalLoader(t);if(n){var i=n.context;if(i&&i.url===e)return d.logger.trace("playlist request ongoing"),!1;d.logger.warn("aborting previous loader for type: "+t.type),n.abort()}var a=void 0,o=void 0,s=void 0,l=void 0;switch(t.type){case x.MANIFEST:a=r.manifestLoadingMaxRetry,o=r.manifestLoadingTimeOut,s=r.manifestLoadingRetryDelay,l=r.manifestLoadingMaxRetryTimeout;break;case x.LEVEL:a=0,o=r.levelLoadingTimeOut;break;default:a=r.levelLoadingMaxRetry,o=r.levelLoadingTimeOut,s=r.levelLoadingRetryDelay,l=r.levelLoadingMaxRetryTimeout;break}n=this.createInternalLoader(t),t.url=e,t.responseType=t.responseType||"";var u={timeout:o,maxRetry:a,retryDelay:s,maxRetryDelay:l},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return d.logger.debug("Calling internal loader delegate for URL: "+e),n.load(t,u,c),!0}},{key:"loadsuccess",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(r.isSidxRequest)return this._handleSidxRequest(e,r),void this._handlePlaylistLoaded(e,t,r,n);this.resetInternalLoader(r.type);var i=e.data;t.tload=b.now(),0===i.indexOf("#EXTM3U")?i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,r,n):this._handleMasterPlaylist(e,t,r,n):this._handleManifestParsingError(e,r,"no EXTM3U delimiter",n)}},{key:"loaderror",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(t,r,!1,e)}},{key:"loadtimeout",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(t,r,!0)}},{key:"_handleMasterPlaylist",value:function(e,r,n,i){var a=this.hls,s=e.data,l=t.getResponseUrl(e,n),u=p.default.parseMasterPlaylist(s,l);if(u.length){var c=u.map((function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}})),f=p.default.parseMasterPlaylistMedia(s,l,"AUDIO",c),h=p.default.parseMasterPlaylistMedia(s,l,"SUBTITLES");if(f.length){var g=!1;f.forEach((function(e){e.url||(g=!0)})),!1===g&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(d.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main"}))}a.trigger(o.default.MANIFEST_LOADED,{levels:u,audioTracks:f,subtitles:h,url:l,stats:r,networkDetails:i})}else this._handleManifestParsingError(e,n,"no level found in manifest",i)}},{key:"_handleTrackOrLevelPlaylist",value:function(e,r,n,i){var a=this.hls,s=n.id,l=n.level,u=n.type,d=t.getResponseUrl(e,n),c=Number.isFinite(s)?s:0,f=Number.isFinite(l)?l:c,h=t.mapContextToLevelType(n),g=p.default.parseLevelPlaylist(e.data,d,f,h,c);if(g.tload=r.tload,u===x.MANIFEST){var y={url:d,details:g};a.trigger(o.default.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:d,stats:r,networkDetails:i})}if(r.tparsed=b.now(),g.needSidxRanges){var v=g.initSegment.url;this.load(v,{isSidxRequest:!0,type:u,level:l,levelDetails:g,id:s,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else n.levelDetails=g,this._handlePlaylistLoaded(e,r,n,i)}},{key:"_handleSidxRequest",value:function(e,t){var r=f.default.parseSegmentIndex(new Uint8Array(e.data));if(r){var n=r.references,i=t.levelDetails;n.forEach((function(e,t){var r=e.info,n=i.fragments[t];0===n.byteRange.length&&(n.rawByteRange=String(1+r.end-r.start)+"@"+String(r.start))})),i.initSegment.rawByteRange=String(r.moovEndOffset)+"@0"}}},{key:"_handleManifestParsingError",value:function(e,t,r,n){this.hls.trigger(o.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:r,networkDetails:n})}},{key:"_handleNetworkError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;d.logger.info("A network error occured while loading a "+e.type+"-type playlist");var i=void 0,a=void 0,s=this.getInternalLoader(e);switch(e.type){case x.MANIFEST:i=r?u.ErrorDetails.MANIFEST_LOAD_TIMEOUT:u.ErrorDetails.MANIFEST_LOAD_ERROR,a=!0;break;case x.LEVEL:i=r?u.ErrorDetails.LEVEL_LOAD_TIMEOUT:u.ErrorDetails.LEVEL_LOAD_ERROR,a=!1;break;case x.AUDIO_TRACK:i=r?u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,a=!1;break;default:a=!1}s&&(s.abort(),this.resetInternalLoader(e.type));var l={type:u.ErrorTypes.NETWORK_ERROR,details:i,fatal:a,url:s.url,loader:s,context:e,networkDetails:t};n&&(l.response=n),this.hls.trigger(o.default.ERROR,l)}},{key:"_handlePlaylistLoaded",value:function(e,r,n,i){var a=n.type,s=n.level,l=n.id,u=n.levelDetails;if(u.targetduration){var d=t.canHaveQualityLevels(n.type);if(d)this.hls.trigger(o.default.LEVEL_LOADED,{details:u,level:s||0,id:l||0,stats:r,networkDetails:i});else switch(a){case x.AUDIO_TRACK:this.hls.trigger(o.default.AUDIO_TRACK_LOADED,{details:u,id:l,stats:r,networkDetails:i});break;case x.SUBTITLE_TRACK:this.hls.trigger(o.default.SUBTITLE_TRACK_LOADED,{details:u,id:l,stats:r,networkDetails:i});break}}else this._handleManifestParsingError(e,n,"invalid target duration",i)}}],[{key:"canHaveQualityLevels",value:function(e){return e!==x.AUDIO_TRACK&&e!==x.SUBTITLE_TRACK}},{key:"mapContextToLevelType",value:function(e){var t=e.type;switch(t){case x.AUDIO_TRACK:return k.AUDIO;case x.SUBTITLE_TRACK:return k.SUBTITLE;default:return k.MAIN}}},{key:"getResponseUrl",value:function(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}},{key:"ContextType",get:function(){return x}},{key:"LevelType",get:function(){return k}}]),t}(l.default);t.default=E,e.exports=t["default"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),a=r(1),o=s(a);function s(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=Math.pow(2,32)-1,d=function(){function e(t,r){l(this,e),this.observer=t,this.remuxer=r}return n(e,[{key:"resetTimeStamp",value:function(e){this.initPTS=e}},{key:"resetInitSegment",value:function(t,r,n,i){if(t&&t.byteLength){var a=this.initData=e.parseInitSegment(t);null==r&&(r="mp4a.40.5"),null==n&&(n="avc1.42e01e");var s={};a.audio&&a.video?s.audiovideo={container:"video/mp4",codec:r+","+n,initSegment:i?t:null}:(a.audio&&(s.audio={container:"audio/mp4",codec:r,initSegment:i?t:null}),a.video&&(s.video={container:"video/mp4",codec:n,initSegment:i?t:null})),this.observer.trigger(o.default.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else r&&(this.audioCodec=r),n&&(this.videoCodec=n)}},{key:"append",value:function(t,r,n,i){var a=this.initData;a||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),a=this.initData);var s=void 0,l=this.initPTS;if(void 0===l){var u=e.getStartDTS(a,t);this.initPTS=l=u-r,this.observer.trigger(o.default.INIT_PTS_FOUND,{initPTS:l})}e.offsetStartDTS(a,t,l),s=e.getStartDTS(a,t),this.remuxer.remux(a.audio,a.video,null,null,s,n,i,t)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0}},{key:"bin2str",value:function(e){return String.fromCharCode.apply(null,e)}},{key:"readUint16",value: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}},{key:"readUint32",value: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}},{key:"writeUint32",value: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}},{key:"findBox",value:function(t,r){var n=[],i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,d=void 0;if(t.data?(u=t.start,s=t.end,t=t.data):(u=0,s=t.byteLength),!r.length)return null;for(i=u;i<s;)a=e.readUint32(t,i),o=e.bin2str(t.subarray(i+4,i+8)),d=a>1?i+a:s,o===r[0]&&(1===r.length?n.push({data:t,start:i+8,end:d}):(l=e.findBox({data:t,start:i+8,end:d},r.slice(1)),l.length&&(n=n.concat(l)))),i=d;return n}},{key:"parseSegmentIndex",value:function(t){var r=e.findBox(t,["moov"])[0],n=r?r.end:null,i=0,a=e.findBox(t,["sidx"]),o=void 0;if(!a||!a[0])return null;o=[],a=a[0];var s=a.data[0];i=0===s?8:16;var l=e.readUint32(a,i);i+=4;var u=0,d=0;i+=0===s?8:16,i+=2;var c=a.end+d,f=e.readUint16(a,i);i+=2;for(var h=0;h<f;h++){var p=i,g=e.readUint32(a,p);p+=4;var y=2147483647&g,v=(2147483648&g)>>>31;if(1===v)return void console.warn("SIDX has hierarchical references (not supported)");var m=e.readUint32(a,p);p+=4,o.push({referenceSize:y,subsegmentDuration:m,info:{duration:m/l,start:c,end:c+y-1}}),c+=y,p+=4,i=p}return{earliestPresentationTime:u,timescale:l,version:s,referencesCount:f,references:o,moovEndOffset:n}}},{key:"parseInitSegment",value:function(t){var r=[],n=e.findBox(t,["moov","trak"]);return n.forEach((function(t){var n=e.findBox(t,["tkhd"])[0];if(n){var a=n.data[n.start],o=0===a?12:20,s=e.readUint32(n,o),l=e.findBox(t,["mdia","mdhd"])[0];if(l){a=l.data[l.start],o=0===a?12:20;var u=e.readUint32(l,o),d=e.findBox(t,["mdia","hdlr"])[0];if(d){var c=e.bin2str(d.data.subarray(d.start+8,d.start+12)),f={soun:"audio",vide:"video"}[c];if(f){var h=e.findBox(t,["mdia","minf","stbl","stsd"]);if(h.length){h=h[0];var p=e.bin2str(h.data.subarray(h.start+12,h.start+16));i.logger.log("MP4Demuxer:"+f+":"+p+" found")}r[s]={timescale:u,type:f},r[f]={timescale:u,id:s}}}}}})),r}},{key:"getStartDTS",value:function(t,r){var n=void 0,i=void 0,a=void 0;return n=e.findBox(r,["moof","traf"]),i=[].concat.apply([],n.map((function(r){return e.findBox(r,["tfhd"]).map((function(n){var i=void 0,a=void 0,o=void 0;return i=e.readUint32(n,4),a=t[i].timescale||9e4,o=e.findBox(r,["tfdt"]).map((function(t){var r=void 0,n=void 0;return r=t.data[t.start],n=e.readUint32(t,4),1===r&&(n*=Math.pow(2,32),n+=e.readUint32(t,8)),n}))[0],o/a}))}))),a=Math.min.apply(null,i),isFinite(a)?a:0}},{key:"offsetStartDTS",value:function(t,r,n){e.findBox(r,["moof","traf"]).map((function(r){return e.findBox(r,["tfhd"]).map((function(i){var a=e.readUint32(i,4),o=t[a].timescale||9e4;e.findBox(r,["tfdt"]).map((function(t){var r=t.data[t.start],i=e.readUint32(t,4);if(0===r)e.writeUint32(t,4,i-n*o);else{i*=Math.pow(2,32),i+=e.readUint32(t,8),i-=n*o,i=Math.max(i,0);var a=Math.floor(i/(u+1)),s=Math.floor(i%(u+1));e.writeUint32(t,4,a),e.writeUint32(t,8,s)}}))}))}))}}]),e}();t.default=d,e.exports=t["default"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(8),a=o(i);function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function e(){s(this,e),this.method=null,this.key=null,this.iv=null,this._uri=null}return n(e,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=a.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),e}();t.default=l,e.exports=t["default"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={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}};function i(e,t){var r=n[t];return!!r&&!0===r[e.slice(0,4)]}function a(e,t){return window.MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}t.isCodecType=i,t.isCodecSupportedInMp4=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=(r(20),r(41)),a=y(i),o=r(1),s=g(o),l=r(21),u=g(l),d=r(0),c=r(2),f=r(13),h=r(5),p=r(24);function g(e){return e&&e.__esModule?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var m=(0,h.getSelfScope)(),_=(0,f.getMediaSource)(),b=function(){function e(t,r){var n=this;v(this,e),this.hls=t,this.id=r;var i=this.observer=new p.Observer,o=t.config,l=function(e,r){r=r||{},r.frag=n.frag,r.id=n.id,t.trigger(e,r)};i.on(s.default.FRAG_DECRYPTED,l),i.on(s.default.FRAG_PARSING_INIT_SEGMENT,l),i.on(s.default.FRAG_PARSING_DATA,l),i.on(s.default.FRAG_PARSED,l),i.on(s.default.ERROR,l),i.on(s.default.FRAG_PARSING_METADATA,l),i.on(s.default.FRA