!function(e){if("object"==typeofexports&&"undefined"!=typeofmodule)module.exports=e();elseif("function"==typeofdefine&&define.amd)define([],e);else{vart;t="undefined"!=typeofwindow?window:"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:this,t.Hls=e()}}(function(){returnfunctions(e,t,r){functiona(i,d){if(!t[i]){if(!e[i]){varl="function"==typeofrequire&&require;if(!d&&l)returnl(i,!0);if(n)returnn(i,!0);varu=newError("Cannot find module '"+i+"'");throwu.code="MODULE_NOT_FOUND",u}varo=t[i]={exports:{}};e[i][0].call(o.exports,function(t){varr=e[i][1][t];returna(r?r:t)},o,o.exports,s,e,t,r)}returnt[i].exports}for(varn="function"==typeofrequire&&require,i=0;i<r.length;i++)a(r[i]);returna}({1:[function(s,i,o){functione(){this._events=this._events||{},this._maxListeners=this._maxListeners||void0}functiont(e){return"function"==typeofe}functionn(e){return"number"==typeofe}functionr(e){return"object"==typeofe&&null!==e}functiona(e){returnvoid0===e}i.exports=e,e.EventEmitter=e,e.prototype._events=void0,e.prototype._maxListeners=void0,e.defaultMaxListeners=10,e.prototype.setMaxListeners=function(e){if(!n(e)||0>e||isNaN(e))throwTypeError("n must be a positive number");returnthis._maxListeners=e,this},e.prototype.emit=function(l){vars,e,u,i,n,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],sinstanceofError)throws;throwTypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],a(e))return!1;if(t(e))switch(arguments.length){case1:e.call(this);break;case2:e.call(this,arguments[1]);break;case3:e.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),e.apply(this,i)}elseif(r(e))for(i=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,n=0;u>n;n++)o[n].apply(this,i);return!0},e.prototype.addListener=function(i,n){vars;if(!t(n))throwTypeError("listener must be a function");returnthis._events||(this._events={}),this._events.newListener&&this.emit("newListener",i,t(n.listener)?n.listener:n),this._events[i]?r(this._events[i])?this._events[i].push(n):this._events[i]=[this._events[i],n]:this._events[i]=n,r(this._events[i])&&!this._events[i].warned&&(s=a(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[i].length>s&&(this._events[i].warned=!0,"function"==typeofconsole.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(a,e){functionr(){this.removeListener(a,r),i||(i=!0,e.apply(this,arguments))}if(!t(e))throwTypeError("listener must be a function");vari=!1;returnr.listener=e,this.on(a,r),this},e.prototype.removeListener=function(i,a){vare,s,o,n;if(!t(a))throwTypeError("listener must be a function");if(!this._events||!this._events[i])returnthis;if(e=this._events[i],o=e.length,s=-1,e===a||t(e.listener)&&e.listener===a)deletethis._events[i],this._events.removeListener&&this.emit("removeListener",i,a);elseif(r(e)){for(n=o;n-->0;)if(e[n]===a||e[n].listener&&e[n].listener===a){s=n;break}if(0>s)returnthis;1===e.length?(e.length=0,deletethis._events[i]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",i,a)}returnthis},e.prototype.removeAllListeners=function(r){vara,e;if(!this._events)returnthis;if(!this._events.removeListener)return0===arguments.length?this._events={}:this._events[r]&&deletethis._events[r],this;if(0===arguments.length){for(ainthis._events)"removeListener"!==a&&this.removeAllListeners(a);returnthis.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);elseif(e)for(;e.length;)this.removeListener(r,e[e.length-1]);returndeletethis._events[r],this},e.prototype.listeners=function(e){varr;returnr=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){vare=this._events[r];if(t(e))return1;if(e)returne.length}return0},e.listenerCount=function(e,t){returne.listenerCount(t)}},{}]
t.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),c.loadCounter--):(i=u[k+1],t.logger.log("SN just loaded, load next one: "+i.sn)),!i)break}if(null!=i.decryptdata.uri&&null==i.decryptdata.key)t.logger.log("Loading key for "+i.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+l),this.state=e.KEY_LOADING,h.trigger(r.default.KEY_LOADING,{frag:i});else{if(t.logger.log("Loading "+i.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+l+", currentTime:"+R+",bufferEnd:"+d.toFixed(3)),void0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,i.loadCounter){i.loadCounter++;varS=o.fragLoadingLoopThreshold;if(i.loadCounter>S&&Math.abs(this.fragLoadIdx-i.loadIdx)<S)returnvoidh.trigger(r.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:i})}elsei.loadCounter=1;i.loadIdx=this.fragLoadIdx,this.fragCurrent=i,this.startFragRequested=!0,i.autoLevel=h.autoLevelEnabled,h.trigger(r.default.FRAG_LOADING,{frag:i}),this.state=e.FRAG_LOADING}}}break;casee.WAITING_LEVEL:l=this.levels[this.level],l&&l.details&&(this.state=e.IDLE);break;casee.FRAG_LOADING_WAITING_RETRY:varI=performance.now(),w=this.retryDate;(!w||I>=w||b)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;casee.STOPPED:casee.FRAG_LOADING:casee.PARSING:casee.PARSED:casee.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(a){vare,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],a>=t.start&&a<=t.end)returnt;returnnull}},{key:"followingBufferRange",value:function(e){returne?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){vara=this.media;if(a)for(vart=a.buffered,e=0;e<t.length;e++)if(r>=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){vart,e,a=this.media;if(a&&a.seeking===!1&&(e=a.currentTime,e>a.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){vari=t.frag;i!==this.fragPlaying&&(this.fragPlaying=i,this.hls.trigger(r.default.FRAG_CHANGED,{frag:i}))}}},{key:"immediateLevelSwitch",value:function(){if(t.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;vara=this.media,i=void0;a?(i=a.paused,a.pause()):i=!0,this.previouslyPaused=i}varn=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){this.immediateSwitch=!1;vare=this.media;e&&e.readyState&&(e.currentTime-=1e-4,this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){vart=this.media;if(t&&t.readyState){varn=void0,i=void0,a=void0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,i=this.getBufferRange(t.currentTime),i&&i.start>1&&(this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:i.start-1})),t.paused)n=0;else{varl=this.hls.nextLoadLevel,u=this.levels[l],o=this.fragLastKbps;n=o&&this.fragCurrent?this.fragCurrent.duration*u.bitrate/(1e3*o)+1:0}if(a=this.getBufferRange(t.currentTime+n),a&&(a=this.followingBufferRange(a))){vars=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:a.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(r){vare=this.media=r.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);vart=this.config;this.levels&&t.autoStartLoad&&this.hls.startLoad(t.startPosition)}},{key:"onMed
webworkify:2}],18:[function(t,s,e){"use strict";functionr(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});vara=function(){functione(a,r){for(vart=0;t<r.length;t++){vare=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"ine&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}returnfunction(t,r,a){returnr&&e(t.prototype,r),a&&e(t,a),t}}(),i=t("../utils/logger"),n=function(){functione(t){r(this,e),this.data=t,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}returna(e,[{key:"loadWord",value:function(){vart=this.data.byteLength-this.bytesAvailable,r=newUint8Array(4),e=Math.min(4,this.bytesAvailable);if(0===e)thrownewError("no bytes available");r.set(this.data.subarray(t,t+e)),this.word=newDataView(r.buffer).getUint32(0),this.bitsAvailable=8*e,this.bytesAvailable-=e}},{key:"skipBits",value:function(e){vart;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(t){vare=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;returnt>32&&i.logger.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?r<<e|this.readBits(e):r}},{key:"skipLZ",value:function(){vare;for(e=0;e<this.bitsAvailable;++e)if(0!==(this.word&2147483648>>>e))returnthis.word<<=e,this.bitsAvailable-=e,e;returnthis.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){vare=this.skipLZ();returnthis.readBits(e+1)-1}},{key:"readEG",value:function(){vare=this.readUEG();return1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return1===this.readBits(1)}},{key:"readUByte",value:function(){returnthis.readBits(8)}},{key:"readUShort",value:function(){returnthis.readBits(16)}},{key:"readUInt",value:function(){returnthis.readBits(32)}},{key:"skipScalingList",value:function(i){vart,a,r=8,e=8;for(t=0;i>t;t++)0!==e&&(a=this.readEG(),e=(r+a+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){vart,g,p,l,i,n,a,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),g=this.readBits(5),this.skipBits(3),p=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){varv=this.readUEG();if(3===v&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==v?8:12,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();varu=this.readUEG();if(0===u)this.readUEG();elseif(1===u)for(this.skipBits(1),this.skipEG(),this.skipEG(),l=this.readUEG(),r=0;l>r;r++)this.skipEG();if(this.skipUEG(),this.skipBits(1),i=this.readUEG(),n=this.readUEG(),a=this.readBits(1),0===a&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){vare=void0,y=this.readUByte();switch(y){case1:e=[1,1];break;case2:e=[12,11];break;case3:e=[10,11];break;case4:e=[16,11];break;case5:e=[40,33];break;case6:e=[24,11];break;case7:e=[20,11];break;case8:e=[32,11];break;case9:e=[80,33];break;case10:e=[18,11];break;case11:e=[15,11];break;case12:e=[64,33];break;case13:e=[160,99];break;case14:e=[4,3];break;case15:e=[3,2];break;case16:e=[2,1];break;case255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(i+1)-2*s-2*d)*c),height:(2-a)*(n+1)*16-(a?2:4)*(f+h)}}},{key:"readSliceType",value:function(){returnthis.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=n},{"../utils/logger":38}],19:[function(r,s,t){"use strict";functiona(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var
"../events":23}],29:[function(r,c,a){"use strict";functioni(e){returne&&e.__esModule?e:{default:e}}functionu(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionf(t,e){if(!t)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeofe&&"function"!=typeofe?t:e}functions(t,e){if("function"!=typeofe&&null!==e)thrownewTypeError("Super expression must either be null or a function, not "+typeofe);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)}Object.defineProperty(a,"__esModule",{value:!0});varh=function(){functione(a,r){for(vart=0;t<r.length;t++){vare=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"ine&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}returnfunction(t,r,a){returnr&&e(t.prototype,r),a&&e(t,a),t}}(),l=r("../events"),e=i(l),d=r("../event-handler"),n=i(d),t=r("../errors"),o=function(a){functionr(a){u(this,r);vart=f(this,Object.getPrototypeOf(r).call(this,a,e.default.KEY_LOADING));returnt.decryptkey=null,t.decrypturl=null,t}returns(r,a),h(r,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),n.default.prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(n){vart=this.frag=n.frag,i=t.decryptdata,a=i.uri;if(a!==this.decrypturl||null===this.decryptkey){varr=this.hls.config;t.loader=this.loader=newr.loader(r),this.decrypturl=a,this.decryptkey=null,t.loader.load(a,"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),r.fragLoadingTimeOut,r.fragLoadingMaxRetry,r.fragLoadingRetryDelay,this.loadprogress.bind(this),t)}elsethis.decryptkey&&(i.key=this.decryptkey,this.hls.trigger(e.default.KEY_LOADED,{frag:t}))}},{key:"loadsuccess",value:function(r){vart=this.frag;this.decryptkey=t.decryptdata.key=newUint8Array(r.currentTarget.response),t.loader=void0,this.hls.trigger(e.default.KEY_LOADED,{frag:t})}},{key:"loaderror",value:function(r){this.loader&&this.loader.abort(),this.hls.trigger(e.default.ERROR,{type:t.ErrorTypes.NETWORK_ERROR,details:t.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:this.frag,response:r})}},{key:"loadtimeout",value:function(){this.loader&&this.loader.abort(),this.hls.trigger(e.default.ERROR,{type:t.ErrorTypes.NETWORK_ERROR,details:t.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:this.frag})}},{key:"loadprogress",value:function(){}}]),r}(n.default);a.default=o},{"../errors":21,"../event-handler":22,"../events":23}],30:[function(r,y,s){"use strict";functiona(e){returne&&e.__esModule?e:{default:e}}functiond(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionf(t,e){if(!t)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeofe&&"function"!=typeofe?t:e}functionh(t,e){if("function"!=typeofe&&null!==e)thrownewTypeError("Super expression must either be null or a function, not "+typeofe);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)}Object.defineProperty(s,"__esModule",{value:!0});varo=function(){functione(a,r){for(vart=0;t<r.length;t++){vare=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"ine&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}returnfunction(t,r,a){returnr&&e(t.prototype,r),a&&e(t,a),t}}(),l=r("../events"),t=a(l),p=r("../event-handler"),n=a(p),e=r("../errors"),c=r("../utils/url"),v=a(c),g=r("../utils/attr-list"),i=a(g),u=function(a){functionr(e){returnd(this,r),f(this,Object.getPrototypeOf(r).call(this,e,t.default.MANIFEST_LOADING,t.default.LEVEL_LOADING))}returnh(r,a),o(r,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),this.url=this.id=null,n.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,null)}},{key:"onLevelLoa
l&&(i+=l),o&&(i+=o),i},buildAbsolutePath:function(n,s){for(vara,e,o=s,i="",t=n.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+a)a=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,i=(i+t.substring(r,e)).replace(newRegExp("(?:\\/+[^\\/]*){0,"+(a-1)/3+"}$"),"/");returni+t.substr(r)}};t.exports=e},{}],40:[function(r,s,t){"use strict";functiona(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});vari=function(){functione(a,r){for(vart=0;t<r.length;t++){vare=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"ine&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}returnfunction(t,r,a){returnr&&e(t.prototype,r),a&&e(t,a),t}}(),e=r("../utils/logger"),n=function(){functiont(e){a(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}returni(t,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){vare=this.loader,t=this.timeoutHandle;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),t&&window.clearTimeout(t)}},{key:"load",value:function(t,r,a,i,n,s,o,l){varu=arguments.length<=8||void0===arguments[8]?null:arguments[8],e=arguments.length<=9||void0===arguments[9]?null:arguments[9];this.url=t,!e||isNaN(e.byteRangeStartOffset)||isNaN(e.byteRangeEndOffset)||(this.byteRange=e.byteRangeStartOffset+"-"+(e.byteRangeEndOffset-1)),this.responseType=r,this.onSuccess=a,this.onProgress=u,this.onTimeout=n,this.onError=i,this.stats={trequest:performance.now(),retry:0},this.timeout=s,this.maxRetry=o,this.retryDelay=l,this.loadInternal()}},{key:"loadInternal",value:function(){vare;e="undefined"!=typeofXDomainRequest?this.loader=newXDomainRequest:this.loader=newXMLHttpRequest,e.onloadend=this.loadend.bind(this),e.onprogress=this.loadprogress.bind(this),e.open("GET",this.url,!0),this.byteRange&&e.setRequestHeader("Range","bytes="+this.byteRange),e.responseType=this.responseType;vart=this.stats;t.tfirst=0,t.loaded=0,this.xhrSetup&&this.xhrSetup(e,this.url),this.timeoutHandle=window.setTimeout(this.loadtimeout.bind(this),this.timeout),e.send()}},{key:"loadend",value:function(a){vari=a.currentTarget,r=i.status,t=this.stats;t.aborted||(r>=200&&300>r?(window.clearTimeout(this.timeoutHandle),t.tload=Math.max(t.tfirst,performance.now()),this.onSuccess(a,t)):t.retry<this.maxRetry?(e.logger.warn(r+" while loading "+this.url+", retrying in "+this.retryDelay+"..."),this.destroy(),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),t.retry++):(window.clearTimeout(this.timeoutHandle),e.logger.error(r+" while loading "+this.url),this.onError(a)))}},{key:"loadtimeout",value:function(t){e.logger.warn("timeout while loading "+this.url),this.onTimeout(t,this.stats)}},{key:"loadprogress",value:function(t){vare=this.stats;0===e.tfirst&&(e.tfirst=Math.max(performance.now(),e.trequest)),e.loaded=t.loaded,this.onProgress&&this.onProgress(t,e)}}]),t}();t.default=n},{"../utils/logger":38}]},{},[27])(27)});