!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,
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+")");try{varo=t[i]=r.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe),this.tracks[i]={codec:n,container:a.container},a.buffer=o}catch(e){h.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:s})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:e})}},{key:"onBufferAppending",value:function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())}},{key:"onBufferAppendFai
}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=T.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&&(k.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(k.logger.log("media seeking to "+t.toFixed(3)),this.state===T.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&&(k.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=T.IDLE):k.logger.log("seeking outside of buffer but within currently loaded fragment range")}}elsethis.state===T.ENDED&&(this.state=T.IDLE);e&&(this.lastCurrentTime=t),this.state!==T.FRAG_LOADING&&void0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=t),this.tick()}},{key:"onMediaSeeked",value:function(){k.logger.log("media seeked to "+this.media.currentTime.toFixed(3)),this.tick()}},{key:"onMediaEnded",value:function(){k.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){k.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&&k.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(k.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?k.logger.log("live playlist sliding:"+n.toFixed(3)):k.logger.log("live playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,k.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),k.logger.log("configure startPosition to "+this.st
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(newUint8Array(a.data),a.audioCodec,a.videoCodec,a.timeOffset,a.cc,a.level,a.sn,a.duration,a.accurateTimeOffset,a.defaultInitPTS)}}),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(16),g=i(c),v=e(26),p=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:v.ErrorTypes.OTHER_ERROR,details:v.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("error while initializing DemuxerWorker, fallback on DemuxerInline"),s&&URL.revokeObjectURL(s.objectURL),this.demuxer=newu.default(r,i,n)}}elsethis.demuxer=newu.default(r,i,n);this.demuxInitialized=!0}returnn(t,[{key:"destroy",value:function(){vare=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{vart=this.demuxer;t&&(t.destroy(),this.demuxer=null)}varr=this.decrypter;r&&(r.destroy(),this.decrypter=null)}},{key:"pushDecrypted",value:function(e,t,r,i,a,n,s,o,l,u){vard=this.w;if(d)d.postMessage({cmd:"demux",data:e,audioCodec:t,videoCodec:r,timeOffset:i,cc:a,level:n,sn:s,duration:o,accurateTimeOffset:l,defaultInitPTS:u},[e]);else{varf=this.demuxer;f&&f.push(newUint8Array(e),t,r,i,a,n,s,o,l,u)}}},{key:"push",value:function(e,t,r,i,a,n,s,l,u,d,f){if(e.byteLength>0&&null!=u&&null!=u.key&&"AES-128"===u.method){null==this.decrypter&&(this.decrypter=newg.default(this.hls));varh=this,c=performance.now();this.decrypter.decrypt(e,u.key.buffer,u.iv.buffer,function(e){h.hls.trigger(o.default.FRAG_DECRYPTED,{level:n,sn:s,stats:{tstart:c,tdecrypt:performance.now()}}),h.pushDecrypted(e,t,r,i,a,n,s,l,d,f)})}elsethis.pushDecrypted(e,t,r,i,a,n,s,l,d,f)}},{key:"onWorkerMessage",value:function(e){vart=e.data,r=this.hls;switch(t.event){case"init":URL.revokeObjectURL(this.w.objectURL);break;caseo.default.FRAG_PARSING_DATA:t.data.data1=newUint8Array(t.data1),t.data.data2=newUint8Array(t.data2);default:r.trigger(t.event,t.data)}}}]),t}();r.default=p},{16:16,20:20,21:21,26:26,28:28,3:3,45:45}],23:[fu
}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),_=e(12),R=i(_),k=e(11),T=i(k),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),N=e(35),F=i(N),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=newT.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=newF.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.17"}},{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,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void0,liveMaxLatencyDuration:void0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void0,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:C.default,fLoader:void0,pLoader:void0,xhrSetup:void0,fetchSetup:void0,abrController:g.default,bufferController:p.default,capLevelController:m.default,fpsController:D.default,streamController:R.default,audioSt
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=[],_=E.length,R=this._PTSNormalize,k=this._initDTS;E.sort(function(e,t){varr=e.dts-t.dts;returnr?r:e.pts-t.pts});varT=E.reduce(function(e,t){returnMath.max(Math.min(e,t.pts-t.dts),-18e3)},0);if(T<0){d.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(T/90)+" ms to overcome this issue");for(varA=0;A<E.length;A++)E[A].dts+=T}varS=void0;S=r?this.nextAvcDts:t*y;varL=E[0];l=Math.max(R(L.dts-k,S),0),o=Math.max(R(L.pts-k,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+k,o=Math.max(o-D,S),E[0].pts=o+k,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(R(L.dts-k,S),0),g=Math.max(R(L.pts-k,S),0),g=Math.max(g,v);varw=navigator.vendor,O=navigator.userAgent,I=w&&w.indexOf("Apple")>-1&&O&&!O.match("CriOS");I&&(a=Math.round((v-l)/(m*(E.length-1))));for(varP=0;P<_;P++){varC=E[P];I?C.dts=l+P*m*a:(C.dts=Math.max(R(C.dts-k,S),l),C.dts=Math.round(C.dts/m)*m),C.pts=Math.max(R(C.pts-k,S),C.dts),C.pts=Math.round(C.pts/m)*m}varM=e.len+4*e.nbNalu+8;try{n=newUint8Array(M)}catch(e){returnvoidthis.observer.trigger(u.default.ERROR,{type:c.ErrorTypes.MUX_ERROR,level:this.level,id:this.id,details:c.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:M,reason:"fail allocating video mdat "+M})}varx=newDataView(n.buffer);x.setUint32(0,M),n.set(h.default.types.mdat,4);for(varN=0;N<_;N++){for(varF=E[N],U=F.units.units,G=0,B=void0,j=0,H=U.length;j<H;j++){varK=U[j],W=K.data,V=K.data.byteLength;x.setUint32(p,V),p+=4,n.set(W,p),p+=V,G+=4+V}if(I)B=Math.max(0,a*Math.round((F.pts-F.dts)/(m*a)));else{if(N<_-1)a=E[N+1].dts-F.dts;else{varY=this.config,q=F.dts-E[N>0?N-1:N].dts;if(Y.stretchShortVideoTrack){varX=Y.maxBufferHole,z=Y.maxSeekHole,$=Math.floor(Math.min(X,z)*y),J=(i?o+i*y:this.nextAudioPts)-F.pts;J>$?(a=J-q,a<0&&(a=q),d.logger.log("It is approximately "+J/90+" ms to the next segment; using duration "+a/90+" ms for the last video frame.")):a=q}elsea=q}a/=m,B=M
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&&(window.clearTimeout(this.requestTimeout),r>=2&&(0===i.tfirst&&(i.tfirst=Math.max(performance.now(),i.trequest),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout-(i.tfirst-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++)}}},{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)});