forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hls.light.min.js
2 lines (2 loc) · 166 KB
/
hls.light.min.js
1
2
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Hls=e():t.Hls=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=18)}([function(t,e,r){"use strict";function a(){}function i(t,e){return e="["+t+"] > "+e}function n(t){var e=self.console[t];return e?function(){for(var r=arguments.length,a=Array(r),n=0;n<r;n++)a[n]=arguments[n];a[0]&&(a[0]=i(t,a[0])),e.apply(self.console,a)}:a}function o(t){for(var e=arguments.length,r=Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];r.forEach(function(e){u[e]=t[e]?t[e].bind(t):n(e)})}r.d(e,"a",function(){return d}),r.d(e,"b",function(){return f});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l={trace:a,debug:a,log:a,warn:a,info:a,error:a},u=l,d=function(t){if(!0===t||"object"===(void 0===t?"undefined":s(t))){o(t,"debug","log","info","warn","error");try{u.log()}catch(t){u=l}}else u=l},f=u},function(t,e,r){"use strict";e.a={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_SWITCH:"hlsLevelSwitch",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_SWITCH:"hlsAudioTrackSwitch",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(t,e,r){"use strict";r.d(e,"b",function(){return a}),r.d(e,"a",function(){return i});var a={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",KEY_SYSTEM_ERROR:"keySystemError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},i={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_LOOP_LOADING_ERROR:"fragLoopLoadingError",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(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(0),n=r(2),o=r(1),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=new Set(["hlsEventGeneric","hlsHandlerDestroying","hlsHandlerDestroyed"]),u=function(){function t(e){a(this,t),this.hls=e,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];this.handledEvents=i,this.useGenericHandler=!0,this.registerListeners()}return t.prototype.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},t.prototype.onHandlerDestroying=function(){},t.prototype.onHandlerDestroyed=function(){},t.prototype.isEventHandler=function(){return"object"===s(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent},t.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){if(l.has(t))throw new Error("Forbidden event-name: "+t);this.hls.on(t,this.onEvent)},this)},t.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){this.hls.off(t,this.onEvent)},this)},t.prototype.onEvent=function(t,e){this.onEventGeneric(t,e)},t.prototype.onEventGeneric=function(t,e){var r=function(t,e){var r="on"+t.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,e)};try{r.call(this,t,e).call()}catch(e){i.b.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.hls.trigger(o.a.ERROR,{type:n.b.OTHER_ERROR,details:n.a.INTERNAL_EXCEPTION,fatal:!1,event:t,err:e})}},t}();e.a=u},function(t,e){},function(t,e,r){!function(e){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,a=/^([^\/;?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var n=this.parseURL(e);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)):e;var s=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=a.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(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(i,"");t.length!==(t=t.replace(n,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=o}()},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(){a(this,t)}return t.isHeader=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},t.isFooter=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},t.getID3Data=function(e,r){for(var a=r,i=0;t.isHeader(e,r);){i+=10;i+=t._readSize(e,r+6),t.isFooter(e,r+10)&&(i+=10),r+=i}if(i>0)return e.subarray(a,a+i)},t._readSize=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},t.getTimeStamp=function(e){for(var r=t.getID3Frames(e),a=0;a<r.length;a++){var i=r[a];if(t.isTimeStampFrame(i))return t._readTimeStamp(i)}},t.isTimeStampFrame=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},t._getFrameData=function(e){var r=String.fromCharCode(e[0],e[1],e[2],e[3]),a=t._readSize(e,4);return{type:r,size:a,data:e.subarray(10,10+a)}},t.getID3Frames=function(e){for(var r=0,a=[];t.isHeader(e,r);){var i=t._readSize(e,r+6);r+=10;for(var n=r+i;r+8<n;){var o=t._getFrameData(e.subarray(r)),s=t._decodeFrame(o);s&&a.push(s),r+=o.size+10}t.isFooter(e,r)&&(r+=10)}return a},t._decodeFrame=function(e){return"PRIV"===e.type?t._decodePrivFrame(e):"T"===e.type[0]?t._decodeTextFrame(e):"W"===e.type[0]?t._decodeURLFrame(e):void 0},t._readTimeStamp=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],a=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return a/=45,r&&(a+=47721858.84),Math.round(a)}},t._decodePrivFrame=function(e){if(!(e.size<2)){var r=t._utf8ArrayToStr(e.data,!0),a=new Uint8Array(e.data.subarray(r.length+1));return{key:e.type,info:r,data:a.buffer}}},t._decodeTextFrame=function(e){if(!(e.size<2)){if("TXXX"===e.type){var r=1,a=t._utf8ArrayToStr(e.data.subarray(r));r+=a.length+1;var i=t._utf8ArrayToStr(e.data.subarray(r));return{key:e.type,info:a,data:i}}var n=t._utf8ArrayToStr(e.data.subarray(1));return{key:e.type,data:n}}},t._decodeURLFrame=function(e){if("WXXX"===e.type){if(e.size<2)return;var r=1,a=t._utf8ArrayToStr(e.data.subarray(r));r+=a.length+1;var i=t._utf8ArrayToStr(e.data.subarray(r));return{key:e.type,info:a,data:i}}var n=t._utf8ArrayToStr(e.data);return{key:e.type,data:n}},t._utf8ArrayToStr=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.length,a=void 0,i=void 0,n=void 0,o="",s=0;s<r;){if(0===(a=t[s++])&&e)return o;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(a);break;case 12:case 13:i=t[s++],o+=String.fromCharCode((31&a)<<6|63&i);break;case 14:i=t[s++],n=t[s++],o+=String.fromCharCode((15&a)<<12|(63&i)<<6|(63&n)<<0)}}return o},t}();i._utf8ArrayToStr;e.a=i},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(t){return"function"==typeof t}function i(t){return"number"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,i,s,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var d=new Error('Uncaught, unspecified "error" event. ('+e+")");throw d.context=e,d}if(r=this._events[t],o(r))return!1;if(a(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(n(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,s);return!0},r.prototype.addListener=function(t,e){var i;if(!a(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,a(e.listener)?e.listener:e),this._events[t]?n(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,n(this._events[t])&&!this._events[t].warned&&(i=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,o,s;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,i=-1,r===e||a(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(n(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){i=s;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],a(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){"use strict";function a(){if("undefined"!=typeof window)return window.MediaSource||window.WebKitMediaSource}e.a=a},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(0),n=r(1),o=Math.pow(2,32)-1,s=function(){function t(e,r){a(this,t),this.observer=e,this.remuxer=r}return t.prototype.resetTimeStamp=function(t){this.initPTS=t},t.prototype.resetInitSegment=function(e,r,a,i){if(e&&e.byteLength){var o=this.initData=t.parseInitSegment(e);null==r&&(r="mp4a.40.5"),null==a&&(a="avc1.42e01e");var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:r+","+a,initSegment:i?e:null}:(o.audio&&(s.audio={container:"audio/mp4",codec:r,initSegment:i?e:null}),o.video&&(s.video={container:"video/mp4",codec:a,initSegment:i?e:null})),this.observer.trigger(n.a.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else r&&(this.audioCodec=r),a&&(this.videoCodec=a)},t.probe=function(e){return t.findBox({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length>0},t.bin2str=function(t){return String.fromCharCode.apply(null,t)},t.readUint16=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<8|t[e+1];return r<0?65536+r:r},t.readUint32=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return r<0?4294967296+r:r},t.writeUint32=function(t,e,r){t.data&&(e+=t.start,t=t.data),t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r},t.findBox=function(e,r){var a,i,n,o,s,l,u,d=[];if(e.data?(l=e.start,o=e.end,e=e.data):(l=0,o=e.byteLength),!r.length)return null;for(a=l;a<o;)i=t.readUint32(e,a),n=t.bin2str(e.subarray(a+4,a+8)),u=i>1?a+i:o,n===r[0]&&(1===r.length?d.push({data:e,start:a+8,end:u}):(s=t.findBox({data:e,start:a+8,end:u},r.slice(1)),s.length&&(d=d.concat(s)))),a=u;return d},t.parseSegmentIndex=function(e){var r=t.findBox(e,["moov"])[0],a=r?r.end:null,i=0,n=t.findBox(e,["sidx"]),o=void 0;if(!n||!n[0])return null;o=[],n=n[0];var s=n.data[0];i=0===s?8:16;var l=t.readUint32(n,i);i+=4;i+=0===s?8:16,i+=2;var u=n.end+0,d=t.readUint16(n,i);i+=2;for(var f=0;f<d;f++){var h=i,c=t.readUint32(n,h);h+=4;var p=2147483647&c;if(1===(2147483648&c)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var v=t.readUint32(n,h);h+=4,o.push({referenceSize:p,subsegmentDuration:v,info:{duration:v/l,start:u,end:u+p-1}}),u+=p,h+=4,i=h}return{earliestPresentationTime:0,timescale:l,version:s,referencesCount:d,references:o,moovEndOffset:a}},t.parseInitSegment=function(e){var r=[];return t.findBox(e,["moov","trak"]).forEach(function(e){var a=t.findBox(e,["tkhd"])[0];if(a){var n=a.data[a.start],o=0===n?12:20,s=t.readUint32(a,o),l=t.findBox(e,["mdia","mdhd"])[0];if(l){n=l.data[l.start],o=0===n?12:20;var u=t.readUint32(l,o),d=t.findBox(e,["mdia","hdlr"])[0];if(d){var f=t.bin2str(d.data.subarray(d.start+8,d.start+12)),h={soun:"audio",vide:"video"}[f];if(h){var c=t.findBox(e,["mdia","minf","stbl","stsd"]);if(c.length){c=c[0];var p=t.bin2str(c.data.subarray(c.start+12,c.start+16));i.b.log("MP4Demuxer:"+h+":"+p+" found")}r[s]={timescale:u,type:h},r[h]={timescale:u,id:s}}}}}}),r},t.getStartDTS=function(e,r){var a,i,n;return a=t.findBox(r,["moof","traf"]),i=[].concat.apply([],a.map(function(r){return t.findBox(r,["tfhd"]).map(function(a){var i,n;return i=t.readUint32(a,4),n=e[i].timescale||9e4,t.findBox(r,["tfdt"]).map(function(e){var r,a;return r=e.data[e.start],a=t.readUint32(e,4),1===r&&(a*=Math.pow(2,32),a+=t.readUint32(e,8)),a})[0]/n})})),n=Math.min.apply(null,i),isFinite(n)?n:0},t.offsetStartDTS=function(e,r,a){t.findBox(r,["moof","traf"]).map(function(r){return t.findBox(r,["tfhd"]).map(function(i){var n=t.readUint32(i,4),s=e[n].timescale||9e4;t.findBox(r,["tfdt"]).map(function(e){var r=e.data[e.start],i=t.readUint32(e,4);if(0===r)t.writeUint32(e,4,i-a*s);else{i*=Math.pow(2,32),i+=t.readUint32(e,8),i-=a*s,i=Math.max(i,0);var n=Math.floor(i/(o+1)),l=Math.floor(i%(o+1));t.writeUint32(e,4,n),t.writeUint32(e,8,l)}})})})},t.prototype.append=function(e,r,a,i){var o=this.initData;o||(this.resetInitSegment(e,this.audioCodec,this.videoCodec,!1),o=this.initData);var s=void 0,l=this.initPTS;if(void 0===l){var u=t.getStartDTS(o,e);this.initPTS=l=u-r,this.observer.trigger(n.a.INIT_PTS_FOUND,{initPTS:l})}t.offsetStartDTS(o,e,l),s=t.getStartDTS(o,e),this.remuxer.remux(o.audio,o.video,null,null,s,a,i,e)},t.prototype.destroy=function(){},t}();e.a=s},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(5),n=r.n(i),o=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),s=function(){function t(){a(this,t),this.method=null,this.key=null,this.iv=null,this._uri=null}return o(t,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=n.a.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),t}();e.a=s},function(t,e,r){"use strict";function a(t,e){var r=n[e];return!!r&&!0===r[t.slice(0,4)]}function i(t,e){return MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}r.d(e,"b",function(){return a}),r.d(e,"a",function(){return i});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(t,e,r){"use strict";var a={search:function(t,e){for(var r=0,a=t.length-1,i=null,n=null;r<=a;){i=(r+a)/2|0,n=t[i];var o=e(n);if(o>0)r=i+1;else{if(!(o<0))return n;a=i-1}}return null}};e.a=a},function(t,e,r){"use strict";var a={isBuffered:function(t,e){try{if(t)for(var r=t.buffered,a=0;a<r.length;a++)if(e>=r.start(a)&&e<=r.end(a))return!0}catch(t){}return!1},bufferInfo:function(t,e,r){try{if(t){var a,i=t.buffered,n=[];for(a=0;a<i.length;a++)n.push({start:i.start(a),end:i.end(a)});return this.bufferedInfo(n,e,r)}}catch(t){}return{len:0,start:e,end:e,nextStart:void 0}},bufferedInfo:function(t,e,r){var a,i,n,o,s,l=[];for(t.sort(function(t,e){var r=t.start-e.start;return r||e.end-t.end}),s=0;s<t.length;s++){var u=l.length;if(u){var d=l[u-1].end;t[s].start-d<r?t[s].end>d&&(l[u-1].end=t[s].end):l.push(t[s])}else l.push(t[s])}for(s=0,a=0,i=n=e;s<l.length;s++){var f=l[s].start,h=l[s].end;if(e+r>=f&&e<h)i=f,n=h,a=n-e;else if(e+r<f){o=f;break}}return{len:a,start:i,end:n,nextStart:o}}};e.a=a},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1),n=r(2),o=r(15),s=r(30),l=r(9),u=r(31),d=r(34),f=r(35),h=r(38),c=function(){function t(e,r,i,n){a(this,t),this.observer=e,this.typeSupported=r,this.config=i,this.vendor=n}return t.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},t.prototype.push=function(t,e,r,a,n,s,l,u,d,f,h,c){if(t.byteLength>0&&null!=e&&null!=e.key&&"AES-128"===e.method){var p=this.decrypter;null==p&&(p=this.decrypter=new o.a(this.observer,this.config));var v,g=this;try{v=performance.now()}catch(t){v=Date.now()}p.decrypt(t,e.key.buffer,e.iv.buffer,function(t){var o;try{o=performance.now()}catch(t){o=Date.now()}g.observer.trigger(i.a.FRAG_DECRYPTED,{stats:{tstart:v,tdecrypt:o}}),g.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),a,n,s,l,u,d,f,h,c)})}else this.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),a,n,s,l,u,d,f,h,c)},t.prototype.pushDecrypted=function(t,e,r,a,o,c,p,v,g,y,m,b){var E=this.demuxer;if(!E||p&&!this.probe(t)){for(var S=this.observer,T=this.typeSupported,A=this.config,R=[{demux:u.a,remux:f.a},{demux:l.a,remux:h.a},{demux:s.a,remux:f.a},{demux:d.a,remux:f.a}],_=0,L=R.length;_<L;_++){var w=R[_],D=w.demux.probe;if(D(t)){var O=this.remuxer=new w.remux(S,A,T,this.vendor);E=new w.demux(S,O,A,T),this.probe=D;break}}if(!E)return void S.trigger(i.a.ERROR,{type:n.b.MEDIA_ERROR,details:n.a.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=E}var I=this.remuxer;(p||v)&&(E.resetInitSegment(r,a,o,y),I.resetInitSegment()),p&&(E.resetTimeStamp(b),I.resetTimeStamp(b)),"function"==typeof E.setDecryptData&&E.setDecryptData(e),E.append(t,c,g,m)},t}();e.a=c},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(27),n=r(28),o=r(29),s=r(2),l=r(0),u=function(){function t(e,r){a(this,t),this.observer=e,this.config=r,this.logEnabled=!0;try{var i=crypto||self.crypto;this.subtle=i.subtle||i.webkitSubtle}catch(t){}this.disableWebCrypto=!this.subtle}return t.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},t.prototype.decrypt=function(t,e,r,a){var s=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(l.b.log("JS AES decrypt"),this.logEnabled=!1);var u=this.decryptor;u||(this.decryptor=u=new o.a),u.expandKey(e),a(u.decrypt(t,0,r))}else{this.logEnabled&&(l.b.log("WebCrypto AES decrypt"),this.logEnabled=!1);var d=this.subtle;this.key!==e&&(this.key=e,this.fastAesKey=new n.a(d,e)),this.fastAesKey.expandKey().then(function(n){new i.a(d,r).decrypt(t,n).catch(function(i){s.onWebCryptoError(i,t,e,r,a)}).then(function(t){a(t)})}).catch(function(i){s.onWebCryptoError(i,t,e,r,a)})}},t.prototype.onWebCryptoError=function(t,e,r,a,i){this.config.enableSoftwareAES?(l.b.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(e,r,a,i)):(l.b.error("decrypting error : "+t.message),this.observer.trigger(Event.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))},t.prototype.destroy=function(){var t=this.decryptor;t&&(t.destroy(),this.decryptor=void 0)},t}();e.a=u},function(t,e,r){"use strict";function a(t,e,r,a){var i,n,o,s,l,u=navigator.userAgent.toLowerCase(),d=a,f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return i=1+((192&e[r+2])>>>6),(n=(60&e[r+2])>>>2)>f.length-1?void t.trigger(Event.ERROR,{type:p.b.MEDIA_ERROR,details:p.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n}):(s=(1&e[r+2])<<2,s|=(192&e[r+3])>>>6,c.b.log("manifest codec:"+a+",ADTS data:type:"+i+",sampleingIndex:"+n+"["+f[n]+"Hz],channelConfig:"+s),/firefox/i.test(u)?n>=6?(i=5,l=new Array(4),o=n-3):(i=2,l=new Array(2),o=n):-1!==u.indexOf("android")?(i=2,l=new Array(2),o=n):(i=5,l=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&n>=6?o=n-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(n>=6&&1===s||/vivaldi/i.test(u))||!a&&1===s)&&(i=2,l=new Array(2)),o=n)),l[0]=i<<3,l[0]|=(14&n)>>1,l[1]|=(1&n)<<7,l[1]|=s<<3,5===i&&(l[1]|=(14&o)>>1,l[2]=(1&o)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:f[n],channelCount:s,codec:"mp4a.40."+i,manifestCodec:d})}function i(t,e){return 255===t[e]&&240==(246&t[e+1])}function n(t,e){return 1&t[e+1]?7:9}function o(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function s(t,e){return!!(e+1<t.length&&i(t,e))}function l(t,e){if(e+1<t.length&&i(t,e)){var r=n(t,e),a=r;e+5<t.length&&(a=o(t,e));var s=e+a;if(s===t.length||s+1<t.length&&i(t,s))return!0}return!1}function u(t,e,r,i,n){if(!t.samplerate){var o=a(e,r,i,n);t.config=o.config,t.samplerate=o.samplerate,t.channelCount=o.channelCount,t.codec=o.codec,t.manifestCodec=o.manifestCodec,c.b.log("parsed codec:"+t.codec+",rate:"+o.samplerate+",nb channel:"+o.channelCount)}}function d(t){return 9216e4/t}function f(t,e,r,a,i){var s,l,u,d=t.length;if(s=n(t,e),l=o(t,e),(l-=s)>0&&e+s+l<=d)return u=r+a*i,{headerLength:s,frameLength:l,stamp:u}}function h(t,e,r,a,i){var n=d(t.samplerate),o=f(e,r,a,i,n);if(o){var s=o.stamp,l=o.headerLength,u=o.frameLength,h={unit:e.subarray(r+l,r+l+u),pts:s,dts:s};return t.samples.push(h),t.len+=u,{sample:h,length:u+l}}}e.d=s,e.e=l,e.c=u,e.b=d,e.a=h;var c=r(0),p=r(2)},function(t,e,r){"use strict";var a={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(t,e,r,a,i){if(!(r+24>e.length)){var n=this.parseHeader(e,r);if(n&&r+n.frameLength<=e.length){var o=9e4*n.samplesPerFrame/n.sampleRate,s=a+i*o,l={unit:e.subarray(r,r+n.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(l),t.len+=n.frameLength,{sample:l,length:n.frameLength}}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,n=t[e+2]>>4&15,o=t[e+2]>>2&3,s=t[e+2]>>1&1;if(1!==r&&0!==n&&15!==n&&3!==o){var l=3===r?3-i:3===i?3:4,u=1e3*a.BitratesMap[14*l+n-1],d=3===r?0:2===r?1:2,f=a.SamplingRateMap[3*d+o],h=t[e+3]>>6==3?1:2,c=a.SamplesCoefficients[r][i],p=a.BytesInSlot[i],v=8*c*p;return{sampleRate:f,channelCount:h,frameLength:parseInt(c*u/f+s,10)*p,samplesPerFrame:v}}},isHeaderPattern:function(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1<t.length&&this.isHeaderPattern(t,e))},probe:function(t,e){if(e+1<t.length&&this.isHeaderPattern(t,e)){var r=this.parseHeader(t,e),a=4;r&&r.frameLength&&(a=r.frameLength);var i=e+a;if(i===t.length||i+1<t.length&&this.isHeaderPattern(t,i))return!0}return!1}};e.a=a},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),n=r.n(i),o=r(1),s=r(2),l=r(19),u=r(23),d=r(24),f=r(25),h=r(45),c=r(46),p=r(47),v=r(0),g=r(7),y=r.n(g),m=r(48),b=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}();r(57);var E=function(){function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,t);var i=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 i)n in r||(r[n]=i[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"');Object(v.a)(r.debug),this.config=r,this._autoLevelCapping=-1;var o=this.observer=new y.a;o.trigger=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];o.emit.apply(o,[t,t].concat(r))},o.off=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];o.removeListener.apply(o,[t].concat(r))},this.on=o.on.bind(o),this.off=o.off.bind(o),this.trigger=o.trigger.bind(o);var s=this.abrController=new r.abrController(this),p=new r.bufferController(this),g=new r.capLevelController(this),m=new r.fpsController(this),b=new l.a(this),E=new u.a(this),S=new d.a(this),T=new c.a(this),A=this.levelController=new h.a(this),R=this.streamController=new f.a(this),_=[A,R],L=r.audioStreamController;L&&_.push(new L(this)),this.networkControllers=_;var w=[b,E,S,s,p,g,m,T];if(L=r.audioTrackController){var D=new L(this);this.audioTrackController=D,w.push(D)}if(L=r.subtitleTrackController){var O=new L(this);this.subtitleTrackController=O,w.push(O)}if(L=r.emeController){var I=new L(this);this.emeController=I,w.push(I)}[r.subtitleStreamController,r.timelineController].forEach(function(t){t&&w.push(new t(e))}),this.coreComponents=w}return t.isSupported=function(){return Object(p.a)()},b(t,null,[{key:"version",get:function(){return"0.8.9"}},{key:"Events",get:function(){return o.a}},{key:"ErrorTypes",get:function(){return s.b}},{key:"ErrorDetails",get:function(){return s.a}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:m.a},set:function(e){t.defaultConfig=e}}]),t.prototype.destroy=function(){v.b.log("destroy"),this.trigger(o.a.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach(function(t){t.destroy()}),this.url=null,this.observer.removeAllListeners(),this._autoLevelCapping=-1},t.prototype.attachMedia=function(t){v.b.log("attachMedia"),this.media=t,this.trigger(o.a.MEDIA_ATTACHING,{media:t})},t.prototype.detachMedia=function(){v.b.log("detachMedia"),this.trigger(o.a.MEDIA_DETACHING),this.media=null},t.prototype.loadSource=function(t){t=n.a.buildAbsoluteURL(window.location.href,t,{alwaysNormalize:!0}),v.b.log("loadSource:"+t),this.url=t,this.trigger(o.a.MANIFEST_LOADING,{url:t})},t.prototype.startLoad=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;v.b.log("startLoad("+t+")"),this.networkControllers.forEach(function(e){e.startLoad(t)})},t.prototype.stopLoad=function(){v.b.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},t.prototype.swapAudioCodec=function(){v.b.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.prototype.recoverMediaError=function(){v.b.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)},b(t,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){v.b.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){v.b.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){v.b.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){v.b.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){v.b.log("set startLevel:"+t);var e=this;-1!==t&&(t=Math.max(t,e.minAutoLevel)),e.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){v.b.log("set autoLevelCapping:"+t),this._autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var t=this,e=t.levels,r=t.config.minAutoBitrate,a=e?e.length:0,i=0;i<a;i++){if((e[i].realBitrate?Math.max(e[i].realBitrate,e[i].bitrate):e[i].bitrate)>r)return i}return 0}},{key:"maxAutoLevel",get:function(){var t=this,e=t.levels,r=t.autoLevelCapping;return-1===r&&e&&e.length?e.length-1:r}},{key:"nextAutoLevel",get:function(){var t=this;return Math.min(Math.max(t.abrController.nextAutoLevel,t.minAutoLevel),t.maxAutoLevel)},set:function(t){var e=this;e.abrController.nextAutoLevel=Math.max(e.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}}]),t}();e.default=E},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(2),u=r(0),d=r(9),f=r(20),h=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),c={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},p=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.MANIFEST_LOADING,o.a.LEVEL_LOADING,o.a.AUDIO_TRACK_LOADING,o.a.SUBTITLE_TRACK_LOADING));return n.loaders={},n}return n(e,t),e.canHaveQualityLevels=function(t){return t!==c.AUDIO_TRACK&&t!==c.SUBTITLE_TRACK},e.mapContextToLevelType=function(t){switch(t.type){case c.AUDIO_TRACK:return"audio";case c.SUBTITLE_TRACK:return"subtitle";default:return"main"}},e.getResponseUrl=function(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r},e.prototype.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,a=e.loader,i=r||a,n=new i(e);return t.loader=a,this.loaders[t.type]=n,n},e.prototype.getInternalLoader=function(t){return this.loaders[t.type]},e.prototype.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.prototype.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.prototype.destroy=function(){this.destroyInternalLoaders(),t.prototype.destroy.call(this)},e.prototype.onManifestLoading=function(t){this.load(t.url,{type:c.MANIFEST})},e.prototype.onLevelLoading=function(t){this.load(t.url,{type:c.LEVEL,level:t.level,id:t.id})},e.prototype.onAudioTrackLoading=function(t){this.load(t.url,{type:c.AUDIO_TRACK,id:t.id})},e.prototype.onSubtitleTrackLoading=function(t){this.load(t.url,{type:c.SUBTITLE_TRACK,id:t.id})},e.prototype.load=function(t,e){var r=this.hls.config,a=this.getInternalLoader(e);if(a){var i=a.context;if(i&&i.url===t)return u.b.trace("playlist request ongoing"),!1;u.b.warn("aborting previous loader for type: "+e.type),a.abort()}var n=void 0,o=void 0,s=void 0,l=void 0;switch(e.type){case c.MANIFEST:n=r.manifestLoadingMaxRetry,o=r.manifestLoadingTimeOut,s=r.manifestLoadingRetryDelay,l=r.manifestLoadingMaxRetryTimeout;break;case c.LEVEL:n=0,o=r.levelLoadingTimeOut;break;default:n=r.levelLoadingMaxRetry,o=r.levelLoadingTimeOut,s=r.levelLoadingRetryDelay,l=r.levelLoadingMaxRetryTimeout,u.b.log("Playlist loader for "+e.type+" "+(e.level||e.id))}a=this.createInternalLoader(e),e.url=t,e.responseType=e.responseType||"";var d=void 0,f=void 0;return d={timeout:o,maxRetry:n,retryDelay:s,maxRetryDelay:l},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},a.load(e,d,f),!0},e.prototype.loadsuccess=function(t,e,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(r.isSidxRequest)return this._handleSidxRequest(t,r),void this._handlePlaylistLoaded(t,e,r,a);this.resetInternalLoader(r.type);var i=t.data;if(e.tload=performance.now(),0!==i.indexOf("#EXTM3U"))return void this._handleManifestParsingError(t,r,"no EXTM3U delimiter",a);i.indexOf("#EXTINF:")>0?this._handleTrackOrLevelPlaylist(t,e,r,a):this._handleMasterPlaylist(t,e,r,a)},e.prototype.loaderror=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r)},e.prototype.loadtimeout=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r)},e.prototype._handleMasterPlaylist=function(t,r,a,i){var n=this.hls,s=t.data,l=e.getResponseUrl(t,a),d=f.a.parseMasterPlaylist(s,l);if(!d.length)return void this._handleManifestParsingError(t,a,"no level found in manifest",i);var h=d.map(function(t){return{id:t.attrs.AUDIO,codec:t.audioCodec}}),c=f.a.parseMasterPlaylistMedia(s,l,"AUDIO",h),p=f.a.parseMasterPlaylistMedia(s,l,"SUBTITLES");if(c.length){var v=!1;c.forEach(function(t){t.url||(v=!0)}),!1===v&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(u.b.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),c.unshift({type:"main",name:"main"}))}n.trigger(o.a.MANIFEST_LOADED,{levels:d,audioTracks:c,subtitles:p,url:l,stats:r,networkDetails:i})},e.prototype._handleTrackOrLevelPlaylist=function(t,r,a,i){var n=this.hls,s=a.id,l=a.level,u=a.type,d=e.getResponseUrl(t,a),h=isNaN(l)?isNaN(s)?0:s:l,p=e.mapContextToLevelType(a),v=f.a.parseLevelPlaylist(t.data,d,h,p);if(v.tload=r.tload,u===c.MANIFEST){var g={url:d,details:v};n.trigger(o.a.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:d,stats:r,networkDetails:i})}if(r.tparsed=performance.now(),v.needSidxRanges){var y=v.initSegment.url;return void this.load(y,{isSidxRequest:!0,type:u,level:l,levelDetails:v,id:s,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}a.levelDetails=v,this._handlePlaylistLoaded(t,r,a,i)},e.prototype._handleSidxRequest=function(t,e){var r=d.a.parseSegmentIndex(new Uint8Array(t.data));r.references.forEach(function(t,r){var a=t.info,i=e.levelDetails.fragments[r];0===i.byteRange.length&&(i.rawByteRange=String(1+a.end-a.start)+"@"+String(a.start))}),e.levelDetails.initSegment.rawByteRange=String(r.moovEndOffset)+"@0"},e.prototype._handleManifestParsingError=function(t,e,r,a){this.hls.trigger(o.a.ERROR,{type:l.b.NETWORK_ERROR,details:l.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t.url,reason:r,networkDetails:a})},e.prototype._handleNetworkError=function(t,e){var r=void 0,a=void 0,i=t.loader;switch(t.type){case c.MANIFEST:r=l.a.MANIFEST_LOAD_TIMEOUT,a=!0;break;case c.LEVEL:r=l.a.LEVEL_LOAD_TIMEOUT,a=!1;break;case c.AUDIO_TRACK:r=l.a.AUDIO_TRACK_LOAD_TIMEOUT,a=!1;break;default:a=!1}i&&(i.abort(),this.resetInternalLoader(t.type)),this.hls.trigger(o.a.ERROR,{type:l.b.NETWORK_ERROR,details:r,fatal:a,url:i.url,loader:i,context:t,networkDetails:e})},e.prototype._handlePlaylistLoaded=function(t,r,a,i){var n=a.type,s=a.level,l=a.id,u=a.levelDetails;if(!u.targetduration)return void this._handleManifestParsingError(t,a,"invalid target duration",i);if(e.canHaveQualityLevels(a.type))this.hls.trigger(o.a.LEVEL_LOADED,{details:u,level:s||0,id:l||0,stats:r,networkDetails:i});else switch(n){case c.AUDIO_TRACK:this.hls.trigger(o.a.AUDIO_TRACK_LOADED,{details:u,id:l,stats:r,networkDetails:i});break;case c.SUBTITLE_TRACK:this.hls.trigger(o.a.SUBTITLE_TRACK_LOADED,{details:u,id:l,stats:r,networkDetails:i})}},h(e,null,[{key:"ContextType",get:function(){return c}}]),e}(s.a);e.a=p},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(5),n=r.n(i),o=r(21),s=r(10),l=r(22),u=r(0),d=r(11),f=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,h=/#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"),p=/(?:(?:#(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?/,v=function(){function t(){a(this,t)}return t.findGroup=function(t,e){if(!t)return null;for(var r=null,a=0;a<t.length;a++){var i=t[a];i.id===e&&(r=i)}return r},t.convertAVC1ToAVCOTI=function(t){var e,r=t.split(".");return r.length>2?(e=r.shift()+".",e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):e=t,e},t.resolve=function(t,e){return n.a.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,r){var a=[],i=void 0;for(f.lastIndex=0;null!=(i=f.exec(e));){var n={},o=n.attrs=new l.a(i[1]);n.url=t.resolve(i[2],r);var s=o.decimalResolution("RESOLUTION");s&&(n.width=s.width,n.height=s.height),n.bitrate=o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),n.name=o.NAME,function(t,e){["video","audio"].forEach(function(r){var a=t.filter(function(t){return Object(d.b)(t,r)});if(a.length){var i=a.filter(function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)});e[r+"Codec"]=i.length>0?i[0]:a[0],t=t.filter(function(t){return-1===a.indexOf(t)})}}),e.unknownCodecs=t}([].concat((o.CODECS||"").split(/[ ,]+/)),n),n.videoCodec&&-1!==n.videoCodec.indexOf("avc1")&&(n.videoCodec=t.convertAVC1ToAVCOTI(n.videoCodec)),a.push(n)}return a},t.parseMasterPlaylistMedia=function(e,r,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],n=void 0,o=[],s=0;for(h.lastIndex=0;null!==(n=h.exec(e));){var u={},d=new l.a(n[1]);if(d.TYPE===a){if(u.groupId=d["GROUP-ID"],u.name=d.NAME,u.type=a,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),i.length){var f=t.findGroup(i,u.groupId);u.audioCodec=f?f.codec:i[0].codec}u.id=s++,o.push(u)}}return o},t.parseLevelPlaylist=function(t,e,r,a){var i,n,d=0,f=0,h={type:null,version:null,url:e,fragments:[],live:!0,startSN:0},v=new s.a,g=0,y=null,m=new o.a;for(c.lastIndex=0;null!==(i=c.exec(t));){var b=i[1];if(b){m.duration=parseFloat(b);var E=(" "+i[2]).slice(1);m.title=E||null,m.tagList.push(E?["INF",b,E]:["INF",b])}else if(i[3]){if(!isNaN(m.duration)){var S=d++;m.type=a,m.start=f,m.levelkey=v,m.sn=S,m.level=r,m.cc=g,m.baseurl=e,m.relurl=(" "+i[3]).slice(1),h.fragments.push(m),y=m,f+=m.duration,m=new o.a}}else if(i[4]){if(m.rawByteRange=(" "+i[4]).slice(1),y){var T=y.byteRangeEndOffset;T&&(m.lastByteRangeEndOffset=T)}}else if(i[5])m.rawProgramDateTime=(" "+i[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),void 0===h.programDateTime&&(h.programDateTime=new Date(new Date(Date.parse(i[5]))-1e3*f));else{for(i=i[0].match(p),n=1;n<i.length&&void 0===i[n];n++);var A=(" "+i[n+1]).slice(1),R=(" "+i[n+2]).slice(1);switch(i[n]){case"#":m.tagList.push(R?[A,R]:[A]);break;case"PLAYLIST-TYPE":h.type=A.toUpperCase();break;case"MEDIA-SEQUENCE":d=h.startSN=parseInt(A);break;case"TARGETDURATION":h.targetduration=parseFloat(A);break;case"VERSION":h.version=parseInt(A);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"DIS":g++,m.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":g=parseInt(A);break;case"KEY":var _=A,L=new l.a(_),w=L.enumeratedString("METHOD"),D=L.URI,O=L.hexadecimalInteger("IV");w&&(v=new s.a,D&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(w)>=0&&(v.method=w,v.baseuri=e,v.reluri=D,v.key=null,v.iv=O));break;case"START":var I=A,x=new l.a(I),k=x.decimalFloatingPoint("TIME-OFFSET");isNaN(k)||(h.startTimeOffset=k);break;case"MAP":var C=new l.a(A);m.relurl=C.URI,m.rawByteRange=C.BYTERANGE,m.baseurl=e,m.level=r,m.type=a,m.sn="initSegment",h.initSegment=m,m=new o.a;break;default:u.b.warn("line parsed but not handled: "+i)}}}return m=y,m&&!m.relurl&&(h.fragments.pop(),f-=m.duration),h.totalduration=f,h.averagetargetduration=f/h.fragments.length,h.endSN=d-1,h.startCC=h.fragments[0]?h.fragments[0].cc:0,h.endCC=g,!h.initSegment&&h.fragments.length&&h.fragments.every(function(t){return t.relurl.endsWith(".mp4")})&&(u.b.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),m=new o.a,m.relurl=h.fragments[0].relurl,m.baseurl=e,m.level=r,m.type=a,m.sn="initSegment",h.initSegment=m,h.needSidxRanges=!0),h},t}();e.a=v},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(5),n=r.n(i),o=r(10),s=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),l=function(){function t(){a(this,t),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[]}return t.prototype.createInitializationVector=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e},t.prototype.fragmentDecryptdataFromLevelkey=function(t,e){var r=t;return t&&t.method&&t.uri&&!t.iv&&(r=new o.a,r.method=t.method,r.baseuri=t.baseuri,r.reluri=t.reluri,r.iv=this.createInitializationVector(e)),r},t.prototype.cloneObj=function(t){return JSON.parse(JSON.stringify(t))},s(t,[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=n.a.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(t){this._url=t}},{key:"programDateTime",get:function(){return!this._programDateTime&&this.rawProgramDateTime&&(this._programDateTime=new Date(Date.parse(this.rawProgramDateTime))),this._programDateTime}},{key:"byteRange",get:function(){if(!this._byteRange&&!this.rawByteRange)return[];if(this._byteRange)return this._byteRange;var t=[];if(this.rawByteRange){var e=this.rawByteRange.split("@",2);if(1===e.length){var r=this.lastByteRangeEndOffset;t[0]=r||0}else t[0]=parseInt(e[1]);t[1]=parseInt(e[0])+t[0],this._byteRange=t}return t}},{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}}]),t}();e.a=l},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=/^(\d+)x(\d+)$/,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function t(e){a(this,t),"string"==typeof e&&(e=t.parseAttrList(e));for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r])}return t.prototype.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},t.prototype.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var r=new Uint8Array(e.length/2),a=0;a<e.length/2;a++)r[a]=parseInt(e.slice(2*a,2*a+2),16);return r}return null},t.prototype.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},t.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])},t.prototype.enumeratedString=function(t){return this[t]},t.prototype.decimalResolution=function(t){var e=i.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,r={};for(n.lastIndex=0;null!==(e=n.exec(t));){var a=e[2];0===a.indexOf('"')&&a.lastIndexOf('"')===a.length-1&&(a=a.slice(1,-1)),r[e[1]]=a}return r},t}();e.a=o},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(2),u=r(0),d=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.FRAG_LOADING));return n.loaders={},n}return n(e,t),e.prototype.destroy=function(){var e=this.loaders;for(var r in e){var a=e[r];a&&a.destroy()}this.loaders={},t.prototype.destroy.call(this)},e.prototype.onFragLoading=function(t){var e=t.frag,r=e.type,a=this.loaders,i=this.hls.config,n=i.fLoader,o=i.loader;e.loaded=0;var s=a[r];s&&(u.b.warn("abort previous fragment loader for type: "+r),s.abort()),s=a[r]=e.loader=i.fLoader?new n(i):new o(i);var l=void 0,d=void 0,f=void 0;l={url:e.url,frag:e,responseType:"arraybuffer",progressData:!1};var h=e.byteRangeStartOffset,c=e.byteRangeEndOffset;isNaN(h)||isNaN(c)||(l.rangeStart=h,l.rangeEnd=c),d={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},s.load(l,d,f)},e.prototype.loadsuccess=function(t,e,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.data,n=r.frag;n.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(o.a.FRAG_LOADED,{payload:i,frag:n,stats:e,networkDetails:a})},e.prototype.loaderror=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=e.loader;a&&a.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:l.b.NETWORK_ERROR,details:l.a.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t,networkDetails:r})},e.prototype.loadtimeout=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=e.loader;a&&a.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:l.b.NETWORK_ERROR,details:l.a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag,networkDetails:r})},e.prototype.loadprogress=function(t,e,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=e.frag;i.loaded=t.loaded,this.hls.trigger(o.a.FRAG_LOAD_PROGRESS,{frag:i,stats:t,networkDetails:a})},e}(s.a);e.a=d},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(2),u=r(0),d=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.KEY_LOADING));return n.loaders={},n.decryptkey=null,n.decrypturl=null,n}return n(e,t),e.prototype.destroy=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},s.a.prototype.destroy.call(this)},e.prototype.onKeyLoading=function(t){var e=t.frag,r=e.type,a=this.loaders[r],i=e.decryptdata,n=i.uri;if(n!==this.decrypturl||null===this.decryptkey){var s=this.hls.config;a&&(u.b.warn("abort previous key loader for type:"+r),a.abort()),e.loader=this.loaders[r]=new s.loader(s),this.decrypturl=n,this.decryptkey=null;var l=void 0,d=void 0,f=void 0;l={url:n,frag:e,responseType:"arraybuffer"},d={timeout:s.fragLoadingTimeOut,maxRetry:s.fragLoadingMaxRetry,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},e.loader.load(l,d,f)}else this.decryptkey&&(i.key=this.decryptkey,this.hls.trigger(o.a.KEY_LOADED,{frag:e}))},e.prototype.loadsuccess=function(t,e,r){var a=r.frag;this.decryptkey=a.decryptdata.key=new Uint8Array(t.data),a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(o.a.KEY_LOADED,{frag:a})},e.prototype.loaderror=function(t,e){var r=e.frag,a=r.loader;a&&a.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:l.b.NETWORK_ERROR,details:l.a.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},e.prototype.loadtimeout=function(t,e){var r=e.frag,a=r.loader;a&&a.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:l.b.NETWORK_ERROR,details:l.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},e}(s.a);e.a=d},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(12),s=r(13),l=r(26),u=r(1),d=r(41),f=r(42),h=r(2),c=r(0),p=r(43),v=r(44),g=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),y={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR"},m=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,u.a.MEDIA_ATTACHED,u.a.MEDIA_DETACHING,u.a.MANIFEST_LOADING,u.a.MANIFEST_PARSED,u.a.LEVEL_LOADED,u.a.KEY_LOADED,u.a.FRAG_LOADED,u.a.FRAG_LOAD_EMERGENCY_ABORTED,u.a.FRAG_PARSING_INIT_SEGMENT,u.a.FRAG_PARSING_DATA,u.a.FRAG_PARSED,u.a.ERROR,u.a.AUDIO_TRACK_SWITCHING,u.a.AUDIO_TRACK_SWITCHED,u.a.BUFFER_CREATED,u.a.BUFFER_APPENDED,u.a.BUFFER_FLUSHED));return n.config=r.config,n.audioCodecSwap=!1,n._state=y.STOPPED,n}return n(e,t),e.prototype.onHandlerDestroying=function(){this.stopLoad()},e.prototype.onHandlerDestroyed=function(){this.state=y.STOPPED},e.prototype.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var a=r.startLevel;-1===a&&(a=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=a,this.loadedmetadata=!1}e>0&&-1===t&&(c.b.log("override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=y.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this.forceStartLoad=!0,this.state=y.STOPPED},e.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=y.STOPPED,this.forceStartLoad=!1},e.prototype.doTick=function(){switch(this.state){case y.ERROR:break;case y.BUFFER_FLUSHING:this.fragLoadError=0;break;case y.IDLE:this._doTickIdle();break;case y.WAITING_LEVEL:var t=this.levels[this.level];t&&t.details&&(this.state=y.IDLE);break;case y.FRAG_LOADING_WAITING_RETRY:var e=performance.now(),r=this.retryDate;(!r||e>=r||this.media&&this.media.seeking)&&(c.b.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=y.IDLE);break;case y.ERROR:case y.STOPPED:case y.FRAG_LOADING:case y.PARSING:case y.PARSED:case y.ENDED:}this._checkBuffer(),this._checkFragmentChanged()},e.prototype._doTickIdle=function(){var t=this.hls,e=t.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&e.startFragPrefetch)){var a=void 0;a=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var i=t.nextLoadLevel,n=this.levels[i];if(n){var o=n.bitrate,l=void 0;l=o?Math.max(8*e.maxBufferSize/o,e.maxBufferLength):e.maxBufferLength,l=Math.min(l,e.maxMaxBufferLength);var d=s.a.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,a,e.maxBufferHole),f=d.len;if(!(f>=l)){c.b.trace("buffer length of "+f.toFixed(3)+" is below max of "+l.toFixed(3)+". checking for more payload ..."),this.level=t.nextLoadLevel=i;var h=n.details;if(void 0===h||!0===h.live&&this.levelLastLoaded!==i)return void(this.state=y.WAITING_LEVEL);var p=this.fragPrevious;if(!h.live&&p&&!p.backtracked&&p.sn===h.endSN&&!d.nextStart){if(Math.min(r.duration,p.start+p.duration)-Math.max(d.end,p.start)<=Math.max(.2,p.duration)){var v={};return this.altAudio&&(v.type="video"),this.hls.trigger(u.a.BUFFER_EOS,v),void(this.state=y.ENDED)}}this._fetchPayloadOrEos(a,d,h)}}}},e.prototype._fetchPayloadOrEos=function(t,e,r){var a=this.fragPrevious,i=this.level,n=r.fragments,o=n.length;if(0!==o){var s=n[0].start,l=n[o-1].start+n[o-1].duration,u=e.end,d=void 0;if(r.initSegment&&!r.initSegment.data)d=r.initSegment;else if(r.live){var f=this.config.initialLiveManifestSize;if(o<f)return void c.b.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+f);if(null===(d=this._ensureFragmentAtLivePoint(r,u,s,l,a,n,o)))return}else u<s&&(d=n[0]);d||(d=this._findFragment(s,a,o,n,u,l,r)),d&&this._loadFragmentOrKey(d,i,r,t,u)}},e.prototype._ensureFragmentAtLivePoint=function(t,e,r,a,i,n,s){var l=this.hls.config,u=this.media,d=void 0,f=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*t.targetduration;if(e<Math.max(r-l.maxFragLookUpTolerance,a-f)){var h=this.liveSyncPosition=this.computeLivePosition(r,t);c.b.log("buffer end: "+e.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+h.toFixed(3)),e=h,u&&u.readyState&&u.duration>h&&(u.currentTime=h),this.nextLoadPosition=h}if(t.PTSKnown&&e>a&&u&&u.readyState)return null;if(this.startFragRequested&&!t.PTSKnown){if(i){var p=i.sn+1;if(p>=t.startSN&&p<=t.endSN){var v=n[p-t.startSN];i.cc===v.cc&&(d=v,c.b.log("live playlist, switching playlist, load frag with next SN: "+d.sn))}d||(d=o.a.search(n,function(t){return i.cc-t.cc}))&&c.b.log("live playlist, switching playlist, load frag with same CC: "+d.sn)}d||(d=n[Math.min(s-1,Math.round(s/2))],c.b.log("live playlist, switching playlist, unknown, load middle frag : "+d.sn))}return d},e.prototype._findFragment=function(t,e,r,a,i,n,s){var l=this.hls.config,u=void 0,d=void 0,f=l.maxFragLookUpTolerance,h=e?a[e.sn-a[0].sn+1]:void 0,p=function(t){var e=Math.min(f,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-e<=i?1:t.start-e>i&&t.start?-1:0};if(i<n?(i>n-f&&(f=0),d=h&&!p(h)?h:o.a.search(a,p)):d=a[r-1],d){u=d;var v=u.sn-s.startSN,g=e&&u.level===e.level,y=a[v-1],m=a[v+1];if(e&&u.sn===e.sn)if(g&&!u.backtracked)if(u.sn<s.endSN){var b=e.deltaPTS;b&&b>l.maxBufferHole&&e.dropped&&v?(u=y,c.b.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"),e.loadCounter--):(u=m,c.b.log("SN just loaded, load next one: "+u.sn))}else u=null;else u.backtracked&&(m&&m.backtracked?(c.b.warn("Already backtracked from fragment "+m.sn+", will not backtrack to fragment "+u.sn+". Loading fragment "+m.sn),u=m):(c.b.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),u.dropped=0,y?(y.loadCounter&&y.loadCounter--,u=y,u.backtracked=!0):v&&(u=null)))}return u},e.prototype._loadFragmentOrKey=function(t,e,r,a,i){var n=this.hls,o=n.config;if(!t.decryptdata||null==t.decryptdata.uri||null!=t.decryptdata.key){if(c.b.log("Loading "+t.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+e+", currentTime:"+a.toFixed(3)+",bufferEnd:"+i.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,t.loadCounter){t.loadCounter++;var s=o.fragLoadingLoopThreshold;if(t.loadCounter>s&&Math.abs(this.fragLoadIdx-t.loadIdx)<s)return void n.trigger(u.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:t})}else t.loadCounter=1;return t.loadIdx=this.fragLoadIdx,t.autoLevel=n.autoLevelEnabled,t.bitrateTest=this.bitrateTest,this.fragCurrent=t,this.startFragRequested=!0,isNaN(t.sn)||t.bitrateTest||(this.nextLoadPosition=t.start+t.duration),n.trigger(u.a.FRAG_LOADING,{frag:t}),this.demuxer||(this.demuxer=new l.a(n,"main")),void(this.state=y.FRAG_LOADING)}c.b.log("Loading key for "+t.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+e),this.state=y.KEY_LOADING,n.trigger(u.a.KEY_LOADING,{frag:t})},e.prototype.getBufferedFrag=function(t){return o.a.search(this._bufferedFrags,function(e){return t<e.startPTS?-1:t>e.endPTS?1:0})},e.prototype.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.endPTS+.5):null},e.prototype._checkFragmentChanged=function(){var t,e,r=this.media;if(r&&r.readyState&&!1===r.seeking&&(e=r.currentTime,e>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),s.a.isBuffered(r,e)?t=this.getBufferedFrag(e):s.a.isBuffered(r,e+.1)&&(t=this.getBufferedFrag(e+.1)),t)){var a=t;if(a!==this.fragPlaying){this.hls.trigger(u.a.FRAG_CHANGED,{frag:a});var i=a.level;this.fragPlaying&&this.fragPlaying.level===i||this.hls.trigger(u.a.LEVEL_SWITCHED,{level:i}),this.fragPlaying=a}}},e.prototype.immediateLevelSwitch=function(){if(c.b.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var t=this.media,e=void 0;t?(e=t.paused,t.pause()):e=!0,this.previouslyPaused=e}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},e.prototype.immediateLevelSwitchEnd=function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,s.a.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())},e.prototype.nextLevelSwitch=function(){var t=this.media;if(t&&t.readyState){var e=void 0,r=void 0,a=void 0;if(void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),r=this.getBufferedFrag(t.currentTime),r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),t.paused)e=0;else{var i=this.hls.nextLoadLevel,n=this.levels[i],o=this.fragLastKbps;e=o&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*o)+1:0}if((a=this.getBufferedFrag(t.currentTime+e))&&(a=this.followingBufferedFrag(a))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(a.maxStartPTS,Number.POSITIVE_INFINITY)}}},e.prototype.flushMainBuffer=function(t,e){this.state=y.BUFFER_FLUSHING;var r={startOffset:t,endOffset:e};this.altAudio&&(r.type="video"),this.hls.trigger(u.a.BUFFER_FLUSHING,r)},e.prototype.onMediaAttached=function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)},e.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(c.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var e=this.levels;e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0,t.backtracked=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("seeked",this.onvseeked),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},e.prototype.onMediaSeeking=function(){var t=this.media,e=t?t.currentTime:void 0,r=this.config;isNaN(e)||c.b.log("media seeking to "+e.toFixed(3));var a=this.mediaBuffer?this.mediaBuffer:t,i=s.a.bufferInfo(a,e,this.config.maxBufferHole);if(this.state===y.FRAG_LOADING){var n=this.fragCurrent;if(0===i.len&&n){var o=r.maxFragLookUpTolerance,l=n.start-o,u=n.start+n.duration+o;e<l||e>u?(n.loader&&(c.b.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE):c.b.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===y.ENDED&&(0===i.len&&(this.fragPrevious=0),this.state=y.IDLE);t&&(this.lastCurrentTime=e),this.state!==y.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=e),this.tick()},e.prototype.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:void 0;isNaN(e)||c.b.log("media seeked to "+e.toFixed(3)),this.tick()},e.prototype.onMediaEnded=function(){c.b.log("media ended"),this.startPosition=this.lastCurrentTime=0},e.prototype.onManifestLoading=function(){c.b.log("trigger BUFFER_RESET"),this.hls.trigger(u.a.BUFFER_RESET),this._bufferedFrags=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0},e.prototype.onManifestParsed=function(t){var e,r=!1,a=!1;t.levels.forEach(function(t){(e=t.audioCodec)&&(-1!==e.indexOf("mp4a.40.2")&&(r=!0),-1!==e.indexOf("mp4a.40.5")&&(a=!0))}),this.audioCodecSwitch=r&&a,this.audioCodecSwitch&&c.b.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1;var i=this.config;(i.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(i.startPosition)},e.prototype.onLevelLoaded=function(t){var e=t.details,r=t.level,a=this.levels[this.levelLastLoaded],i=this.levels[r],n=e.totalduration,o=0;if(c.b.log("level "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+n),e.live){var s=i.details;s&&e.fragments.length>0?(d.a(s,e),o=e.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),e.PTSKnown&&!isNaN(o)?c.b.log("live playlist sliding:"+o.toFixed(3)):(c.b.log("live playlist - outdated PTS, unknown sliding"),Object(p.a)(this.fragPrevious,a,e))):(c.b.log("live playlist - first load, unknown sliding"),e.PTSKnown=!1,Object(p.a)(this.fragPrevious,a,e))}else e.PTSKnown=!1;if(i.details=e,this.levelLastLoaded=r,this.hls.trigger(u.a.LEVEL_UPDATED,{details:e,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var l=e.startTimeOffset;isNaN(l)?e.live?(this.startPosition=this.computeLivePosition(o,e),c.b.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(l<0&&(c.b.log("negative start time offset "+l+", count from end of last fragment"),l=o+n+l),c.b.log("start time offset found in playlist, adjust startPosition to "+l),this.startPosition=l),this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===y.WAITING_LEVEL&&(this.state=y.IDLE),this.tick()},e.prototype.onKeyLoaded=function(){this.state===y.KEY_LOADING&&(this.state=y.IDLE,this.tick())},e.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===y.FRAG_LOADING&&e&&"main"===r.type&&r.level===e.level&&r.sn===e.sn){var a=t.stats,i=this.levels[e.level],n=i.details;if(c.b.log("Loaded "+e.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+e.level),this.bitrateTest=!1,this.stats=a,!0===r.bitrateTest&&this.hls.nextLoadLevel)this.state=y.IDLE,this.startFragRequested=!1,a.tparsed=a.tbuffered=performance.now(),this.hls.trigger(u.a.FRAG_BUFFERED,{stats:a,frag:e,id:"main"}),this.tick();else if("initSegment"===r.sn)this.state=y.IDLE,a.tparsed=a.tbuffered=performance.now(),n.initSegment.data=t.payload,this.hls.trigger(u.a.FRAG_BUFFERED,{stats:a,frag:e,id:"main"}),this.tick();else{this.state=y.PARSING;var o=n.totalduration,s=e.level,d=e.sn,f=this.config.defaultAudioCodec||i.audioCodec;this.audioCodecSwap&&(c.b.log("swapping playlist audio codec"),void 0===f&&(f=this.lastAudioCodec),f&&(f=-1!==f.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingBuffering=!0,this.appended=!1,c.b.log("Parsing "+d+" of ["+n.startSN+" ,"+n.endSN+"],level "+s+", cc "+e.cc);var h=this.demuxer;h||(h=this.demuxer=new l.a(this.hls,"main"));var p=this.media,v=p&&p.seeking,g=!v&&(n.PTSKnown||!n.live),m=n.initSegment?n.initSegment.data:[];h.push(t.payload,m,f,i.videoCodec,e,o,g,void 0)}}this.fragLoadError=0},e.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;if(e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===y.PARSING){var a,i,n=t.tracks;if(n.audio&&this.altAudio&&delete n.audio,i=n.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(c.b.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==i.container&&(o="mp4a.40.2",c.b.log("Android: force audio codec to "+o)),i.levelCodec=o,i.id=t.id}i=n.video,i&&(i.levelCodec=this.levels[this.level].videoCodec,i.id=t.id),this.hls.trigger(u.a.BUFFER_CODECS,n);for(a in n){i=n[a],c.b.log("main track:"+a+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var l=i.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.a.BUFFER_APPENDING,{type:a,data:l,parent:"main",content:"initSegment"}))}this.tick()}},e.prototype.onFragParsingData=function(t){var e=this,r=this.fragCurrent,a=t.frag;if(r&&"main"===t.id&&a.sn===r.sn&&a.level===r.level&&("audio"!==t.type||!this.altAudio)&&this.state===y.PARSING){var i=this.levels[this.level],n=r;if(isNaN(t.endPTS)&&(t.endPTS=t.startPTS+r.duration,t.endDTS=t.startDTS+r.duration),c.b.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(n.dropped=t.dropped,n.dropped)if(n.backtracked)c.b.warn("Already backtracked on this fragment, appending with the gap");else{var o=i.details;if(!o||n.sn!==o.startSN)return c.b.warn("missing video frame(s), backtracking fragment"),n.backtracked=!0,this.nextLoadPosition=t.startPTS,this.state=y.IDLE,this.fragPrevious=n,void this.tick();c.b.warn("missing video frame(s) on first frag, appending with gap")}else n.backtracked=!1;var s=d.b(i.details,n,t.startPTS,t.endPTS,t.startDTS,t.endDTS),l=this.hls;l.trigger(u.a.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:s,type:t.type,start:t.startPTS,end:t.endPTS}),[t.data1,t.data2].forEach(function(r){r&&r.length&&e.state===y.PARSING&&(e.appended=!0,e.pendingBuffering=!0,l.trigger(u.a.BUFFER_APPENDING,{type:t.type,data:r,parent:"main",content:"data"}))}),this.tick()}},e.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===y.PARSING&&(this.stats.tparsed=performance.now(),this.state=y.PARSED,this._checkAppendedParsed())},e.prototype.onAudioTrackSwitching=function(t){var e=!!t.url,r=t.id;if(!e){if(this.mediaBuffer!==this.media){c.b.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;a.loader&&(c.b.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.IDLE}var i=this.hls;i.trigger(u.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),i.trigger(u.a.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}},e.prototype.onAudioTrackSwitched=function(t){var e=t.id,r=!!this.hls.audioTracks[e].url;if(r){var a=this.videoBuffer;a&&this.mediaBuffer!==a&&(c.b.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=a)}this.altAudio=r,this.tick()},e.prototype.onBufferCreated=function(t){var e=t.tracks,r=void 0,a=void 0,i=!1;for(var n in e){var o=e[n];"main"===o.id?(a=n,r=o,"video"===n&&(this.videoBuffer=e[n].buffer)):i=!0}i&&r?(c.b.log("alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},e.prototype.onBufferAppended=function(t){if("main"===t.parent){var e=this.state;e!==y.PARSING&&e!==y.PARSED||(this.pendingBuffering=t.pending>0,this._checkAppendedParsed())}},e.prototype._checkAppendedParsed=function(){if(!(this.state!==y.PARSED||this.appended&&this.pendingBuffering)){var t=this.fragCurrent;if(t){var e=this.mediaBuffer?this.mediaBuffer:this.media;c.b.log("main buffered : "+f.a.toString(e.buffered));var r=this._bufferedFrags.filter(function(t){return s.a.isBuffered(e,(t.startPTS+t.endPTS)/2)});r.push(t),this._bufferedFrags=r.sort(function(t,e){return t.startPTS-e.startPTS}),this.fragPrevious=t;var a=this.stats;a.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*a.total/(a.tbuffered-a.tfirst)),this.hls.trigger(u.a.FRAG_BUFFERED,{stats:a,frag:t,id:"main"}),this.state=y.IDLE}this.tick()}},e.prototype.onError=function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var r=!!this.media&&s.a.isBuffered(this.media,this.media.currentTime)&&s.a.isBuffered(this.media,this.media.currentTime+.5);switch(t.details){case h.a.FRAG_LOAD_ERROR:case h.a.FRAG_LOAD_TIMEOUT:case h.a.KEY_LOAD_ERROR:case h.a.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);e.loadCounter=0,c.b.warn("mediaController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else c.b.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=y.ERROR;break;case h.a.FRAG_LOOP_LOADING_ERROR:t.fatal||(r?(this._reduceMaxBufferLength(e.duration),this.state=y.IDLE):e.autoLevel&&0!==e.level||(t.fatal=!0,this.state=y.ERROR));break;case h.a.LEVEL_LOAD_ERROR:case h.a.LEVEL_LOAD_TIMEOUT:this.state!==y.ERROR&&(t.fatal?(this.state=y.ERROR,c.b.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==y.WAITING_LEVEL||(this.state=y.IDLE));break;case h.a.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==y.PARSING&&this.state!==y.PARSED||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=y.IDLE):(c.b.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},e.prototype._reduceMaxBufferLength=function(t){var e=this.config;e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,c.b.warn("main:reduce max buffer length to "+e.maxMaxBufferLength+"s"),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*e.fragLoadingLoopThreshold))},e.prototype._checkBuffer=function(){var t=this.media,e=this.config;if(t&&t.readyState){var r=t.currentTime,a=this.mediaBuffer?this.mediaBuffer:t,i=a.buffered;if(!this.loadedmetadata&&i.length){this.loadedmetadata=!0;var n=t.seeking?r:this.startPosition,o=s.a.isBuffered(a,n),l=i.start(0),d=!o&&Math.abs(n-l)<e.maxSeekHole;(r!==n||d)&&(c.b.log("target start position:"+n),d&&(n=l,c.b.log("target start position not buffered, seek to buffered.start(0) "+n)),c.b.log("adjust currentTime from "+r+" to "+n),t.currentTime=n)}else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var f=s.a.bufferInfo(t,r,0),p=!(t.paused||t.ended||0===t.buffered.length),v=r!==this.lastCurrentTime;if(v)this.stallReported&&(c.b.warn("playback not stuck anymore @"+r+", after "+Math.round(performance.now()-this.stalled)+"ms"),this.stallReported=!1),this.stalled=void 0,this.nudgeRetry=0;else if(p){var g=performance.now(),y=this.hls;if(this.stalled){var m=g-this.stalled,b=f.len,E=this.nudgeRetry||0;if(b<=.5&&m>1e3*e.lowBufferWatchdogPeriod){this.stallReported||(this.stallReported=!0,c.b.warn("playback stalling in low buffer @"+r),y.trigger(u.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}));var S=f.nextStart,T=S-r;if(S&&T<e.maxSeekHole&&T>0){this.nudgeRetry=++E;var A=E*e.nudgeOffset;c.b.log("adjust currentTime from "+t.currentTime+" to next buffered @ "+S+" + nudge "+A),t.currentTime=S+A,this.stalled=void 0,y.trigger(u.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:S+A-r})}}else if(b>.5&&m>1e3*e.highBufferWatchdogPeriod)if(this.stallReported||(this.stallReported=!0,c.b.warn("playback stalling in high buffer @"+r),y.trigger(u.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:b})),this.stalled=void 0,this.nudgeRetry=++E,E<e.nudgeMaxRetry){var R=t.currentTime,_=R+E*e.nudgeOffset;c.b.log("adjust currentTime from "+R+" to "+_),t.currentTime=_,y.trigger(u.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.BUFFER_NUDGE_ON_STALL,fatal:!1})}else c.b.error("still stuck in high buffer @"+r+" after "+e.nudgeMaxRetry+", raise fatal error"),y.trigger(u.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.BUFFER_STALLED_ERROR,fatal:!0})}else this.stalled=g,this.stallReported=!1}}}},e.prototype.onFragLoadEmergencyAborted=function(){this.state=y.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},e.prototype.onBufferFlushed=function(){var t=this.mediaBuffer?this.mediaBuffer:this.media;this._bufferedFrags=this._bufferedFrags.filter(function(e){return s.a.isBuffered(t,(e.startPTS+e.endPTS)/2)}),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.state=y.IDLE,this.fragPrevious=null},e.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.prototype.computeLivePosition=function(t,e){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*e.targetduration;return t+Math.max(0,e.totalduration-r)},g(e,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,c.b.log("main stream:"+e+"->"+t),this.hls.trigger(u.a.STREAM_STATE_TRANSITION,{previousState:e,nextState:t})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getBufferedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;return t?this.followingBufferedFrag(this.getBufferedFrag(t.currentTime)):null}},{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(t){this._liveSyncPosition=t}}]),e}(v.a);e.a=m},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1),n=r(14),o=r(0),s=r(2),l=r(7),u=r.n(l),d=r(39),f=r.n(d),h=r(8),c=Object(h.a)(),p=function(){function t(e,r){a(this,t),this.hls=e,this.id=r;var l=this.observer=new u.a,d=e.config;l.trigger=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];l.emit.apply(l,[t,t].concat(r))},l.off=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];l.removeListener.apply(l,[t].concat(r))};var h=function(t,r){r=r||{},r.frag=this.frag,r.id=this.id,e.trigger(t,r)}.bind(this);l.on(i.a.FRAG_DECRYPTED,h),l.on(i.a.FRAG_PARSING_INIT_SEGMENT,h),l.on(i.a.FRAG_PARSING_DATA,h),l.on(i.a.FRAG_PARSED,h),l.on(i.a.ERROR,h),l.on(i.a.FRAG_PARSING_METADATA,h),l.on(i.a.FRAG_PARSING_USERDATA,h),l.on(i.a.INIT_PTS_FOUND,h);var p={mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(d.enableWorker&&"undefined"!=typeof Worker){o.b.log("demuxing in webworker");var g=void 0;try{g=this.w=f()(40),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(t){e.trigger(i.a.ERROR,{type:s.b.OTHER_ERROR,details:s.a.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},g.postMessage({cmd:"init",typeSupported:p,vendor:v,id:r,config:JSON.stringify(d)})}catch(t){o.b.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),g&&URL.revokeObjectURL(g.objectURL),this.demuxer=new n.a(l,p,d,v),this.w=void 0}}else this.demuxer=new n.a(l,p,d,v)}return t.prototype.destroy=function(){var t=this.w;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.w=null;else{var e=this.demuxer;e&&(e.destroy(),this.demuxer=null)}var r=this.observer;r&&(r.removeAllListeners(),this.observer=null)},t.prototype.push=function(t,e,r,a,i,n,s,l){var u=this.w,d=isNaN(i.startDTS)?i.start:i.startDTS,f=i.decryptdata,h=this.frag,c=!(h&&i.cc===h.cc),p=!(h&&i.level===h.level),v=h&&i.sn===h.sn+1,g=!p&&v;if(c&&o.b.log(this.id+":discontinuity detected"),p&&o.b.log(this.id+":switch detected"),this.frag=i,u)u.postMessage({cmd:"demux",data:t,decryptdata:f,initSegment:e,audioCodec:r,videoCodec:a,timeOffset:d,discontinuity:c,trackSwitch:p,contiguous:g,duration:n,accurateTimeOffset:s,defaultInitPTS:l},t instanceof ArrayBuffer?[t]:[]);else{var y=this.demuxer;y&&y.push(t,f,e,r,a,d,c,p,g,n,s,l)}},t.prototype.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":URL.revokeObjectURL(this.w.objectURL);break;case i.a.FRAG_PARSING_DATA:e.data.data1=new Uint8Array(e.data1),e.data2&&(e.data.data2=new Uint8Array(e.data2));default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}},t}();e.a=p},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(e,r){a(this,t),this.subtle=e,this.aesIV=r}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}();e.a=i},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(e,r){a(this,t),this.subtle=e,this.key=r}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}();e.a=i},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){var e=t.byteLength,r=e&&new DataView(t).getUint8(e-1);return r?t.slice(0,e-r):t}var n=function(){function t(){a(this,t),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 t.prototype.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),a=0;a<4;a++)r[a]=e.getUint32(4*a);return r},t.prototype.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,a=r[0],i=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],d=s[2],f=s[3],h=new Uint32Array(256),c=0,p=0,v=0;for(v=0;v<256;v++)h[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99,t[c]=g,e[g]=c;var y=h[c],m=h[y],b=h[m],E=257*h[g]^16843008*g;a[c]=E<<24|E>>>8,i[c]=E<<16|E>>>16,n[c]=E<<8|E>>>24,o[c]=E,E=16843009*b^65537*m^257*y^16843008*c,l[g]=E<<24|E>>>8,u[g]=E<<16|E>>>16,d[g]=E<<8|E>>>24,f[g]=E,c?(c=y^h[h[h[b^y]]],p^=h[h[p]]):c=p=1}},t.prototype.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,a=0;a<e.length&&r;)r=e[a]===this.key[a],a++;if(!r){this.key=e;var i=this.keySize=e.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var n=this.ksRows=4*(i+6+1),o=void 0,s=void 0,l=this.keySchedule=new Uint32Array(n),u=this.invKeySchedule=new Uint32Array(n),d=this.sBox,f=this.rcon,h=this.invSubMix,c=h[0],p=h[1],v=h[2],g=h[3],y=void 0,m=void 0;for(o=0;o<n;o++)o<i?y=l[o]=e[o]:(m=y,o%i==0?(m=m<<8|m>>>24,m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m],m^=f[o/i|0]<<24):i>6&&o%i==4&&(m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m]),l[o]=y=(l[o-i]^m)>>>0);for(s=0;s<n;s++)o=n-s,m=3&s?l[o]:l[o-4],u[s]=s<4||o<=4?m:c[d[m>>>24]]^p[d[m>>>16&255]]^v[d[m>>>8&255]]^g[d[255&m]],u[s]=u[s]>>>0}},t.prototype.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},t.prototype.decrypt=function(t,e,r){for(var a,n,o=this.keySize+6,s=this.invKeySchedule,l=this.invSBox,u=this.invSubMix,d=u[0],f=u[1],h=u[2],c=u[3],p=this.uint8ArrayToUint32Array_(r),v=p[0],g=p[1],y=p[2],m=p[3],b=new Int32Array(t),E=new Int32Array(b.length),S=void 0,T=void 0,A=void 0,R=void 0,_=void 0,L=void 0,w=void 0,D=void 0,O=void 0,I=void 0,x=void 0,k=void 0,C=this.networkToHostOrderSwap;e<b.length;){for(O=C(b[e]),I=C(b[e+1]),x=C(b[e+2]),k=C(b[e+3]),_=O^s[0],L=k^s[1],w=x^s[2],D=I^s[3],a=4,n=1;n<o;n++)S=d[_>>>24]^f[L>>16&255]^h[w>>8&255]^c[255&D]^s[a],T=d[L>>>24]^f[w>>16&255]^h[D>>8&255]^c[255&_]^s[a+1],A=d[w>>>24]^f[D>>16&255]^h[_>>8&255]^c[255&L]^s[a+2],R=d[D>>>24]^f[_>>16&255]^h[L>>8&255]^c[255&w]^s[a+3],_=S,L=T,w=A,D=R,a+=4;S=l[_>>>24]<<24^l[L>>16&255]<<16^l[w>>8&255]<<8^l[255&D]^s[a],T=l[L>>>24]<<24^l[w>>16&255]<<16^l[D>>8&255]<<8^l[255&_]^s[a+1],A=l[w>>>24]<<24^l[D>>16&255]<<16^l[_>>8&255]<<8^l[255&L]^s[a+2],R=l[D>>>24]<<24^l[_>>16&255]<<16^l[L>>8&255]<<8^l[255&w]^s[a+3],a+=3,E[e]=C(S^v),E[e+1]=C(R^g),E[e+2]=C(A^y),E[e+3]=C(T^m),v=O,g=I,y=x,m=k,e+=4}return i(E.buffer)},t.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},t}();e.a=n},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(16),n=r(0),o=r(6),s=function(){function t(e,r,i){a(this,t),this.observer=e,this.config=i,this.remuxer=r}return t.prototype.resetInitSegment=function(t,e,r,a){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:e,duration:a,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){if(!t)return!1;for(var e=o.a.getID3Data(t,0)||[],r=e.length,a=t.length;r<a;r++)if(i.e(t,r))return n.b.log("ADTS sync word found !"),!0;return!1},t.prototype.append=function(t,e,r,a){for(var s=this._audioTrack,l=o.a.getID3Data(t,0)||[],u=o.a.getTimeStamp(l),d=u?90*u:9e4*e,f=0,h=d,c=t.length,p=l.length,v=[{pts:h,dts:h,data:l}];p<c-1;)if(i.d(t,p)&&p+5<c){i.c(s,this.observer,t,p,s.manifestCodec);var g=i.a(s,t,p,d,f);if(!g){n.b.log("Unable to parse AAC frame");break}p+=g.length,h=g.sample.pts,f++}else o.a.isHeader(t,p)?(l=o.a.getID3Data(t,p),v.push({pts:h,dts:h,data:l}),p+=l.length):p++;this.remuxer.remux(s,{samples:[]},{samples:v,inputTimeScale:9e4},{samples:[]},e,r,a)},t.prototype.destroy=function(){},t}();e.a=s},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(16),n=r(17),o=r(1),s=r(32),l=r(33),u=r(0),d=r(2),f={video:0,audio:1,id3:2,text:3},h=function(){function t(e,r,i,n){a(this,t),this.observer=e,this.config=i,this.typeSupported=n,this.remuxer=r,this.sampleAes=null}return t.prototype.setDecryptData=function(t){null!=t&&null!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new l.a(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},t.probe=function(e){var r=t._syncOffset(e);return!(r<0)&&(r&&u.b.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),!0)},t._syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),r=0;r<e;){if(71===t[r]&&71===t[r+188]&&71===t[r+376])return r;r++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:f[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:"video"===t?0:void 0,isAAC:"audio"===t||void 0,duration:"audio"===t?e:void 0}},t.prototype.resetInitSegment=function(e,r,a,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video",i),this._audioTrack=t.createTrack("audio",i),this._id3Track=t.createTrack("id3",i),this._txtTrack=t.createTrack("text",i),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=r,this.videoCodec=a,this._duration=i},t.prototype.resetTimeStamp=function(){},t.prototype.append=function(e,r,a,i){var n,s,l,f,h,c=e.length,p=!1;this.contiguous=a;var v=this.pmtParsed,g=this._avcTrack,y=this._audioTrack,m=this._id3Track,b=g.pid,E=y.pid,S=m.pid,T=this._pmtId,A=g.pesData,R=y.pesData,_=m.pesData,L=this._parsePAT,w=this._parsePMT,D=this._parsePES,O=this._parseAVCPES.bind(this),I=this._parseAACPES.bind(this),x=this._parseMPEGPES.bind(this),k=this._parseID3PES.bind(this),C=t._syncOffset(e);for(c-=(c+C)%188,n=C;n<c;n+=188)if(71===e[n]){if(s=!!(64&e[n+1]),l=((31&e[n+1])<<8)+e[n+2],(48&e[n+3])>>4>1){if((f=n+5+e[n+4])===n+188)continue}else f=n+4;switch(l){case b:s&&(A&&(h=D(A))&&O(h,!1),A={data:[],size:0}),A&&(A.data.push(e.subarray(f,n+188)),A.size+=n+188-f);break;case E:s&&(R&&(h=D(R))&&(y.isAAC?I(h):x(h)),R={data:[],size:0}),R&&(R.data.push(e.subarray(f,n+188)),R.size+=n+188-f);break;case S:s&&(_&&(h=D(_))&&k(h),_={data:[],size:0}),_&&(_.data.push(e.subarray(f,n+188)),_.size+=n+188-f);break;case 0:s&&(f+=e[f]+1),T=this._pmtId=L(e,f);break;case T:s&&(f+=e[f]+1);var P=w(e,f,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);b=P.avc,b>0&&(g.pid=b),E=P.audio,E>0&&(y.pid=E,y.isAAC=P.isAAC),S=P.id3,S>0&&(m.pid=S),p&&!v&&(u.b.log("reparse from beginning"),p=!1,n=C-188),v=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(o.a.ERROR,{type:d.b.MEDIA_ERROR,details:d.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});A&&(h=D(A))?(O(h,!0),g.pesData=null):g.pesData=A,R&&(h=D(R))?(y.isAAC?I(h):x(h),y.pesData=null):(R&&R.size&&u.b.log("last AAC PES packet truncated,might overlap between fragments"),y.pesData=R),_&&(h=D(_))?(k(h),m.pesData=null):m.pesData=_,null==this.sampleAes?this.remuxer.remux(y,g,m,this._txtTrack,r,a,i):this.decryptAndRemux(y,g,m,this._txtTrack,r,a,i)},t.prototype.decryptAndRemux=function(t,e,r,a,i,n,o){if(t.samples&&t.isAAC){var s=this;this.sampleAes.decryptAacSamples(t.samples,0,function(){s.decryptAndRemuxAvc(t,e,r,a,i,n,o)})}else this.decryptAndRemuxAvc(t,e,r,a,i,n,o)},t.prototype.decryptAndRemuxAvc=function(t,e,r,a,i,n,o){if(e.samples){var s=this;this.sampleAes.decryptAvcSamples(e.samples,0,0,function(){s.remuxer.remux(t,e,r,a,i,n,o)})}else this.remuxer.remux(t,e,r,a,i,n,o)},t.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},t.prototype._parsePMT=function(t,e,r,a){var i,n,o,s,l={audio:-1,avc:-1,id3:-1,isAAC:!0};for(i=(15&t[e+1])<<8|t[e+2],n=e+3+i-4,o=(15&t[e+10])<<8|t[e+11],e+=12+o;e<n;){switch(s=(31&t[e+1])<<8|t[e+2],t[e]){case 207:if(!a){u.b.log("unkown stream type:"+t[e]);break}case 15:-1===l.audio&&(l.audio=s);break;case 21:-1===l.id3&&(l.id3=s);break;case 219:if(!a){u.b.log("unkown stream type:"+t[e]);break}case 27:-1===l.avc&&(l.avc=s);break;case 3:case 4:r?-1===l.audio&&(l.audio=s,l.isAAC=!1):u.b.log("MPEG audio found, not supported in this browser for now");break;case 36:u.b.warn("HEVC stream type found, not supported for now");break;default:u.b.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}return l},t.prototype._parsePES=function(t){var e,r,a,i,n,o,s,l,d=0,f=t.data;if(!t||0===t.size)return null;for(;f[0].length<19&&f.length>1;){var h=new Uint8Array(f[0].length+f[1].length);h.set(f[0]),h.set(f[1],f[0].length),f[0]=h,f.splice(1,1)}if(e=f[0],1===(e[0]<<16)+(e[1]<<8)+e[2]){if((a=(e[4]<<8)+e[5])&&a>t.size-6)return null;r=e[7],192&r&&(o=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,o>4294967295&&(o-=8589934592),64&r?(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,s>4294967295&&(s-=8589934592),o-s>54e5&&(u.b.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),i=e[8],l=i+9,t.size-=l,n=new Uint8Array(t.size);for(var c=0,p=f.length;c<p;c++){e=f[c];var v=e.byteLength;if(l){if(l>v){l-=v;continue}e=e.subarray(l),v-=l,l=0}n.set(e,d),d+=v}return a&&(a-=i+3),{data:n,pts:o,dts:s,len:a}}return null},t.prototype.pushAccesUnit=function(t,e){if(t.units.length&&t.frame){var r=e.samples,a=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===t.key||e.sps&&(a||this.contiguous)?(t.id=a,r.push(t)):e.dropped++}t.debug.length&&u.b.log(t.pts+"/"+t.dts+":"+t.debug)},t.prototype._parseAVCPES=function(t,e){var r,a,i,n=this,o=this._avcTrack,l=this._parseAVCNALu(t.data),u=this.avcSample,d=!1,f=this.pushAccesUnit.bind(this),h=function(t,e,r,a){return{key:t,pts:e,dts:r,units:[],debug:a}};t.data=null,u&&l.length&&!o.audFound&&(f(u,o),u=this.avcSample=h(!1,t.pts,t.dts,"")),l.forEach(function(e){switch(e.type){case 1:a=!0,u||(u=n.avcSample=h(!0,t.pts,t.dts,"")),u.frame=!0;var l=e.data;if(d&&l.length>4){var c=new s.a(l).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(u.key=!0)}break;case 5:a=!0,u||(u=n.avcSample=h(!0,t.pts,t.dts,"")),u.key=!0,u.frame=!0;break;case 6:a=!0,r=new s.a(n.discardEPB(e.data)),r.readUByte();for(var p=0,v=0,g=!1,y=0;!g&&r.bytesAvailable>1;){p=0;do{y=r.readUByte(),p+=y}while(255===y);v=0;do{y=r.readUByte(),v+=y}while(255===y);if(4===p&&0!==r.bytesAvailable){g=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){var m=r.readUByte(),b=r.readUByte(),E=31&m,S=[m,b];for(i=0;i<E;i++)S.push(r.readUByte()),S.push(r.readUByte()),S.push(r.readUByte());n._insertSampleInOrder(n._txtTrack.samples,{type:3,pts:t.pts,bytes:S})}}}}}else if(v<r.bytesAvailable)for(i=0;i<v;i++)r.readUByte()}break;case 7:if(a=!0,d=!0,!o.sps){r=new s.a(e.data);var T=r.readSPS();o.width=T.width,o.height=T.height,o.pixelRatio=T.pixelRatio,o.sps=[e.data],o.duration=n._duration;var A=e.data.subarray(1,4),R="avc1.";for(i=0;i<3;i++){var _=A[i].toString(16);_.length<2&&(_="0"+_),R+=_}o.codec=R}break;case 8:a=!0,o.pps||(o.pps=[e.data]);break;case 9:a=!1,o.audFound=!0,u&&f(u,o),u=n.avcSample=h(!1,t.pts,t.dts,"");break;case 12:a=!1;break;default:a=!1,u&&(u.debug+="unknown NAL "+e.type+" ")}if(u&&a){u.units.push(e)}}),e&&u&&(f(u,o),this.avcSample=null)},t.prototype._insertSampleInOrder=function(t,e){var r=t.length;if(r>0){if(e.pts>=t[r-1].pts)t.push(e);else for(var a=r-1;a>=0;a--)if(e.pts<t[a].pts){t.splice(a,0,e);break}}else t.push(e)},t.prototype._getLastNalUnit=function(){var t=this.avcSample,e=void 0;if(!t||0===t.units.length){var r=this._avcTrack,a=r.samples;t=a[a.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},t.prototype._parseAVCNALu=function(t){var e,r,a,i,n,o=0,s=t.byteLength,l=this._avcTrack,u=l.naluState||0,d=u,f=[],h=-1;for(-1===u&&(h=0,n=31&t[0],u=0,o=1);o<s;)if(e=t[o++],u)if(1!==u)if(e)if(1===e){if(h>=0)a={data:t.subarray(h,o-u-1),type:n},f.push(a);else{var c=this._getLastNalUnit();if(c&&(d&&o<=4-d&&c.state&&(c.data=c.data.subarray(0,c.data.byteLength-d)),(r=o-u-1)>0)){var p=new Uint8Array(c.data.byteLength+r);p.set(c.data,0),p.set(t.subarray(0,r),c.data.byteLength),c.data=p}}o<s?(i=31&t[o],h=o,n=i,u=0):u=-1}else u=0;else u=3;else u=e?0:2;else u=e?0:1;if(h>=0&&u>=0&&(a={data:t.subarray(h,s),type:n,state:u},f.push(a)),0===f.length){var v=this._getLastNalUnit();if(v){var g=new Uint8Array(v.data.byteLength+t.byteLength);g.set(v.data,0),g.set(t,v.data.byteLength),v.data=g}}return l.naluState=u,f},t.prototype.discardEPB=function(t){for(var e,r,a=t.byteLength,i=[],n=1;n<a-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return t;e=a-i.length,r=new Uint8Array(e);var o=0;for(n=0;n<e;o++,n++)o===i[0]&&(o++,i.shift()),r[n]=t[o];return r},t.prototype._parseAACPES=function(t){var e,r,a,n,s,l=this._audioTrack,f=t.data,h=t.pts,c=this.aacOverFlow,p=this.aacLastPTS;if(c){var v=new Uint8Array(c.byteLength+f.byteLength);v.set(c,0),v.set(f,c.byteLength),f=v}for(a=0,s=f.length;a<s-1&&!i.d(f,a);a++);if(a){var g,y;if(a<s-1?(g="AAC PES did not start with ADTS header,offset:"+a,y=!1):(g="no ADTS header found in AAC PES",y=!0),u.b.warn("parsing error:"+g),this.observer.trigger(o.a.ERROR,{type:d.b.MEDIA_ERROR,details:d.a.FRAG_PARSING_ERROR,fatal:y,reason:g}),y)return}if(i.c(l,this.observer,f,a,this.audioCodec),r=0,e=i.b(l.samplerate),c&&p){var m=p+e;Math.abs(m-h)>1&&(u.b.log("AAC: align PTS for overlapping frames by "+Math.round((m-h)/90)),h=m)}for(;a<s;)if(i.d(f,a)&&a+5<s){var b=i.a(l,f,a,h,r);if(!b)break;a+=b.length,n=b.sample.pts,r++}else a++;c=a<s?f.subarray(a,s):null,this.aacOverFlow=c,this.aacLastPTS=n},t.prototype._parseMPEGPES=function(t){for(var e=t.data,r=e.length,a=0,i=0,o=t.pts;i<r;)if(n.a.isHeader(e,i)){var s=n.a.appendFrame(this._audioTrack,e,i,o,a);if(!s)break;i+=s.length,a++}else i++},t.prototype._parseID3PES=function(t){this._id3Track.samples.push(t)},t}();e.a=h},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(0),n=function(){function t(e){a(this,t),this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}return t.prototype.loadWord=function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,a=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");a.set(t.subarray(r,r+i)),this.word=new DataView(a.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},t.prototype.skipBits=function(t){var e;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,e=t>>3,t-=e>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},t.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&i.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0&&this.bitsAvailable?r<<e|this.readBits(e):r},t.prototype.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},t.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},t.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},t.prototype.readBoolean=function(){return 1===this.readBits(1)},t.prototype.readUByte=function(){return this.readBits(8)},t.prototype.readUShort=function(){return this.readBits(16)},t.prototype.readUInt=function(){return this.readBits(32)},t.prototype.skipScalingList=function(t){var e,r,a=8,i=8;for(e=0;e<t;e++)0!==i&&(r=this.readEG(),i=(a+r+256)%256),a=0===i?a:i},t.prototype.readSPS=function(){var t,e,r,a,i,n,o,s=0,l=0,u=0,d=0,f=this.readUByte.bind(this),h=this.readBits.bind(this),c=this.readUEG.bind(this),p=this.readBoolean.bind(this),v=this.skipBits.bind(this),g=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);if(f(),t=f(),h(5),v(3),f(),y(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var b=c();if(3===b&&v(1),y(),y(),v(1),p())for(n=3!==b?8:12,o=0;o<n;o++)p()&&m(o<6?16:64)}y();var E=c();if(0===E)c();else if(1===E)for(v(1),g(),g(),e=c(),o=0;o<e;o++)g();y(),v(1),r=c(),a=c(),i=h(1),0===i&&v(1),v(1),p()&&(s=c(),l=c(),u=c(),d=c());var S=[1,1];if(p()&&p()){switch(f()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[f()<<8|f(),f()<<8|f()]}}return{width:Math.ceil(16*(r+1)-2*s-2*l),height:(2-i)*(a+1)*16-(i?2:4)*(u+d),pixelRatio:S}},t.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}();e.a=n},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(15),n=function(){function t(e,r,n,o){a(this,t),this.decryptdata=n,this.discardEPB=o,this.decrypter=new i.a(e,r)}return t.prototype.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,e)},t.prototype.decryptAacSample=function(t,e,r,a){var i=t[e].unit,n=i.subarray(16,i.length-i.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),s=this;this.decryptBuffer(o,function(n){n=new Uint8Array(n),i.set(n,16),a||s.decryptAacSamples(t,e+1,r)})},t.prototype.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)){var a=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,a),!a)return}}},t.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),a=0,i=32;i<=t.length-16;i+=160,a+=16)r.set(t.subarray(i,i+16),a);return r},t.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,a=32;a<=t.length-16;a+=160,r+=16)t.set(e.subarray(r,r+16),a);return t},t.prototype.decryptAvcSample=function(t,e,r,a,i,n){var o=this.discardEPB(i.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,function(s){i.data=l.getAvcDecryptedUnit(o,s),n||l.decryptAvcSamples(t,e,r+1,a)})},t.prototype.decryptAvcSamples=function(t,e,r,a){for(;;e++,r=0){if(e>=t.length)return void a();for(var i=t[e].units;!(r>=i.length);r++){var n=i[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,a,n,o),!o)return}}}},t}();e.a=n},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(6),n=r(0),o=r(17),s=function(){function t(e,r,i){a(this,t),this.observer=e,this.config=i,this.remuxer=r}return t.prototype.resetInitSegment=function(t,e,r,a){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:e,duration:a,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){var e,r,a=i.a.getID3Data(t,0);if(a&&void 0!==i.a.getTimeStamp(a))for(e=a.length,r=Math.min(t.length-1,e+100);e<r;e++)if(o.a.probe(t,e))return n.b.log("MPEG Audio sync word found !"),!0;return!1},t.prototype.append=function(t,e,r,a){for(var n=i.a.getID3Data(t,0),s=i.a.getTimeStamp(n),l=s?90*s:9e4*e,u=n.length,d=t.length,f=0,h=0,c=this._audioTrack,p=[{pts:l,dts:l,data:n}];u<d;)if(o.a.isHeader(t,u)){var v=o.a.appendFrame(c,t,u,l,f);if(!v)break;u+=v.length,h=v.sample.pts,f++}else i.a.isHeader(t,u)?(n=i.a.getID3Data(t,u),p.push({pts:h,dts:h,data:n}),u+=n.length):u++;this.remuxer.remux(c,{samples:[]},{samples:p,inputTimeScale:9e4},{samples:[]},e,r,a)},t.prototype.destroy=function(){},t}();e.a=s},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(36),n=r(1),o=r(0),s=r(37),l=r(2),u=function(){function t(e,r,i,n){a(this,t),this.observer=e,this.config=r,this.typeSupported=i;var o=navigator.userAgent;this.isSafari=n&&n.indexOf("Apple")>-1&&o&&!o.match("CriOS"),this.ISGenerated=!1}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},t.prototype.resetInitSegment=function(){this.ISGenerated=!1},t.prototype.remux=function(t,e,r,a,i,s,l){if(this.ISGenerated||this.generateIS(t,e,i),this.ISGenerated){var u=t.samples.length,d=e.samples.length,f=i,h=i;if(u&&d){var c=(t.samples[0].dts-e.samples[0].dts)/e.inputTimeScale;f+=Math.max(0,c),h+=Math.max(0,-c)}if(u){t.timescale||(o.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,i));var p=this.remuxAudio(t,f,s,l);if(d){var v=void 0;p&&(v=p.endPTS-p.startPTS),e.timescale||(o.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,i)),this.remuxVideo(e,h,s,v,l)}}else{var g=void 0;d&&(g=this.remuxVideo(e,h,s,l)),g&&t.codec&&this.remuxEmptyAudio(t,f,s,g)}}r.samples.length&&this.remuxID3(r,i),a.samples.length&&this.remuxText(a,i),this.observer.trigger(n.a.FRAG_PARSED)},t.prototype.generateIS=function(t,e,r){var a,i,u=this.observer,d=t.samples,f=e.samples,h=this.typeSupported,c="audio/mp4",p={},v={tracks:p},g=void 0===this._initPTS;if(g&&(a=i=1/0),t.config&&d.length&&(t.timescale=t.samplerate,o.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(h.mpeg?(c="audio/mpeg",t.codec=""):h.mp3&&(t.codec="mp3")),p.audio={container:c,codec:t.codec,initSegment:!t.isAAC&&h.mpeg?new Uint8Array:s.a.initSegment([t]),metadata:{channelCount:t.channelCount}},g&&(a=i=d[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&f.length){var y=e.inputTimeScale;e.timescale=y,p.video={container:"video/mp4",codec:e.codec,initSegment:s.a.initSegment([e]),metadata:{width:e.width,height:e.height}},g&&(a=Math.min(a,f[0].pts-y*r),i=Math.min(i,f[0].dts-y*r),this.observer.trigger(n.a.INIT_PTS_FOUND,{initPTS:a}))}Object.keys(p).length?(u.trigger(n.a.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,g&&(this._initPTS=a,this._initDTS=i)):u.trigger(n.a.ERROR,{type:l.b.MEDIA_ERROR,details:l.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.prototype.remuxVideo=function(t,e,r,a,i){var u,d,f,h,c,p,v,g=8,y=t.timescale,m=t.samples,b=[],E=m.length,S=this._PTSNormalize,T=this._initDTS,A=this.nextAvcDts,R=this.isSafari;R&&(r|=m.length&&A&&(i&&Math.abs(e-A/y)<.1||Math.abs(m[0].pts-A-T)<y/5)),r||(A=e*y),m.forEach(function(t){t.pts=S(t.pts-T,A),t.dts=S(t.dts-T,A)}),m.sort(function(t,e){var r=t.dts-e.dts,a=t.pts-e.pts;return r||(a||t.id-e.id)});var _=m.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);if(_<0){o.b.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(_/90)+" ms to overcome this issue");for(var L=0;L<m.length;L++)m[L].dts+=_}var w=m[0];c=Math.max(w.dts,0),h=Math.max(w.pts,0);var D=Math.round((c-A)/90);r&&D&&(D>1?o.b.log("AVC:"+D+" ms hole between fragments detected,filling it"):D<-1&&o.b.log("AVC:"+-D+" ms overlapping between fragments detected"),c=A,m[0].dts=c,h=Math.max(h-D,A),m[0].pts=h,o.b.log("Video/PTS/DTS adjusted: "+Math.round(h/90)+"/"+Math.round(c/90)+",delta:"+D+" ms")),w=m[m.length-1],v=Math.max(w.dts,0),p=Math.max(w.pts,0,v),R&&(u=Math.round((v-c)/(m.length-1)));for(var O=0,I=0,x=0;x<E;x++){for(var k=m[x],C=k.units,P=C.length,F=0,M=0;M<P;M++)F+=C[M].data.length;I+=F,O+=P,k.length=F,k.dts=R?c+x*u:Math.max(k.dts,c),k.pts=Math.max(k.pts,k.dts)}var N=I+4*O+8;try{d=new Uint8Array(N)}catch(t){return void this.observer.trigger(n.a.ERROR,{type:l.b.MUX_ERROR,details:l.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating video mdat "+N})}var U=new DataView(d.buffer);U.setUint32(0,N),d.set(s.a.types.mdat,4);for(var B=0;B<E;B++){for(var G=m[B],j=G.units,H=0,K=void 0,V=0,W=j.length;V<W;V++){var Y=j[V],z=Y.data,X=Y.data.byteLength;U.setUint32(g,X),g+=4,d.set(z,g),g+=X,H+=4+X}if(R)K=Math.max(0,u*Math.round((G.pts-G.dts)/u));else{if(B<E-1)u=m[B+1].dts-G.dts;else{var q=this.config,Q=G.dts-m[B>0?B-1:B].dts;if(q.stretchShortVideoTrack){var J=q.maxBufferHole,Z=q.maxSeekHole,$=Math.floor(Math.min(J,Z)*y),tt=(a?h+a*y:this.nextAudioPts)-G.pts;tt>$?(u=tt-Q,u<0&&(u=Q),o.b.log("It is approximately "+tt/90+" ms to the next segment; using duration "+u/90+" ms for the last video frame.")):u=Q}else u=Q}K=Math.round(G.pts-G.dts)}b.push({size:H,duration:u,cts:K,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:G.key?2:1,isNonSync:G.key?0:1}})}this.nextAvcDts=v+u;var et=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,b.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var rt=b[0].flags;rt.dependsOn=2,rt.isNonSync=0}t.samples=b,f=s.a.moof(t.sequenceNumber++,c,t),t.samples=[];var at={data1:f,data2:d,startPTS:h/y,endPTS:(p+u)/y,startDTS:c/y,endDTS:this.nextAvcDts/y,type:"video",nb:b.length,dropped:et};return this.observer.trigger(n.a.FRAG_PARSING_DATA,at),at},t.prototype.remuxAudio=function(t,e,r,a){var u,d,f,h,c,p,v,g=t.inputTimeScale,y=t.timescale,m=g/y,b=t.isAAC?1024:1152,E=b*m,S=this._PTSNormalize,T=this._initDTS,A=!t.isAAC&&this.typeSupported.mpeg,R=t.samples,_=[],L=this.nextAudioPts;if(r|=R.length&&L&&(a&&Math.abs(e-L/g)<.1||Math.abs(R[0].pts-L-T)<20*E),R.forEach(function(t){t.pts=t.dts=S(t.pts-T,e*g)}),R=R.filter(function(t){return t.pts>=0}),0!==R.length){if(r||(L=a?e*g:R[0].pts),t.isAAC)for(var w=this.config.maxAudioFramesDrift,D=0,O=L;D<R.length;){var I,x=R[D],k=x.pts;I=k-O;var C=Math.abs(1e3*I/g);if(I<=-w*E)o.b.warn("Dropping 1 audio frame @ "+(O/g).toFixed(3)+"s due to "+Math.round(C)+" ms overlap."),R.splice(D,1),t.len-=x.unit.length;else if(I>=w*E&&C<1e4&&O){var P=Math.round(I/E);o.b.warn("Injecting "+P+" audio frame @ "+(O/g).toFixed(3)+"s due to "+Math.round(1e3*I/g)+" ms gap.");for(var F=0;F<P;F++){var M=Math.max(O,0);f=i.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),f||(o.b.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),f=x.unit.subarray()),R.splice(D,0,{unit:f,pts:M,dts:M}),t.len+=f.length,O+=E,D++}x.pts=x.dts=O,O+=E,D++}else Math.abs(I),x.pts=x.dts=O,O+=E,D++}for(var N=0,U=R.length;N<U;N++){var B=R[N],G=B.unit,j=B.pts;if(void 0!==v)d.duration=Math.round((j-v)/m);else{var H=Math.round(1e3*(j-L)/g),K=0;if(r&&t.isAAC&&H){if(H>0&&H<1e4)K=Math.round((j-L)/E),o.b.log(H+" ms hole between AAC samples detected,filling it"),K>0&&(f=i.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),f||(f=G.subarray()),t.len+=K*f.length);else if(H<-12){o.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(L/g).toFixed(3)+"s/"+(j/g).toFixed(3)+"s/"+-H+"ms"),t.len-=G.byteLength;continue}j=L}if(p=j,!(t.len>0))return;var V=A?t.len:t.len+8;u=A?0:8;try{h=new Uint8Array(V)}catch(t){return void this.observer.trigger(n.a.ERROR,{type:l.b.MUX_ERROR,details:l.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:V,reason:"fail allocating audio mdat "+V})}if(!A){new DataView(h.buffer).setUint32(0,V),h.set(s.a.types.mdat,4)}for(var W=0;W<K;W++)f=i.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),f||(o.b.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),f=G.subarray()),h.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}},_.push(d)}h.set(G,u);var Y=G.byteLength;u+=Y,d={size:Y,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},_.push(d),v=j}var z=0,X=_.length;if(X>=2&&(z=_[X-2].duration,d.duration=z),X){this.nextAudioPts=L=v+m*z,t.len=0,t.samples=_,c=A?new Uint8Array:s.a.moof(t.sequenceNumber++,p/m,t),t.samples=[];var q=p/g,Q=L/g,J={data1:c,data2:h,startPTS:q,endPTS:Q,startDTS:q,endDTS:Q,type:"audio",nb:X};return this.observer.trigger(n.a.FRAG_PARSING_DATA,J),J}return null}},t.prototype.remuxEmptyAudio=function(t,e,r,a){var n=t.inputTimeScale,s=t.samplerate?t.samplerate:n,l=n/s,u=this.nextAudioPts,d=(void 0!==u?u:a.startDTS*n)+this._initDTS,f=a.endDTS*n+this._initDTS,h=1024*l,c=Math.ceil((f-d)/h),p=i.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(o.b.warn("remux empty Audio"),!p)return void o.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var v=[],g=0;g<c;g++){var y=d+g*h;v.push({unit:p,pts:y,dts:y}),t.len+=p.length}t.samples=v,this.remuxAudio(t,e,r)},t.prototype.remuxID3=function(t,e){var r,a=t.samples.length,i=t.inputTimeScale,o=this._initPTS,s=this._initDTS;if(a){for(var l=0;l<a;l++)r=t.samples[l],r.pts=(r.pts-o)/i,r.dts=(r.dts-s)/i;this.observer.trigger(n.a.FRAG_PARSING_METADATA,{samples:t.samples})}t.samples=[],e=e},t.prototype.remuxText=function(t,e){t.samples.sort(function(t,e){return t.pts-e.pts});var r,a=t.samples.length,i=t.inputTimeScale,o=this._initPTS;if(a){for(var s=0;s<a;s++)r=t.samples[s],r.pts=(r.pts-o)/i;this.observer.trigger(n.a.FRAG_PARSING_USERDATA,{samples:t.samples})}t.samples=[],e=e},t.prototype._PTSNormalize=function(t,e){var r;if(void 0===e)return t;for(r=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=r;return t},t}();e.a=u},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(){a(this,t)}return t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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===e)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===e)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===e)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===e)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},t}();e.a=i},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=Math.pow(2,32)-1,n=function(){function t(){a(this,t)}return t.init=function(){t.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:[]};var e;for(e in t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.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]),a=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]);t.HDLR_TYPES={video:r,audio:a};var i=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]);t.STTS=t.STSC=t.STCO=n,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.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]);t.FTYP=t.box(t.types.ftyp,o,l,o,s),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))},t.box=function(t){for(var e,r=Array.prototype.slice.call(arguments,1),a=8,i=r.length,n=i;i--;)a+=r[i].byteLength;for(e=new Uint8Array(a),e[0]=a>>24&255,e[1]=a>>16&255,e[2]=a>>8&255,e[3]=255&a,e.set(t,4),i=0,a=8;i<n;i++)e.set(r[i],a),a+=r[i].byteLength;return e},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,r){r*=e;var a=Math.floor(r/(i+1)),n=Math.floor(r%(i+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,a>>24,a>>16&255,a>>8&255,255&a,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,a){return t.box(t.types.moof,t.mfhd(e),t.traf(a,r))},t.moov=function(e){for(var r=e.length,a=[];r--;)a[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(a).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,a=[];r--;)a[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(a))},t.mvhd=function(e,r){r*=e;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,e>>24&255,e>>16&255,e>>8&255,255&e,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 t.box(t.types.mvhd,o)},t.sdtp=function(e){var r,a,i=e.samples||[],n=new Uint8Array(4+i.length);for(a=0;a<i.length;a++)r=i[a].flags,n[a+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return t.box(t.types.sdtp,n)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var r,a,i,n=[],o=[];for(r=0;r<e.sps.length;r++)a=e.sps[r],i=a.byteLength,n.push(i>>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(a));for(r=0;r<e.pps.length;r++)a=e.pps[r],i=a.byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(a));var s=t.box(t.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(o))),l=e.width,u=e.height,d=e.pixelRatio[0],f=e.pixelRatio[1];return t.box(t.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,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,f>>24,f>>16&255,f>>8&255,255&f])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,a=e.duration*e.timescale,n=e.width,o=e.height,s=Math.floor(a/(i+1)),l=Math.floor(a%(i+1));return t.box(t.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]))},t.traf=function(e,r){var a=t.sdtp(e),n=e.id,o=Math.floor(r/(i+1)),s=Math.floor(r%(i+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),t.box(t.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])),t.trun(e,a.length+16+20+8+16+8+8),a)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.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]))},t.trun=function(e,r){var a,i,n,o,s,l,u=e.samples||[],d=u.length,f=12+16*d,h=new Uint8Array(f);for(r+=8+f,h.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),a=0;a<d;a++)i=u[a],n=i.duration,o=i.size,s=i.flags,l=i.cts,h.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*a);return t.box(t.types.trun,h)},t.initSegment=function(e){t.types||t.init();var r,a=t.moov(e);return r=new Uint8Array(t.FTYP.byteLength+a.byteLength),r.set(t.FTYP),r.set(a,t.FTYP.byteLength),r},t}();e.a=n},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1),n=function(){function t(e){a(this,t),this.observer=e}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(){},t.prototype.resetInitSegment=function(){},t.prototype.remux=function(t,e,r,a,n,o,s,l){var u=this.observer,d="";t&&(d+="audio"),e&&(d+="video"),u.trigger(i.a.FRAG_PARSING_DATA,{data1:l,startPTS:n,startDTS:n,type:d,nb:1,dropped:0}),u.trigger(i.a.FRAG_PARSED)},t}();e.a=n},function(t,e,r){function a(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e.oe=function(t){throw console.error(t),t};var a=e(e.s=ENTRY_MODULE);return a.default||a}function i(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function n(t,e,a){var n={};n[a]=[];var o=e.toString(),s=o.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return n;for(var d,f=s[1],h=new RegExp("(\\\\n|\\W)"+i(f)+u,"g");d=h.exec(o);)"dll-reference"!==d[3]&&n[a].push(d[3]);for(h=new RegExp("\\("+i(f)+'\\("(dll-reference\\s('+l+'))"\\)\\)'+u,"g");d=h.exec(o);)t[d[2]]||(n[a].push(d[1]),t[d[2]]=r(d[1]).m),n[d[2]]=n[d[2]]||[],n[d[2]].push(d[4]);return n}function o(t){return Object.keys(t).reduce(function(e,r){return e||t[r].length>0},!1)}function s(t,e){for(var r={main:[e]},a={main:[]},i={main:{}};o(r);)for(var s=Object.keys(r),l=0;l<s.length;l++){var u=s[l],d=r[u],f=d.pop();if(i[u]=i[u]||{},!i[u][f]&&t[u][f]){i[u][f]=!0,a[u]=a[u]||[],a[u].push(f);for(var h=n(t,t[u][f],u),c=Object.keys(h),p=0;p<c.length;p++)r[c[p]]=r[c[p]]||[],r[c[p]]=r[c[p]].concat(h[c[p]])}}return a}var l="[\\.|\\-|\\+|\\w|/|@]+",u="\\((/\\*.*?\\*/)?s?.*?("+l+").*?\\)";t.exports=function(t,e){e=e||{};var i={main:r.m},n=e.all?{main:Object.keys(i)}:s(i,t),o="";Object.keys(n).filter(function(t){return"main"!==t}).forEach(function(t){for(var e=0;n[t][e];)e++;n[t].push(e),i[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+t+" = ("+a.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+n[t].map(function(e){return JSON.stringify(e)+": "+i[t][e].toString()}).join(",")+"});\n"}),o=o+"("+a.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+n.main.map(function(t){return JSON.stringify(t)+": "+i.main[t].toString()}).join(",")+"})(self);";var l=new window.Blob([o],{type:"text/javascript"});if(e.bare)return l;var u=window.URL||window.webkitURL||window.mozURL||window.msURL,d=u.createObjectURL(l),f=new window.Worker(d);return f.objectURL=d,f}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=r(14),i=r(1),n=r(0),o=r(7),s=r.n(o),l=function(t){var e=new s.a;e.trigger=function(t){for(var r=arguments.length,a=Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];e.emit.apply(e,[t,t].concat(a))},e.off=function(t){for(var r=arguments.length,a=Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];e.removeListener.apply(e,[t].concat(a))};var r=function(e,r){t.postMessage({event:e,data:r})};t.addEventListener("message",function(i){var o=i.data;switch(o.cmd){case"init":var s=JSON.parse(o.config);t.demuxer=new a.a(e,o.typeSupported,s,o.vendor);try{Object(n.a)(!0===s.debug)}catch(t){console.warn("demuxerWorker: unable to enable logs")}r("init",null);break;case"demux":t.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)}}),e.on(i.a.FRAG_DECRYPTED,r),e.on(i.a.FRAG_PARSING_INIT_SEGMENT,r),e.on(i.a.FRAG_PARSED,r),e.on(i.a.ERROR,r),e.on(i.a.FRAG_PARSING_METADATA,r),e.on(i.a.FRAG_PARSING_USERDATA,r),e.on(i.a.INIT_PTS_FOUND,r),e.on(i.a.FRAG_PARSING_DATA,function(e,r){var a=[],i={event:e,data:r};r.data1&&(i.data1=r.data1.buffer,a.push(r.data1.buffer),delete r.data1),r.data2&&(i.data2=r.data2.buffer,a.push(r.data2.buffer),delete r.data2),t.postMessage(i,a)})};e.default=l},function(t,e,r){"use strict";function a(t,e,r){var a=t[e],i=t[r],n=i.startPTS;isNaN(n)?i.start=r>e?a.start+a.duration:Math.max(a.start-i.duration,0):r>e?(a.duration=n-a.start,a.duration<0&&o.b.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!")):(i.duration=a.start-n,i.duration<0&&o.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!"))}function i(t,e,r,i,n,o){var s=r;if(!isNaN(e.startPTS)){var l=Math.abs(e.startPTS-r);isNaN(e.deltaPTS)?e.deltaPTS=l:e.deltaPTS=Math.max(l,e.deltaPTS),s=Math.max(r,e.startPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),n=Math.min(n,e.startDTS),o=Math.max(o,e.endDTS)}var u=r-e.start;e.start=e.startPTS=r,e.maxStartPTS=s,e.endPTS=i,e.startDTS=n,e.endDTS=o,e.duration=i-r;var d=e.sn;if(!t||d<t.startSN||d>t.endSN)return 0;var f,h,c;for(f=d-t.startSN,h=t.fragments,h[f]=e,c=f;c>0;c--)a(h,c,c-1);for(c=f;c<h.length-1;c++)a(h,c,c+1);return t.PTSKnown=!0,u}function n(t,e){var r,a=Math.max(t.startSN,e.startSN)-e.startSN,n=Math.min(t.endSN,e.endSN)-e.startSN,s=e.startSN-t.startSN,l=t.fragments,u=e.fragments,d=0;if(n<a)return void(e.PTSKnown=!1);for(var f=a;f<=n;f++){var h=l[s+f],c=u[f];c&&h&&(d=h.cc-c.cc,isNaN(h.startPTS)||(c.start=c.startPTS=h.startPTS,c.endPTS=h.endPTS,c.duration=h.duration,c.backtracked=h.backtracked,c.dropped=h.dropped,r=c))}if(d)for(o.b.log("discontinuity sliding from playlist, take drift into account"),f=0;f<u.length;f++)u[f].cc+=d;if(r)i(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS);else if(s>=0&&s<l.length){var p=l[s].start;for(f=0;f<u.length;f++)u[f].start+=p}e.PTSKnown=t.PTSKnown}e.b=i,e.a=n;var o=r(0)},function(t,e,r){"use strict";var a={toString:function(t){for(var e="",r=t.length,a=0;a<r;a++)e+="["+t.start(a).toFixed(3)+","+t.end(a).toFixed(3)+"]";return e}};e.a=a},function(t,e,r){"use strict";function a(t,e){for(var r=null,a=0;a<t.length;a+=1){var i=t[a];if(i&&i.cc===e){r=i;break}}return r}function i(t,e,r){var a=!1;return e&&e.details&&r&&(r.endCC>r.startCC||t&&t.cc<r.startCC)&&(a=!0),a}function n(t,e){var r=t.fragments,i=e.fragments;if(!i.length||!r.length)return void l.b.log("No fragments to align");var n=a(r,i[0].cc);return!n||n&&!n.startPTS?void l.b.log("No frag in previous level to align on"):n}function o(t,e){e.fragments.forEach(function(e){if(e){var r=e.start+t;e.start=e.startPTS=r,e.endPTS=r+e.duration}}),e.PTSKnown=!0}function s(t,e,r){if(i(t,e,r)){var a=n(e.details,r);a&&(l.b.log("Adjusting PTS using last level due to CC increase within current level"),o(a.start,r))}if(!1===r.PTSKnown&&e&&e.details){var s=e.details.programDateTime,u=r.programDateTime,d=(u-s)/1e3+e.details.fragments[0].start;isNaN(d)||(l.b.log("adjusting PTS using programDateTime delta, sliding:"+d.toFixed(3)),o(d,r))}}e.a=s;var l=(r(12),r(0))},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(3),s=function(t){function e(r){a(this,e);for(var n=arguments.length,o=Array(n>1?n-1:0),s=1;s<n;s++)o[s-1]=arguments[s];var l=i(this,t.call.apply(t,[this,r].concat(o)));return l._tickInterval=null,l._tickCallCount=0,l}return n(e,t),e.prototype.destroy=function(){this.clearInterval(),t.prototype.destroy.call(this)},e.prototype.hasInterval=function(){return!isNaN(this._tickInterval)},e.prototype.setInterval=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return!this._tickInterval&&(this._tickInterval=setInterval(this.tick.bind(this,!1),t),!0)}),e.prototype.clearInterval=function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(){return!!this._tickInterval&&(clearInterval(this._tickInterval),!0)}),e.prototype.tick=function(){1===++this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&setTimeout(this.tick.bind(this),0),this._tickCallCount=0)},e.prototype.doTick=function(){throw new Error("TaskLoop is abstract and `doLoop` must be implemented")},e}(o.a);e.a=s},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(0),u=r(2),d=r(11),f=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),h=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.MANIFEST_LOADED,o.a.LEVEL_LOADED,o.a.FRAG_LOADED,o.a.ERROR));return n.canload=!1,n.currentLevelIndex=null,n.manualLevelIndex=-1,n.timer=null,n}return n(e,t),e.prototype.onHandlerDestroying=function(){this.cleanTimer(),this.manualLevelIndex=-1},e.prototype.cleanTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.startLoad=function(){var t=this._levels;this.canload=!0,this.levelRetryCount=0,t&&t.forEach(function(t){t.loadError=0;var e=t.details;e&&e.live&&(t.details=void 0)}),null!==this.timer&&this.loadLevel()},e.prototype.stopLoad=function(){this.canload=!1},e.prototype.onManifestLoaded=function(t){var e=[],r=void 0,a={},i=null,n=!1,s=!1,f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=[];if(t.levels.forEach(function(t){t.loadError=0,t.fragmentError=!1,n=n||!!t.videoCodec,s=s||!!t.audioCodec||!(!t.attrs||!t.attrs.AUDIO),!0===f&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0),i=a[t.bitrate],void 0===i?(t.url=[t.url],t.urlId=0,a[t.bitrate]=t,e.push(t)):i.url.push(t.url)}),!0===n&&!0===s&&(e=e.filter(function(t){return!!t.videoCodec})),e=e.filter(function(t){var e=t.audioCodec,r=t.videoCodec;return(!e||Object(d.a)(e))&&(!r||Object(d.a)(r))}),t.audioTracks&&(h=t.audioTracks.filter(function(t){return!t.audioCodec||Object(d.a)(t.audioCodec,"audio")})),e.length>0){r=e[0].bitrate,e.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=e;for(var c=0;c<e.length;c++)if(e[c].bitrate===r){this._firstLevel=c,l.b.log("manifest loaded,"+e.length+" level(s) found, first bitrate:"+r);break}this.hls.trigger(o.a.MANIFEST_PARSED,{levels:e,audioTracks:h,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:h.length>0})}else this.hls.trigger(o.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},e.prototype.setLevelInternal=function(t){var e=this._levels,r=this.hls;if(t>=0&&t<e.length){if(this.cleanTimer(),this.currentLevelIndex!==t){l.b.log("switching to level "+t),this.currentLevelIndex=t;var a=e[t];a.level=t,r.trigger(o.a.LEVEL_SWITCH,a),r.trigger(o.a.LEVEL_SWITCHING,a)}var i=e[t],n=i.details;if(!n||!0===n.live){var s=i.urlId;r.trigger(o.a.LEVEL_LOADING,{url:i.url[s],level:t,id:s})}}else r.trigger(o.a.ERROR,{type:u.b.OTHER_ERROR,details:u.a.LEVEL_SWITCH_ERROR,level:t,fatal:!1,reason:"invalid level idx"})},e.prototype.onError=function(t){if(!0===t.fatal)return void(t.type===u.b.NETWORK_ERROR&&this.cleanTimer());var e=!1,r=!1,a=void 0;switch(t.details){case u.a.FRAG_LOAD_ERROR:case u.a.FRAG_LOAD_TIMEOUT:case u.a.FRAG_LOOP_LOADING_ERROR:case u.a.KEY_LOAD_ERROR:case u.a.KEY_LOAD_TIMEOUT:a=t.frag.level,r=!0;break;case u.a.LEVEL_LOAD_ERROR:case u.a.LEVEL_LOAD_TIMEOUT:a=t.context.level,e=!0;break;case u.a.REMUX_ALLOC_ERROR:a=t.level,e=!0}void 0!==a&&this.recoverLevel(t,a,e,r)},e.prototype.recoverLevel=function(t,e,r,a){var i=this,n=this.hls.config,o=t.details,s=this._levels[e],u=void 0,d=void 0,f=void 0;if(s.loadError++,s.fragmentError=a,!0===r){if(!(this.levelRetryCount+1<=n.levelLoadingMaxRetry))return l.b.error("level controller, cannot recover from "+o+" error"),this.currentLevelIndex=null,this.cleanTimer(),void(t.fatal=!0);d=Math.min(Math.pow(2,this.levelRetryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout),this.timer=setTimeout(function(){return i.loadLevel()},d),t.levelRetry=!0,this.levelRetryCount++,l.b.warn("level controller, "+o+", retry in "+d+" ms, current retry count is "+this.levelRetryCount)}!0!==r&&!0!==a||(u=s.url.length,u>1&&s.loadError<u?(l.b.warn("level controller, "+o+" for level "+e+": switching to redundant stream id "+s.urlId),s.urlId=(s.urlId+1)%u,s.details=void 0):-1===this.manualLevelIndex?(f=0===e?this._levels.length-1:e-1,l.b.warn("level controller, "+o+": switch to "+f),this.hls.nextAutoLevel=this.currentLevelIndex=f):!0===a&&(l.b.warn("level controller, "+o+": reload a fragment"),this.currentLevelIndex=null))},e.prototype.onFragLoaded=function(t){var e=t.frag;if(void 0!==e&&"main"===e.type){var r=this._levels[e.level];void 0!==r&&(r.fragmentError=!1,r.loadError=0,this.levelRetryCount=0)}},e.prototype.onLevelLoaded=function(t){var e=this,r=t.level;if(r===this.currentLevelIndex){var a=this._levels[r];!1===a.fragmentError&&(a.loadError=0,this.levelRetryCount=0);var i=t.details;if(i.live){var n=1e3*(i.averagetargetduration?i.averagetargetduration:i.targetduration),o=a.details;o&&i.endSN===o.endSN&&(n/=2,l.b.log("same live playlist, reload twice faster")),n-=performance.now()-t.stats.trequest,n=Math.max(1e3,Math.round(n)),l.b.log("live playlist, reload in "+n+" ms"),this.timer=setTimeout(function(){return e.loadLevel()},n)}else this.cleanTimer()}},e.prototype.loadLevel=function(){var t=void 0,e=void 0;null!==this.currentLevelIndex&&!0===this.canload&&void 0!==(t=this._levels[this.currentLevelIndex])&&t.url.length>0&&(e=t.urlId,this.hls.trigger(o.a.LEVEL_LOADING,{url:t.url[e],level:this.currentLevelIndex,id:e}))},f(e,[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e=this._levels;e&&(t=Math.min(t,e.length-1),this.currentLevelIndex===t&&void 0!==e[t].details||this.setLevelInternal(t))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}]),e}(s.a);e.a=h},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(6),u=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.MEDIA_ATTACHED,o.a.MEDIA_DETACHING,o.a.FRAG_PARSING_METADATA));return n.id3Track=void 0,n.media=void 0,n}return n(e,t),e.prototype.destroy=function(){s.a.prototype.destroy.call(this)},e.prototype.onMediaAttached=function(t){this.media=t.media,this.media},e.prototype.onMediaDetaching=function(){this.media=void 0},e.prototype.onFragParsingMetadata=function(t){var e=t.frag,r=t.samples;this.id3Track||(this.id3Track=this.media.addTextTrack("metadata","id3"),this.id3Track.mode="hidden");for(var a=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,i=0;i<r.length;i++){var n=l.a.getID3Frames(r[i].data);if(n){var o=r[i].pts,s=i<r.length-1?r[i+1].pts:e.endPTS;o===s&&(s+=1e-4);for(var u=0;u<n.length;u++){var d=n[u];if(!l.a.isTimeStampFrame(d)){var f=new a(o,s,"");f.value=d,this.id3Track.addCue(f)}}}}},e}(s.a);e.a=u},function(t,e,r){"use strict";function a(){var t=Object(i.a)(),e=window.SourceBuffer||window.WebKitSourceBuffer,r=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!r&&!!a}e.a=a;var i=r(8)},function(t,e,r){"use strict";r.d(e,"a",function(){return g});var a=r(49),i=r(52),n=r(53),o=r(54),s=r(55),l=r(4),u=(r.n(l),r(4)),d=(r.n(u),r(4)),f=(r.n(d),r(4)),h=(r.n(f),r(4)),c=(r.n(h),r(4)),p=(r.n(c),r(4)),v=(r.n(p),r(56)),g={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,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,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:s.a,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,fetchSetup:void 0,abrController:a.a,bufferController:i.a,capLevelController:n.a,fpsController:o.a,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:v.a}},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(13),u=r(2),d=r(0),f=r(50),h=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),c=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.FRAG_LOADING,o.a.FRAG_LOADED,o.a.FRAG_BUFFERED,o.a.ERROR));return n.lastLoadedFragLevel=0,n._nextAutoLevel=-1,n.hls=r,n.timer=null,n._bwEstimator=null,n.onCheck=n._abandonRulesCheck.bind(n),n}return n(e,t),e.prototype.destroy=function(){this.clearTimer(),s.a.prototype.destroy.call(this)},e.prototype.onFragLoading=function(t){var e=t.frag;if("main"===e.type){if(this.timer||(this.timer=setInterval(this.onCheck,100)),!this._bwEstimator){var r=this.hls,a=t.frag.level,i=r.levels[a].details.live,n=r.config,o=void 0,s=void 0;i?(o=n.abrEwmaFastLive,s=n.abrEwmaSlowLive):(o=n.abrEwmaFastVoD,s=n.abrEwmaSlowVoD),this._bwEstimator=new f.a(r,s,o,n.abrEwmaDefaultEstimate)}this.fragCurrent=e}},e.prototype._abandonRulesCheck=function(){var t=this.hls,e=t.media,r=this.fragCurrent,a=r.loader,i=t.minAutoLevel;if(!a||a.stats&&a.stats.aborted)return d.b.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var n=a.stats;if(e&&n&&(!e.paused&&0!==e.playbackRate||!e.readyState)&&r.autoLevel&&r.level){var s=performance.now()-n.trequest,u=Math.abs(e.playbackRate);if(s>500*r.duration/u){var f=t.levels,h=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/s),c=f[r.level],p=c.realBitrate?Math.max(c.realBitrate,c.bitrate):c.bitrate,v=n.total?n.total:Math.max(n.loaded,Math.round(r.duration*p/8)),g=e.currentTime,y=(v-n.loaded)/h,m=(l.a.bufferInfo(e,g,t.config.maxBufferHole).end-g)/u;if(m<2*r.duration/u&&y>m){var b=void 0,E=void 0;for(E=r.level-1;E>i;E--){var S=f[E].realBitrate?Math.max(f[E].realBitrate,f[E].bitrate):f[E].bitrate;if((b=r.duration*S/(6.4*h))<m)break}b<y&&(d.b.warn("loading too slow, abort fragment loading and switch to level "+E+":fragLoadedDelay["+E+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+b.toFixed(1)+"<"+y.toFixed(1)+":"+m.toFixed(1)),t.nextLoadLevel=E,this._bwEstimator.sample(s,n.loaded),a.abort(),this.clearTimer(),t.trigger(o.a.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:n}))}}}},e.prototype.onFragLoaded=function(t){var e=t.frag;if("main"===e.type&&!isNaN(e.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=e.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var r=this.hls.levels[e.level],a=(r.loaded?r.loaded.bytes:0)+t.stats.loaded,i=(r.loaded?r.loaded.duration:0)+t.frag.duration;r.loaded={bytes:a,duration:i},r.realBitrate=Math.round(8*a/i)}if(t.frag.bitrateTest){var n=t.stats;n.tparsed=n.tbuffered=n.tload,this.onFragBuffered(t)}}},e.prototype.onFragBuffered=function(t){var e=t.stats,r=t.frag;if(!(!0===e.aborted||1!==r.loadCounter||"main"!==r.type||isNaN(r.sn)||r.bitrateTest&&e.tload!==e.tbuffered)){var a=e.tparsed-e.trequest;d.b.log("latency/loading/parsing/append/kbps:"+Math.round(e.tfirst-e.trequest)+"/"+Math.round(e.tload-e.tfirst)+"/"+Math.round(e.tparsed-e.tload)+"/"+Math.round(e.tbuffered-e.tparsed)+"/"+Math.round(8*e.loaded/(e.tbuffered-e.trequest))),this._bwEstimator.sample(a,e.loaded),e.bwEstimate=this._bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},e.prototype.onError=function(t){switch(t.details){case u.a.FRAG_LOAD_ERROR:case u.a.FRAG_LOAD_TIMEOUT:this.clearTimer()}},e.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},e.prototype._findBestLevel=function(t,e,r,a,i,n,o,s,l){for(var u=i;u>=a;u--){var f=l[u],h=f.details,c=h?h.totalduration/h.fragments.length:e,p=!!h&&h.live,v=void 0;v=u<=t?o*r:s*r;var g=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,y=g*c/v;if(d.b.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(v)+"/"+g+"/"+c+"/"+n+"/"+y),v>g&&(!y||p&&!this.bitrateTestDelay||y<n))return u}return-1},h(e,[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this._bwEstimator;if(!(-1===t||e&&e.canEstimate()))return t;var r=this._nextABRAutoLevel;return-1!==t&&(r=Math.min(t,r)),r},set:function(t){this._nextAutoLevel=t}},{key:"_nextABRAutoLevel",get:function(){var t=this.hls,e=t.maxAutoLevel,r=t.levels,a=t.config,i=t.minAutoLevel,n=t.media,o=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,u=n?n.currentTime:0,f=n&&0!==n.playbackRate?Math.abs(n.playbackRate):1,h=this._bwEstimator?this._bwEstimator.getEstimate():a.abrEwmaDefaultEstimate,c=(l.a.bufferInfo(n,u,a.maxBufferHole).end-u)/f,p=this._findBestLevel(o,s,h,i,e,c,a.abrBandWidthFactor,a.abrBandWidthUpFactor,r);if(p>=0)return p;d.b.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var v=s?Math.min(s,a.maxStarvationDelay):a.maxStarvationDelay,g=a.abrBandWidthFactor,y=a.abrBandWidthUpFactor;if(0===c){var m=this.bitrateTestDelay;if(m){v=(s?Math.min(s,a.maxLoadingDelay):a.maxLoadingDelay)-m,d.b.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),g=y=1}}return p=this._findBestLevel(o,s,h,i,e,c+v,g,y,r),Math.max(p,0)}}]),e}(s.a);e.a=c},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(51),n=function(){function t(e,r,n,o){a(this,t),this.hls=e,this.defaultEstimate_=o,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new i.a(r),this.fast_=new i.a(n)}return t.prototype.sample=function(t,e){t=Math.max(t,this.minDelayMs_);var r=8e3*e/t,a=t/1e3;this.fast_.sample(a,r),this.slow_.sample(a,r)},t.prototype.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},t.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.prototype.destroy=function(){},t}();e.a=n},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(e){a(this,t),this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}return t.prototype.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},t.prototype.getTotalWeight=function(){return this.totalWeight_},t.prototype.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/t}return this.estimate_},t}();e.a=i},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(0),u=r(2),d=r(8),f=Object(d.a)(),h=function(t){function e(r){a(this,e);var n=i(this,t.call(this,r,o.a.MEDIA_ATTACHING,o.a.MEDIA_DETACHING,o.a.MANIFEST_PARSED,o.a.BUFFER_RESET,o.a.BUFFER_APPENDING,o.a.BUFFER_CODECS,o.a.BUFFER_EOS,o.a.BUFFER_FLUSHING,o.a.LEVEL_PTS_UPDATED,o.a.LEVEL_UPDATED));return n._msDuration=null,n._levelDuration=null,n._live=null,n._objectUrl=null,n.onsbue=n.onSBUpdateEnd.bind(n),n.onsbe=n.onSBUpdateError.bind(n),n.pendingTracks={},n.tracks={},n}return n(e,t),e.prototype.destroy=function(){s.a.prototype.destroy.call(this)},e.prototype.onLevelPtsUpdated=function(t){var e=t.type,r=this.tracks.audio;if("audio"===e&&r&&"audio/mpeg"===r.container){var a=this.sourceBuffer.audio;if(Math.abs(a.timestampOffset-t.start)>.1){var i=a.updating;try{a.abort()}catch(t){i=!0,l.b.warn("can not abort audio buffer: "+t)}i?this.audioTimestampOffset=t.start:(l.b.warn("change mpeg audio timestamp offset from "+a.timestampOffset+" to "+t.start),a.timestampOffset=t.start)}}},e.prototype.onManifestParsed=function(t){var e=t.audio,r=t.video||t.levels.length&&t.audio,a=0;t.altAudio&&(e||r)&&(a=(e?1:0)+(r?1:0),l.b.log(a+" sourceBuffer(s) expected")),this.sourceBufferNb=a},e.prototype.onMediaAttaching=function(t){var e=this.media=t.media;if(e){var r=this.mediaSource=new f;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),e.src=URL.createObjectURL(r),this._objectUrl=e.src}},e.prototype.onMediaDetaching=function(){l.b.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){l.b.warn("onMediaDetaching:"+t.message+" while calling endOfStream")}t.removeEventListener("sourceopen",this.onmso),t.removeEventListener("sourceended",this.onmse),t.removeEventListener("sourceclose",this.onmsc),this.media&&(URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):l.b.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(o.a.MEDIA_DETACHED)},e.prototype.onMediaSourceOpen=function(){l.b.log("media source opened"),this.hls.trigger(o.a.MEDIA_ATTACHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},e.prototype.checkPendingTracks=function(){var t=this.pendingTracks,e=Object.keys(t).length;e&&(this.sourceBufferNb<=e||0===this.sourceBufferNb)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},e.prototype.onMediaSourceClose=function(){l.b.log("media source closed")},e.prototype.onMediaSourceEnded=function(){l.b.log("media source ended")},e.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var t=this.sourceBuffer.audio;l.b.warn("change mpeg audio timestamp offset from "+t.timestampOffset+" to "+this.audioTimestampOffset),t.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var e=this.parent,r=this.segments.reduce(function(t,r){return r.parent===e?t+1:t},0);this.hls.trigger(o.a.BUFFER_APPENDED,{parent:e,pending:r}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()},e.prototype.onSBUpdateError=function(t){l.b.error("sourceBuffer error:",t),this.hls.trigger(o.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.BUFFER_APPENDING_ERROR,fatal:!1})},e.prototype.onBufferReset=function(){var t=this.sourceBuffer;for(var e in t){var r=t[e];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(t){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},e.prototype.onBufferCodecs=function(t){if(0===Object.keys(this.sourceBuffer).length){for(var e in t)this.pendingTracks[e]=t[e];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}},e.prototype.createSourceBuffers=function(t){var e=this.sourceBuffer,r=this.mediaSource;for(var a in t)if(!e[a]){var i=t[a],n=i.levelCodec||i.codec,s=i.container+";codecs="+n;l.b.log("creating sourceBuffer("+s+")");try{var d=e[a]=r.addSourceBuffer(s);d.addEventListener("updateend",this.onsbue),d.addEventListener("error",this.onsbe),this.tracks[a]={codec:n,container:i.container},i.buffer=d}catch(t){l.b.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(o.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:s})}}this.hls.trigger(o.a.BUFFER_CREATED,{tracks:t})},e.prototype.onBufferAppending=function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())},e.prototype.onBufferAppendFail=function(t){l.b.error("sourceBuffer error:",t.event),this.hls.trigger(o.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.BUFFER_APPENDING_ERROR,fatal:!1})},e.prototype.onBufferEos=function(t){var e=this.sourceBuffer,r=t.type;for(var a in e)r&&a!==r||e[a].ended||(e[a].ended=!0,l.b.log(a+" sourceBuffer now EOS"));this.checkEos()},e.prototype.checkEos=function(){var t=this.sourceBuffer,e=this.mediaSource;if(!e||"open"!==e.readyState)return void(this._needsEos=!1);for(var r in t){var a=t[r];if(!a.ended)return;if(a.updating)return void(this._needsEos=!0)}l.b.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{e.endOfStream()}catch(t){l.b.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1},e.prototype.onBufferFlushing=function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()},e.prototype.onLevelUpdated=function(t){var e=t.details;e.fragments.length>0&&(this._levelDuration=e.totalduration+e.fragments[0].start,this._live=e.live,this.updateMediaElementDuration())},e.prototype.updateMediaElementDuration=function(){var t=this.hls.config,e=void 0;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var r in this.sourceBuffer)if(!0===this.sourceBuffer[r].updating)return;e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(l.b.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||e===1/0||isNaN(e))&&(l.b.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},e.prototype.doFlush=function(){for(;this.flushRange.length;){var t=this.flushRange[0];if(!this.flushBuffer(t.start,t.end,t.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var e=0,r=this.sourceBuffer;try{for(var a in r)e+=r[a].buffered.length}catch(t){l.b.error("error while accessing sourceBuffer.buffered")}this.appended=e,this.hls.trigger(o.a.BUFFER_FLUSHED)}},e.prototype.doAppending=function(){var t=this.hls,e=this.sourceBuffer,r=this.segments;if(Object.keys(e).length){if(this.media.error)return this.segments=[],void l.b.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var a=r.shift();try{var i=a.type,n=e[i];n?n.updating?r.unshift(a):(n.ended=!1,this.parent=a.parent,n.appendBuffer(a.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(e){l.b.error("error while trying to append buffer:"+e.message),r.unshift(a);var s={type:u.b.MEDIA_ERROR,parent:a.parent};if(22===e.code)return this.segments=[],s.details=u.a.BUFFER_FULL_ERROR,s.fatal=!1,void t.trigger(o.a.ERROR,s);if(this.appendError?this.appendError++:this.appendError=1,s.details=u.a.BUFFER_APPEND_ERROR,this.appendError>t.config.appendErrorMaxRetry)return l.b.log("fail "+t.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],s.fatal=!0,void t.trigger(o.a.ERROR,s);s.fatal=!1,t.trigger(o.a.ERROR,s)}}}},e.prototype.flushBuffer=function(t,e,r){var a,i,n,o,s,u,d=this.sourceBuffer;if(Object.keys(d).length){if(l.b.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+t+"/"+e),this.flushBufferCounter<this.appended){for(var f in d)if(!r||f===r){if(a=d[f],a.ended=!1,a.updating)return l.b.warn("cannot flush, sb updating in progress"),!1;try{for(i=0;i<a.buffered.length;i++)if(n=a.buffered.start(i),o=a.buffered.end(i),-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&e===Number.POSITIVE_INFINITY?(s=t,u=e):(s=Math.max(n,t),u=Math.min(o,e)),Math.min(u,o)-s>.5)return this.flushBufferCounter++,l.b.log("flush "+f+" ["+s+","+u+"], of ["+n+","+o+"], pos:"+this.media.currentTime),a.remove(s,u),!1}catch(t){l.b.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else l.b.warn("abort flushing too many retries");l.b.log("buffer flushed")}return!0},e}(s.a);e.a=h},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),u=function(t){function e(r){return a(this,e),i(this,t.call(this,r,o.a.FPS_DROP_LEVEL_CAPPING,o.a.MEDIA_ATTACHING,o.a.MANIFEST_PARSED))}return n(e,t),e.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=this.restrictedLevels=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer)))},e.prototype.onFpsDropLevelCapping=function(t){e.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},e.prototype.onMediaAttaching=function(t){this.media=t.media instanceof HTMLVideoElement?t.media:null},e.prototype.onManifestParsed=function(t){var e=this.hls;this.restrictedLevels=[],e.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=t.levels,e.firstLevel=this.getMaxLevel(t.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},e.prototype.detectPlayerSize=function(){if(this.media){var t=this.levels?this.levels.length:0;if(t){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t-1),e.autoLevelCapping>this.autoLevelCapping&&e.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},e.prototype.getMaxLevel=function(t){var r=this;if(!this.levels)return-1;var a=this.levels.filter(function(a,i){return e.isLevelAllowed(i,r.restrictedLevels)&&i<=t});return e.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},e.isLevelAllowed=function(t){return-1===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).indexOf(t)},e.getMaxLevelByMediaSize=function(t,e,r){if(!t||t&&!t.length)return-1;for(var a=t.length-1,i=0;i<t.length;i+=1){var n=t[i];if((n.width>=e||n.height>=r)&&function(t,e){return!e||(t.width!==e.width||t.height!==e.height)}(n,t[i+1])){a=i;break}}return a},l(e,[{key:"mediaWidth",get:function(){var t=void 0,r=this.media;return r&&(t=r.width||r.clientWidth||r.offsetWidth,t*=e.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0,r=this.media;return r&&(t=r.height||r.clientHeight||r.offsetHeight,t*=e.contentScaleFactor),t}}],[{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}}]),e}(s.a);e.a=u},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=r(1),s=r(3),l=r(0),u=function(t){function e(r){return a(this,e),i(this,t.call(this,r,o.a.MEDIA_ATTACHING))}return n(e,t),e.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},e.prototype.onMediaAttaching=function(t){var e=this.hls.config;if(e.capLevelOnFPSDrop){"function"==typeof(this.video=t.media instanceof HTMLVideoElement?t.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),e.fpsDroppedMonitoringPeriod)}},e.prototype.checkFPS=function(t,e,r){var a=performance.now();if(e){if(this.lastTime){var i=a-this.lastTime,n=r-this.lastDroppedFrames,s=e-this.lastDecodedFrames,u=1e3*n/i,d=this.hls;if(d.trigger(o.a.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r}),u>0&&n>d.config.fpsDroppedMonitoringThreshold*s){var f=d.currentLevel;l.b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(-1===d.autoLevelCapping||d.autoLevelCapping>=f)&&(f-=1,d.trigger(o.a.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:d.currentLevel}),d.autoLevelCapping=f,d.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},e.prototype.checkFPSInterval=function(){var t=this.video;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},e}(s.a);e.a=u},function(t,e,r){"use strict";function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(0),n=function(){function t(e){a(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return t.prototype.destroy=function(){this.abort(),this.loader=null},t.prototype.abort=function(){var t=this.loader;t&&4!==t.readyState&&(this.stats.aborted=!0,t.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.prototype.load=function(t,e,r){this.context=t,this.config=e,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()},t.prototype.loadInternal=function(){var t,e=this.context;t=this.loader=new XMLHttpRequest;var r=this.stats;r.tfirst=0,r.loaded=0;var a=this.xhrSetup;try{if(a)try{a(t,e.url)}catch(r){t.open("GET",e.url,!0),a(t,e.url)}t.readyState||t.open("GET",e.url,!0)}catch(r){return void this.callbacks.onError({code:t.status,text:r.message},e,t)}e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),t.send()},t.prototype.readystatechange=function(t){var e=t.currentTarget,r=e.readyState,a=this.stats,n=this.context,o=this.config;if(!a.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===a.tfirst&&(a.tfirst=Math.max(performance.now(),a.trequest)),4===r){var s=e.status;if(s>=200&&s<300){a.tload=Math.max(a.tfirst,performance.now());var l=void 0,u=void 0;"arraybuffer"===n.responseType?(l=e.response,u=l.byteLength):(l=e.responseText,u=l.length),a.loaded=a.total=u;var d={url:e.responseURL,data:l};this.callbacks.onSuccess(d,a,n,e)}else a.retry>=o.maxRetry||s>=400&&s<499?(i.b.error(s+" while loading "+n.url),this.callbacks.onError({code:s,text:e.statusText},n,e)):(i.b.warn(s+" while loading "+n.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,o.maxRetryDelay),a.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),o.timeout)},t.prototype.loadtimeout=function(){i.b.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.prototype.loadprogress=function(t){var e=t.currentTarget,r=this.stats;r.loaded=t.loaded,t.lengthComputable&&(r.total=t.total);var a=this.callbacks.onProgress;a&&a(r,this.context,null,e)},t}();e.a=n},function(t,e,r){"use strict";r.d(e,"a",function(){return a});var a=function(){return window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null}()},function(t,e){/*! http://mths.be/endswith v0.2.0 by @mathias */
String.prototype.endsWith||function(){"use strict";var t=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(t){}return r}(),e={}.toString,r=function(t){if(null==this)throw TypeError();var r=String(this);if(t&&"[object RegExp]"==e.call(t))throw TypeError();var a=r.length,i=String(t),n=i.length,o=a;if(arguments.length>1){var s=arguments[1];void 0!==s&&(o=s?Number(s):0)!=o&&(o=0)}var l=Math.min(Math.max(o,0),a),u=l-n;if(u<0)return!1;for(var d=-1;++d<n;)if(r.charCodeAt(u+d)!=i.charCodeAt(d))return!1;return!0};t?t(String.prototype,"endsWith",{value:r,configurable:!0,writable:!0}):String.prototype.endsWith=r}()}]).default});