!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(){vare;returnfunctione(t,r,i){functiona(s,o){if(!r[s]){if(!t[s]){varl="function"==typeofrequire&&require;if(!o&&l)returnl(s,!0);if(n)returnn(s,!0);varu=newError("Cannot find module '"+s+"'");throwu.code="MODULE_NOT_FOUND",u}vard=r[s]={exports:{}};t[s][0].call(d.exports,function(e){varr=t[s][1][e];returna(r?r:e)},d,d.exports,e,t,r,i)}returnr[s].exports}for(varn="function"==typeofrequire&&require,s=0;s<i.length;s++)a(i[s]);returna}({1:[function(e,t,r){functioni(){this._events=this._events||{},this._maxListeners=this._maxListeners||void0}functiona(e){return"function"==typeofe}functionn(e){return"number"==typeofe}functions(e){return"object"==typeofe&&null!==e}functiono(e){returnvoid0===e}t.exports=i,i.EventEmitter=i,i.prototype._events=void0,i.prototype._maxListeners=void0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throwTypeError("n must be a positive number");returnthis._maxListeners=e,this},i.prototype.emit=function(e){vart,r,i,n,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],tinstanceofError)throwt;vard=newError('Uncaught, unspecified "error" event. ('+t+")");throwd.context=t,d}if(r=this._events[e],o(r))return!1;if(a(r))switch(arguments.length){case1:r.call(this);break;case2:r.call(this,arguments[1]);break;case3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}elseif(s(r))for(n=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,n);return!0},i.prototype.addListener=function(e,t){varr;if(!a(t))throwTypeError("listener must be a function");returnthis._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,"function"==typeofconsole.trace)),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){functionr(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!a(t))throwTypeError("listener must be a function");vari=!1;returnr.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){varr,i,n,o;if(!a(t))throwTypeError("listener must be a function");if(!this._events||!this._events[e])returnthis;if(r=this._events[e],n=r.length,i=-1,r===t||a(r.listener)&&r.listener===t)deletethis._events[e],this._events.removeListener&&this.emit("removeListener",e,t);elseif(s(r)){for(o=n;o-->0;)if(r[o]===t||r[o].listener&&r[o].listener===t){i=o;break}if(i<0)returnthis;1===r.length?(r.length=0,deletethis._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}returnthis},i.prototype.removeAllListeners=function(e){vart,r;if(!this._events)returnthis;if(!this._events.removeListener)return0===arguments.length?this._events={}:this._events[e]&&deletethis._events[e],this;if(0===arguments.length){for(tinthis._events)"removeListener"!==t&&this.removeAllListeners(t);returnthis.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);elseif(r)for(;r.length;)this.removeListener(e,r[r.length-1]);returndeletethis._events[e],this},i.prototype.listeners=function(e){vart;returnt=this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){vart=this._events[e];if(a(t))return1;if(t)returnt.length}return0},i.listenerCount=function(e,
r.onsbue=r.onSBUpdateEnd.bind(r),r.onsbe=r.onSBUpdateError.bind(r),r.pendingTracks={},r.tracks={},r}returns(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"onLevelPtsUpdated",value:function(e){vart=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){vari=this.sourceBuffer.audio,a=Math.abs(i.timestampOffset-e.start);if(a>.1){varn=i.updating;try{i.abort()}catch(e){n=!0,h.logger.warn("can not abort audio buffer: "+e)}n?this.audioTimestampOffset=e.start:(h.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}}},{key:"onManifestParsed",value:function(e){vart=e.audio,r=e.video,i=0;e.altAudio&&(t||r)&&(i=(t?1:0)+(r?1:0),h.logger.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i}},{key:"onMediaAttaching",value:function(e){vart=this.media=e.media;if(t){varr=this.mediaSource=newMediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),t.src=URL.createObjectURL(r)}}},{key:"onMediaDetaching",value:function(){h.logger.log("media source detaching");vare=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){h.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this.onmso),e.removeEventListener("sourceended",this.onmse),e.removeEventListener("sourceclose",this.onmsc),this.media&&(URL.revokeObjectURL(this.media.src),this.media.removeAttribute("src"),this.media.load()),this.mediaSource=null,this.media=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(u.default.MEDIA_DETACHED)}},{key:"onMediaSourceOpen",value:function(){h.logger.log("media source opened"),this.hls.trigger(u.default.MEDIA_ATTACHED,{media:this.media});vare=this.mediaSource;e&&e.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()}},{key:"checkPendingTracks",value:function(){vare=this.pendingTracks,t=Object.keys(e).length;t&&(this.sourceBufferNb<=t||0===this.sourceBufferNb)&&(this.createSourceBuffers(e),this.pendingTracks={},this.doAppending())}},{key:"onMediaSourceClose",value:function(){h.logger.log("media source closed")}},{key:"onMediaSourceEnded",value:function(){h.logger.log("media source ended")}},{key:"onSBUpdateEnd",value:function(){if(this.audioTimestampOffset){vare=this.sourceBuffer.audio;h.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+this.audioTimestampOffset),e.timestampOffset=this.audioTimestampOffset,deletethis.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;vart=this.parent,r=this.segments.reduce(function(e,r){returnr.parent===t?e+1:e},0);this.hls.trigger(u.default.BUFFER_APPENDED,{parent:t,pending:r}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()}},{key:"onSBUpdateError",value:function(e){h.logger.error("sourceBuffer error:"+e),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferReset",value:function(){vare=this.sourceBuffer;for(vartine){varr=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}},{key:"onBufferCodecs",value:function(e){if(0===Object.keys(this.sourceBuffer).length){for(vartine)this.pendingTracks[t]=e[t];varr=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}}},{key:"createSourceBuffers",value:function(e){vart=this.sourceBuffer,r=this.mediaSource;for(variine)if(!t[i]){vara=e[i],n=a.levelCodec||a.codec,s=a.container+";codecs="+n;h.logger.log("creating sourceBuffer("+s+")
}if(i=this.getBufferRange(e.currentTime+t),i&&(i=this.followingBufferRange(i))){varo=this.fragCurrent;o&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.start,Number.POSITIVE_INFINITY)}}}},{key:"flushMainBuffer",value:function(e,t){this.state=k.BUFFER_FLUSHING;varr={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(v.default.BUFFER_FLUSHING,r)}},{key:"onMediaAttached",value:function(e){vart=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);varr=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){vare=this.media;e&&e.ended&&(T.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);vart=this.levels;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){vare=this.media,t=e?e.currentTime:void0,r=this.config;if(T.logger.log("media seeking to "+t.toFixed(3)),this.state===k.FRAG_LOADING){vari=this.mediaBuffer?this.mediaBuffer:e,a=f.default.bufferInfo(i,t,this.config.maxBufferHole),n=this.fragCurrent;if(0===a.len&&n){vars=r.maxFragLookUpTolerance,o=n.start-s,l=n.start+n.duration+s;t<o||t>l?(n.loader&&(T.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=k.IDLE):T.logger.log("seeking outside of buffer but within currently loaded fragment range")}}elsethis.state===k.ENDED&&(this.state=k.IDLE);e&&(this.lastCurrentTime=t),this.state!==k.FRAG_LOADING&&void0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=t),this.tick()}},{key:"onMediaSeeked",value:function(){T.logger.log("media seeked to "+this.media.currentTime.toFixed(3)),this.tick()}},{key:"onMediaEnded",value:function(){T.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){T.logger.log("trigger BUFFER_RESET"),this.hls.trigger(v.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0}},{key:"onManifestParsed",value:function(e){vart,r=!1,i=!1;e.levels.forEach(function(e){t=e.audioCodec,t&&(t.indexOf("mp4a.40.2")!==-1&&(r=!0),t.indexOf("mp4a.40.5")!==-1&&(i=!0))}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&T.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;vara=this.config;a.autoStartLoad&&this.hls.startLoad(a.startPosition)}},{key:"onLevelLoaded",value:function(e){vart=e.details,r=e.level,i=this.levels[r],a=t.totalduration,n=0;if(T.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),this.levelLastLoaded=r,t.live){vars=i.details;s&&t.fragments.length>0?(E.default.mergeDetails(s,t),n=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(n,s),t.PTSKnown?T.logger.log("live playlist sliding:"+n.toFixed(3)):T.logger.log("live playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,T.logger.log("live playlist - first load, unknown sliding"))}elset.PTSKnown=!1;if(i.details=t,this.hls.trigger(v.default.LEVEL_UPDATED,{details:t,level:r}),this.startFragRequested===!1){if(this.startPosition===-1||this.lastCurrentTime===-1){varo=t.startTimeOffset;isNaN(o)?t.live?(this.startPosition=this.computeLivePosition(n,t),T.logger.log("configure startPosition to "+this.st
}returnn(e,[{key:"destroy",value:function(){vare=this.demuxer;e&&e.destroy()}},{key:"push",value:function(e,t,r,i,a,n,s,l,u,f,h){if(e.byteLength>0&&null!=u&&null!=u.key&&"AES-128"===u.method){null==this.decrypter&&(this.decrypter=newd.default(this.hls,this.config));varc,g=this;try{c=performance.now()}catch(e){c=Date.now()}this.decrypter.decrypt(e,u.key.buffer,u.iv.buffer,function(e){varu;try{u=performance.now()}catch(e){u=Date.now()}g.hls.trigger(o.default.FRAG_DECRYPTED,{level:n,sn:s,stats:{tstart:c,tdecrypt:u}}),g.pushDecrypted(newUint8Array(e),t,r,i,a,n,s,l,f,h)})}elsethis.pushDecrypted(newUint8Array(e),t,r,i,a,n,s,l,f,h)}},{key:"pushDecrypted",value:function(e,t,r,i,a,n,s,u,d,f){varc=this.demuxer;if(!c||a!==this.cc&&!c.probe(e)){varv=this.hls,y=this.id,E=this.config,b=this.typeSupported;if(g.default.probe(e))c=this.typeSupported.mp2t===!0?newg.default(v,y,m.default,E,b):newg.default(v,y,p.default,E,b),c.probe=g.default.probe;else{if(!h.default.probe(e))returnvoidv.trigger(o.default.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,id:y,details:l.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});c=newh.default(v,y,p.default,E,b),c.probe=h.default.probe}this.demuxer=c}c.push(e,t,r,i,a,n,s,u,d,f),this.cc=a}}]),e}();r.default=E},{16:16,18:18,25:25,26:26,28:28,38:38,39:39}],21:[function(e,t,r){"use strict";functioni(e){returne&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});vara=e(20),n=i(a),s=e(28),o=i(s),l=e(45),u=e(1),d=i(u),f=function(e){vart=newd.default;t.trigger=function(e){for(varr=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.emit.apply(t,[e,e].concat(i))},t.off=function(e){for(varr=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.removeListener.apply(t,[e].concat(i))};varr=function(t,r){e.postMessage({event:t,data:r})};e.addEventListener("message",function(i){vara=i.data;switch(a.cmd){case"init":vars=JSON.parse(a.config);e.demuxer=newn.default(t,a.id,a.typeSupported,s);try{(0,l.enableLogs)(s.debug===!0)}catch(e){}r("init",null);break;case"demux":e.demuxer.push(a.data,a.audioCodec,a.videoCodec,a.timeOffset,a.cc,a.level,a.sn,a.duration,a.decryptdata,a.accurateTimeOffset,a.defaultInitPTS)}}),t.on(o.default.FRAG_DECRYPTED,r),t.on(o.default.FRAG_PARSING_INIT_SEGMENT,r),t.on(o.default.FRAG_PARSED,r),t.on(o.default.ERROR,r),t.on(o.default.FRAG_PARSING_METADATA,r),t.on(o.default.FRAG_PARSING_USERDATA,r),t.on(o.default.INIT_PTS_FOUND,r),t.on(o.default.FRAG_PARSING_DATA,function(t,r){vari=r.data1.buffer,a=r.data2.buffer;deleter.data1,deleter.data2,e.postMessage({event:t,data:r,data1:i,data2:a},[i,a])})};r.default=f},{1:1,20:20,28:28,45:45}],22:[function(e,t,r){"use strict";functioni(e){returne&&e.__esModule?e:{default:e}}functiona(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});varn=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=e(20),u=i(l),d=e(21),f=i(d),h=e(45),c=e(26),g=function(){functiont(r,i){a(this,t),this.hls=r,this.id=i;varn={mp4:MediaSource.isTypeSupported("video/mp4"),mp2t:r.config.enableMP2TPassThrough&&MediaSource.isTypeSupported("video/mp2t"),mpeg:MediaSource.isTypeSupported("audio/mpeg"),mp3:MediaSource.isTypeSupported('audio/mp4; codecs="mp3"')};if(r.config.enableWorker&&"undefined"!=typeofWorker){h.logger.log("demuxing in webworker");vars=void0;try{varl=e(3);s=this.w=l(f.default),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(e){r.trigger(o.default.ERROR,{type:c.ErrorTypes.OTHER_ERROR,details:c.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:e.message+" ("+e.filename+":"+e.lineno+")"}})},s.postMessage({cmd:"init",typeSupported:n,id:i,config:JSON.stringify(r.config)})}catch(e){h.logger.error(
varf=Math.abs(u.startPTS-i);isNaN(u.deltaPTS)?u.deltaPTS=f:u.deltaPTS=Math.max(f,u.deltaPTS),i=Math.min(i,u.startPTS),a=Math.max(a,u.endPTS),n=Math.min(n,u.startDTS),s=Math.max(s,u.endDTS)}varh=i-u.start;for(u.start=u.startPTS=i,u.endPTS=a,u.startDTS=n,u.endDTS=s,u.duration=a-i,d=o;d>0;d--)e.updatePTS(l,d,d-1);for(d=o;d<l.length-1;d++)e.updatePTS(l,d,d+1);returnt.PTSKnown=!0,h}},{key:"updatePTS",value:function(e,t,r){vari=e[t],a=e[r],s=a.startPTS;isNaN(s)?r>t?a.start=i.start+i.duration:a.start=i.start-a.duration:r>t?(i.duration=s-i.start,i.duration<0&&n.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-s,a.duration<0&&n.logger.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"))}}]),e}();r.default=s},{45:45}],32:[function(e,t,r){"use strict";functioni(e){returne&&e.__esModule?e:{default:e}}functiona(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});varn=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=e(26),u=e(36),d=i(u),f=e(34),h=i(f),c=e(4),g=i(c),v=e(7),p=i(v),y=e(8),m=i(y),E=e(5),b=i(E),R=e(12),_=i(R),T=e(11),k=i(T),A=e(13),S=i(A),L=e(10),D=i(L),w=e(6),O=i(w),I=e(45),P=e(47),C=i(P),M=e(1),x=i(M),F=e(35),N=i(F),U=e(43),G=i(U),B=function(){functione(){vart=arguments.length>0&&void0!==arguments[0]?arguments[0]:{};a(this,e);varr=e.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))thrownewError("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(variinr)iint||(t[i]=r[i]);if(void0!==t.liveMaxLatencyDurationCount&&t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount)thrownewError('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void0!==t.liveMaxLatencyDuration&&(t.liveMaxLatencyDuration<=t.liveSyncDuration||void0===t.liveSyncDuration))thrownewError('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');(0,I.enableLogs)(t.debug),this.config=t;varn=this.observer=newx.default;n.trigger=function(e){for(vart=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.emit.apply(n,[e,e].concat(r))},n.off=function(e){for(vart=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[e].concat(r))},this.on=n.on.bind(n),this.off=n.off.bind(n),this.trigger=n.trigger.bind(n),this.playlistLoader=newd.default(this),this.fragmentLoader=newh.default(this),this.levelController=newk.default(this),this.abrController=newt.abrController(this),this.bufferController=newt.bufferController(this),this.capLevelController=newt.capLevelController(this),this.fpsController=newt.fpsController(this),this.streamController=newt.streamController(this),this.audioStreamController=newt.audioStreamController(this),this.timelineController=newt.timelineController(this),this.audioTrackController=newO.default(this),this.keyLoader=newN.default(this)}returnn(e,null,[{key:"isSupported",value:function(){returnwindow.MediaSource=window.MediaSource||window.WebKitMediaSource,window.MediaSource&&"function"==typeofwindow.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"version",get:function(){return"0.6.19"}},{key:"Events",get:function(){returno.default}},{key:"ErrorTypes",get:function(){returnl.ErrorTypes}},{key:"ErrorDetails",get:function(){returnl.ErrorDetails}},{key:"DefaultConfig",get:function(){returne.defaultConfig||(e.defaultConfig={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void0,d
returne.box(e.types.trun,h)}},{key:"initSegment",value:function(t){e.types||e.init();varr,i=e.moov(t);returnr=newUint8Array(e.FTYP.byteLength+i.byteLength),r.set(e.FTYP),r.set(i,e.FTYP.byteLength),r}}]),e}();r.default=n},{}],38:[function(e,t,r){"use strict";functioni(e){returne&&e.__esModule?e:{default:e}}functiona(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});varn=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(29),o=i(s),l=e(28),u=i(l),d=e(45),f=e(37),h=i(f),c=e(26),g=function(){functione(t,r,i,n){a(this,e),this.observer=t,this.id=r,this.config=i,this.typeSupported=n,this.ISGenerated=!1,this.PES2MP4SCALEFACTOR=4,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR}returnn(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){this._initPTS=this._initDTS=void0}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,i,a,n,s,o,l,d,f){if(this.level=e,this.sn=t,this.ISGenerated||this.generateIS(i,a,o,r),null!==f&&(this._initPTS=this._initDTS=f),this.ISGenerated)if(i.samples.length){varh=this.remuxAudio(i,o,l,d);if(a.samples.length){varc=void0;h&&(c=h.endPTS-h.startPTS),this.remuxVideo(a,o,l,c)}}else{varg=void0;a.samples.length&&(g=this.remuxVideo(a,o,l)),g&&i.codec&&this.remuxEmptyAudio(i,o,l,g)}n.samples.length&&this.remuxID3(n,o),s.samples.length&&this.remuxText(s,o),this.observer.trigger(u.default.FRAG_PARSED,{id:this.id,level:this.level,sn:this.sn})}},{key:"generateIS",value:function(e,t,r,i){vara,n,s=this.observer,o=e.samples,l=t.samples,f=this.PES_TIMESCALE,g=this.typeSupported,v="audio/mp4",p={},y={id:this.id,level:this.level,sn:this.sn,tracks:p,unique:!1},m=void0===this._initPTS;m&&(a=n=1/0),e.config&&o.length&&(e.timescale=e.audiosamplerate,e.timescale*e.duration>Math.pow(2,32)&&!function(){vart=functione(t,r){returnr?e(r,t%r):t};e.timescale=e.audiosamplerate/t(e.audiosamplerate,e.isAAC?1024:1152)}(),d.logger.log("audio mp4 timescale :"+e.timescale),e.isAAC||(g.mpeg?(v="audio/mpeg",e.codec=""):g.mp3&&(e.codec="mp3")),p.audio={container:v,codec:e.codec,initSegment:!e.isAAC&&g.mpeg?newUint8Array:h.default.initSegment([e]),metadata:{channelCount:e.channelCount}},m&&(a=n=o[0].pts-f*r)),t.sps&&t.pps&&l.length&&(t.timescale=this.MP4_TIMESCALE,p.video={container:"video/mp4",codec:t.codec,initSegment:h.default.initSegment([t]),metadata:{width:t.width,height:t.height}},m&&(a=Math.min(a,l[0].pts-f*r),n=Math.min(n,l[0].dts-f*r),this.observer.trigger(u.default.INIT_PTS_FOUND,{id:this.id,initPTS:a,cc:i}))),Object.keys(p).length?(s.trigger(u.default.FRAG_PARSING_INIT_SEGMENT,y),this.ISGenerated=!0,m&&(this._initPTS=a,this._initDTS=n)):s.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,id:this.id,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(e,t,r,i){vara,n,s,o,l,f,g,v,p=8,y=this.PES_TIMESCALE,m=this.PES2MP4SCALEFACTOR,E=e.samples,b=[],R=E.length,_=this._PTSNormalize,T=this._initDTS;E.sort(function(e,t){varr=e.dts-t.dts;returnr?r:e.pts-t.pts});vark=E.reduce(function(e,t){returnMath.max(Math.min(e,t.pts-t.dts),-18e3)},0);if(k<0){d.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(k/90)+" ms to overcome this issue");for(varA=0;A<E.length;A++)E[A].dts+=k}varS=void0;S=r?this.nextAvcDts:t*y;varL=E[0];l=Math.max(_(L.dts-T,S),0),o=Math.max(_(L.pts-T,S),0);varD=Math.round((l-S)/90);r&&D&&(D>1?d.logger.log("AVC:"+D+" ms hole between fragments detected,filling it"):D<-1&&d.logger.log("AVC:"+-D+" ms overlapping between fragments detected"),l=S,E[0].dts=l+T,o=Math.max(o-D,S),E[0].pts=o+T,d.logger.log("Video/PTS/DTS adjusted: "+Math.round(o/90)+"/"+Math.round(l/90)+",delta:"+D+" ms")),f=l,L=E[E.length-1],v=Math.max(_(L.dts
},l={trace:i,debug:i,log:i,warn:i,info:i,error:i},u=l;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeofe?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{u.log()}catch(e){u=l}}elseu=l},r.logger=u},{}],46:[function(e,t,r){"use strict";functioni(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});vara=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){functione(){i(this,e)}returna(e,null,[{key:"toString",value:function(e){for(vart="",r=e.length,i=0;i<r;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";returnt}}]),e}();r.default=n},{}],47:[function(e,t,r){"use strict";functioni(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});vara=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=function(){functione(t){i(this,e),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}returna(e,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){vare=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"load",value:function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()}},{key:"loadInternal",value:function(){vare,t=this.context;e="undefined"!=typeofXDomainRequest?this.loader=newXDomainRequest:this.loader=newXMLHttpRequest,e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.open("GET",t.url,!0),t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.responseType=t.responseType;varr=this.stats;r.tfirst=0,r.loaded=0,this.xhrSetup&&this.xhrSetup(e,t.url),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()}},{key:"readystatechange",value:function(e){vart=e.currentTarget,r=t.readyState,i=this.stats,a=this.context,s=this.config;if(!i.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(performance.now(),i.trequest)),4===r){varo=t.status;if(o>=200&&o<300){i.tload=Math.max(i.tfirst,performance.now());varl=void0,u=void0;"arraybuffer"===a.responseType?(l=t.response,u=l.byteLength):(l=t.responseText,u=l.length),i.loaded=i.total=u;vard={url:t.responseURL,data:l};this.callbacks.onSuccess(d,i,a)}elsei.retry>=s.maxRetry||o>=400&&o<499?(n.logger.error(o+" while loading "+a.url),this.callbacks.onError({code:o,text:t.statusText},a)):(n.logger.warn(o+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),i.retry++)}elsethis.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout)}},{key:"loadtimeout",value:function(){n.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context)}},{key:"loadprogress",value:function(e){vart=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total);varr=this.callbacks.onProgress;r&&r(t,this.context,null)}}]),e}();r.default=s},{45:45}]},{},[33])(33)});