diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 3ece7529ed..0bd2a1ebbe 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -15,12 +15,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.16", - "_release": "1.4.16", + "version": "1.4.17", + "_release": "1.4.17", "_resolution": { "type": "version", - "tag": "1.4.16", - "commit": "b564ac84f300199b48a8a2338111d6b7609b671b" + "tag": "1.4.17", + "commit": "26ee95baf54887c88d2aadf768ded7aa75a65fb7" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.css b/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.css index 8b41ff459c..42621baca1 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.css +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.css @@ -30,7 +30,7 @@ .inputLabel { display: inline-block; - transition: all .25s ease-out; + transition: all .2s ease-out; } .inputLabel.blank { diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js b/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js index e39266667f..ccb25ab162 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js @@ -2,10 +2,13 @@ var EmbyInputPrototype = Object.create(HTMLInputElement.prototype); + var inputId = 0; + EmbyInputPrototype.createdCallback = function () { if (!this.id) { - this.id = 'input' + new Date().getTime(); + this.id = 'embyinput' + inputId; + inputId++; } }; diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js b/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js index 147efaf028..59b673f9e4 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js @@ -103,6 +103,8 @@ } } + var inputId = 0; + EmbySelectPrototype.createdCallback = function () { var parent = this.parentNode; @@ -112,8 +114,10 @@ parent.replaceChild(div, this); div.appendChild(this); } + if (!this.id) { - this.id = 'select' + new Date().getTime(); + this.id = 'embyselect' + inputId; + inputId++; } this.removeEventListener('mousedown', onMouseDown); diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css index d309157716..c665943f12 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css @@ -186,7 +186,7 @@ .channelHeaderCell { border-bottom: .65vh solid #121212 !important; - background-size: auto 65.7%; + background-size: auto 70%; background-position: 90% center; background-repeat: no-repeat; } @@ -234,7 +234,7 @@ } .layout-tv .channelPrograms, .layout-tv .channelHeaderCell { - height: 7.6vh; + height: 9vh; } } @@ -365,13 +365,12 @@ height: auto !important; } -.programCell:focus, .channelHeaderCell:focus, .btnSelectDate:focus { - background-color: #52B54B; +.programCell, .channelHeaderCell, .btnSelectDate { outline: none !important; } - .programCell:focus .programAccent { - background-color: transparent !important; + .programCell:focus, .channelHeaderCell:focus, .btnSelectDate:focus { + background-color: #555; } .timerIcon, .seriesTimerIcon { diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js index b549dc7fee..ac98056523 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js @@ -307,6 +307,7 @@ // but since mobile browsers are often underpowered, // it can help performance to get them out of the markup var showIndicators = window.innerWidth >= 800; + showIndicators = false; var options = { showHdIcon: showIndicators, diff --git a/dashboard-ui/bower_components/hls.js/.bower.json b/dashboard-ui/bower_components/hls.js/.bower.json index 5e90c60cc0..4a0891c00c 100644 --- a/dashboard-ui/bower_components/hls.js/.bower.json +++ b/dashboard-ui/bower_components/hls.js/.bower.json @@ -1,6 +1,6 @@ { "name": "hls.js", - "version": "0.5.33", + "version": "0.5.34", "license": "Apache-2.0", "description": "Media Source Extension - HLS library, by/for Dailymotion", "homepage": "https://github.com/dailymotion/hls.js", @@ -16,11 +16,11 @@ "test", "tests" ], - "_release": "0.5.33", + "_release": "0.5.34", "_resolution": { "type": "version", - "tag": "v0.5.33", - "commit": "bee1aea020de895904cef15962e71c062338e22e" + "tag": "v0.5.34", + "commit": "fe719c8631da6014babef8c5914f59b1620769a6" }, "_source": "git://github.com/dailymotion/hls.js.git", "_target": "~0.5.7", diff --git a/dashboard-ui/bower_components/hls.js/bower.json b/dashboard-ui/bower_components/hls.js/bower.json index 7bfe08a278..67145c946b 100644 --- a/dashboard-ui/bower_components/hls.js/bower.json +++ b/dashboard-ui/bower_components/hls.js/bower.json @@ -1,6 +1,6 @@ { "name": "hls.js", - "version": "0.5.33", + "version": "0.5.34", "license": "Apache-2.0", "description": "Media Source Extension - HLS library, by/for Dailymotion", "homepage": "https://github.com/dailymotion/hls.js", diff --git a/dashboard-ui/bower_components/hls.js/dist/hls.js b/dashboard-ui/bower_components/hls.js/dist/hls.js index 74647c8758..a4533e219f 100644 --- a/dashboard-ui/bower_components/hls.js/dist/hls.js +++ b/dashboard-ui/bower_components/hls.js/dist/hls.js @@ -2373,7 +2373,7 @@ var StreamController = function (_EventHandler) { var currentLevel = this.levels[this.level], details = currentLevel.details, duration = details.totalduration, - start = fragCurrent.start, + start = fragCurrent.startDTS !== undefined ? fragCurrent.startDTS : fragCurrent.start, level = fragCurrent.level, sn = fragCurrent.sn, audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec; @@ -2495,7 +2495,7 @@ var StreamController = function (_EventHandler) { _logger.logger.log('parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb); - var drift = _levelHelper2.default.updateFragPTS(level.details, frag.sn, data.startPTS, data.endPTS), + var drift = _levelHelper2.default.updateFragPTSDTS(level.details, frag.sn, data.startPTS, data.endPTS, data.startDTS, data.endDTS), hls = this.hls; hls.trigger(_events2.default.LEVEL_PTS_UPDATED, { details: level.details, level: this.level, drift: drift }); @@ -2645,7 +2645,7 @@ var StreamController = function (_EventHandler) { _logger.logger.log('target seek position:' + targetSeekPosition); } var bufferInfo = _bufferHelper2.default.bufferInfo(media, currentTime, 0), - expectedPlaying = !(media.paused || media.ended || media.seeking || readyState < 2), + expectedPlaying = !(media.paused || media.ended || media.seeking || media.buffered.length === 0), jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end playheadMoving = currentTime > media.playbackRate * this.lastCurrentTime; @@ -4581,14 +4581,14 @@ var TSDemuxer = function () { value: function switchLevel() { this.pmtParsed = false; this._pmtId = -1; - this.lastAacPTS = null; - this.aacOverFlow = null; this._avcTrack = { container: 'video/mp2t', type: 'video', id: -1, sequenceNumber: 0, samples: [], len: 0, nbNalu: 0 }; this._aacTrack = { container: 'video/mp2t', type: 'audio', id: -1, sequenceNumber: 0, samples: [], len: 0 }; this._id3Track = { type: 'id3', id: -1, sequenceNumber: 0, samples: [], len: 0 }; this._txtTrack = { type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0 }; // flush any partial content this.aacOverFlow = null; + this.aacLastPTS = null; + this.avcNaluState = 0; this.remuxer.switchLevel(); } }, { @@ -4917,6 +4917,22 @@ var TSDemuxer = function () { pes.data = null; var debugString = ''; + var pushAccesUnit = function pushAccesUnit() { + if (units2.length) { + // only push AVC sample if keyframe already found in this fragment OR + // keyframe found in last fragment (track.sps) AND + // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous + if (key === true || track.sps && (samples.length || this.contiguous)) { + avcSample = { units: { units: units2, length: length }, pts: pes.pts, dts: pes.dts, key: key }; + samples.push(avcSample); + track.len += length; + track.nbNalu += units2.length; + } + units2 = []; + length = 0; + } + }; + units.forEach(function (unit) { switch (unit.type) { //NDR @@ -5029,6 +5045,7 @@ var TSDemuxer = function () { if (debug) { debugString += 'AUD '; } + pushAccesUnit(); break; default: push = false; @@ -5043,19 +5060,7 @@ var TSDemuxer = function () { if (debug || debugString.length) { _logger.logger.log(debugString); } - //build sample from PES - // Annex B to MP4 conversion to be done - if (units2.length) { - // only push AVC sample if keyframe already found in this fragment OR - // keyframe found in last fragment (track.sps) AND - // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous - if (key === true || track.sps && (samples.length || this.contiguous)) { - avcSample = { units: { units: units2, length: length }, pts: pes.pts, dts: pes.dts, key: key }; - samples.push(avcSample); - track.len += length; - track.nbNalu += units2.length; - } - } + pushAccesUnit(); } }, { key: '_parseAVCNALu', @@ -5064,7 +5069,7 @@ var TSDemuxer = function () { len = array.byteLength, value, overflow, - state = 0; + state = this.avcNaluState; var units = [], unit, unitType, @@ -5099,22 +5104,45 @@ var TSDemuxer = function () { //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); units.push(unit); } else { - // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit. - overflow = i - state - 1; - if (overflow) { + // lastUnitStart is undefined => this is the first start code found in this PES packet + // first check if start code delimiter is overlapping between 2 PES packets, + // ie it started in last packet (lastState not zero) + // and ended at the beginning of this PES packet (i <= 4 - lastState) + var lastState = this.avcNaluState; + if (lastState && i <= 4 - lastState) { + // start delimiter overlapping between PES packets + // strip start delimiter bytes from the end of last NAL unit var track = this._avcTrack, samples = track.samples; - //logger.log('first NALU found with overflow:' + overflow); if (samples.length) { var lastavcSample = samples[samples.length - 1], lastUnits = lastavcSample.units.units, - lastUnit = lastUnits[lastUnits.length - 1], - tmp = new Uint8Array(lastUnit.data.byteLength + overflow); - tmp.set(lastUnit.data, 0); - tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength); - lastUnit.data = tmp; - lastavcSample.units.length += overflow; - track.len += overflow; + lastUnit = lastUnits[lastUnits.length - 1]; + // check if lastUnit had a state different from zero + if (lastUnit.state) { + // strip last bytes + lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState); + lastavcSample.units.length -= lastState; + track.len -= lastState; + } + } + } + // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit. + overflow = i - state - 1; + if (overflow > 0) { + var _track = this._avcTrack, + _samples = _track.samples; + //logger.log('first NALU found with overflow:' + overflow); + if (_samples.length) { + var _lastavcSample = _samples[_samples.length - 1], + _lastUnits = _lastavcSample.units.units, + _lastUnit = _lastUnits[_lastUnits.length - 1], + tmp = new Uint8Array(_lastUnit.data.byteLength + overflow); + tmp.set(_lastUnit.data, 0); + tmp.set(array.subarray(0, overflow), _lastUnit.data.byteLength); + _lastUnit.data = tmp; + _lastavcSample.units.length += overflow; + _track.len += overflow; } } } @@ -5130,9 +5158,10 @@ var TSDemuxer = function () { } } if (lastUnitStart) { - unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType }; + unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType, state: state }; units.push(unit); - //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); + //logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state); + this.avcNaluState = state; } return units; } @@ -5146,7 +5175,7 @@ var TSDemuxer = function () { duration = this._duration, audioCodec = this.audioCodec, aacOverFlow = this.aacOverFlow, - lastAacPTS = this.lastAacPTS, + aacLastPTS = this.aacLastPTS, config, frameLength, frameDuration, @@ -5198,8 +5227,8 @@ var TSDemuxer = function () { // if last AAC frame is overflowing, we should ensure timestamps are contiguous: // first sample PTS should be equal to last sample PTS + frameDuration - if (aacOverFlow && lastAacPTS) { - var newPTS = lastAacPTS + frameDuration; + if (aacOverFlow && aacLastPTS) { + var newPTS = aacLastPTS + frameDuration; if (Math.abs(newPTS - pts) > 1) { _logger.logger.log('AAC: align PTS for overlapping frames by ' + Math.round((newPTS - pts) / 90)); pts = newPTS; @@ -5239,7 +5268,7 @@ var TSDemuxer = function () { aacOverFlow = null; } this.aacOverFlow = aacOverFlow; - this.lastAacPTS = stamp; + this.aacLastPTS = stamp; } }, { key: '_parseID3PES', @@ -5667,7 +5696,7 @@ var LevelHelper = function () { // if at least one fragment contains PTS info, recompute PTS information for all fragments if (PTSFrag) { - LevelHelper.updateFragPTS(newDetails, PTSFrag.sn, PTSFrag.startPTS, PTSFrag.endPTS); + LevelHelper.updateFragPTSDTS(newDetails, PTSFrag.sn, PTSFrag.startPTS, PTSFrag.endPTS, PTSFrag.startDTS, PTSFrag.endDTS); } else { // ensure that delta is within oldfragments range // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61]) @@ -5686,8 +5715,8 @@ var LevelHelper = function () { return; } }, { - key: 'updateFragPTS', - value: function updateFragPTS(details, sn, startPTS, endPTS) { + key: 'updateFragPTSDTS', + value: function updateFragPTSDTS(details, sn, startPTS, endPTS, startDTS, endDTS) { var fragIdx, fragments, frag, i; // exit if sn out of range if (sn < details.startSN || sn > details.endSN) { @@ -5699,12 +5728,16 @@ var LevelHelper = function () { if (!isNaN(frag.startPTS)) { startPTS = Math.min(startPTS, frag.startPTS); endPTS = Math.max(endPTS, frag.endPTS); + startDTS = Math.min(startDTS, frag.startDTS); + endDTS = Math.max(endDTS, frag.endDTS); } var drift = startPTS - frag.start; frag.start = frag.startPTS = startPTS; frag.endPTS = endPTS; + frag.startDTS = startDTS; + frag.endDTS = endDTS; frag.duration = endPTS - startPTS; // adjust fragment PTS/duration from seqnum-1 to frag 0 for (i = fragIdx; i > 0; i--) { diff --git a/dashboard-ui/bower_components/hls.js/dist/hls.js.map b/dashboard-ui/bower_components/hls.js/dist/hls.js.map index 4df7d37d66..2b99a1c664 100644 --- a/dashboard-ui/bower_components/hls.js/dist/hls.js.map +++ b/dashboard-ui/bower_components/hls.js/dist/hls.js.map @@ -44,7 +44,7 @@ "src/utils/xhr-loader.js" ], "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3DA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;IAEM,a;;;AAEJ,yBAAY,GAAZ,EAAiB;AAAA;;AAAA,iGACT,GADS,EACJ,iBAAM,YADF,EAEJ,iBAAM,WAFF,EAGJ,iBAAM,KAHF;;AAIf,UAAK,mBAAL,GAA2B,CAA3B;AACA,UAAK,iBAAL,GAAyB,CAAC,CAA1B;AACA,UAAK,cAAL,GAAsB,CAAC,CAAvB;AACA,UAAK,GAAL,GAAW,GAAX;AACA,UAAK,WAAL,GAAmB,qCAA2B,GAA3B,CAAnB;AACA,UAAK,OAAL,GAAe,MAAK,iBAAL,CAAuB,IAAvB,OAAf;AATe;AAUhB;;;;8BAES;AACR,WAAK,UAAL;AACA,6BAAa,SAAb,CAAuB,OAAvB,CAA+B,IAA/B,CAAoC,IAApC;AACD;;;kCAEa,I,EAAM;AAClB,UAAI,CAAC,KAAK,KAAV,EAAiB;AACf,aAAK,KAAL,GAAa,YAAY,KAAK,OAAjB,EAA0B,GAA1B,CAAb;AACD;AACD,WAAK,W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8B,KAA9B,CAAlB;AACA,kBAAM,KAAN;AACD,WAPD,MAOO;AACL,mBAAO,YAAP,CAAoB,KAAK,aAAzB;AACA,2BAAO,KAAP,CAAgB,MAAhB,uBAAwC,KAAK,GAA7C;AACA,iBAAK,OAAL,CAAa,KAAb;AACD;AACF;AACF;AACF;;;gCAEW,K,EAAO;AACjB,qBAAO,IAAP,4BAAqC,KAAK,GAA1C;AACA,WAAK,SAAL,CAAe,KAAf,EAAsB,KAAK,KAA3B;AACD;;;iCAEY,K,EAAO;AAClB,UAAI,QAAQ,KAAK,KAAjB;AACA,UAAI,MAAM,MAAN,KAAiB,IAArB,EAA2B;AACzB,cAAM,MAAN,GAAe,YAAY,GAAZ,EAAf;AACD;AACD,YAAM,MAAN,GAAe,MAAM,MAArB;AACA,UAAI,KAAK,UAAT,EAAqB;AACnB,aAAK,UAAL,CAAgB,KAAhB,EAAuB,KAAvB;AACD;AACF;;;;;;kBAGY,S", + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3DA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;IAEM,a;;;AAEJ,yBAAY,GA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ClC,iBAAO,YAAP,CAAoB,KAAK,aAAzB;AACA,gBAAM,KAAN,GAAc,YAAY,GAAZ,EAAd;AACA,eAAK,SAAL,CAAe,KAAf,EAAsB,KAAtB;AACH,SAJC,MAIK;;AAEL,cAAI,MAAM,KAAN,GAAc,KAAK,QAAvB,EAAiC;AAC/B,2BAAO,IAAP,CAAe,MAAf,uBAAuC,KAAK,GAA5C,sBAAgE,KAAK,UAArE;AACA,iBAAK,OAAL;AACA,mBAAO,UAAP,CAAkB,KAAK,YAAL,CAAkB,IAAlB,CAAuB,IAAvB,CAAlB,EAAgD,KAAK,UAArD;;AAEA,iBAAK,UAAL,GAAkB,KAAK,GAAL,CAAS,IAAI,KAAK,UAAlB,EAA8B,KAA9B,CAAlB;AACA,kBAAM,KAAN;AACD,WAPD,MAOO;AACL,mBAAO,YAAP,CAAoB,KAAK,aAAzB;AACA,2BAAO,KAAP,CAAgB,MAAhB,uBAAwC,KAAK,GAA7C;AACA,iBAAK,OAAL,CAAa,KAAb;AACD;AACF;AACF;AACF;;;gCAEW,K,EAAO;AACjB,qBAAO,IAAP,4BAAqC,KAAK,GAA1C;AACA,WAAK,SAAL,CAAe,KAAf,EAAsB,KAAK,KAA3B;AACD;;;iCAEY,K,EAAO;AAClB,UAAI,QAAQ,KAAK,KAAjB;AACA,UAAI,MAAM,MAAN,KAAiB,IAArB,EAA2B;AACzB,cAAM,MAAN,GAAe,YAAY,GAAZ,EAAf;AACD;AACD,YAAM,MAAN,GAAe,MAAM,MAArB;AACA,UAAI,KAAK,UAAT,EAAqB;AACnB,aAAK,UAAL,CAAgB,KAAhB,EAAuB,KAAvB;AACD;AACF;;;;;;kBAGY,S", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ @@ -56,7 +56,7 @@ "/*\n * cap stream level to media size dimension controller\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\n\nclass CapLevelController extends EventHandler {\n\tconstructor(hls) {\n super(hls,\n Event.MEDIA_ATTACHING,\n Event.MANIFEST_PARSED); \n\t}\n\t\n\tdestroy() {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n }\n }\n }\n\t \n\tonMediaAttaching(data) {\n this.media = data.media instanceof HTMLVideoElement ? data.media : null; \n }\n\n onManifestParsed(data) {\n if (this.hls.config.capLevelToPlayerSize) {\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.levels = data.levels;\n this.hls.firstLevel = this.getMaxLevel(data.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n }\n }\n \n detectPlayerSize() {\n if (this.media) {\n let levelsLength = this.levels ? this.levels.length : 0;\n if (levelsLength) {\n this.hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n if (this.hls.autoLevelCapping > this.autoLevelCapping) {\n // if auto level capping has a higher value for the previous one, flush the buffer using nextLevelSwitch\n // usually happen when the user go to the fullscreen mode.\n this.hls.streamController.nextLevelSwitch();\n }\n this.autoLevelCapping = this.hls.autoLevelCapping; \n } \n }\n }\n \n /*\n * returns level should be the one with the dimensions equal or greater than the media (player) dimensions (so the video will be downscaled)\n */\n getMaxLevel(capLevelIndex) {\n let result,\n i,\n level,\n mWidth = this.mediaWidth,\n mHeight = this.mediaHeight,\n lWidth = 0,\n lHeight = 0;\n \n for (i = 0; i <= capLevelIndex; i++) {\n level = this.levels[i];\n result = i;\n lWidth = level.width;\n lHeight = level.height;\n if (mWidth <= lWidth || mHeight <= lHeight) {\n break;\n }\n } \n return result;\n }\n \n get contentScaleFactor() {\n let pixelRatio = 1;\n try {\n pixelRatio = window.devicePixelRatio;\n } catch(e) {}\n return pixelRatio;\n }\n \n get mediaWidth() {\n let width;\n if (this.media) {\n width = this.media.width || this.media.clientWidth || this.media.offsetWidth;\n width *= this.contentScaleFactor;\n }\n return width;\n }\n \n get mediaHeight() {\n let height;\n if (this.media) {\n height = this.media.height || this.media.clientHeight || this.media.offsetHeight;\n height *= this.contentScaleFactor; \n }\n return height;\n }\n}\n\nexport default CapLevelController;", "/*\n * EWMA Bandwidth Estimator\n * - heavily inspired from shaka-player\n * Tracks bandwidth samples and estimates available bandwidth.\n * Based on the minimum of two exponentially-weighted moving averages with\n * different half-lives.\n */\n\nimport EWMA from '../utils/ewma';\n\n\nclass EwmaBandWidthEstimator {\n\n constructor(hls) {\n this.hls = hls;\n this.defaultEstimate_ = 5e5; // 500kbps\n this.minWeight_ = 0.001;\n this.minDelayMs_ = 50;\n this.fast_ = new EWMA(hls.config.abrEwmaFast);\n this.slow_ = new EWMA(hls.config.abrEwmaSlow);\n }\n\n sample(durationMs,numBytes) {\n durationMs = Math.max(durationMs, this.minDelayMs_);\n var bandwidth = 8000* numBytes / durationMs;\n //console.log('instant bw:'+ Math.round(bandwidth));\n // we weight sample using loading duration....\n var weigth = durationMs / 1000;\n this.fast_.sample(weigth,bandwidth);\n this.slow_.sample(weigth,bandwidth);\n }\n\n\n getEstimate() {\n if (this.fast_.getTotalWeight() < this.minWeight_) {\n return this.defaultEstimate_;\n }\n //console.log('slow estimate:'+ Math.round(this.slow_.getEstimate()));\n //console.log('fast estimate:'+ Math.round(this.fast_.getEstimate()));\n // Take the minimum of these two estimates. This should have the effect of\n // adapting down quickly, but up more slowly.\n return Math.min(this.fast_.getEstimate(),this.slow_.getEstimate());\n }\n\n destroy() {\n }\n}\nexport default EwmaBandWidthEstimator;\n\n", "/*\n * Level Controller\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {logger} from '../utils/logger';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nclass LevelController extends EventHandler {\n\n constructor(hls) {\n super(hls,\n Event.MANIFEST_LOADED,\n Event.LEVEL_LOADED,\n Event.ERROR);\n this.ontick = this.tick.bind(this);\n this._manualLevel = this._autoLevelCapping = -1;\n }\n\n destroy() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this._manualLevel = -1;\n }\n\n startLoad() {\n this.canload = true;\n // speed up live playlist refresh if timer exists\n if (this.timer) {\n this.tick();\n }\n }\n\n stopLoad() {\n this.canload = false;\n }\n\n onManifestLoaded(data) {\n var levels0 = [], levels = [], bitrateStart, i, bitrateSet = {}, videoCodecFound = false, audioCodecFound = false, hls = this.hls;\n\n // regroup redundant level together\n data.levels.forEach(level => {\n if(level.videoCodec) {\n videoCodecFound = true;\n }\n if(level.audioCodec) {\n audioCodecFound = true;\n }\n var redundantLevelId = bitrateSet[level.bitrate];\n if (redundantLevelId === undefined) {\n bitrateSet[level.bitrate] = levels0.length;\n level.url = [level.url];\n level.urlId = 0;\n levels0.push(level);\n } else {\n levels0[redundantLevelId].url.push(level.url);\n }\n });\n\n // remove audio-only level if we also have levels with audio+video codecs signalled\n if(videoCodecFound && audioCodecFound) {\n levels0.forEach(level => {\n if(level.videoCodec) {\n levels.push(level);\n }\n });\n } else {\n levels = levels0;\n }\n\n // only keep level with supported audio/video codecs\n levels = levels.filter(function(level) {\n var checkSupportedAudio = function(codec) { return MediaSource.isTypeSupported(`audio/mp4;codecs=${codec}`);};\n var checkSupportedVideo = function(codec) { return MediaSource.isTypeSupported(`video/mp4;codecs=${codec}`);};\n var audioCodec = level.audioCodec, videoCodec = level.videoCodec;\n\n return (!audioCodec || checkSupportedAudio(audioCodec)) &&\n (!videoCodec || checkSupportedVideo(videoCodec));\n });\n\n if(levels.length) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate;\n // sort level on bitrate\n levels.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n this._levels = levels;\n // find index of first level in sorted levels\n for (i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger.log(`manifest loaded,${levels.length} level(s) found, first bitrate:${bitrateStart}`);\n break;\n }\n }\n hls.trigger(Event.MANIFEST_PARSED, {levels: this._levels, firstLevel: this._firstLevel, stats: data.stats});\n } else {\n hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal: true, url: hls.url, reason: 'no level with compatible codecs found in manifest'});\n }\n return;\n }\n\n get levels() {\n return this._levels;\n }\n\n get level() {\n return this._level;\n }\n\n set level(newLevel) {\n let levels = this._levels;\n if (levels && levels.length > newLevel) {\n if (this._level !== newLevel || levels[newLevel].details === undefined) {\n this.setLevelInternal(newLevel);\n }\n }\n }\n\n setLevelInternal(newLevel) {\n let levels = this._levels;\n // check if level idx is valid\n if (newLevel >= 0 && newLevel < levels.length) {\n // stopping live reloading timer if any\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this._level = newLevel;\n logger.log(`switching to level ${newLevel}`);\n this.hls.trigger(Event.LEVEL_SWITCH, {level: newLevel});\n var level = levels[newLevel];\n // check if we need to load playlist for this level\n if (level.details === undefined || level.details.live === true) {\n // level not retrieved yet, or live playlist we need to (re)load it\n logger.log(`(re)loading playlist for level ${newLevel}`);\n var urlId = level.urlId;\n this.hls.trigger(Event.LEVEL_LOADING, {url: level.url[urlId], level: newLevel, id: urlId});\n }\n } else {\n // invalid level id given, trigger error\n this.hls.trigger(Event.ERROR, {type : ErrorTypes.OTHER_ERROR, details: ErrorDetails.LEVEL_SWITCH_ERROR, level: newLevel, fatal: false, reason: 'invalid level idx'});\n }\n }\n\n get manualLevel() {\n return this._manualLevel;\n }\n\n set manualLevel(newLevel) {\n this._manualLevel = newLevel;\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n\n get firstLevel() {\n return this._firstLevel;\n }\n\n set firstLevel(newLevel) {\n this._firstLevel = newLevel;\n }\n\n get startLevel() {\n if (this._startLevel === undefined) {\n return this._firstLevel;\n } else {\n return this._startLevel;\n }\n }\n\n set startLevel(newLevel) {\n this._startLevel = newLevel;\n }\n\n onError(data) {\n if(data.fatal) {\n return;\n }\n\n let details = data.details, hls = this.hls, levelId, level, levelError = false;\n // try to recover not fatal errors\n switch(details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n case ErrorDetails.FRAG_LOOP_LOADING_ERROR:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n levelId = data.frag.level;\n break;\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n levelId = data.level;\n levelError = true;\n break;\n default:\n break;\n }\n /* try to switch to a redundant stream if any available.\n * if no redundant stream available, emergency switch down (if in auto mode and current level not 0)\n * otherwise, we cannot recover this network error ...\n * don't raise FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT as fatal, as it is handled by mediaController\n */\n if (levelId !== undefined) {\n level = this._levels[levelId];\n if (level.urlId < (level.url.length - 1)) {\n level.urlId++;\n level.details = undefined;\n logger.warn(`level controller,${details} for level ${levelId}: switching to redundant stream id ${level.urlId}`);\n } else {\n // we could try to recover if in auto mode and current level not lowest level (0)\n let recoverable = ((this._manualLevel === -1) && levelId);\n if (recoverable) {\n logger.warn(`level controller,${details}: emergency switch-down for next fragment`);\n hls.abrController.nextAutoLevel = 0;\n } else if(level && level.details && level.details.live) {\n logger.warn(`level controller,${details} on live stream, discard`);\n if (levelError) {\n // reset this._level so that another call to set level() will retrigger a frag load\n this._level = undefined;\n }\n // FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT are handled by mediaController\n } else if (details !== ErrorDetails.FRAG_LOAD_ERROR && details !== ErrorDetails.FRAG_LOAD_TIMEOUT) {\n logger.error(`cannot recover ${details} error`);\n this._level = undefined;\n // stopping live reloading timer if any\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n // redispatch same error but with fatal set to true\n data.fatal = true;\n hls.trigger(Event.ERROR, data);\n }\n }\n }\n }\n\n onLevelLoaded(data) {\n // only process level loaded events matching with expected level\n if (data.level === this._level) {\n let newDetails = data.details;\n // if current playlist is a live playlist, arm a timer to reload it\n if (newDetails.live) {\n let reloadInterval = 1000*newDetails.targetduration,\n curLevel = this._levels[data.level],\n curDetails = curLevel.details;\n if (curDetails && newDetails.endSN === curDetails.endSN) {\n // follow HLS Spec, If the client reloads a Playlist file and finds that it has not\n // changed then it MUST wait for a period of one-half the target\n // duration before retrying.\n reloadInterval /=2;\n logger.log(`same live playlist, reload twice faster`);\n }\n // decrement reloadInterval with level loading delay\n reloadInterval -= performance.now() - data.stats.trequest;\n // in any case, don't reload more than every second\n reloadInterval = Math.max(1000,Math.round(reloadInterval));\n logger.log(`live playlist, reload in ${reloadInterval} ms`);\n this.timer = setTimeout(this.ontick,reloadInterval);\n } else {\n this.timer = null;\n }\n }\n }\n\n tick() {\n var levelId = this._level;\n if (levelId !== undefined && this.canload) {\n var level = this._levels[levelId], urlId = level.urlId;\n this.hls.trigger(Event.LEVEL_LOADING, {url: level.url[urlId], level: levelId, id: urlId});\n }\n }\n\n get nextLoadLevel() {\n if (this._manualLevel !== -1) {\n return this._manualLevel;\n } else {\n return this.hls.abrController.nextAutoLevel;\n }\n }\n\n set nextLoadLevel(nextLevel) {\n this.level = nextLevel;\n if (this._manualLevel === -1) {\n this.hls.abrController.nextAutoLevel = nextLevel;\n }\n }\n}\n\nexport default LevelController;\n\n", - "/*\n * Stream Controller\n*/\n\nimport Demuxer from '../demux/demuxer';\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {logger} from '../utils/logger';\nimport BinarySearch from '../utils/binary-search';\nimport BufferHelper from '../helper/buffer-helper';\nimport LevelHelper from '../helper/level-helper';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nconst State = {\n STOPPED : 'STOPPED',\n STARTING : 'STARTING',\n IDLE : 'IDLE',\n PAUSED : 'PAUSED',\n KEY_LOADING : 'KEY_LOADING',\n FRAG_LOADING : 'FRAG_LOADING',\n FRAG_LOADING_WAITING_RETRY : 'FRAG_LOADING_WAITING_RETRY',\n WAITING_LEVEL : 'WAITING_LEVEL',\n PARSING : 'PARSING',\n PARSED : 'PARSED',\n ENDED : 'ENDED',\n ERROR : 'ERROR'\n};\n\nclass StreamController extends EventHandler {\n\n constructor(hls) {\n super(hls,\n Event.MEDIA_ATTACHED,\n Event.MEDIA_DETACHING,\n Event.MANIFEST_LOADING,\n Event.MANIFEST_PARSED,\n Event.LEVEL_LOADED,\n Event.KEY_LOADED,\n Event.FRAG_LOADED,\n Event.FRAG_LOAD_EMERGENCY_ABORTED,\n Event.FRAG_PARSING_INIT_SEGMENT,\n Event.FRAG_PARSING_DATA,\n Event.FRAG_PARSED,\n Event.ERROR,\n Event.BUFFER_APPENDED,\n Event.BUFFER_FLUSHED);\n\n this.config = hls.config;\n this.audioCodecSwap = false;\n this.ticks = 0;\n this.ontick = this.tick.bind(this);\n }\n\n destroy() {\n this.stopLoad();\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n EventHandler.prototype.destroy.call(this);\n this.state = State.STOPPED;\n }\n\n startLoad(startPosition=0) {\n if (this.levels) {\n var media = this.media, lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n this.demuxer = new Demuxer(this.hls);\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n this.level = -1;\n this.fragLoadError = 0;\n if (media && lastCurrentTime) {\n logger.log(`configure startPosition @${lastCurrentTime}`);\n if (!this.lastPaused) {\n logger.log('resuming video');\n media.play();\n }\n this.state = State.IDLE;\n } else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = State.STARTING;\n }\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n } else {\n logger.warn('cannot start loading as manifest not parsed yet');\n this.state = State.STOPPED;\n }\n }\n\n stopLoad() {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = State.STOPPED;\n }\n\n tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n }\n\n doTick() {\n var pos, level, levelDetails, hls = this.hls, config = hls.config;\n //logger.log(this.state);\n switch(this.state) {\n case State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n case State.PAUSED:\n //don't do anything in paused state either ...\n break;\n case State.STARTING:\n // determine load level\n let startLevel = hls.startLevel;\n if (startLevel === -1) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n startLevel = 0;\n this.fragBitrateTest = true;\n }\n // set new level to playlist loader : this will trigger start level load\n // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded\n this.level = hls.nextLoadLevel = startLevel;\n this.state = State.WAITING_LEVEL;\n this.loadedmetadata = false;\n break;\n case State.IDLE:\n // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n if (!this.media &&\n (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n }\n // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // ensure 60s of buffer upfront\n // if we have not yet loaded any fragment, start loading from start position\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n }\n level = hls.nextLoadLevel;\n var bufferInfo = BufferHelper.bufferInfo(this.media,pos,config.maxBufferHole),\n bufferLen = bufferInfo.len,\n bufferEnd = bufferInfo.end,\n fragPrevious = this.fragPrevious,\n maxBufLen;\n // compute max Buffer Length that we could get from this load level, based on level bitrate. don't buffer more than 60 MB and more than 30s\n if ((this.levels[level]).hasOwnProperty('bitrate')) {\n maxBufLen = Math.max(8 * config.maxBufferSize / this.levels[level].bitrate, config.maxBufferLength);\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n // if buffer length is less than maxBufLen try to load a new fragment\n if (bufferLen < maxBufLen) {\n // set next load level : this will trigger a playlist load if needed\n hls.nextLoadLevel = level;\n this.level = level;\n levelDetails = this.levels[level].details;\n // if level info not retrieved yet, switch state and wait for level retrieval\n // if live playlist, ensure that new playlist has been refreshed to avoid loading/try to load\n // a useless and outdated fragment (that might even introduce load error if it is already out of the live playlist)\n if (typeof levelDetails === 'undefined' || levelDetails.live && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n break;\n }\n // find fragment index, contiguous with end of buffer position\n let fragments = levelDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen-1].start + fragments[fragLen-1].duration,\n frag;\n\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n // check if requested position is within seekable boundaries :\n //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n let maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount*levelDetails.targetduration;\n\n if (bufferEnd < Math.max(start, end - maxLatency)) {\n let targetLatency = config.liveSyncDuration !== undefined ? config.liveSyncDuration : config.liveSyncDurationCount * levelDetails.targetduration;\n this.seekAfterBuffered = start + Math.max(0, levelDetails.totalduration - targetLatency);\n logger.log(`buffer end: ${bufferEnd} is located too far from the end of live sliding playlist, media position will be reseted to: ${this.seekAfterBuffered.toFixed(3)}`);\n bufferEnd = this.seekAfterBuffered;\n }\n\n // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n if (levelDetails.PTSKnown && bufferEnd > end) {\n break;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n frag = fragments[targetSN - levelDetails.startSN];\n logger.log(`live playlist, switching playlist, load frag with next SN: ${frag.sn}`);\n }\n }\n if (!frag) {\n /* we have no idea about which fragment should be loaded.\n so let's load mid fragment. it will help computing playlist sliding and find the right one\n */\n frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))];\n logger.log(`live playlist, switching playlist, unknown, load middle frag : ${frag.sn}`);\n }\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n if (!frag) {\n let foundFrag;\n let maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n foundFrag = BinarySearch.search(fragments, (candidate) => {\n // offset should be within fragment boundary - config.maxFragLookUpTolerance\n // this is to cope with situations like\n // bufferEnd = 9.991\n // frag[Ø] : [0,10]\n // frag[1] : [10,20]\n // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here\n // frag start frag start+duration\n // |-----------------------------|\n // <---> <--->\n // ...--------><-----------------------------><---------....\n // previous frag matching fragment next frag\n // return -1 return 0 return 1\n //logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);\n if ((candidate.start + candidate.duration - maxFragLookUpTolerance) <= bufferEnd) {\n return 1;\n }\n else if (candidate.start - maxFragLookUpTolerance > bufferEnd) {\n return -1;\n }\n return 0;\n });\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen-1];\n }\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start;\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < levelDetails.endSN) {\n frag = fragments[frag.sn + 1 - levelDetails.startSN];\n logger.log(`SN just loaded, load next one: ${frag.sn}`);\n } else {\n // have we reached end of VOD playlist ?\n if (!levelDetails.live) {\n // Finalize the media stream\n this.hls.trigger(Event.BUFFER_EOS);\n // We might be loading the last fragment but actually the media\n // is currently processing a seek command and waiting for new data to resume at another point.\n // Going to ended state while media is seeking can spawn an infinite buffering broken state.\n if (!this.media.seeking) {\n this.state = State.ENDED;\n }\n }\n frag = null;\n }\n }\n }\n }\n if(frag) {\n //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if ((frag.decryptdata.uri != null) && (frag.decryptdata.key == null)) {\n logger.log(`Loading key for ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}`);\n this.state = State.KEY_LOADING;\n hls.trigger(Event.KEY_LOADING, {frag: frag});\n } else {\n logger.log(`Loading ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}, currentTime:${pos},bufferEnd:${bufferEnd.toFixed(3)}`);\n frag.autoLevel = hls.autoLevelEnabled;\n if (this.levels.length > 1) {\n frag.expectedLen = Math.round(frag.duration * this.levels[level].bitrate / 8);\n frag.trequest = performance.now();\n }\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n let maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && (Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold)) {\n hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag});\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n this.fragCurrent = frag;\n this.startFragRequested = true;\n hls.trigger(Event.FRAG_LOADING, {frag: frag});\n this.state = State.FRAG_LOADING;\n }\n }\n }\n break;\n case State.WAITING_LEVEL:\n level = this.levels[this.level];\n // check if playlist is already loaded\n if (level && level.details) {\n this.state = State.IDLE;\n }\n break;\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = performance.now();\n var retryDate = this.retryDate;\n var media = this.media;\n var isSeeking = media && media.seeking;\n // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n if(!retryDate || (now >= retryDate) || isSeeking) {\n logger.log(`mediaController: retryDate reached, switch back to IDLE state`);\n this.state = State.IDLE;\n }\n break;\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n default:\n break;\n }\n // check buffer\n this._checkBuffer();\n // check/update current fragment\n this._checkFragmentChanged();\n }\n\n\n\n\n getBufferRange(position) {\n var i, range,\n bufferRange = this.bufferRange;\n if (bufferRange) {\n for (i = bufferRange.length - 1; i >=0; i--) {\n range = bufferRange[i];\n if (position >= range.start && position <= range.end) {\n return range;\n }\n }\n }\n return null;\n }\n\n get currentLevel() {\n if (this.media) {\n var range = this.getBufferRange(this.media.currentTime);\n if (range) {\n return range.frag.level;\n }\n }\n return -1;\n }\n\n get nextBufferRange() {\n if (this.media) {\n // first get end range of current fragment\n return this.followingBufferRange(this.getBufferRange(this.media.currentTime));\n } else {\n return null;\n }\n }\n\n followingBufferRange(range) {\n if (range) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferRange(range.end + 0.5);\n }\n return null;\n }\n\n get nextLevel() {\n var range = this.nextBufferRange;\n if (range) {\n return range.frag.level;\n } else {\n return -1;\n }\n }\n\n isBuffered(position) {\n let media = this.media;\n if (media) {\n let buffered = media.buffered;\n for (let i = 0; i < buffered.length; i++) {\n if (position >= buffered.start(i) && position <= buffered.end(i)) {\n return true;\n }\n }\n }\n return false;\n }\n\n _checkFragmentChanged() {\n var rangeCurrent, currentTime, video = this.media;\n if (video && video.seeking === false) {\n currentTime = video.currentTime;\n /* if video element is in seeked state, currentTime can only increase.\n (assuming that playback rate is positive ...)\n As sometimes currentTime jumps back to zero after a\n media decode error, check this, to avoid seeking back to\n wrong position after a media decode error\n */\n if(currentTime > video.playbackRate*this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n if (this.isBuffered(currentTime)) {\n rangeCurrent = this.getBufferRange(currentTime);\n } else if (this.isBuffered(currentTime + 0.1)) {\n /* ensure that FRAG_CHANGED event is triggered at startup,\n when first video frame is displayed and playback is paused.\n add a tolerance of 100ms, in case current position is not buffered,\n check if current pos+100ms is buffered and use that buffer range\n for FRAG_CHANGED event reporting */\n rangeCurrent = this.getBufferRange(currentTime + 0.1);\n }\n if (rangeCurrent) {\n var fragPlaying = rangeCurrent.frag;\n if (fragPlaying !== this.fragPlaying) {\n this.fragPlaying = fragPlaying;\n this.hls.trigger(Event.FRAG_CHANGED, {frag: fragPlaying});\n }\n }\n }\n }\n\n /*\n on immediate level switch :\n - pause playback if playing\n - cancel any pending load request\n - and trigger a buffer flush\n */\n immediateLevelSwitch() {\n logger.log('immediateLevelSwitch');\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n this.previouslyPaused = this.media.paused;\n this.media.pause();\n }\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n this.state = State.PAUSED;\n // flush everything\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: 0, endOffset: Number.POSITIVE_INFINITY});\n }\n\n /*\n on immediate level switch end, after new fragment has been buffered :\n - nudge video decoder by slightly adjusting video currentTime\n - resume the playback if needed\n */\n immediateLevelSwitchEnd() {\n this.immediateSwitch = false;\n let media = this.media;\n if (media && media.readyState) {\n media.currentTime -= 0.0001;\n if (!this.previouslyPaused) {\n media.play();\n }\n }\n }\n\n nextLevelSwitch() {\n /* try to switch ASAP without breaking video playback :\n in order to ensure smooth but quick level switching,\n we need to find the next flushable buffer range\n we should take into account new segment fetch time\n */\n let media = this.media;\n // ensure that media is defined and that metadata are available (to retrieve currentTime)\n if (media && media.readyState) {\n let fetchdelay, currentRange, nextRange;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n currentRange = this.getBufferRange(media.currentTime);\n if (currentRange && currentRange.start > 1) {\n // flush buffer preceding current fragment (flush until current fragment start offset)\n // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ...\n this.state = State.PAUSED;\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: 0, endOffset: currentRange.start - 1});\n }\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,nextLevel = this.levels[nextLevelId], fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n }\n //logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n nextRange = this.getBufferRange(media.currentTime + fetchdelay);\n if (nextRange) {\n // we can flush buffer range following this one without stalling playback\n nextRange = this.followingBufferRange(nextRange);\n if (nextRange) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // flush position is the start position of this new buffer\n this.state = State.PAUSED;\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: nextRange.start, endOffset: Number.POSITIVE_INFINITY});\n }\n }\n }\n }\n\n onMediaAttached(data) {\n var media = this.media = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n if(this.levels && this.config.autoStartLoad) {\n this.hls.startLoad();\n }\n }\n\n onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger.log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var levels = this.levels;\n if (levels) {\n // reset fragment load counter\n levels.forEach(level => {\n if(level.details) {\n level.details.fragments.forEach(fragment => {\n fragment.loadCounter = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = null;\n this.loadedmetadata = false;\n this.stopLoad();\n }\n\n onMediaSeeking() {\n if (this.state === State.FRAG_LOADING) {\n // check if currently loaded fragment is inside buffer.\n //if outside, cancel fragment loading, otherwise do nothing\n if (BufferHelper.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len === 0) {\n logger.log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n var fragCurrent = this.fragCurrent;\n if (fragCurrent) {\n if (fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n }\n } else if (this.state === State.ENDED) {\n // switch to IDLE state to check for potential new fragment\n this.state = State.IDLE;\n }\n if (this.media) {\n this.lastCurrentTime = this.media.currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // tick to speed up processing\n this.tick();\n }\n\n onMediaSeeked() {\n // tick to speed up FRAGMENT_PLAYING triggering\n this.tick();\n }\n\n onMediaEnded() {\n logger.log('media ended');\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n\n onManifestLoading() {\n // reset buffer on manifest loading\n logger.log('trigger BUFFER_RESET');\n this.hls.trigger(Event.BUFFER_RESET);\n this.bufferRange = [];\n this.stalled = false;\n }\n\n onManifestParsed(data) {\n var aac = false, heaac = false, codec;\n data.levels.forEach(level => {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = (aac && heaac);\n if (this.audioCodecSwitch) {\n logger.log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n this.levels = data.levels;\n this.startLevelLoaded = false;\n this.startFragRequested = false;\n if (this.config.autoStartLoad) {\n this.hls.startLoad();\n }\n }\n\n onLevelLoaded(data) {\n var newDetails = data.details,\n newLevelId = data.level,\n curLevel = this.levels[newLevelId],\n duration = newDetails.totalduration,\n sliding = 0;\n\n logger.log(`level ${newLevelId} loaded [${newDetails.startSN},${newDetails.endSN}],duration:${duration}`);\n this.levelLastLoaded = newLevelId;\n\n if (newDetails.live) {\n var curDetails = curLevel.details;\n if (curDetails) {\n // we already have details for that level, merge them\n LevelHelper.mergeDetails(curDetails,newDetails);\n sliding = newDetails.fragments[0].start;\n if (newDetails.PTSKnown) {\n logger.log(`live playlist sliding:${sliding.toFixed(3)}`);\n } else {\n logger.log('live playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger.log('live playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n // override level info\n curLevel.details = newDetails;\n this.hls.trigger(Event.LEVEL_UPDATED, { details: newDetails, level: newLevelId });\n\n // compute start position\n if (this.startFragRequested === false) {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n let targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration;\n this.startPosition = Math.max(0, sliding + duration - targetLatency);\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n }\n //trigger handler right now\n this.tick();\n }\n\n onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n }\n\n onFragLoaded(data) {\n var fragCurrent = this.fragCurrent;\n if (this.state === State.FRAG_LOADING &&\n fragCurrent &&\n data.frag.level === fragCurrent.level &&\n data.frag.sn === fragCurrent.sn) {\n\n logger.log(`Loaded ${fragCurrent.sn} of level ${fragCurrent.level}`);\n if (this.fragBitrateTest === true) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.fragBitrateTest = false;\n this.startFragRequested = false;\n data.stats.tparsed = data.stats.tbuffered = performance.now();\n this.hls.trigger(Event.FRAG_BUFFERED, {stats: data.stats, frag: fragCurrent});\n } else {\n this.state = State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n this.stats = data.stats;\n var currentLevel = this.levels[this.level],\n details = currentLevel.details,\n duration = details.totalduration,\n start = fragCurrent.start,\n level = fragCurrent.level,\n sn = fragCurrent.sn,\n audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec;\n if(this.audioCodecSwap) {\n logger.log('swapping playlist audio codec');\n if(audioCodec === undefined) {\n audioCodec = this.lastAudioCodec;\n }\n if(audioCodec) {\n if(audioCodec.indexOf('mp4a.40.5') !==-1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n }\n this.pendingAppending = 0;\n logger.log(`Demuxing ${sn} of [${details.startSN} ,${details.endSN}],level ${level}`);\n let demuxer = this.demuxer;\n if (demuxer) {\n demuxer.push(data.payload, audioCodec, currentLevel.videoCodec, start, fragCurrent.cc, level, sn, duration, fragCurrent.decryptdata);\n }\n }\n }\n this.fragLoadError = 0;\n }\n\n onFragParsingInitSegment(data) {\n if (this.state === State.PARSING) {\n var tracks = data.tracks, trackName, track;\n\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if(track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n if(audioCodec && this.audioCodecSwap) {\n logger.log('swapping playlist audio codec');\n if(audioCodec.indexOf('mp4a.40.5') !==-1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if(track.metadata.channelCount !== 1 &&\n // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if(ua.indexOf('android') !== -1) {\n audioCodec = 'mp4a.40.2';\n logger.log(`Android: force audio codec to` + audioCodec);\n }\n track.levelCodec = audioCodec;\n }\n track = tracks.video;\n if(track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n }\n\n // if remuxer specify that a unique track needs to generated,\n // let's merge all tracks together\n if (data.unique) {\n var mergedTrack = {\n codec : '',\n levelCodec : ''\n };\n for (trackName in data.tracks) {\n track = tracks[trackName];\n mergedTrack.container = track.container;\n if (mergedTrack.codec) {\n mergedTrack.codec += ',';\n mergedTrack.levelCodec += ',';\n }\n if(track.codec) {\n mergedTrack.codec += track.codec;\n }\n if (track.levelCodec) {\n mergedTrack.levelCodec += track.levelCodec;\n }\n }\n tracks = { audiovideo : mergedTrack };\n }\n this.hls.trigger(Event.BUFFER_CODECS,tracks);\n // loop through tracks that are going to be provided to bufferController\n for (trackName in tracks) {\n track = tracks[trackName];\n logger.log(`track:${trackName},container:${track.container},codecs[level/parsed]=[${track.levelCodec}/${track.codec}]`);\n var initSegment = track.initSegment;\n if (initSegment) {\n this.pendingAppending++;\n this.hls.trigger(Event.BUFFER_APPENDING, {type: trackName, data: initSegment});\n }\n }\n //trigger handler right now\n this.tick();\n }\n }\n\n onFragParsingData(data) {\n if (this.state === State.PARSING) {\n this.tparse2 = Date.now();\n var level = this.levels[this.level],\n frag = this.fragCurrent;\n\n logger.log(`parsed ${data.type},PTS:[${data.startPTS.toFixed(3)},${data.endPTS.toFixed(3)}],DTS:[${data.startDTS.toFixed(3)}/${data.endDTS.toFixed(3)}],nb:${data.nb}`);\n\n var drift = LevelHelper.updateFragPTS(level.details,frag.sn,data.startPTS,data.endPTS),\n hls = this.hls;\n hls.trigger(Event.LEVEL_PTS_UPDATED, {details: level.details, level: this.level, drift: drift});\n\n [data.data1, data.data2].forEach(buffer => {\n if (buffer) {\n this.pendingAppending++;\n hls.trigger(Event.BUFFER_APPENDING, {type: data.type, data: buffer});\n }\n });\n\n this.nextLoadPosition = data.endPTS;\n this.bufferRange.push({type: data.type, start: data.startPTS, end: data.endPTS, frag: frag});\n\n //trigger handler right now\n this.tick();\n } else {\n logger.warn(`not in PARSING state but ${this.state}, ignoring FRAG_PARSING_DATA event`);\n }\n }\n\n onFragParsed() {\n if (this.state === State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = State.PARSED;\n this._checkAppendedParsed();\n }\n }\n\n onBufferAppended() {\n switch (this.state) {\n case State.PARSING:\n case State.PARSED:\n this.pendingAppending--;\n this._checkAppendedParsed();\n break;\n default:\n break;\n }\n }\n\n _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === State.PARSED && this.pendingAppending === 0) {\n var frag = this.fragCurrent, stats = this.stats;\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = performance.now();\n this.fragLastKbps = Math.round(8 * stats.length / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(Event.FRAG_BUFFERED, {stats: stats, frag: frag});\n logger.log(`media buffered : ${this.timeRangesToString(this.media.buffered)}`);\n this.state = State.IDLE;\n }\n this.tick();\n }\n }\n\n onError(data) {\n switch(data.details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n if(!data.fatal) {\n var loadError = this.fragLoadError;\n if(loadError) {\n loadError++;\n } else {\n loadError=1;\n }\n if (loadError <= this.config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError;\n // reset load counter to avoid frag loop loading error\n data.frag.loadCounter = 0;\n // exponential backoff capped to 64s\n var delay = Math.min(Math.pow(2,loadError-1)*this.config.fragLoadingRetryDelay,64000);\n logger.warn(`mediaController: frag loading failed, retry in ${delay} ms`);\n this.retryDate = performance.now() + delay;\n // retry loading state\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger.error(`mediaController: ${data.details} reaches max retry, redispatch as fatal ...`);\n // redispatch same error but with fatal set to true\n data.fatal = true;\n this.hls.trigger(Event.ERROR, data);\n this.state = State.ERROR;\n }\n }\n break;\n case ErrorDetails.FRAG_LOOP_LOADING_ERROR:\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if(this.state !== State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? State.ERROR : State.IDLE;\n logger.warn(`mediaController: ${data.details} while loading frag,switch to ${this.state} state ...`);\n }\n break;\n case ErrorDetails.BUFFER_FULL_ERROR:\n // trigger a smooth level switch to empty buffers\n // also reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n this.config.maxMaxBufferLength/=2;\n logger.warn(`reduce max buffer length to ${this.config.maxMaxBufferLength}s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError`);\n this.nextLevelSwitch();\n break;\n default:\n break;\n }\n }\n\n_checkBuffer() {\n var media = this.media;\n if(media) {\n // compare readyState\n var readyState = media.readyState;\n // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek\n if(readyState) {\n var targetSeekPosition, currentTime;\n // if seek after buffered defined, let's seek if within acceptable range\n var seekAfterBuffered = this.seekAfterBuffered;\n if(seekAfterBuffered) {\n if(media.duration >= seekAfterBuffered) {\n targetSeekPosition = seekAfterBuffered;\n this.seekAfterBuffered = undefined;\n }\n } else {\n currentTime = media.currentTime;\n var loadedmetadata = this.loadedmetadata;\n\n // adjust currentTime to start position on loaded metadata\n if(!loadedmetadata && media.buffered.length) {\n this.loadedmetadata = true;\n // only adjust currentTime if not equal to 0\n if (!currentTime && currentTime !== this.startPosition) {\n targetSeekPosition = this.startPosition;\n }\n }\n }\n if (targetSeekPosition) {\n currentTime = targetSeekPosition;\n logger.log(`target seek position:${targetSeekPosition}`);\n }\n var bufferInfo = BufferHelper.bufferInfo(media,currentTime,0),\n expectedPlaying = !(media.paused || media.ended || media.seeking || readyState < 2),\n jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end\n playheadMoving = currentTime > media.playbackRate*this.lastCurrentTime;\n\n if (this.stalled && playheadMoving) {\n this.stalled = false;\n logger.log(`playback not stuck anymore @${currentTime}`);\n }\n // check buffer upfront\n // if less than jumpThreshold second is buffered, and media is expected to play but playhead is not moving,\n // and we have a new buffer range available upfront, let's seek to that one\n if(expectedPlaying && bufferInfo.len <= jumpThreshold) {\n if(playheadMoving) {\n // playhead moving\n jumpThreshold = 0;\n this.seekHoleNudgeDuration = 0;\n } else {\n // playhead not moving AND media expected to play\n if(!this.stalled) {\n this.seekHoleNudgeDuration = 0;\n logger.log(`playback seems stuck @${currentTime}`);\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_STALLED_ERROR, fatal: false});\n this.stalled = true;\n } else {\n this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration;\n }\n }\n // if we are below threshold, try to jump if next buffer range is close\n if(bufferInfo.len <= jumpThreshold) {\n // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range)\n var nextBufferStart = bufferInfo.nextStart, delta = nextBufferStart-currentTime;\n if(nextBufferStart &&\n (delta < this.config.maxSeekHole) &&\n (delta > 0) &&\n !media.seeking) {\n // next buffer is close ! adjust currentTime to nextBufferStart\n // this will ensure effective video decoding\n logger.log(`adjust currentTime from ${media.currentTime} to next buffered @ ${nextBufferStart} + nudge ${this.seekHoleNudgeDuration}`);\n let hole = nextBufferStart + this.seekHoleNudgeDuration - media.currentTime;\n media.currentTime = nextBufferStart + this.seekHoleNudgeDuration;\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false, hole : hole});\n }\n }\n } else {\n let currentTime = media.currentTime;\n if (targetSeekPosition && currentTime !== targetSeekPosition) {\n if(bufferInfo.len === 0) {\n let nextStart = bufferInfo.nextStart;\n if (nextStart !== undefined &&\n (nextStart - targetSeekPosition) < this.config.maxSeekHole) {\n targetSeekPosition = nextStart;\n logger.log(`target seek position not buffered, seek to next buffered ${targetSeekPosition}`);\n }\n }\n logger.log(`adjust currentTime from ${currentTime} to ${targetSeekPosition}`);\n media.currentTime = targetSeekPosition;\n }\n }\n }\n }\n }\n\n onFragLoadEmergencyAborted() {\n this.state = State.IDLE;\n this.tick();\n }\n\n onBufferFlushed() {\n /* after successful buffer flushing, rebuild buffer Range array\n loop through existing buffer range and check if\n corresponding range is still buffered. only push to new array already buffered range\n */\n var newRange = [],range,i;\n for (i = 0; i < this.bufferRange.length; i++) {\n range = this.bufferRange[i];\n if (this.isBuffered((range.start + range.end) / 2)) {\n newRange.push(range);\n }\n }\n this.bufferRange = newRange;\n\n // handle end of immediate switching if needed\n if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n }\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n }\n\n swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n }\n\n timeRangesToString(r) {\n var log = '', len = r.length;\n for (var i=0; i 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n }\n\n doTick() {\n var pos, level, levelDetails, hls = this.hls, config = hls.config;\n //logger.log(this.state);\n switch(this.state) {\n case State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n case State.PAUSED:\n //don't do anything in paused state either ...\n break;\n case State.STARTING:\n // determine load level\n let startLevel = hls.startLevel;\n if (startLevel === -1) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n startLevel = 0;\n this.fragBitrateTest = true;\n }\n // set new level to playlist loader : this will trigger start level load\n // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded\n this.level = hls.nextLoadLevel = startLevel;\n this.state = State.WAITING_LEVEL;\n this.loadedmetadata = false;\n break;\n case State.IDLE:\n // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n if (!this.media &&\n (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n }\n // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // ensure 60s of buffer upfront\n // if we have not yet loaded any fragment, start loading from start position\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n }\n level = hls.nextLoadLevel;\n var bufferInfo = BufferHelper.bufferInfo(this.media,pos,config.maxBufferHole),\n bufferLen = bufferInfo.len,\n bufferEnd = bufferInfo.end,\n fragPrevious = this.fragPrevious,\n maxBufLen;\n // compute max Buffer Length that we could get from this load level, based on level bitrate. don't buffer more than 60 MB and more than 30s\n if ((this.levels[level]).hasOwnProperty('bitrate')) {\n maxBufLen = Math.max(8 * config.maxBufferSize / this.levels[level].bitrate, config.maxBufferLength);\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n // if buffer length is less than maxBufLen try to load a new fragment\n if (bufferLen < maxBufLen) {\n // set next load level : this will trigger a playlist load if needed\n hls.nextLoadLevel = level;\n this.level = level;\n levelDetails = this.levels[level].details;\n // if level info not retrieved yet, switch state and wait for level retrieval\n // if live playlist, ensure that new playlist has been refreshed to avoid loading/try to load\n // a useless and outdated fragment (that might even introduce load error if it is already out of the live playlist)\n if (typeof levelDetails === 'undefined' || levelDetails.live && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n break;\n }\n // find fragment index, contiguous with end of buffer position\n let fragments = levelDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen-1].start + fragments[fragLen-1].duration,\n frag;\n\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n // check if requested position is within seekable boundaries :\n //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n let maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount*levelDetails.targetduration;\n\n if (bufferEnd < Math.max(start, end - maxLatency)) {\n let targetLatency = config.liveSyncDuration !== undefined ? config.liveSyncDuration : config.liveSyncDurationCount * levelDetails.targetduration;\n this.seekAfterBuffered = start + Math.max(0, levelDetails.totalduration - targetLatency);\n logger.log(`buffer end: ${bufferEnd} is located too far from the end of live sliding playlist, media position will be reseted to: ${this.seekAfterBuffered.toFixed(3)}`);\n bufferEnd = this.seekAfterBuffered;\n }\n\n // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n if (levelDetails.PTSKnown && bufferEnd > end) {\n break;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n frag = fragments[targetSN - levelDetails.startSN];\n logger.log(`live playlist, switching playlist, load frag with next SN: ${frag.sn}`);\n }\n }\n if (!frag) {\n /* we have no idea about which fragment should be loaded.\n so let's load mid fragment. it will help computing playlist sliding and find the right one\n */\n frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))];\n logger.log(`live playlist, switching playlist, unknown, load middle frag : ${frag.sn}`);\n }\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n if (!frag) {\n let foundFrag;\n let maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n foundFrag = BinarySearch.search(fragments, (candidate) => {\n // offset should be within fragment boundary - config.maxFragLookUpTolerance\n // this is to cope with situations like\n // bufferEnd = 9.991\n // frag[Ø] : [0,10]\n // frag[1] : [10,20]\n // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here\n // frag start frag start+duration\n // |-----------------------------|\n // <---> <--->\n // ...--------><-----------------------------><---------....\n // previous frag matching fragment next frag\n // return -1 return 0 return 1\n //logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);\n if ((candidate.start + candidate.duration - maxFragLookUpTolerance) <= bufferEnd) {\n return 1;\n }\n else if (candidate.start - maxFragLookUpTolerance > bufferEnd) {\n return -1;\n }\n return 0;\n });\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen-1];\n }\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start;\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < levelDetails.endSN) {\n frag = fragments[frag.sn + 1 - levelDetails.startSN];\n logger.log(`SN just loaded, load next one: ${frag.sn}`);\n } else {\n // have we reached end of VOD playlist ?\n if (!levelDetails.live) {\n // Finalize the media stream\n this.hls.trigger(Event.BUFFER_EOS);\n // We might be loading the last fragment but actually the media\n // is currently processing a seek command and waiting for new data to resume at another point.\n // Going to ended state while media is seeking can spawn an infinite buffering broken state.\n if (!this.media.seeking) {\n this.state = State.ENDED;\n }\n }\n frag = null;\n }\n }\n }\n }\n if(frag) {\n //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if ((frag.decryptdata.uri != null) && (frag.decryptdata.key == null)) {\n logger.log(`Loading key for ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}`);\n this.state = State.KEY_LOADING;\n hls.trigger(Event.KEY_LOADING, {frag: frag});\n } else {\n logger.log(`Loading ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}, currentTime:${pos},bufferEnd:${bufferEnd.toFixed(3)}`);\n frag.autoLevel = hls.autoLevelEnabled;\n if (this.levels.length > 1) {\n frag.expectedLen = Math.round(frag.duration * this.levels[level].bitrate / 8);\n frag.trequest = performance.now();\n }\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n let maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && (Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold)) {\n hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag});\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n this.fragCurrent = frag;\n this.startFragRequested = true;\n hls.trigger(Event.FRAG_LOADING, {frag: frag});\n this.state = State.FRAG_LOADING;\n }\n }\n }\n break;\n case State.WAITING_LEVEL:\n level = this.levels[this.level];\n // check if playlist is already loaded\n if (level && level.details) {\n this.state = State.IDLE;\n }\n break;\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = performance.now();\n var retryDate = this.retryDate;\n var media = this.media;\n var isSeeking = media && media.seeking;\n // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n if(!retryDate || (now >= retryDate) || isSeeking) {\n logger.log(`mediaController: retryDate reached, switch back to IDLE state`);\n this.state = State.IDLE;\n }\n break;\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n default:\n break;\n }\n // check buffer\n this._checkBuffer();\n // check/update current fragment\n this._checkFragmentChanged();\n }\n\n\n\n\n getBufferRange(position) {\n var i, range,\n bufferRange = this.bufferRange;\n if (bufferRange) {\n for (i = bufferRange.length - 1; i >=0; i--) {\n range = bufferRange[i];\n if (position >= range.start && position <= range.end) {\n return range;\n }\n }\n }\n return null;\n }\n\n get currentLevel() {\n if (this.media) {\n var range = this.getBufferRange(this.media.currentTime);\n if (range) {\n return range.frag.level;\n }\n }\n return -1;\n }\n\n get nextBufferRange() {\n if (this.media) {\n // first get end range of current fragment\n return this.followingBufferRange(this.getBufferRange(this.media.currentTime));\n } else {\n return null;\n }\n }\n\n followingBufferRange(range) {\n if (range) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferRange(range.end + 0.5);\n }\n return null;\n }\n\n get nextLevel() {\n var range = this.nextBufferRange;\n if (range) {\n return range.frag.level;\n } else {\n return -1;\n }\n }\n\n isBuffered(position) {\n let media = this.media;\n if (media) {\n let buffered = media.buffered;\n for (let i = 0; i < buffered.length; i++) {\n if (position >= buffered.start(i) && position <= buffered.end(i)) {\n return true;\n }\n }\n }\n return false;\n }\n\n _checkFragmentChanged() {\n var rangeCurrent, currentTime, video = this.media;\n if (video && video.seeking === false) {\n currentTime = video.currentTime;\n /* if video element is in seeked state, currentTime can only increase.\n (assuming that playback rate is positive ...)\n As sometimes currentTime jumps back to zero after a\n media decode error, check this, to avoid seeking back to\n wrong position after a media decode error\n */\n if(currentTime > video.playbackRate*this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n if (this.isBuffered(currentTime)) {\n rangeCurrent = this.getBufferRange(currentTime);\n } else if (this.isBuffered(currentTime + 0.1)) {\n /* ensure that FRAG_CHANGED event is triggered at startup,\n when first video frame is displayed and playback is paused.\n add a tolerance of 100ms, in case current position is not buffered,\n check if current pos+100ms is buffered and use that buffer range\n for FRAG_CHANGED event reporting */\n rangeCurrent = this.getBufferRange(currentTime + 0.1);\n }\n if (rangeCurrent) {\n var fragPlaying = rangeCurrent.frag;\n if (fragPlaying !== this.fragPlaying) {\n this.fragPlaying = fragPlaying;\n this.hls.trigger(Event.FRAG_CHANGED, {frag: fragPlaying});\n }\n }\n }\n }\n\n /*\n on immediate level switch :\n - pause playback if playing\n - cancel any pending load request\n - and trigger a buffer flush\n */\n immediateLevelSwitch() {\n logger.log('immediateLevelSwitch');\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n this.previouslyPaused = this.media.paused;\n this.media.pause();\n }\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n this.state = State.PAUSED;\n // flush everything\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: 0, endOffset: Number.POSITIVE_INFINITY});\n }\n\n /*\n on immediate level switch end, after new fragment has been buffered :\n - nudge video decoder by slightly adjusting video currentTime\n - resume the playback if needed\n */\n immediateLevelSwitchEnd() {\n this.immediateSwitch = false;\n let media = this.media;\n if (media && media.readyState) {\n media.currentTime -= 0.0001;\n if (!this.previouslyPaused) {\n media.play();\n }\n }\n }\n\n nextLevelSwitch() {\n /* try to switch ASAP without breaking video playback :\n in order to ensure smooth but quick level switching,\n we need to find the next flushable buffer range\n we should take into account new segment fetch time\n */\n let media = this.media;\n // ensure that media is defined and that metadata are available (to retrieve currentTime)\n if (media && media.readyState) {\n let fetchdelay, currentRange, nextRange;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n currentRange = this.getBufferRange(media.currentTime);\n if (currentRange && currentRange.start > 1) {\n // flush buffer preceding current fragment (flush until current fragment start offset)\n // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ...\n this.state = State.PAUSED;\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: 0, endOffset: currentRange.start - 1});\n }\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,nextLevel = this.levels[nextLevelId], fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n }\n //logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n nextRange = this.getBufferRange(media.currentTime + fetchdelay);\n if (nextRange) {\n // we can flush buffer range following this one without stalling playback\n nextRange = this.followingBufferRange(nextRange);\n if (nextRange) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // flush position is the start position of this new buffer\n this.state = State.PAUSED;\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: nextRange.start, endOffset: Number.POSITIVE_INFINITY});\n }\n }\n }\n }\n\n onMediaAttached(data) {\n var media = this.media = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n if(this.levels && this.config.autoStartLoad) {\n this.hls.startLoad();\n }\n }\n\n onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger.log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var levels = this.levels;\n if (levels) {\n // reset fragment load counter\n levels.forEach(level => {\n if(level.details) {\n level.details.fragments.forEach(fragment => {\n fragment.loadCounter = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = null;\n this.loadedmetadata = false;\n this.stopLoad();\n }\n\n onMediaSeeking() {\n if (this.state === State.FRAG_LOADING) {\n // check if currently loaded fragment is inside buffer.\n //if outside, cancel fragment loading, otherwise do nothing\n if (BufferHelper.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len === 0) {\n logger.log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n var fragCurrent = this.fragCurrent;\n if (fragCurrent) {\n if (fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n }\n } else if (this.state === State.ENDED) {\n // switch to IDLE state to check for potential new fragment\n this.state = State.IDLE;\n }\n if (this.media) {\n this.lastCurrentTime = this.media.currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // tick to speed up processing\n this.tick();\n }\n\n onMediaSeeked() {\n // tick to speed up FRAGMENT_PLAYING triggering\n this.tick();\n }\n\n onMediaEnded() {\n logger.log('media ended');\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n\n onManifestLoading() {\n // reset buffer on manifest loading\n logger.log('trigger BUFFER_RESET');\n this.hls.trigger(Event.BUFFER_RESET);\n this.bufferRange = [];\n this.stalled = false;\n }\n\n onManifestParsed(data) {\n var aac = false, heaac = false, codec;\n data.levels.forEach(level => {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = (aac && heaac);\n if (this.audioCodecSwitch) {\n logger.log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n this.levels = data.levels;\n this.startLevelLoaded = false;\n this.startFragRequested = false;\n if (this.config.autoStartLoad) {\n this.hls.startLoad();\n }\n }\n\n onLevelLoaded(data) {\n var newDetails = data.details,\n newLevelId = data.level,\n curLevel = this.levels[newLevelId],\n duration = newDetails.totalduration,\n sliding = 0;\n\n logger.log(`level ${newLevelId} loaded [${newDetails.startSN},${newDetails.endSN}],duration:${duration}`);\n this.levelLastLoaded = newLevelId;\n\n if (newDetails.live) {\n var curDetails = curLevel.details;\n if (curDetails) {\n // we already have details for that level, merge them\n LevelHelper.mergeDetails(curDetails,newDetails);\n sliding = newDetails.fragments[0].start;\n if (newDetails.PTSKnown) {\n logger.log(`live playlist sliding:${sliding.toFixed(3)}`);\n } else {\n logger.log('live playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger.log('live playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n // override level info\n curLevel.details = newDetails;\n this.hls.trigger(Event.LEVEL_UPDATED, { details: newDetails, level: newLevelId });\n\n // compute start position\n if (this.startFragRequested === false) {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n let targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration;\n this.startPosition = Math.max(0, sliding + duration - targetLatency);\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n }\n //trigger handler right now\n this.tick();\n }\n\n onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n }\n\n onFragLoaded(data) {\n var fragCurrent = this.fragCurrent;\n if (this.state === State.FRAG_LOADING &&\n fragCurrent &&\n data.frag.level === fragCurrent.level &&\n data.frag.sn === fragCurrent.sn) {\n\n logger.log(`Loaded ${fragCurrent.sn} of level ${fragCurrent.level}`);\n if (this.fragBitrateTest === true) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.fragBitrateTest = false;\n this.startFragRequested = false;\n data.stats.tparsed = data.stats.tbuffered = performance.now();\n this.hls.trigger(Event.FRAG_BUFFERED, {stats: data.stats, frag: fragCurrent});\n } else {\n this.state = State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n this.stats = data.stats;\n var currentLevel = this.levels[this.level],\n details = currentLevel.details,\n duration = details.totalduration,\n start = fragCurrent.startDTS !== undefined ? fragCurrent.startDTS : fragCurrent.start,\n level = fragCurrent.level,\n sn = fragCurrent.sn,\n audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec;\n if(this.audioCodecSwap) {\n logger.log('swapping playlist audio codec');\n if(audioCodec === undefined) {\n audioCodec = this.lastAudioCodec;\n }\n if(audioCodec) {\n if(audioCodec.indexOf('mp4a.40.5') !==-1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n }\n this.pendingAppending = 0;\n logger.log(`Demuxing ${sn} of [${details.startSN} ,${details.endSN}],level ${level}`);\n let demuxer = this.demuxer;\n if (demuxer) {\n demuxer.push(data.payload, audioCodec, currentLevel.videoCodec, start, fragCurrent.cc, level, sn, duration, fragCurrent.decryptdata);\n }\n }\n }\n this.fragLoadError = 0;\n }\n\n onFragParsingInitSegment(data) {\n if (this.state === State.PARSING) {\n var tracks = data.tracks, trackName, track;\n\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if(track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n if(audioCodec && this.audioCodecSwap) {\n logger.log('swapping playlist audio codec');\n if(audioCodec.indexOf('mp4a.40.5') !==-1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if(track.metadata.channelCount !== 1 &&\n // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if(ua.indexOf('android') !== -1) {\n audioCodec = 'mp4a.40.2';\n logger.log(`Android: force audio codec to` + audioCodec);\n }\n track.levelCodec = audioCodec;\n }\n track = tracks.video;\n if(track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n }\n\n // if remuxer specify that a unique track needs to generated,\n // let's merge all tracks together\n if (data.unique) {\n var mergedTrack = {\n codec : '',\n levelCodec : ''\n };\n for (trackName in data.tracks) {\n track = tracks[trackName];\n mergedTrack.container = track.container;\n if (mergedTrack.codec) {\n mergedTrack.codec += ',';\n mergedTrack.levelCodec += ',';\n }\n if(track.codec) {\n mergedTrack.codec += track.codec;\n }\n if (track.levelCodec) {\n mergedTrack.levelCodec += track.levelCodec;\n }\n }\n tracks = { audiovideo : mergedTrack };\n }\n this.hls.trigger(Event.BUFFER_CODECS,tracks);\n // loop through tracks that are going to be provided to bufferController\n for (trackName in tracks) {\n track = tracks[trackName];\n logger.log(`track:${trackName},container:${track.container},codecs[level/parsed]=[${track.levelCodec}/${track.codec}]`);\n var initSegment = track.initSegment;\n if (initSegment) {\n this.pendingAppending++;\n this.hls.trigger(Event.BUFFER_APPENDING, {type: trackName, data: initSegment});\n }\n }\n //trigger handler right now\n this.tick();\n }\n }\n\n onFragParsingData(data) {\n if (this.state === State.PARSING) {\n this.tparse2 = Date.now();\n var level = this.levels[this.level],\n frag = this.fragCurrent;\n\n logger.log(`parsed ${data.type},PTS:[${data.startPTS.toFixed(3)},${data.endPTS.toFixed(3)}],DTS:[${data.startDTS.toFixed(3)}/${data.endDTS.toFixed(3)}],nb:${data.nb}`);\n\n var drift = LevelHelper.updateFragPTSDTS(level.details,frag.sn,data.startPTS,data.endPTS,data.startDTS,data.endDTS),\n hls = this.hls;\n hls.trigger(Event.LEVEL_PTS_UPDATED, {details: level.details, level: this.level, drift: drift});\n\n [data.data1, data.data2].forEach(buffer => {\n if (buffer) {\n this.pendingAppending++;\n hls.trigger(Event.BUFFER_APPENDING, {type: data.type, data: buffer});\n }\n });\n\n this.nextLoadPosition = data.endPTS;\n this.bufferRange.push({type: data.type, start: data.startPTS, end: data.endPTS, frag: frag});\n\n //trigger handler right now\n this.tick();\n } else {\n logger.warn(`not in PARSING state but ${this.state}, ignoring FRAG_PARSING_DATA event`);\n }\n }\n\n onFragParsed() {\n if (this.state === State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = State.PARSED;\n this._checkAppendedParsed();\n }\n }\n\n onBufferAppended() {\n switch (this.state) {\n case State.PARSING:\n case State.PARSED:\n this.pendingAppending--;\n this._checkAppendedParsed();\n break;\n default:\n break;\n }\n }\n\n _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === State.PARSED && this.pendingAppending === 0) {\n var frag = this.fragCurrent, stats = this.stats;\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = performance.now();\n this.fragLastKbps = Math.round(8 * stats.length / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(Event.FRAG_BUFFERED, {stats: stats, frag: frag});\n logger.log(`media buffered : ${this.timeRangesToString(this.media.buffered)}`);\n this.state = State.IDLE;\n }\n this.tick();\n }\n }\n\n onError(data) {\n switch(data.details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n if(!data.fatal) {\n var loadError = this.fragLoadError;\n if(loadError) {\n loadError++;\n } else {\n loadError=1;\n }\n if (loadError <= this.config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError;\n // reset load counter to avoid frag loop loading error\n data.frag.loadCounter = 0;\n // exponential backoff capped to 64s\n var delay = Math.min(Math.pow(2,loadError-1)*this.config.fragLoadingRetryDelay,64000);\n logger.warn(`mediaController: frag loading failed, retry in ${delay} ms`);\n this.retryDate = performance.now() + delay;\n // retry loading state\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger.error(`mediaController: ${data.details} reaches max retry, redispatch as fatal ...`);\n // redispatch same error but with fatal set to true\n data.fatal = true;\n this.hls.trigger(Event.ERROR, data);\n this.state = State.ERROR;\n }\n }\n break;\n case ErrorDetails.FRAG_LOOP_LOADING_ERROR:\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if(this.state !== State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? State.ERROR : State.IDLE;\n logger.warn(`mediaController: ${data.details} while loading frag,switch to ${this.state} state ...`);\n }\n break;\n case ErrorDetails.BUFFER_FULL_ERROR:\n // trigger a smooth level switch to empty buffers\n // also reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n this.config.maxMaxBufferLength/=2;\n logger.warn(`reduce max buffer length to ${this.config.maxMaxBufferLength}s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError`);\n this.nextLevelSwitch();\n break;\n default:\n break;\n }\n }\n\n_checkBuffer() {\n var media = this.media;\n if(media) {\n // compare readyState\n var readyState = media.readyState;\n // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek\n if(readyState) {\n var targetSeekPosition, currentTime;\n // if seek after buffered defined, let's seek if within acceptable range\n var seekAfterBuffered = this.seekAfterBuffered;\n if(seekAfterBuffered) {\n if(media.duration >= seekAfterBuffered) {\n targetSeekPosition = seekAfterBuffered;\n this.seekAfterBuffered = undefined;\n }\n } else {\n currentTime = media.currentTime;\n var loadedmetadata = this.loadedmetadata;\n\n // adjust currentTime to start position on loaded metadata\n if(!loadedmetadata && media.buffered.length) {\n this.loadedmetadata = true;\n // only adjust currentTime if not equal to 0\n if (!currentTime && currentTime !== this.startPosition) {\n targetSeekPosition = this.startPosition;\n }\n }\n }\n if (targetSeekPosition) {\n currentTime = targetSeekPosition;\n logger.log(`target seek position:${targetSeekPosition}`);\n }\n var bufferInfo = BufferHelper.bufferInfo(media,currentTime,0),\n expectedPlaying = !(media.paused || media.ended || media.seeking || media.buffered.length === 0),\n jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end\n playheadMoving = currentTime > media.playbackRate*this.lastCurrentTime;\n\n if (this.stalled && playheadMoving) {\n this.stalled = false;\n logger.log(`playback not stuck anymore @${currentTime}`);\n }\n // check buffer upfront\n // if less than jumpThreshold second is buffered, and media is expected to play but playhead is not moving,\n // and we have a new buffer range available upfront, let's seek to that one\n if(expectedPlaying && bufferInfo.len <= jumpThreshold) {\n if(playheadMoving) {\n // playhead moving\n jumpThreshold = 0;\n this.seekHoleNudgeDuration = 0;\n } else {\n // playhead not moving AND media expected to play\n if(!this.stalled) {\n this.seekHoleNudgeDuration = 0;\n logger.log(`playback seems stuck @${currentTime}`);\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_STALLED_ERROR, fatal: false});\n this.stalled = true;\n } else {\n this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration;\n }\n }\n // if we are below threshold, try to jump if next buffer range is close\n if(bufferInfo.len <= jumpThreshold) {\n // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range)\n var nextBufferStart = bufferInfo.nextStart, delta = nextBufferStart-currentTime;\n if(nextBufferStart &&\n (delta < this.config.maxSeekHole) &&\n (delta > 0) &&\n !media.seeking) {\n // next buffer is close ! adjust currentTime to nextBufferStart\n // this will ensure effective video decoding\n logger.log(`adjust currentTime from ${media.currentTime} to next buffered @ ${nextBufferStart} + nudge ${this.seekHoleNudgeDuration}`);\n let hole = nextBufferStart + this.seekHoleNudgeDuration - media.currentTime;\n media.currentTime = nextBufferStart + this.seekHoleNudgeDuration;\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false, hole : hole});\n }\n }\n } else {\n let currentTime = media.currentTime;\n if (targetSeekPosition && currentTime !== targetSeekPosition) {\n if(bufferInfo.len === 0) {\n let nextStart = bufferInfo.nextStart;\n if (nextStart !== undefined &&\n (nextStart - targetSeekPosition) < this.config.maxSeekHole) {\n targetSeekPosition = nextStart;\n logger.log(`target seek position not buffered, seek to next buffered ${targetSeekPosition}`);\n }\n }\n logger.log(`adjust currentTime from ${currentTime} to ${targetSeekPosition}`);\n media.currentTime = targetSeekPosition;\n }\n }\n }\n }\n }\n\n onFragLoadEmergencyAborted() {\n this.state = State.IDLE;\n this.tick();\n }\n\n onBufferFlushed() {\n /* after successful buffer flushing, rebuild buffer Range array\n loop through existing buffer range and check if\n corresponding range is still buffered. only push to new array already buffered range\n */\n var newRange = [],range,i;\n for (i = 0; i < this.bufferRange.length; i++) {\n range = this.bufferRange[i];\n if (this.isBuffered((range.start + range.end) / 2)) {\n newRange.push(range);\n }\n }\n this.bufferRange = newRange;\n\n // handle end of immediate switching if needed\n if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n }\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n }\n\n swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n }\n\n timeRangesToString(r) {\n var log = '', len = r.length;\n for (var i=0; i OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation\n * are those of the authors and should not be interpreted as representing\n * official policies, either expressed or implied, of the authors.\n */\nclass AES {\n\n /**\n * Schedule out an AES key for both encryption and decryption. This\n * is a low-level class. Use a cipher mode to do bulk encryption.\n *\n * @constructor\n * @param key {Array} The key as an array of 4, 6 or 8 words.\n */\n constructor(key) {\n /**\n * The expanded S-box and inverse S-box tables. These will be computed\n * on the client so that we don't have to send them down the wire.\n *\n * There are two tables, _tables[0] is for encryption and\n * _tables[1] is for decryption.\n *\n * The first 4 sub-tables are the expanded S-box with MixColumns. The\n * last (_tables[01][4]) is the S-box itself.\n *\n * @private\n */\n this._tables = [[[],[],[],[],[]],[[],[],[],[],[]]];\n\n this._precompute();\n\n var i, j, tmp,\n encKey, decKey,\n sbox = this._tables[0][4], decTable = this._tables[1],\n keyLen = key.length, rcon = 1;\n\n if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {\n throw new Error('Invalid aes key size=' + keyLen);\n }\n\n encKey = key.slice(0);\n decKey = [];\n this._key = [encKey, decKey];\n\n // schedule encryption keys\n for (i = keyLen; i < 4 * keyLen + 28; i++) {\n tmp = encKey[i-1];\n\n // apply sbox\n if (i%keyLen === 0 || (keyLen === 8 && i%keyLen === 4)) {\n tmp = sbox[tmp>>>24]<<24 ^ sbox[tmp>>16&255]<<16 ^ sbox[tmp>>8&255]<<8 ^ sbox[tmp&255];\n\n // shift rows and add rcon\n if (i%keyLen === 0) {\n tmp = tmp<<8 ^ tmp>>>24 ^ rcon<<24;\n rcon = rcon<<1 ^ (rcon>>7)*283;\n }\n }\n\n encKey[i] = encKey[i-keyLen] ^ tmp;\n }\n\n // schedule decryption keys\n for (j = 0; i; j++, i--) {\n tmp = encKey[j&3 ? i : i - 4];\n if (i<=4 || j<4) {\n decKey[j] = tmp;\n } else {\n decKey[j] = decTable[0][sbox[tmp>>>24 ]] ^\n decTable[1][sbox[tmp>>16 & 255]] ^\n decTable[2][sbox[tmp>>8 & 255]] ^\n decTable[3][sbox[tmp & 255]];\n }\n }\n }\n\n /**\n * Expand the S-box tables.\n *\n * @private\n */\n _precompute() {\n var encTable = this._tables[0], decTable = this._tables[1],\n sbox = encTable[4], sboxInv = decTable[4],\n i, x, xInv, d=[], th=[], x2, x4, x8, s, tEnc, tDec;\n\n // Compute double and third tables\n for (i = 0; i < 256; i++) {\n th[( d[i] = i<<1 ^ (i>>7)*283 )^i]=i;\n }\n\n for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n // Compute sbox\n s = xInv ^ xInv<<1 ^ xInv<<2 ^ xInv<<3 ^ xInv<<4;\n s = s>>8 ^ s&255 ^ 99;\n sbox[x] = s;\n sboxInv[s] = x;\n\n // Compute MixColumns\n x8 = d[x4 = d[x2 = d[x]]];\n tDec = x8*0x1010101 ^ x4*0x10001 ^ x2*0x101 ^ x*0x1010100;\n tEnc = d[s]*0x101 ^ s*0x1010100;\n\n for (i = 0; i < 4; i++) {\n encTable[i][x] = tEnc = tEnc<<24 ^ tEnc>>>8;\n decTable[i][s] = tDec = tDec<<24 ^ tDec>>>8;\n }\n }\n\n // Compactify. Considerable speedup on Firefox.\n for (i = 0; i < 5; i++) {\n encTable[i] = encTable[i].slice(0);\n decTable[i] = decTable[i].slice(0);\n }\n }\n\n /**\n * Decrypt 16 bytes, specified as four 32-bit words.\n * @param encrypted0 {number} the first word to decrypt\n * @param encrypted1 {number} the second word to decrypt\n * @param encrypted2 {number} the third word to decrypt\n * @param encrypted3 {number} the fourth word to decrypt\n * @param out {Int32Array} the array to write the decrypted words\n * into\n * @param offset {number} the offset into the output array to start\n * writing results\n * @return {Array} The plaintext.\n */\n decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {\n var key = this._key[1],\n // state variables a,b,c,d are loaded with pre-whitened data\n a = encrypted0 ^ key[0],\n b = encrypted3 ^ key[1],\n c = encrypted2 ^ key[2],\n d = encrypted1 ^ key[3],\n a2, b2, c2,\n\n nInnerRounds = key.length / 4 - 2, // key.length === 2 ?\n i,\n kIndex = 4,\n table = this._tables[1],\n\n // load up the tables\n table0 = table[0],\n table1 = table[1],\n table2 = table[2],\n table3 = table[3],\n sbox = table[4];\n\n // Inner rounds. Cribbed from OpenSSL.\n for (i = 0; i < nInnerRounds; i++) {\n a2 = table0[a>>>24] ^ table1[b>>16 & 255] ^ table2[c>>8 & 255] ^ table3[d & 255] ^ key[kIndex];\n b2 = table0[b>>>24] ^ table1[c>>16 & 255] ^ table2[d>>8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];\n c2 = table0[c>>>24] ^ table1[d>>16 & 255] ^ table2[a>>8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];\n d = table0[d>>>24] ^ table1[a>>16 & 255] ^ table2[b>>8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];\n kIndex += 4;\n a=a2; b=b2; c=c2;\n }\n\n // Last round.\n for (i = 0; i < 4; i++) {\n out[(3 & -i) + offset] =\n sbox[a>>>24 ]<<24 ^\n sbox[b>>16 & 255]<<16 ^\n sbox[c>>8 & 255]<<8 ^\n sbox[d & 255] ^\n key[kIndex++];\n a2=a; a=b; b=c; c=d; d=a2;\n }\n }\n}\n\nexport default AES;\n", "/*\n *\n * This file contains an adaptation of the AES decryption algorithm\n * from the Standford Javascript Cryptography Library. That work is\n * covered by the following copyright and permissions notice:\n *\n * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation\n * are those of the authors and should not be interpreted as representing\n * official policies, either expressed or implied, of the authors.\n */\n\nimport AES from './aes';\n\nclass AES128Decrypter {\n\n constructor(key, initVector) {\n this.key = key;\n this.iv = initVector;\n }\n\n /**\n * Convert network-order (big-endian) bytes into their little-endian\n * representation.\n */\n ntoh(word) {\n return (word << 24) |\n ((word & 0xff00) << 8) |\n ((word & 0xff0000) >> 8) |\n (word >>> 24);\n }\n\n\n /**\n * Decrypt bytes using AES-128 with CBC and PKCS#7 padding.\n * @param encrypted {Uint8Array} the encrypted bytes\n * @param key {Uint32Array} the bytes of the decryption key\n * @param initVector {Uint32Array} the initialization vector (IV) to\n * use for the first round of CBC.\n * @return {Uint8Array} the decrypted bytes\n *\n * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard\n * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29\n * @see https://tools.ietf.org/html/rfc2315\n */\n doDecrypt(encrypted, key, initVector) {\n var\n // word-level access to the encrypted bytes\n encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2),\n\n decipher = new AES(Array.prototype.slice.call(key)),\n\n // byte and word-level access for the decrypted output\n decrypted = new Uint8Array(encrypted.byteLength),\n decrypted32 = new Int32Array(decrypted.buffer),\n\n // temporary variables for working with the IV, encrypted, and\n // decrypted data\n init0, init1, init2, init3,\n encrypted0, encrypted1, encrypted2, encrypted3,\n\n // iteration variable\n wordIx;\n\n // pull out the words of the IV to ensure we don't modify the\n // passed-in reference and easier access\n init0 = ~~initVector[0];\n init1 = ~~initVector[1];\n init2 = ~~initVector[2];\n init3 = ~~initVector[3];\n\n // decrypt four word sequences, applying cipher-block chaining (CBC)\n // to each decrypted block\n for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {\n // convert big-endian (network order) words into little-endian\n // (javascript order)\n encrypted0 = ~~this.ntoh(encrypted32[wordIx]);\n encrypted1 = ~~this.ntoh(encrypted32[wordIx + 1]);\n encrypted2 = ~~this.ntoh(encrypted32[wordIx + 2]);\n encrypted3 = ~~this.ntoh(encrypted32[wordIx + 3]);\n\n // decrypt the block\n decipher.decrypt(encrypted0,\n encrypted1,\n encrypted2,\n encrypted3,\n decrypted32,\n wordIx);\n\n // XOR with the IV, and restore network byte-order to obtain the\n // plaintext\n decrypted32[wordIx] = this.ntoh(decrypted32[wordIx] ^ init0);\n decrypted32[wordIx + 1] = this.ntoh(decrypted32[wordIx + 1] ^ init1);\n decrypted32[wordIx + 2] = this.ntoh(decrypted32[wordIx + 2] ^ init2);\n decrypted32[wordIx + 3] = this.ntoh(decrypted32[wordIx + 3] ^ init3);\n\n // setup the IV for the next round\n init0 = encrypted0;\n init1 = encrypted1;\n init2 = encrypted2;\n init3 = encrypted3;\n }\n\n return decrypted;\n }\n\n localDecrypt(encrypted, key, initVector, decrypted) {\n var bytes = this.doDecrypt(encrypted,\n key,\n initVector);\n decrypted.set(bytes, encrypted.byteOffset);\n }\n\n decrypt(encrypted) {\n var\n step = 4 * 8000,\n //encrypted32 = new Int32Array(encrypted.buffer),\n encrypted32 = new Int32Array(encrypted),\n decrypted = new Uint8Array(encrypted.byteLength),\n i = 0;\n\n // split up the encryption job and do the individual chunks asynchronously\n var key = this.key;\n var initVector = this.iv;\n this.localDecrypt(encrypted32.subarray(i, i + step), key, initVector, decrypted);\n\n for (i = step; i < encrypted32.length; i += step) {\n initVector = new Uint32Array([\n this.ntoh(encrypted32[i - 4]),\n this.ntoh(encrypted32[i - 3]),\n this.ntoh(encrypted32[i - 2]),\n this.ntoh(encrypted32[i - 1])\n ]);\n this.localDecrypt(encrypted32.subarray(i, i + step), key, initVector, decrypted);\n }\n\n return decrypted;\n }\n}\n\nexport default AES128Decrypter;\n", @@ -68,12 +68,12 @@ "import Event from '../events';\nimport DemuxerInline from '../demux/demuxer-inline';\nimport DemuxerWorker from '../demux/demuxer-worker';\nimport {logger} from '../utils/logger';\nimport Decrypter from '../crypt/decrypter';\n\nclass Demuxer {\n\n constructor(hls) {\n this.hls = hls;\n var typeSupported = {\n mp4 : MediaSource.isTypeSupported('video/mp4'),\n mp2t : hls.config.enableMP2TPassThrough && MediaSource.isTypeSupported('video/mp2t')\n };\n if (hls.config.enableWorker && (typeof(Worker) !== 'undefined')) {\n logger.log('demuxing in webworker');\n try {\n var work = require('webworkify');\n this.w = work(DemuxerWorker);\n this.onwmsg = this.onWorkerMessage.bind(this);\n this.w.addEventListener('message', this.onwmsg);\n this.w.postMessage({cmd: 'init', typeSupported : typeSupported});\n } catch(err) {\n logger.error('error while initializing DemuxerWorker, fallback on DemuxerInline');\n this.demuxer = new DemuxerInline(hls,typeSupported);\n }\n } else {\n this.demuxer = new DemuxerInline(hls,typeSupported);\n }\n this.demuxInitialized = true;\n }\n\n destroy() {\n if (this.w) {\n this.w.removeEventListener('message', this.onwmsg);\n this.w.terminate();\n this.w = null;\n } else {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n if (this.decrypter) {\n this.decrypter.destroy();\n this.decrypter = null;\n }\n }\n\n pushDecrypted(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n if (this.w) {\n // post fragment payload as transferable objects (no copy)\n this.w.postMessage({cmd: 'demux', data: data, audioCodec: audioCodec, videoCodec: videoCodec, timeOffset: timeOffset, cc: cc, level: level, sn : sn, duration: duration}, [data]);\n } else {\n this.demuxer.push(new Uint8Array(data), audioCodec, videoCodec, timeOffset, cc, level, sn, duration);\n }\n }\n\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration, decryptdata) {\n if ((data.byteLength > 0) && (decryptdata != null) && (decryptdata.key != null) && (decryptdata.method === 'AES-128')) {\n if (this.decrypter == null) {\n this.decrypter = new Decrypter(this.hls);\n }\n\n var localthis = this;\n this.decrypter.decrypt(data, decryptdata.key, decryptdata.iv, function(decryptedData){\n localthis.pushDecrypted(decryptedData, audioCodec, videoCodec, timeOffset, cc, level, sn, duration);\n });\n } else {\n this.pushDecrypted(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration);\n }\n }\n\n onWorkerMessage(ev) {\n var data = ev.data;\n //console.log('onWorkerMessage:' + data.event);\n switch(data.event) {\n case Event.FRAG_PARSING_INIT_SEGMENT:\n var obj = {};\n obj.tracks = data.tracks;\n obj.unique = data.unique;\n this.hls.trigger(Event.FRAG_PARSING_INIT_SEGMENT, obj);\n break;\n case Event.FRAG_PARSING_DATA:\n this.hls.trigger(Event.FRAG_PARSING_DATA,{\n data1: new Uint8Array(data.data1),\n data2: new Uint8Array(data.data2),\n startPTS: data.startPTS,\n endPTS: data.endPTS,\n startDTS: data.startDTS,\n endDTS: data.endDTS,\n type: data.type,\n nb: data.nb\n });\n break;\n case Event.FRAG_PARSING_METADATA:\n this.hls.trigger(Event.FRAG_PARSING_METADATA, {\n samples: data.samples\n });\n break;\n case Event.FRAG_PARSING_USERDATA:\n this.hls.trigger(Event.FRAG_PARSING_USERDATA, {\n samples: data.samples\n });\n break;\n default:\n this.hls.trigger(data.event, data.data);\n break;\n }\n }\n}\n\nexport default Demuxer;\n\n", "/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\n\nimport {logger} from '../utils/logger';\n\nclass ExpGolomb {\n\n constructor(data) {\n this.data = data;\n // the number of bytes left to examine in this.data\n this.bytesAvailable = this.data.byteLength;\n // the current word being examined\n this.word = 0; // :uint\n // the number of bits left to examine in the current word\n this.bitsAvailable = 0; // :uint\n }\n\n // ():void\n loadWord() {\n var\n position = this.data.byteLength - this.bytesAvailable,\n workingBytes = new Uint8Array(4),\n availableBytes = Math.min(4, this.bytesAvailable);\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n workingBytes.set(this.data.subarray(position, position + availableBytes));\n this.word = new DataView(workingBytes.buffer).getUint32(0);\n // track the amount of this.data that has been processed\n this.bitsAvailable = availableBytes * 8;\n this.bytesAvailable -= availableBytes;\n }\n\n // (count:int):void\n skipBits(count) {\n var skipBytes; // :int\n if (this.bitsAvailable > count) {\n this.word <<= count;\n this.bitsAvailable -= count;\n } else {\n count -= this.bitsAvailable;\n skipBytes = count >> 3;\n count -= (skipBytes >> 3);\n this.bytesAvailable -= skipBytes;\n this.loadWord();\n this.word <<= count;\n this.bitsAvailable -= count;\n }\n }\n\n // (size:int):uint\n readBits(size) {\n var\n bits = Math.min(this.bitsAvailable, size), // :uint\n valu = this.word >>> (32 - bits); // :uint\n if (size > 32) {\n logger.error('Cannot read more than 32 bits at a time');\n }\n this.bitsAvailable -= bits;\n if (this.bitsAvailable > 0) {\n this.word <<= bits;\n } else if (this.bytesAvailable > 0) {\n this.loadWord();\n }\n bits = size - bits;\n if (bits > 0) {\n return valu << bits | this.readBits(bits);\n } else {\n return valu;\n }\n }\n\n // ():uint\n skipLZ() {\n var leadingZeroCount; // :uint\n for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) {\n if (0 !== (this.word & (0x80000000 >>> leadingZeroCount))) {\n // the first bit of working word is 1\n this.word <<= leadingZeroCount;\n this.bitsAvailable -= leadingZeroCount;\n return leadingZeroCount;\n }\n }\n // we exhausted word and still have not found a 1\n this.loadWord();\n return leadingZeroCount + this.skipLZ();\n }\n\n // ():void\n skipUEG() {\n this.skipBits(1 + this.skipLZ());\n }\n\n // ():void\n skipEG() {\n this.skipBits(1 + this.skipLZ());\n }\n\n // ():uint\n readUEG() {\n var clz = this.skipLZ(); // :uint\n return this.readBits(clz + 1) - 1;\n }\n\n // ():int\n readEG() {\n var valu = this.readUEG(); // :int\n if (0x01 & valu) {\n // the number is odd if the low order bit is set\n return (1 + valu) >>> 1; // add 1 to make it even, and divide by 2\n } else {\n return -1 * (valu >>> 1); // divide by two then make it negative\n }\n }\n\n // Some convenience functions\n // :Boolean\n readBoolean() {\n return 1 === this.readBits(1);\n }\n\n // ():int\n readUByte() {\n return this.readBits(8);\n }\n\n // ():int\n readUShort() {\n return this.readBits(16);\n }\n // ():int\n readUInt() {\n return this.readBits(32);\n }\n\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n skipScalingList(count) {\n var\n lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n lastScale = (nextScale === 0) ? lastScale : nextScale;\n }\n }\n\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n readSPS() {\n var\n frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n sarScale = 1,\n profileIdc,profileCompat,levelIdc,\n numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n i;\n this.readUByte();\n profileIdc = this.readUByte(); // profile_idc\n profileCompat = this.readBits(5); // constraint_set[0-4]_flag, u(5)\n this.skipBits(3); // reserved_zero_3bits u(3),\n levelIdc = this.readUByte(); //level_idc u(8)\n this.skipUEG(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n if (profileIdc === 100 ||\n profileIdc === 110 ||\n profileIdc === 122 ||\n profileIdc === 244 ||\n profileIdc === 44 ||\n profileIdc === 83 ||\n profileIdc === 86 ||\n profileIdc === 118 ||\n profileIdc === 128) {\n var chromaFormatIdc = this.readUEG();\n if (chromaFormatIdc === 3) {\n this.skipBits(1); // separate_colour_plane_flag\n }\n this.skipUEG(); // bit_depth_luma_minus8\n this.skipUEG(); // bit_depth_chroma_minus8\n this.skipBits(1); // qpprime_y_zero_transform_bypass_flag\n if (this.readBoolean()) { // seq_scaling_matrix_present_flag\n scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12;\n for (i = 0; i < scalingListCount; i++) {\n if (this.readBoolean()) { // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n this.skipScalingList(16);\n } else {\n this.skipScalingList(64);\n }\n }\n }\n }\n }\n this.skipUEG(); // log2_max_frame_num_minus4\n var picOrderCntType = this.readUEG();\n if (picOrderCntType === 0) {\n this.readUEG(); //log2_max_pic_order_cnt_lsb_minus4\n } else if (picOrderCntType === 1) {\n this.skipBits(1); // delta_pic_order_always_zero_flag\n this.skipEG(); // offset_for_non_ref_pic\n this.skipEG(); // offset_for_top_to_bottom_field\n numRefFramesInPicOrderCntCycle = this.readUEG();\n for(i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n this.skipEG(); // offset_for_ref_frame[ i ]\n }\n }\n this.skipUEG(); // max_num_ref_frames\n this.skipBits(1); // gaps_in_frame_num_value_allowed_flag\n picWidthInMbsMinus1 = this.readUEG();\n picHeightInMapUnitsMinus1 = this.readUEG();\n frameMbsOnlyFlag = this.readBits(1);\n if (frameMbsOnlyFlag === 0) {\n this.skipBits(1); // mb_adaptive_frame_field_flag\n }\n this.skipBits(1); // direct_8x8_inference_flag\n if (this.readBoolean()) { // frame_cropping_flag\n frameCropLeftOffset = this.readUEG();\n frameCropRightOffset = this.readUEG();\n frameCropTopOffset = this.readUEG();\n frameCropBottomOffset = this.readUEG();\n }\n if (this.readBoolean()) {\n // vui_parameters_present_flag\n if (this.readBoolean()) {\n // aspect_ratio_info_present_flag\n let sarRatio;\n const aspectRatioIdc = this.readUByte();\n switch (aspectRatioIdc) {\n case 1: sarRatio = [1,1]; break;\n case 2: sarRatio = [12,11]; break;\n case 3: sarRatio = [10,11]; break;\n case 4: sarRatio = [16,11]; break;\n case 5: sarRatio = [40,33]; break;\n case 6: sarRatio = [24,11]; break;\n case 7: sarRatio = [20,11]; break;\n case 8: sarRatio = [32,11]; break;\n case 9: sarRatio = [80,33]; break;\n case 10: sarRatio = [18,11]; break;\n case 11: sarRatio = [15,11]; break;\n case 12: sarRatio = [64,33]; break;\n case 13: sarRatio = [160,99]; break;\n case 14: sarRatio = [4,3]; break;\n case 15: sarRatio = [3,2]; break;\n case 16: sarRatio = [2,1]; break;\n case 255: {\n sarRatio = [this.readUByte() << 8 | this.readUByte(), this.readUByte() << 8 | this.readUByte()];\n break;\n }\n }\n if (sarRatio) {\n sarScale = sarRatio[0] / sarRatio[1];\n }\n }\n }\n return {\n width: Math.ceil((((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale),\n height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - ((frameMbsOnlyFlag? 2 : 4) * (frameCropTopOffset + frameCropBottomOffset))\n };\n }\n\n readSliceType() {\n // skip NALu type\n this.readUByte();\n // discard first_mb_in_slice\n this.readUEG();\n // return slice_type\n return this.readUEG();\n }\n}\n\nexport default ExpGolomb;\n", "/**\n * ID3 parser\n */\nimport {logger} from '../utils/logger';\n//import Hex from '../utils/hex';\n\n class ID3 {\n\n constructor(data) {\n this._hasTimeStamp = false;\n var offset = 0, byte1,byte2,byte3,byte4,tagSize,endPos,header,len;\n do {\n header = this.readUTF(data,offset,3);\n offset+=3;\n // first check for ID3 header\n if (header === 'ID3') {\n // skip 24 bits\n offset += 3;\n // retrieve tag(s) length\n byte1 = data[offset++] & 0x7f;\n byte2 = data[offset++] & 0x7f;\n byte3 = data[offset++] & 0x7f;\n byte4 = data[offset++] & 0x7f;\n tagSize = (byte1 << 21) + (byte2 << 14) + (byte3 << 7) + byte4;\n endPos = offset + tagSize;\n //logger.log(`ID3 tag found, size/end: ${tagSize}/${endPos}`);\n\n // read ID3 tags\n this._parseID3Frames(data, offset,endPos);\n offset = endPos;\n } else if (header === '3DI') {\n // http://id3.org/id3v2.4.0-structure chapter 3.4. ID3v2 footer\n offset += 7;\n logger.log(`3DI footer found, end: ${offset}`);\n } else {\n offset -= 3;\n len = offset;\n if (len) {\n //logger.log(`ID3 len: ${len}`);\n if (!this.hasTimeStamp) {\n logger.warn('ID3 tag found, but no timestamp');\n }\n this._length = len;\n this._payload = data.subarray(0,len);\n }\n return;\n }\n } while (true);\n }\n\n readUTF(data,start,len) {\n\n var result = '',offset = start, end = start + len;\n do {\n result += String.fromCharCode(data[offset++]);\n } while(offset < end);\n return result;\n }\n\n _parseID3Frames(data,offset,endPos) {\n var tagId,tagLen,tagStart,tagFlags,timestamp;\n while(offset + 8 <= endPos) {\n tagId = this.readUTF(data,offset,4);\n offset +=4;\n\n tagLen = data[offset++] << 24 +\n data[offset++] << 16 +\n data[offset++] << 8 +\n data[offset++];\n\n tagFlags = data[offset++] << 8 +\n data[offset++];\n\n tagStart = offset;\n //logger.log(\"ID3 tag id:\" + tagId);\n switch(tagId) {\n case 'PRIV':\n //logger.log('parse frame:' + Hex.hexDump(data.subarray(offset,endPos)));\n // owner should be \"com.apple.streaming.transportStreamTimestamp\"\n if (this.readUTF(data,offset,44) === 'com.apple.streaming.transportStreamTimestamp') {\n offset+=44;\n // smelling even better ! we found the right descriptor\n // skip null character (string end) + 3 first bytes\n offset+= 4;\n\n // timestamp is 33 bit expressed as a big-endian eight-octet number, with the upper 31 bits set to zero.\n var pts33Bit = data[offset++] & 0x1;\n this._hasTimeStamp = true;\n\n timestamp = ((data[offset++] << 23) +\n (data[offset++] << 15) +\n (data[offset++] << 7) +\n data[offset++]) /45;\n\n if (pts33Bit) {\n timestamp += 47721858.84; // 2^32 / 90\n }\n timestamp = Math.round(timestamp);\n logger.trace(`ID3 timestamp found: ${timestamp}`);\n this._timeStamp = timestamp;\n }\n break;\n default:\n break;\n }\n }\n }\n\n get hasTimeStamp() {\n return this._hasTimeStamp;\n }\n\n get timeStamp() {\n return this._timeStamp;\n }\n\n get length() {\n return this._length;\n }\n\n get payload() {\n return this._payload;\n }\n\n}\n\nexport default ID3;\n\n", - "/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n import ADTS from './adts';\n import Event from '../events';\n import ExpGolomb from './exp-golomb';\n// import Hex from '../utils/hex';\n import {logger} from '../utils/logger';\n import {ErrorTypes, ErrorDetails} from '../errors';\n\n class TSDemuxer {\n\n constructor(observer,remuxerClass) {\n this.observer = observer;\n this.remuxerClass = remuxerClass;\n this.lastCC = 0;\n this.remuxer = new this.remuxerClass(observer);\n }\n\n static probe(data) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data.length >= 3*188 && data[0] === 0x47 && data[188] === 0x47 && data[2*188] === 0x47) {\n return true;\n } else {\n return false;\n }\n }\n\n switchLevel() {\n this.pmtParsed = false;\n this._pmtId = -1;\n this.lastAacPTS = null;\n this.aacOverFlow = null;\n this._avcTrack = {container : 'video/mp2t', type: 'video', id :-1, sequenceNumber: 0, samples : [], len : 0, nbNalu : 0};\n this._aacTrack = {container : 'video/mp2t', type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};\n this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0};\n this._txtTrack = {type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0};\n // flush any partial content\n this.aacOverFlow = null;\n this.remuxer.switchLevel();\n }\n\n insertDiscontinuity() {\n this.switchLevel();\n this.remuxer.insertDiscontinuity();\n }\n\n // feed incoming data to the front of the parsing pipeline\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n var avcData, aacData, id3Data,\n start, len = data.length, stt, pid, atf, offset,\n codecsOnly = this.remuxer.passthrough,\n unknownPIDs = false;\n\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this.timeOffset = timeOffset;\n this._duration = duration;\n this.contiguous = false;\n if (cc !== this.lastCC) {\n logger.log('discontinuity detected');\n this.insertDiscontinuity();\n this.lastCC = cc;\n }\n if (level !== this.lastLevel) {\n logger.log('level switch detected');\n this.switchLevel();\n this.lastLevel = level;\n } else if (sn === (this.lastSN+1)) {\n this.contiguous = true;\n }\n this.lastSN = sn;\n\n var pmtParsed = this.pmtParsed,\n avcId = this._avcTrack.id,\n aacId = this._aacTrack.id,\n id3Id = this._id3Track.id;\n\n // don't parse last TS packet if incomplete\n len -= len % 188;\n // loop through TS packets\n for (start = 0; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40);\n // pid is a 13-bit field starting at the last bit of TS[1]\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4;\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === (start + 188)) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n if (pmtParsed) {\n if (pid === avcId) {\n if (stt) {\n if (avcData) {\n this._parseAVCPES(this._parsePES(avcData));\n if (codecsOnly) {\n // if we have video codec info AND\n // if audio PID is undefined OR if we have audio codec info,\n // we have all codec info !\n if (this._avcTrack.codec && (aacId === -1 || this._aacTrack.codec)) {\n this.remux(data);\n return;\n }\n }\n }\n avcData = {data: [], size: 0};\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n } else if (pid === aacId) {\n if (stt) {\n if (aacData) {\n this._parseAACPES(this._parsePES(aacData));\n if (codecsOnly) {\n // here we now that we have audio codec info\n // if video PID is undefined OR if we have video codec info,\n // we have all codec infos !\n if (this._aacTrack.codec && (avcId === -1 || this._avcTrack.codec)) {\n this.remux(data);\n return;\n }\n }\n }\n aacData = {data: [], size: 0};\n }\n if (aacData) {\n aacData.data.push(data.subarray(offset, start + 188));\n aacData.size += start + 188 - offset;\n }\n } else if (pid === id3Id) {\n if (stt) {\n if (id3Data) {\n this._parseID3PES(this._parsePES(id3Data));\n }\n id3Data = {data: [], size: 0};\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n }\n } else {\n if (stt) {\n offset += data[offset] + 1;\n }\n if (pid === 0) {\n this._parsePAT(data, offset);\n } else if (pid === this._pmtId) {\n this._parsePMT(data, offset);\n pmtParsed = this.pmtParsed = true;\n avcId = this._avcTrack.id;\n aacId = this._aacTrack.id;\n id3Id = this._id3Track.id;\n if (unknownPIDs) {\n logger.log('reparse from beginning');\n unknownPIDs = false;\n // we set it to -188, the += 188 in the for loop will reset start to 0\n start = -188;\n }\n } else {\n logger.log('unknown PID found before PAT/PMT');\n unknownPIDs = true;\n }\n }\n } else {\n this.observer.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47'});\n }\n }\n // parse last PES packet\n if (avcData) {\n this._parseAVCPES(this._parsePES(avcData));\n }\n if (aacData) {\n this._parseAACPES(this._parsePES(aacData));\n }\n if (id3Data) {\n this._parseID3PES(this._parsePES(id3Data));\n }\n this.remux(null);\n }\n\n remux(data) {\n this.remuxer.remux(this._aacTrack, this._avcTrack, this._id3Track, this._txtTrack, this.timeOffset, this.contiguous, data);\n }\n\n destroy() {\n this.switchLevel();\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n }\n\n _parsePAT(data, offset) {\n // skip the PSI header and parse the first PMT entry\n this._pmtId = (data[offset + 10] & 0x1F) << 8 | data[offset + 11];\n //logger.log('PMT PID:' + this._pmtId);\n }\n\n _parsePMT(data, offset) {\n var sectionLength, tableEnd, programInfoLength, pid;\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n tableEnd = offset + 3 + sectionLength - 4;\n // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];\n // advance the offset to the first entry in the mapping table\n offset += 12 + programInfoLength;\n while (offset < tableEnd) {\n pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n switch(data[offset]) {\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n case 0x0f:\n //logger.log('AAC PID:' + pid);\n this._aacTrack.id = pid;\n break;\n // Packetized metadata (ID3)\n case 0x15:\n //logger.log('ID3 PID:' + pid);\n this._id3Track.id = pid;\n break;\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n case 0x1b:\n //logger.log('AVC PID:' + pid);\n this._avcTrack.id = pid;\n break;\n default:\n logger.log('unkown stream type:' + data[offset]);\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n }\n\n _parsePES(stream) {\n var i = 0, frag, pesFlags, pesPrefix, pesLen, pesHdrLen, pesData, pesPts, pesDts, payloadStartOffset, data = stream.data;\n //retrieve PTS/DTS from first fragment\n frag = data[0];\n pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5];\n pesFlags = frag[7];\n if (pesFlags & 0xC0) {\n /* PES header described here : http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n as PTS / DTS is 33 bit we cannot use bitwise operator in JS,\n as Bitwise operators treat their operands as a sequence of 32 bits */\n pesPts = (frag[9] & 0x0E) * 536870912 +// 1 << 29\n (frag[10] & 0xFF) * 4194304 +// 1 << 22\n (frag[11] & 0xFE) * 16384 +// 1 << 14\n (frag[12] & 0xFF) * 128 +// 1 << 7\n (frag[13] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesPts > 4294967295) {\n // decrement 2^33\n pesPts -= 8589934592;\n }\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E ) * 536870912 +// 1 << 29\n (frag[15] & 0xFF ) * 4194304 +// 1 << 22\n (frag[16] & 0xFE ) * 16384 +// 1 << 14\n (frag[17] & 0xFF ) * 128 +// 1 << 7\n (frag[18] & 0xFE ) / 2;\n // check if greater than 2^32 -1\n if (pesDts > 4294967295) {\n // decrement 2^33\n pesDts -= 8589934592;\n }\n } else {\n pesDts = pesPts;\n }\n }\n pesHdrLen = frag[8];\n payloadStartOffset = pesHdrLen + 9;\n\n stream.size -= payloadStartOffset;\n //reassemble PES packet\n pesData = new Uint8Array(stream.size);\n while (data.length) {\n frag = data.shift();\n var len = frag.byteLength;\n if (payloadStartOffset) {\n if (payloadStartOffset > len) {\n // trim full frag if PES header bigger than frag\n payloadStartOffset-=len;\n continue;\n } else {\n // trim partial frag if PES header smaller than frag\n frag = frag.subarray(payloadStartOffset);\n len-=payloadStartOffset;\n payloadStartOffset = 0;\n }\n }\n pesData.set(frag, i);\n i+=len;\n }\n return {data: pesData, pts: pesPts, dts: pesDts, len: pesLen};\n } else {\n return null;\n }\n }\n\n _parseAVCPES(pes) {\n var track = this._avcTrack,\n samples = track.samples,\n units = this._parseAVCNALu(pes.data),\n units2 = [],\n debug = false,\n key = false,\n length = 0,\n expGolombDecoder,\n avcSample,\n push,\n i;\n // no NALu found\n if (units.length === 0 && samples.length > 0) {\n // append pes.data to previous NAL unit\n var lastavcSample = samples[samples.length - 1];\n var lastUnit = lastavcSample.units.units[lastavcSample.units.units.length - 1];\n var tmp = new Uint8Array(lastUnit.data.byteLength + pes.data.byteLength);\n tmp.set(lastUnit.data, 0);\n tmp.set(pes.data, lastUnit.data.byteLength);\n lastUnit.data = tmp;\n lastavcSample.units.length += pes.data.byteLength;\n track.len += pes.data.byteLength;\n }\n //free pes.data to save up some memory\n pes.data = null;\n var debugString = '';\n\n units.forEach(unit => {\n switch(unit.type) {\n //NDR\n case 1:\n push = true;\n if(debug) {\n debugString += 'NDR ';\n }\n break;\n //IDR\n case 5:\n push = true;\n if(debug) {\n debugString += 'IDR ';\n }\n key = true;\n break;\n //SEI\n case 6:\n push = true;\n if(debug) {\n debugString += 'SEI ';\n }\n expGolombDecoder = new ExpGolomb(unit.data);\n\n // skip frameType\n expGolombDecoder.readUByte();\n\n var payloadType = expGolombDecoder.readUByte();\n\n // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n if (payloadType === 4)\n {\n var payloadSize = 0;\n\n do {\n payloadSize = expGolombDecoder.readUByte();\n }\n while (payloadSize === 255);\n\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181)\n {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49)\n {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934)\n {\n var userDataType = expGolombDecoder.readUByte();\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3)\n {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i=0; i 1) {\n logger.log(`AAC: align PTS for overlapping frames by ${Math.round((newPTS-pts)/90)}`);\n pts=newPTS;\n }\n }\n\n while ((offset + 5) < len) {\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = (!!(data[offset + 1] & 0x01) ? 7 : 9);\n // retrieve frame size\n frameLength = ((data[offset + 3] & 0x03) << 11) |\n (data[offset + 4] << 3) |\n ((data[offset + 5] & 0xE0) >>> 5);\n frameLength -= headerLength;\n //stamp = pes.pts;\n\n if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {\n stamp = pts + frameIndex * frameDuration;\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n aacSample = {unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp};\n track.samples.push(aacSample);\n track.len += frameLength;\n offset += frameLength + headerLength;\n frameIndex++;\n // look for ADTS header (0xFFFx)\n for ( ; offset < (len - 1); offset++) {\n if ((data[offset] === 0xff) && ((data[offset + 1] & 0xf0) === 0xf0)) {\n break;\n }\n }\n } else {\n break;\n }\n }\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len);\n //logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n this.aacOverFlow = aacOverFlow;\n this.lastAacPTS = stamp;\n }\n\n _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n }\n}\n\nexport default TSDemuxer;\n\n", + "/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n import ADTS from './adts';\n import Event from '../events';\n import ExpGolomb from './exp-golomb';\n// import Hex from '../utils/hex';\n import {logger} from '../utils/logger';\n import {ErrorTypes, ErrorDetails} from '../errors';\n\n class TSDemuxer {\n\n constructor(observer,remuxerClass) {\n this.observer = observer;\n this.remuxerClass = remuxerClass;\n this.lastCC = 0;\n this.remuxer = new this.remuxerClass(observer);\n }\n\n static probe(data) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data.length >= 3*188 && data[0] === 0x47 && data[188] === 0x47 && data[2*188] === 0x47) {\n return true;\n } else {\n return false;\n }\n }\n\n switchLevel() {\n this.pmtParsed = false;\n this._pmtId = -1;\n this._avcTrack = {container : 'video/mp2t', type: 'video', id :-1, sequenceNumber: 0, samples : [], len : 0, nbNalu : 0};\n this._aacTrack = {container : 'video/mp2t', type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};\n this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0};\n this._txtTrack = {type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0};\n // flush any partial content\n this.aacOverFlow = null;\n this.aacLastPTS = null;\n this.avcNaluState = 0;\n this.remuxer.switchLevel();\n }\n\n insertDiscontinuity() {\n this.switchLevel();\n this.remuxer.insertDiscontinuity();\n }\n\n // feed incoming data to the front of the parsing pipeline\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n var avcData, aacData, id3Data,\n start, len = data.length, stt, pid, atf, offset,\n codecsOnly = this.remuxer.passthrough,\n unknownPIDs = false;\n\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this.timeOffset = timeOffset;\n this._duration = duration;\n this.contiguous = false;\n if (cc !== this.lastCC) {\n logger.log('discontinuity detected');\n this.insertDiscontinuity();\n this.lastCC = cc;\n }\n if (level !== this.lastLevel) {\n logger.log('level switch detected');\n this.switchLevel();\n this.lastLevel = level;\n } else if (sn === (this.lastSN+1)) {\n this.contiguous = true;\n }\n this.lastSN = sn;\n\n var pmtParsed = this.pmtParsed,\n avcId = this._avcTrack.id,\n aacId = this._aacTrack.id,\n id3Id = this._id3Track.id;\n\n // don't parse last TS packet if incomplete\n len -= len % 188;\n // loop through TS packets\n for (start = 0; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40);\n // pid is a 13-bit field starting at the last bit of TS[1]\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4;\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === (start + 188)) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n if (pmtParsed) {\n if (pid === avcId) {\n if (stt) {\n if (avcData) {\n this._parseAVCPES(this._parsePES(avcData));\n if (codecsOnly) {\n // if we have video codec info AND\n // if audio PID is undefined OR if we have audio codec info,\n // we have all codec info !\n if (this._avcTrack.codec && (aacId === -1 || this._aacTrack.codec)) {\n this.remux(data);\n return;\n }\n }\n }\n avcData = {data: [], size: 0};\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n } else if (pid === aacId) {\n if (stt) {\n if (aacData) {\n this._parseAACPES(this._parsePES(aacData));\n if (codecsOnly) {\n // here we now that we have audio codec info\n // if video PID is undefined OR if we have video codec info,\n // we have all codec infos !\n if (this._aacTrack.codec && (avcId === -1 || this._avcTrack.codec)) {\n this.remux(data);\n return;\n }\n }\n }\n aacData = {data: [], size: 0};\n }\n if (aacData) {\n aacData.data.push(data.subarray(offset, start + 188));\n aacData.size += start + 188 - offset;\n }\n } else if (pid === id3Id) {\n if (stt) {\n if (id3Data) {\n this._parseID3PES(this._parsePES(id3Data));\n }\n id3Data = {data: [], size: 0};\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n }\n } else {\n if (stt) {\n offset += data[offset] + 1;\n }\n if (pid === 0) {\n this._parsePAT(data, offset);\n } else if (pid === this._pmtId) {\n this._parsePMT(data, offset);\n pmtParsed = this.pmtParsed = true;\n avcId = this._avcTrack.id;\n aacId = this._aacTrack.id;\n id3Id = this._id3Track.id;\n if (unknownPIDs) {\n logger.log('reparse from beginning');\n unknownPIDs = false;\n // we set it to -188, the += 188 in the for loop will reset start to 0\n start = -188;\n }\n } else {\n logger.log('unknown PID found before PAT/PMT');\n unknownPIDs = true;\n }\n }\n } else {\n this.observer.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47'});\n }\n }\n // parse last PES packet\n if (avcData) {\n this._parseAVCPES(this._parsePES(avcData));\n }\n if (aacData) {\n this._parseAACPES(this._parsePES(aacData));\n }\n if (id3Data) {\n this._parseID3PES(this._parsePES(id3Data));\n }\n this.remux(null);\n }\n\n remux(data) {\n this.remuxer.remux(this._aacTrack, this._avcTrack, this._id3Track, this._txtTrack, this.timeOffset, this.contiguous, data);\n }\n\n destroy() {\n this.switchLevel();\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n }\n\n _parsePAT(data, offset) {\n // skip the PSI header and parse the first PMT entry\n this._pmtId = (data[offset + 10] & 0x1F) << 8 | data[offset + 11];\n //logger.log('PMT PID:' + this._pmtId);\n }\n\n _parsePMT(data, offset) {\n var sectionLength, tableEnd, programInfoLength, pid;\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n tableEnd = offset + 3 + sectionLength - 4;\n // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];\n // advance the offset to the first entry in the mapping table\n offset += 12 + programInfoLength;\n while (offset < tableEnd) {\n pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n switch(data[offset]) {\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n case 0x0f:\n //logger.log('AAC PID:' + pid);\n this._aacTrack.id = pid;\n break;\n // Packetized metadata (ID3)\n case 0x15:\n //logger.log('ID3 PID:' + pid);\n this._id3Track.id = pid;\n break;\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n case 0x1b:\n //logger.log('AVC PID:' + pid);\n this._avcTrack.id = pid;\n break;\n default:\n logger.log('unkown stream type:' + data[offset]);\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n }\n\n _parsePES(stream) {\n var i = 0, frag, pesFlags, pesPrefix, pesLen, pesHdrLen, pesData, pesPts, pesDts, payloadStartOffset, data = stream.data;\n //retrieve PTS/DTS from first fragment\n frag = data[0];\n pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5];\n pesFlags = frag[7];\n if (pesFlags & 0xC0) {\n /* PES header described here : http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n as PTS / DTS is 33 bit we cannot use bitwise operator in JS,\n as Bitwise operators treat their operands as a sequence of 32 bits */\n pesPts = (frag[9] & 0x0E) * 536870912 +// 1 << 29\n (frag[10] & 0xFF) * 4194304 +// 1 << 22\n (frag[11] & 0xFE) * 16384 +// 1 << 14\n (frag[12] & 0xFF) * 128 +// 1 << 7\n (frag[13] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesPts > 4294967295) {\n // decrement 2^33\n pesPts -= 8589934592;\n }\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E ) * 536870912 +// 1 << 29\n (frag[15] & 0xFF ) * 4194304 +// 1 << 22\n (frag[16] & 0xFE ) * 16384 +// 1 << 14\n (frag[17] & 0xFF ) * 128 +// 1 << 7\n (frag[18] & 0xFE ) / 2;\n // check if greater than 2^32 -1\n if (pesDts > 4294967295) {\n // decrement 2^33\n pesDts -= 8589934592;\n }\n } else {\n pesDts = pesPts;\n }\n }\n pesHdrLen = frag[8];\n payloadStartOffset = pesHdrLen + 9;\n\n stream.size -= payloadStartOffset;\n //reassemble PES packet\n pesData = new Uint8Array(stream.size);\n while (data.length) {\n frag = data.shift();\n var len = frag.byteLength;\n if (payloadStartOffset) {\n if (payloadStartOffset > len) {\n // trim full frag if PES header bigger than frag\n payloadStartOffset-=len;\n continue;\n } else {\n // trim partial frag if PES header smaller than frag\n frag = frag.subarray(payloadStartOffset);\n len-=payloadStartOffset;\n payloadStartOffset = 0;\n }\n }\n pesData.set(frag, i);\n i+=len;\n }\n return {data: pesData, pts: pesPts, dts: pesDts, len: pesLen};\n } else {\n return null;\n }\n }\n\n _parseAVCPES(pes) {\n var track = this._avcTrack,\n samples = track.samples,\n units = this._parseAVCNALu(pes.data),\n units2 = [],\n debug = false,\n key = false,\n length = 0,\n expGolombDecoder,\n avcSample,\n push,\n i;\n // no NALu found\n if (units.length === 0 && samples.length > 0) {\n // append pes.data to previous NAL unit\n var lastavcSample = samples[samples.length - 1];\n var lastUnit = lastavcSample.units.units[lastavcSample.units.units.length - 1];\n var tmp = new Uint8Array(lastUnit.data.byteLength + pes.data.byteLength);\n tmp.set(lastUnit.data, 0);\n tmp.set(pes.data, lastUnit.data.byteLength);\n lastUnit.data = tmp;\n lastavcSample.units.length += pes.data.byteLength;\n track.len += pes.data.byteLength;\n }\n //free pes.data to save up some memory\n pes.data = null;\n var debugString = '';\n\n var pushAccesUnit = function() {\n if (units2.length) {\n // only push AVC sample if keyframe already found in this fragment OR\n // keyframe found in last fragment (track.sps) AND\n // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous\n if (key === true ||\n (track.sps && (samples.length || this.contiguous))) {\n avcSample = {units: { units : units2, length : length}, pts: pes.pts, dts: pes.dts, key: key};\n samples.push(avcSample);\n track.len += length;\n track.nbNalu += units2.length;\n }\n units2 = [];\n length = 0;\n }\n };\n\n units.forEach(unit => {\n switch(unit.type) {\n //NDR\n case 1:\n push = true;\n if(debug) {\n debugString += 'NDR ';\n }\n break;\n //IDR\n case 5:\n push = true;\n if(debug) {\n debugString += 'IDR ';\n }\n key = true;\n break;\n //SEI\n case 6:\n push = true;\n if(debug) {\n debugString += 'SEI ';\n }\n expGolombDecoder = new ExpGolomb(unit.data);\n\n // skip frameType\n expGolombDecoder.readUByte();\n\n var payloadType = expGolombDecoder.readUByte();\n\n // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n if (payloadType === 4)\n {\n var payloadSize = 0;\n\n do {\n payloadSize = expGolombDecoder.readUByte();\n }\n while (payloadSize === 255);\n\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181)\n {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49)\n {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934)\n {\n var userDataType = expGolombDecoder.readUByte();\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3)\n {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i=0; i this is the first start code found in this PES packet\n // first check if start code delimiter is overlapping between 2 PES packets,\n // ie it started in last packet (lastState not zero)\n // and ended at the beginning of this PES packet (i <= 4 - lastState)\n let lastState = this.avcNaluState;\n if(lastState && (i <= 4 - lastState)) {\n // start delimiter overlapping between PES packets\n // strip start delimiter bytes from the end of last NAL unit\n let track = this._avcTrack,\n samples = track.samples;\n if (samples.length) {\n let lastavcSample = samples[samples.length - 1],\n lastUnits = lastavcSample.units.units,\n lastUnit = lastUnits[lastUnits.length - 1];\n // check if lastUnit had a state different from zero\n if (lastUnit.state) {\n // strip last bytes\n lastUnit.data = lastUnit.data.subarray(0,lastUnit.data.byteLength - lastState);\n lastavcSample.units.length -= lastState;\n track.len -= lastState;\n }\n }\n }\n // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n overflow = i - state - 1;\n if (overflow > 0) {\n let track = this._avcTrack,\n samples = track.samples;\n //logger.log('first NALU found with overflow:' + overflow);\n if (samples.length) {\n let lastavcSample = samples[samples.length - 1],\n lastUnits = lastavcSample.units.units,\n lastUnit = lastUnits[lastUnits.length - 1],\n tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n lastavcSample.units.length += overflow;\n track.len += overflow;\n }\n }\n }\n lastUnitStart = i;\n lastUnitType = unitType;\n state = 0;\n } else {\n state = 0;\n }\n break;\n default:\n break;\n }\n }\n if (lastUnitStart) {\n unit = {data: array.subarray(lastUnitStart, len), type: lastUnitType, state : state};\n units.push(unit);\n //logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);\n this.avcNaluState = state;\n }\n return units;\n }\n\n _parseAACPES(pes) {\n var track = this._aacTrack,\n data = pes.data,\n pts = pes.pts,\n startOffset = 0,\n duration = this._duration,\n audioCodec = this.audioCodec,\n aacOverFlow = this.aacOverFlow,\n aacLastPTS = this.aacLastPTS,\n config, frameLength, frameDuration, frameIndex, offset, headerLength, stamp, len, aacSample;\n if (aacOverFlow) {\n var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);\n tmp.set(aacOverFlow, 0);\n tmp.set(data, aacOverFlow.byteLength);\n //logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);\n data = tmp;\n }\n // look for ADTS header (0xFFFx)\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if ((data[offset] === 0xff) && (data[offset+1] & 0xf0) === 0xf0) {\n break;\n }\n }\n // if ADTS header does not start straight from the beginning of the PES payload, raise an error\n if (offset) {\n var reason, fatal;\n if (offset < len - 1) {\n reason = `AAC PES did not start with ADTS header,offset:${offset}`;\n fatal = false;\n } else {\n reason = 'no ADTS header found in AAC PES';\n fatal = true;\n }\n this.observer.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: fatal, reason: reason});\n if (fatal) {\n return;\n }\n }\n if (!track.audiosamplerate) {\n config = ADTS.getAudioConfig(this.observer,data, offset, audioCodec);\n track.config = config.config;\n track.audiosamplerate = config.samplerate;\n track.channelCount = config.channelCount;\n track.codec = config.codec;\n track.duration = duration;\n logger.log(`parsed codec:${track.codec},rate:${config.samplerate},nb channel:${config.channelCount}`);\n }\n frameIndex = 0;\n frameDuration = 1024 * 90000 / track.audiosamplerate;\n\n // if last AAC frame is overflowing, we should ensure timestamps are contiguous:\n // first sample PTS should be equal to last sample PTS + frameDuration\n if(aacOverFlow && aacLastPTS) {\n var newPTS = aacLastPTS+frameDuration;\n if(Math.abs(newPTS-pts) > 1) {\n logger.log(`AAC: align PTS for overlapping frames by ${Math.round((newPTS-pts)/90)}`);\n pts=newPTS;\n }\n }\n\n while ((offset + 5) < len) {\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = (!!(data[offset + 1] & 0x01) ? 7 : 9);\n // retrieve frame size\n frameLength = ((data[offset + 3] & 0x03) << 11) |\n (data[offset + 4] << 3) |\n ((data[offset + 5] & 0xE0) >>> 5);\n frameLength -= headerLength;\n //stamp = pes.pts;\n\n if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {\n stamp = pts + frameIndex * frameDuration;\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n aacSample = {unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp};\n track.samples.push(aacSample);\n track.len += frameLength;\n offset += frameLength + headerLength;\n frameIndex++;\n // look for ADTS header (0xFFFx)\n for ( ; offset < (len - 1); offset++) {\n if ((data[offset] === 0xff) && ((data[offset + 1] & 0xf0) === 0xf0)) {\n break;\n }\n }\n } else {\n break;\n }\n }\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len);\n //logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n this.aacOverFlow = aacOverFlow;\n this.aacLastPTS = stamp;\n }\n\n _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n }\n}\n\nexport default TSDemuxer;\n\n", "export const ErrorTypes = {\n // Identifier for a network error (loading error / timeout ...)\n NETWORK_ERROR: 'networkError',\n // Identifier for a media Error (video/parsing/mediasource error)\n MEDIA_ERROR: 'mediaError',\n // Identifier for all other errors\n OTHER_ERROR: 'otherError'\n};\n\nexport const ErrorDetails = {\n // Identifier for a manifest load error - data: { url : faulty URL, response : XHR response}\n MANIFEST_LOAD_ERROR: 'manifestLoadError',\n // Identifier for a manifest load timeout - data: { url : faulty URL, response : XHR response}\n MANIFEST_LOAD_TIMEOUT: 'manifestLoadTimeOut',\n // Identifier for a manifest parsing error - data: { url : faulty URL, reason : error reason}\n MANIFEST_PARSING_ERROR: 'manifestParsingError',\n // Identifier for a manifest with only incompatible codecs error - data: { url : faulty URL, reason : error reason}\n MANIFEST_INCOMPATIBLE_CODECS_ERROR: 'manifestIncompatibleCodecsError',\n // Identifier for playlist load error - data: { url : faulty URL, response : XHR response}\n LEVEL_LOAD_ERROR: 'levelLoadError',\n // Identifier for playlist load timeout - data: { url : faulty URL, response : XHR response}\n LEVEL_LOAD_TIMEOUT: 'levelLoadTimeOut',\n // Identifier for a level switch error - data: { level : faulty level Id, event : error description}\n LEVEL_SWITCH_ERROR: 'levelSwitchError',\n // Identifier for fragment load error - data: { frag : fragment object, response : XHR response}\n FRAG_LOAD_ERROR: 'fragLoadError',\n // Identifier for fragment loop loading error - data: { frag : fragment object}\n FRAG_LOOP_LOADING_ERROR: 'fragLoopLoadingError',\n // Identifier for fragment load timeout error - data: { frag : fragment object}\n FRAG_LOAD_TIMEOUT: 'fragLoadTimeOut',\n // Identifier for a fragment decryption error event - data: parsing error description\n FRAG_DECRYPT_ERROR: 'fragDecryptError',\n // Identifier for a fragment parsing error event - data: parsing error description\n FRAG_PARSING_ERROR: 'fragParsingError',\n // Identifier for decrypt key load error - data: { frag : fragment object, response : XHR response}\n KEY_LOAD_ERROR: 'keyLoadError',\n // Identifier for decrypt key load timeout error - data: { frag : fragment object}\n KEY_LOAD_TIMEOUT: 'keyLoadTimeOut',\n // Identifier for a buffer append error - data: append error description\n BUFFER_APPEND_ERROR: 'bufferAppendError',\n // Identifier for a buffer appending error event - data: appending error description\n BUFFER_APPENDING_ERROR: 'bufferAppendingError',\n // Identifier for a buffer stalled error event\n BUFFER_STALLED_ERROR: 'bufferStalledError',\n // Identifier for a buffer full event\n BUFFER_FULL_ERROR: 'bufferFullError',\n // Identifier for a buffer seek over hole event\n BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',\n // Identifier for an internal exception happening inside hls.js while handling an event\n INTERNAL_EXCEPTION: 'internalException'\n};\n", "/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\n\nimport {logger} from './utils/logger';\nimport {ErrorTypes, ErrorDetails} from './errors';\nimport Event from './events';\n\nclass EventHandler {\n\n constructor(hls, ...events) {\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n this.handledEvents = events;\n this.useGenericHandler = true;\n\n this.registerListeners();\n }\n\n destroy() {\n this.unregisterListeners();\n }\n\n isEventHandler() {\n return typeof this.handledEvents === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n }\n\n registerListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function(event) {\n if (event === 'hlsEventGeneric') {\n throw new Error('Forbidden event name: ' + event);\n }\n this.hls.on(event, this.onEvent);\n }.bind(this));\n }\n }\n\n unregisterListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function(event) {\n this.hls.off(event, this.onEvent);\n }.bind(this));\n }\n }\n\n /*\n * arguments: event (string), data (any)\n */\n onEvent(event, data) {\n this.onEventGeneric(event, data);\n }\n\n onEventGeneric(event, data) {\n var eventToFunction = function(event, data) {\n var funcName = 'on' + event.replace('hls', '');\n if (typeof this[funcName] !== 'function') {\n throw new Error(`Event ${event} has no generic handler in this ${this.constructor.name} class (tried ${funcName})`);\n }\n return this[funcName].bind(this, data);\n };\n try {\n eventToFunction.call(this, event, data).call();\n } catch (err) {\n logger.error(`internal error happened while processing ${event}:${err.message}`);\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.OTHER_ERROR, details: ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event : event, err : err});\n }\n }\n}\n\nexport default EventHandler;\n", "module.exports = {\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be resetted\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data {startOffset, endOffset}\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media has been flushed\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels] , url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels] , firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level playlist loading starts - data: { url : level URL level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded. - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCH: 'hlsLevelSwitch',\n // fired when a fragment loading starts - data: { frag : fragment object}\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded}}\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: {frag : fragment object}\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}}\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when Init Segment has been extracted from fragment - data: { moov : moov MP4 box, codecs : codecs found while parsing fragment}\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: undefined\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: {curentDropped, currentDecoded, totalDroppedFrames}\n FPS_DROP: 'hlsFpsDrop',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data}\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object}\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length}}\n KEY_LOADED: 'hlsKeyLoaded',\n};\n", "/**\n * Buffer Helper class, providing methods dealing buffer length retrieval\n*/\n\n\nclass BufferHelper {\n\n static bufferInfo(media, pos,maxHoleDuration) {\n if (media) {\n var vbuffered = media.buffered, buffered = [],i;\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({start: vbuffered.start(i), end: vbuffered.end(i)});\n }\n return this.bufferedInfo(buffered,pos,maxHoleDuration);\n } else {\n return {len: 0, start: 0, end: 0, nextStart : undefined} ;\n }\n }\n\n static bufferedInfo(buffered,pos,maxHoleDuration) {\n var buffered2 = [],\n // bufferStart and bufferEnd are buffer boundaries around current video position\n bufferLen,bufferStart, bufferEnd,bufferStartNext,i;\n // sort on buffer.start/smaller end (IE does not always return sorted buffered range)\n buffered.sort(function (a, b) {\n var diff = a.start - b.start;\n if (diff) {\n return diff;\n } else {\n return b.end - a.end;\n }\n });\n // there might be some small holes between buffer time range\n // consider that holes smaller than maxHoleDuration are irrelevant and build another\n // buffer time range representations that discards those holes\n for (i = 0; i < buffered.length; i++) {\n var buf2len = buffered2.length;\n if(buf2len) {\n var buf2end = buffered2[buf2len - 1].end;\n // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative)\n if((buffered[i].start - buf2end) < maxHoleDuration) {\n // merge overlapping time ranges\n // update lastRange.end only if smaller than item.end\n // e.g. [ 1, 15] with [ 2,8] => [ 1,15] (no need to modify lastRange.end)\n // whereas [ 1, 8] with [ 2,15] => [ 1,15] ( lastRange should switch from [1,8] to [1,15])\n if(buffered[i].end > buf2end) {\n buffered2[buf2len - 1].end = buffered[i].end;\n }\n } else {\n // big hole\n buffered2.push(buffered[i]);\n }\n } else {\n // first value\n buffered2.push(buffered[i]);\n }\n }\n for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) {\n var start = buffered2[i].start,\n end = buffered2[i].end;\n //logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i));\n if ((pos + maxHoleDuration) >= start && pos < end) {\n // play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length\n bufferStart = start;\n bufferEnd = end;\n bufferLen = bufferEnd - pos;\n } else if ((pos + maxHoleDuration) < start) {\n bufferStartNext = start;\n break;\n }\n }\n return {len: bufferLen, start: bufferStart, end: bufferEnd, nextStart : bufferStartNext};\n }\n\n}\n\nexport default BufferHelper;\n", - "/**\n * Level Helper class, providing methods dealing with playlist sliding and drift\n*/\n\nimport {logger} from '../utils/logger';\n\nclass LevelHelper {\n\n static mergeDetails(oldDetails,newDetails) {\n var start = Math.max(oldDetails.startSN,newDetails.startSN)-newDetails.startSN,\n end = Math.min(oldDetails.endSN,newDetails.endSN)-newDetails.startSN,\n delta = newDetails.startSN - oldDetails.startSN,\n oldfragments = oldDetails.fragments,\n newfragments = newDetails.fragments,\n ccOffset =0,\n PTSFrag;\n\n // check if old/new playlists have fragments in common\n if ( end < start) {\n newDetails.PTSKnown = false;\n return;\n }\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n for(var i = start ; i <= end ; i++) {\n var oldFrag = oldfragments[delta+i],\n newFrag = newfragments[i];\n ccOffset = oldFrag.cc - newFrag.cc;\n if (!isNaN(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n PTSFrag = newFrag;\n }\n }\n\n if(ccOffset) {\n logger.log(`discontinuity sliding from playlist, take drift into account`);\n for(i = 0 ; i < newfragments.length ; i++) {\n newfragments[i].cc += ccOffset;\n }\n }\n\n // if at least one fragment contains PTS info, recompute PTS information for all fragments\n if(PTSFrag) {\n LevelHelper.updateFragPTS(newDetails,PTSFrag.sn,PTSFrag.startPTS,PTSFrag.endPTS);\n } else {\n // ensure that delta is within oldfragments range\n // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61])\n // in that case we also need to adjust start offset of all fragments\n if (delta >= 0 && delta < oldfragments.length) {\n // adjust start by sliding offset\n var sliding = oldfragments[delta].start;\n for(i = 0 ; i < newfragments.length ; i++) {\n newfragments[i].start += sliding;\n }\n }\n }\n // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n newDetails.PTSKnown = oldDetails.PTSKnown;\n return;\n }\n\n static updateFragPTS(details,sn,startPTS,endPTS) {\n var fragIdx, fragments, frag, i;\n // exit if sn out of range\n if (sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n fragIdx = sn - details.startSN;\n fragments = details.fragments;\n frag = fragments[fragIdx];\n if(!isNaN(frag.startPTS)) {\n startPTS = Math.min(startPTS,frag.startPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n }\n\n var drift = startPTS - frag.start;\n\n frag.start = frag.startPTS = startPTS;\n frag.endPTS = endPTS;\n frag.duration = endPTS - startPTS;\n // adjust fragment PTS/duration from seqnum-1 to frag 0\n for(i = fragIdx ; i > 0 ; i--) {\n LevelHelper.updatePTS(fragments,i,i-1);\n }\n\n // adjust fragment PTS/duration from seqnum to last frag\n for(i = fragIdx ; i < fragments.length - 1 ; i++) {\n LevelHelper.updatePTS(fragments,i,i+1);\n }\n details.PTSKnown = true;\n //logger.log(` frag start/end:${startPTS.toFixed(3)}/${endPTS.toFixed(3)}`);\n\n return drift;\n }\n\n static updatePTS(fragments,fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],fragTo = fragments[toIdx], fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if(!isNaN(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS-fragFrom.start;\n if(fragFrom.duration < 0) {\n logger.error(`negative duration computed for frag ${fragFrom.sn},level ${fragFrom.level}, there should be some duration drift between playlist and fragment!`);\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n if(fragTo.duration < 0) {\n logger.error(`negative duration computed for frag ${fragTo.sn},level ${fragTo.level}, there should be some duration drift between playlist and fragment!`);\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n fragTo.start = fragFrom.start + fragFrom.duration;\n } else {\n fragTo.start = fragFrom.start - fragTo.duration;\n }\n }\n }\n}\n\nexport default LevelHelper;\n", + "/**\n * Level Helper class, providing methods dealing with playlist sliding and drift\n*/\n\nimport {logger} from '../utils/logger';\n\nclass LevelHelper {\n\n static mergeDetails(oldDetails,newDetails) {\n var start = Math.max(oldDetails.startSN,newDetails.startSN)-newDetails.startSN,\n end = Math.min(oldDetails.endSN,newDetails.endSN)-newDetails.startSN,\n delta = newDetails.startSN - oldDetails.startSN,\n oldfragments = oldDetails.fragments,\n newfragments = newDetails.fragments,\n ccOffset =0,\n PTSFrag;\n\n // check if old/new playlists have fragments in common\n if ( end < start) {\n newDetails.PTSKnown = false;\n return;\n }\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n for(var i = start ; i <= end ; i++) {\n var oldFrag = oldfragments[delta+i],\n newFrag = newfragments[i];\n ccOffset = oldFrag.cc - newFrag.cc;\n if (!isNaN(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n PTSFrag = newFrag;\n }\n }\n\n if(ccOffset) {\n logger.log(`discontinuity sliding from playlist, take drift into account`);\n for(i = 0 ; i < newfragments.length ; i++) {\n newfragments[i].cc += ccOffset;\n }\n }\n\n // if at least one fragment contains PTS info, recompute PTS information for all fragments\n if(PTSFrag) {\n LevelHelper.updateFragPTSDTS(newDetails,PTSFrag.sn,PTSFrag.startPTS,PTSFrag.endPTS,PTSFrag.startDTS,PTSFrag.endDTS);\n } else {\n // ensure that delta is within oldfragments range\n // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61])\n // in that case we also need to adjust start offset of all fragments\n if (delta >= 0 && delta < oldfragments.length) {\n // adjust start by sliding offset\n var sliding = oldfragments[delta].start;\n for(i = 0 ; i < newfragments.length ; i++) {\n newfragments[i].start += sliding;\n }\n }\n }\n // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n newDetails.PTSKnown = oldDetails.PTSKnown;\n return;\n }\n\n static updateFragPTSDTS(details,sn,startPTS,endPTS,startDTS,endDTS) {\n var fragIdx, fragments, frag, i;\n // exit if sn out of range\n if (sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n fragIdx = sn - details.startSN;\n fragments = details.fragments;\n frag = fragments[fragIdx];\n if(!isNaN(frag.startPTS)) {\n startPTS = Math.min(startPTS,frag.startPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n startDTS = Math.min(startDTS,frag.startDTS);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n\n var drift = startPTS - frag.start;\n\n frag.start = frag.startPTS = startPTS;\n frag.endPTS = endPTS;\n frag.startDTS = startDTS;\n frag.endDTS = endDTS;\n frag.duration = endPTS - startPTS;\n // adjust fragment PTS/duration from seqnum-1 to frag 0\n for(i = fragIdx ; i > 0 ; i--) {\n LevelHelper.updatePTS(fragments,i,i-1);\n }\n\n // adjust fragment PTS/duration from seqnum to last frag\n for(i = fragIdx ; i < fragments.length - 1 ; i++) {\n LevelHelper.updatePTS(fragments,i,i+1);\n }\n details.PTSKnown = true;\n //logger.log(` frag start/end:${startPTS.toFixed(3)}/${endPTS.toFixed(3)}`);\n\n return drift;\n }\n\n static updatePTS(fragments,fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],fragTo = fragments[toIdx], fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if(!isNaN(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS-fragFrom.start;\n if(fragFrom.duration < 0) {\n logger.error(`negative duration computed for frag ${fragFrom.sn},level ${fragFrom.level}, there should be some duration drift between playlist and fragment!`);\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n if(fragTo.duration < 0) {\n logger.error(`negative duration computed for frag ${fragTo.sn},level ${fragTo.level}, there should be some duration drift between playlist and fragment!`);\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n fragTo.start = fragFrom.start + fragFrom.duration;\n } else {\n fragTo.start = fragFrom.start - fragTo.duration;\n }\n }\n }\n}\n\nexport default LevelHelper;\n", "/**\n * HLS interface\n */\n'use strict';\n\nimport Event from './events';\nimport {ErrorTypes, ErrorDetails} from './errors';\nimport PlaylistLoader from './loader/playlist-loader';\nimport FragmentLoader from './loader/fragment-loader';\nimport AbrController from './controller/abr-controller';\nimport BufferController from './controller/buffer-controller';\nimport CapLevelController from './controller/cap-level-controller';\nimport StreamController from './controller/stream-controller';\nimport LevelController from './controller/level-controller';\nimport TimelineController from './controller/timeline-controller';\n//import FPSController from './controller/fps-controller';\nimport {logger, enableLogs} from './utils/logger';\nimport XhrLoader from './utils/xhr-loader';\nimport EventEmitter from 'events';\nimport KeyLoader from './loader/key-loader';\n\nclass Hls {\n\n static isSupported() {\n return (window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"'));\n }\n\n static get Events() {\n return Event;\n }\n\n static get ErrorTypes() {\n return ErrorTypes;\n }\n\n static get ErrorDetails() {\n return ErrorDetails;\n }\n\n static get DefaultConfig() {\n if(!Hls.defaultConfig) {\n Hls.defaultConfig = {\n autoStartLoad: true,\n debug: false,\n capLevelToPlayerSize: false,\n maxBufferLength: 30,\n maxBufferSize: 60 * 1000 * 1000,\n maxBufferHole: 0.5,\n maxSeekHole: 2,\n seekHoleNudgeDuration : 0.01,\n stalledInBufferedNudgeThreshold: 10,\n maxFragLookUpTolerance : 0.2,\n liveSyncDurationCount:3,\n liveMaxLatencyDurationCount: Infinity,\n liveSyncDuration: undefined,\n liveMaxLatencyDuration: undefined,\n maxMaxBufferLength: 600,\n enableWorker: true,\n enableSoftwareAES: true,\n manifestLoadingTimeOut: 10000,\n manifestLoadingMaxRetry: 1,\n manifestLoadingRetryDelay: 1000,\n levelLoadingTimeOut: 10000,\n levelLoadingMaxRetry: 4,\n levelLoadingRetryDelay: 1000,\n fragLoadingTimeOut: 20000,\n fragLoadingMaxRetry: 6,\n fragLoadingRetryDelay: 1000,\n fragLoadingLoopThreshold: 3,\n startFragPrefetch : false,\n // fpsDroppedMonitoringPeriod: 5000,\n // fpsDroppedMonitoringThreshold: 0.2,\n appendErrorMaxRetry: 3,\n loader: XhrLoader,\n fLoader: undefined,\n pLoader: undefined,\n abrController : AbrController,\n bufferController : BufferController,\n capLevelController : CapLevelController,\n streamController: StreamController,\n timelineController: TimelineController,\n enableCEA708Captions: true,\n enableMP2TPassThrough : false,\n abrEwmaFast: 0,\n abrEwmaSlow: 0,\n abrBandWidthFactor : 0.8,\n abrBandWidthUpFactor : 0.7\n };\n }\n return Hls.defaultConfig;\n }\n\n static set DefaultConfig(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n\n constructor(config = {}) {\n var defaultConfig = Hls.DefaultConfig;\n\n if ((config.liveSyncDurationCount || config.liveMaxLatencyDurationCount) && (config.liveSyncDuration || config.liveMaxLatencyDuration)) {\n throw new Error('Illegal hls.js config: don\\'t mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration');\n }\n\n for (var prop in defaultConfig) {\n if (prop in config) { continue; }\n config[prop] = defaultConfig[prop];\n }\n\n if (config.liveMaxLatencyDurationCount !== undefined && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n\n if (config.liveMaxLatencyDuration !== undefined && (config.liveMaxLatencyDuration <= config.liveSyncDuration || config.liveSyncDuration === undefined)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n\n enableLogs(config.debug);\n this.config = config;\n // observer setup\n var observer = this.observer = new EventEmitter();\n observer.trigger = function trigger (event, ...data) {\n observer.emit(event, event, ...data);\n };\n\n observer.off = function off (event, ...data) {\n observer.removeListener(event, ...data);\n };\n this.on = observer.on.bind(observer);\n this.off = observer.off.bind(observer);\n this.trigger = observer.trigger.bind(observer);\n this.playlistLoader = new PlaylistLoader(this);\n this.fragmentLoader = new FragmentLoader(this);\n this.levelController = new LevelController(this);\n this.abrController = new config.abrController(this);\n this.bufferController = new config.bufferController(this);\n this.capLevelController = new config.capLevelController(this);\n this.streamController = new config.streamController(this);\n this.timelineController = new config.timelineController(this);\n this.keyLoader = new KeyLoader(this);\n //this.fpsController = new FPSController(this);\n }\n\n destroy() {\n logger.log('destroy');\n this.trigger(Event.DESTROYING);\n this.detachMedia();\n this.playlistLoader.destroy();\n this.fragmentLoader.destroy();\n this.levelController.destroy();\n this.abrController.destroy();\n this.bufferController.destroy();\n this.capLevelController.destroy();\n this.streamController.destroy();\n this.timelineController.destroy();\n this.keyLoader.destroy();\n //this.fpsController.destroy();\n this.url = null;\n this.observer.removeAllListeners();\n }\n\n attachMedia(media) {\n logger.log('attachMedia');\n this.media = media;\n this.trigger(Event.MEDIA_ATTACHING, {media: media});\n }\n\n detachMedia() {\n logger.log('detachMedia');\n this.trigger(Event.MEDIA_DETACHING);\n this.media = null;\n }\n\n loadSource(url) {\n logger.log(`loadSource:${url}`);\n this.url = url;\n // when attaching to a source URL, trigger a playlist load\n this.trigger(Event.MANIFEST_LOADING, {url: url});\n }\n\n startLoad(startPosition=0) {\n logger.log('startLoad');\n this.levelController.startLoad();\n this.streamController.startLoad(startPosition);\n }\n\n stopLoad() {\n logger.log('stopLoad');\n this.levelController.stopLoad();\n this.streamController.stopLoad();\n }\n\n swapAudioCodec() {\n logger.log('swapAudioCodec');\n this.streamController.swapAudioCodec();\n }\n\n recoverMediaError() {\n logger.log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n this.attachMedia(media);\n }\n\n /** Return all quality levels **/\n get levels() {\n return this.levelController.levels;\n }\n\n /** Return current playback quality level **/\n get currentLevel() {\n return this.streamController.currentLevel;\n }\n\n /* set quality level immediately (-1 for automatic level selection) */\n set currentLevel(newLevel) {\n logger.log(`set currentLevel:${newLevel}`);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n }\n\n /** Return next playback quality level (quality level of next fragment) **/\n get nextLevel() {\n return this.streamController.nextLevel;\n }\n\n /* set quality level for next fragment (-1 for automatic level selection) */\n set nextLevel(newLevel) {\n logger.log(`set nextLevel:${newLevel}`);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n\n /** Return the quality level of current/last loaded fragment **/\n get loadLevel() {\n return this.levelController.level;\n }\n\n /* set quality level for current/next loaded fragment (-1 for automatic level selection) */\n set loadLevel(newLevel) {\n logger.log(`set loadLevel:${newLevel}`);\n this.levelController.manualLevel = newLevel;\n }\n\n /** Return the quality level of next loaded fragment **/\n get nextLoadLevel() {\n return this.levelController.nextLoadLevel;\n }\n\n /** set quality level of next loaded fragment **/\n set nextLoadLevel(level) {\n this.levelController.nextLoadLevel = level;\n }\n\n /** Return first level (index of first level referenced in manifest)\n **/\n get firstLevel() {\n return this.levelController.firstLevel;\n }\n\n /** set first level (index of first level referenced in manifest)\n **/\n set firstLevel(newLevel) {\n logger.log(`set firstLevel:${newLevel}`);\n this.levelController.firstLevel = newLevel;\n }\n\n /** Return start level (level of first fragment that will be played back)\n if not overrided by user, first level appearing in manifest will be used as start level\n if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)\n **/\n get startLevel() {\n return this.levelController.startLevel;\n }\n\n /** set start level (level of first fragment that will be played back)\n if not overrided by user, first level appearing in manifest will be used as start level\n if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)\n **/\n set startLevel(newLevel) {\n logger.log(`set startLevel:${newLevel}`);\n this.levelController.startLevel = newLevel;\n }\n\n /** Return the capping/max level value that could be used by automatic level selection algorithm **/\n get autoLevelCapping() {\n return this.abrController.autoLevelCapping;\n }\n\n /** set the capping/max level value that could be used by automatic level selection algorithm **/\n set autoLevelCapping(newLevel) {\n logger.log(`set autoLevelCapping:${newLevel}`);\n this.abrController.autoLevelCapping = newLevel;\n }\n\n /* check if we are in automatic level selection mode */\n get autoLevelEnabled() {\n return (this.levelController.manualLevel === -1);\n }\n\n /* return manual level */\n get manualLevel() {\n return this.levelController.manualLevel;\n }\n}\n\nexport default Hls;\n", "// This is mostly for support of the es6 module export\n// syntax with the babel compiler, it looks like it doesnt support\n// function exports like we are used to in node/commonjs\nmodule.exports = require('./hls.js').default;\n", "/*\n * Fragment Loader\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nclass FragmentLoader extends EventHandler {\n\n constructor(hls) {\n super(hls, Event.FRAG_LOADING);\n }\n\n destroy() {\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n EventHandler.prototype.destroy.call(this);\n }\n\n onFragLoading(data) {\n var frag = data.frag;\n this.frag = frag;\n this.frag.loaded = 0;\n var config = this.hls.config;\n frag.loader = this.loader = typeof(config.fLoader) !== 'undefined' ? new config.fLoader(config) : new config.loader(config);\n this.loader.load(frag.url, 'arraybuffer', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), config.fragLoadingTimeOut, 1, 0, this.loadprogress.bind(this), frag);\n }\n\n loadsuccess(event, stats) {\n var payload = event.currentTarget.response;\n stats.length = payload.byteLength;\n // detach fragment loader on load success\n this.frag.loader = undefined;\n this.hls.trigger(Event.FRAG_LOADED, {payload: payload, frag: this.frag, stats: stats});\n }\n\n loaderror(event) {\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.FRAG_LOAD_ERROR, fatal: false, frag: this.frag, response: event});\n }\n\n loadtimeout() {\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.FRAG_LOAD_TIMEOUT, fatal: false, frag: this.frag});\n }\n\n loadprogress(event, stats) {\n this.frag.loaded = stats.loaded;\n this.hls.trigger(Event.FRAG_LOAD_PROGRESS, {frag: this.frag, stats: stats});\n }\n}\n\nexport default FragmentLoader;\n", diff --git a/dashboard-ui/bower_components/hls.js/dist/hls.min.js b/dashboard-ui/bower_components/hls.js/dist/hls.min.js index 677d345eac..da274519f2 100644 --- a/dashboard-ui/bower_components/hls.js/dist/hls.min.js +++ b/dashboard-ui/bower_components/hls.js/dist/hls.min.js @@ -1,5 +1,5 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){return function s(e,t,r){function i(n,d){if(!t[n]){if(!e[n]){var l="function"==typeof require&&require;if(!d&&l)return l(n,!0);if(a)return a(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var r=e[n][1][t];return i(r?r:t)},o,o.exports,s,e,t,r)}return t[n].exports}for(var a="function"==typeof require&&require,n=0;ne||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,n,a,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],i(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),e.apply(this,n)}else if(r(e))for(n=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,a=0;u>a;a++)o[a].apply(this,n);return!0},e.prototype.addListener=function(n,a){var s;if(!t(a))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",n,t(a.listener)?a.listener:a),this._events[n]?r(this._events[n])?this._events[n].push(a):this._events[n]=[this._events[n],a]:this._events[n]=a,r(this._events[n])&&!this._events[n].warned&&(s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[n].length>s&&(this._events[n].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(i,e){function r(){this.removeListener(i,r),n||(n=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(i,r),this},e.prototype.removeListener=function(n,i){var e,s,o,a;if(!t(i))throw TypeError("listener must be a function");if(!this._events||!this._events[n])return this;if(e=this._events[n],o=e.length,s=-1,e===i||t(e.listener)&&e.listener===i)delete this._events[n],this._events.removeListener&&this.emit("removeListener",n,i);else if(r(e)){for(a=o;a-- >0;)if(e[a]===i||e[a].listener&&e[a].listener===i){s=a;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[n]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",n,i)}return this},e.prototype.removeAllListeners=function(r){var i,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(i in this._events)"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(a,i,s){var n=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;i.exports=function(l){for(var i,s=Object.keys(r),a=0,d=s.length;d>a;a++){var o=s[a],u=r[o].exports;if(u===l||u.default===l){i=o;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},a=0,d=s.length;d>a;a++){var o=s[a];f[o]=o}e[i]=[Function(["require","module","exports"],"("+l+")(self)"),f]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[i]=i,e[h]=[Function(["require"],"var f = require("+t(i)+");(f.default ? f.default : f)(self);"),c];var g="("+n+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(h)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(v.createObjectURL(new Blob([g],{type:"text/javascript"})))}},{}],3:[function(e,m,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 g(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)}Object.defineProperty(a,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;t500*e.duration){var f=Math.max(1,1e3*e.loaded/u);e.expectedLens){var l=void 0,r=void 0;for(r=e.level-1;r>=0&&(l=e.duration*n.levels[r].bitrate/(6.4*f),i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+d.toFixed(1)+"/"+s.toFixed(1)+"/"+l.toFixed(1)),!(s>l));r--);d>l&&(r=Math.max(0,r),n.nextLoadLevel=r,this.bwEstimator.sample(u,e.loaded),i.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),n.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(e){var t=e.stats;void 0===t.aborted&&1===e.frag.loadCounter&&this.bwEstimator.sample(performance.now()-t.trequest,t.loaded),this.clearTimer(),this.lastLoadedFragLevel=e.frag.level,this._nextAutoLevel=-1}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var e,r,i=this.hls,t=i.levels,n=i.config;if(r=-1===this._autoLevelCapping&&t&&t.length?t.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,r);var a=this.bwEstimator.getEstimate(),s=void 0;for(e=0;r>=e;e++)if(s=e<=this.lastLoadedFragLevel?n.abrBandWidthFactor*a:n.abrBandWidthUpFactor*a,sa.config.appendErrorMaxRetry)return t.logger.log("fail "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],i.fatal=!0,void a.trigger(e.default.ERROR,i);i.fatal=!1,a.trigger(e.default.ERROR,i)}else n=[],i.details=r.ErrorDetails.BUFFER_FULL_ERROR,a.trigger(e.default.ERROR,i)}}}}},{key:"flushBuffer",value:function(l,s){var e,r,o,a,i,n;if(this.flushBufferCounter.5)return this.flushBufferCounter++,t.logger.log("flush "+u+" ["+i+","+n+"], of ["+o+","+a+"], pos:"+this.media.currentTime),e.remove(i,n),!1}else t.logger.warn("abort flushing too many retries");return t.logger.log("buffer flushed"),!0}}]),i}(s.default);n.default=o},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(e,h,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 f(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)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;tthis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(a){var r=void 0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,i=0,n=0;for(e=0;a>=e&&(t=this.levels[e],r=e,i=t.width,n=t.height,!(i>=s||n>=o));e++);return r}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}},{key:"mediaWidth",get:function(){var e=void 0;return this.media&&(e=this.media.width||this.media.clientWidth||this.media.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0;return this.media&&(e=this.media.height||this.media.clientHeight||this.media.offsetHeight,e*=this.contentScaleFactor),e}}]),e}(s.default);t.default=u},{"../event-handler":22,"../events":23}],6:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t=0&&ie&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this._manualLevel?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,-1===this._manualLevel&&(this.hls.abrController.nextAutoLevel=e)}}]),i}(f.default);n.default=o},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(n,A,o){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 g(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)}Object.defineProperty(o,"__esModule",{value:!0});var m=function(){function e(i,r){for(var t=0;t1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var _,l,a,E=this,f=this.hls,o=f.config;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:var b=f.startLevel;-1===b&&(b=0,this.fragBitrateTest=!0),this.level=f.nextLoadLevel=b,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!this.media&&(this.startFragRequested||!o.startFragPrefetch))break;_=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition,l=f.nextLoadLevel;var h,R=s.default.bufferInfo(this.media,_,o.maxBufferHole),T=R.len,u=R.end,c=this.fragPrevious;if(this.levels[l].hasOwnProperty("bitrate")?(h=Math.max(8*o.maxBufferSize/this.levels[l].bitrate,o.maxBufferLength),h=Math.min(h,o.maxMaxBufferLength)):h=o.maxBufferLength,h>T){if(f.nextLoadLevel=l,this.level=l,a=this.levels[l].details,"undefined"==typeof a||a.live&&this.levelLastLoaded!==l){this.state=e.WAITING_LEVEL;break}var d=a.fragments,g=d.length,v=d[0].start,y=d[g-1].start+d[g-1].duration,n=void 0;if(a.live){var S=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*a.targetduration;if(uy)break;if(this.startFragRequested&&!a.PTSKnown){if(c){var m=c.sn+1;m>=a.startSN&&m<=a.endSN&&(n=d[m-a.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=d[Math.min(g-1,Math.round(g/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+n.sn))}}else v>u&&(n=d[0]);if(n||!function(){var i=void 0,s=o.maxFragLookUpTolerance;y>u?(u>y-s&&(s=0),i=p.default.search(d,function(e){return e.start+e.duration-s<=u?1:e.start-s>u?-1:0})):i=d[g-1],i&&(n=i,v=i.start,c&&n.level===c.level&&n.sn===c.sn&&(n.sn1&&(n.expectedLen=Math.round(n.duration*this.levels[l].bitrate/8),n.trequest=performance.now()),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,n.loadCounter){n.loadCounter++;var A=o.fragLoadingLoopThreshold;if(n.loadCounter>A&&Math.abs(this.fragLoadIdx-n.loadIdx)=L||D)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(i){var e,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],i>=t.start&&i<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){var i=this.media;if(i)for(var t=i.buffered,e=0;e=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,i=this.media;if(i&&i.seeking===!1&&(e=i.currentTime,e>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var n=t.frag;n!==this.fragPlaying&&(this.fragPlaying=n,this.hls.trigger(r.default.FRAG_CHANGED,{frag:n}))}}},{key:"immediateLevelSwitch",value:function(){t.logger.log("immediateLevelSwitch"),this.immediateSwitch||(this.immediateSwitch=!0,this.previouslyPaused=this.media.paused,this.media.pause());var i=this.fragCurrent;i&&i.loader&&i.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;var e=this.media;e&&e.readyState&&(e.currentTime-=1e-4,this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var t=this.media;if(t&&t.readyState){var a=void 0,n=void 0,i=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,n=this.getBufferRange(t.currentTime),n&&n.start>1&&(this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:n.start-1})),t.paused)a=0;else{var l=this.hls.nextLoadLevel,u=this.levels[l],o=this.fragLastKbps;a=o&&this.fragCurrent?this.fragCurrent.duration*u.bitrate/(1e3*o)+1:0}if(i=this.getBufferRange(t.currentTime+a),i&&(i=this.followingBufferRange(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:i.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(t){var e=this.media=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),this.levels&&this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),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=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){if(this.state===e.FRAG_LOADING){if(0===s.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var r=this.fragCurrent;r&&(r.loader&&r.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=e.IDLE}}else this.state===e.ENDED&&(this.state=e.IDLE);this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){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(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,i=!1,n=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(i=!0),-1!==e.indexOf("mp4a.40.5")&&(n=!0))}),this.audioCodecSwitch=i&&n,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1,this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onLevelLoaded",value:function(s){var i=s.details,n=s.level,o=this.levels[n],l=i.totalduration,a=0;if(t.logger.log("level "+n+" loaded ["+i.startSN+","+i.endSN+"],duration:"+l),this.levelLastLoaded=n,i.live){var d=o.details;d?(u.default.mergeDetails(d,i),a=i.fragments[0].start,i.PTSKnown?t.logger.log("live playlist sliding:"+a.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(i.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else i.PTSKnown=!1;if(o.details=i,this.hls.trigger(r.default.LEVEL_UPDATED,{details:i,level:n}),this.startFragRequested===!1){if(i.live){var f=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*i.targetduration;this.startPosition=Math.max(0,a+l-f)}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(n){var i=this.fragCurrent;if(this.state===e.FRAG_LOADING&&i&&n.frag.level===i.level&&n.frag.sn===i.sn)if(t.logger.log("Loaded "+i.sn+" of level "+i.level),this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,n.stats.tparsed=n.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:n.stats,frag:i});else{this.state=e.PARSING,this.stats=n.stats;var s=this.levels[this.level],o=s.details,f=o.totalduration,h=i.start,l=i.level,u=i.sn,a=s.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===a&&(a=this.lastAudioCodec),a&&(a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l);var d=this.demuxer;d&&d.push(n.payload,a,s.videoCodec,h,i.cc,l,u,f,i.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(l){if(this.state===e.PARSING){var o,i,n=l.tracks;if(i=n.audio){var a=this.levels[this.level].audioCodec,u=navigator.userAgent.toLowerCase();a&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===u.indexOf("firefox")&&(a="mp4a.40.5"),-1!==u.indexOf("android")&&(a="mp4a.40.2",t.logger.log("Android: force audio codec to"+a)),i.levelCodec=a}if(i=n.video,i&&(i.levelCodec=this.levels[this.level].videoCodec),l.unique){var s={codec:"",levelCodec:""};for(o in l.tracks)i=n[o],s.container=i.container,s.codec&&(s.codec+=",",s.levelCodec+=","),i.codec&&(s.codec+=i.codec),i.levelCodec&&(s.levelCodec+=i.levelCodec);n={audiovideo:s}}this.hls.trigger(r.default.BUFFER_CODECS,n);for(o in n){i=n[o],t.logger.log("track:"+o+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var d=i.initSegment;d&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:o,data:d}))}this.tick()}}},{key:"onFragParsingData",value:function(i){var o=this;if(this.state===e.PARSING){this.tparse2=Date.now();var n=this.levels[this.level],a=this.fragCurrent;t.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb);var l=u.default.updateFragPTS(n.details,a.sn,i.startPTS,i.endPTS),s=this.hls;s.trigger(r.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:l}),[i.data1,i.data2].forEach(function(e){e&&(o.pendingAppending++,s.trigger(r.default.BUFFER_APPENDING,{type:i.type,data:e}))}),this.nextLoadPosition=i.endPTS,this.bufferRange.push({type:i.type,start:i.startPTS,end:i.endPTS,frag:a}),this.tick()}else t.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var n=this.fragCurrent,i=this.stats;n&&(this.fragPrevious=n,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i,frag:n}),t.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=e.IDLE),this.tick()}}},{key:"onError",value:function(n){switch(n.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!n.fatal){var a=this.fragLoadError;if(a?a++:a=1,a<=this.config.fragLoadingMaxRetry){this.fragLoadError=a,n.frag.loadCounter=0;var s=Math.min(Math.pow(2,a-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+n.details+" reaches max retry, redispatch as fatal ..."),n.fatal=!0,this.hls.trigger(r.default.ERROR,n),this.state=e.ERROR}break;case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=n.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+n.details+" while loading frag,switch to "+this.state+" state ..."));break;case i.ErrorDetails.BUFFER_FULL_ERROR:this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError"),this.nextLevelSwitch()}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e){var h=e.readyState;if(h){var n,a,d=this.seekAfterBuffered;if(d)e.duration>=d&&(n=d,this.seekAfterBuffered=void 0);else{a=e.currentTime;var p=this.loadedmetadata;!p&&e.buffered.length&&(this.loadedmetadata=!0,a||a===this.startPosition||(n=this.startPosition))}n&&(a=n,t.logger.log("target seek position:"+n));var l=s.default.bufferInfo(e,a,0),m=!(e.paused||e.ended||e.seeking||2>h),f=.4,c=a>e.playbackRate*this.lastCurrentTime;if(this.stalled&&c&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+a)),m&&l.len<=f){if(c?(f=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+a),this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),l.len<=f){var o=l.nextStart,g=o-a;if(o&&g0&&!e.seeking){t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration);var y=o+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:y})}}}else{var v=e.currentTime;if(n&&v!==n){if(0===l.len){var u=l.nextStart;void 0!==u&&u-ne;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),n}(l.default);o.default=f},{"../demux/demuxer":17,"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../helper/level-helper":25,"../utils/binary-search":35,"../utils/logger":38}],9:[function(t,g,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;te;e++)c[(n[e]=e<<1^283*(e>>7))^e]=e;for(i=r=0;!h[i];i^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,h[i]=t,g[t]=i,d=n[f=n[u=n[i]]],l=16843009*d^65537*f^257*u^16843008*i,s=257*n[t]^16843008*t,e=0;4>e;e++)a[e][i]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)a[e]=a[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var h,v,g,a,e=this._key[1],t=R^e[0],i=b^e[1],n=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],f=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(a=0;y>a;a++)h=f[t>>>24]^d[i>>16&255]^u[n>>8&255]^l[255&r]^e[s],v=f[i>>>24]^d[n>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],g=f[n>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&i]^e[s+2],r=f[r>>>24]^d[t>>16&255]^u[i>>8&255]^l[255&n]^e[s+3],s+=4,t=h,i=v,n=g;for(a=0;4>a;a++)E[(3&-a)+m]=c[t>>>24]<<24^c[i>>16&255]<<16^c[n>>8&255]<<8^c[255&r]^e[s++],h=t,t=i,i=n,n=r,r=h}}]),e}();e.default=i},{}],11:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>8|e>>>24}},{key:"doDecrypt",value:function(i,v,n){var u,h,o,f,l,c,d,a,e,r=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),p=new s.default(Array.prototype.slice.call(v)),g=new Uint8Array(i.byteLength),t=new Int32Array(g.buffer);for(u=~~n[0],h=~~n[1],o=~~n[2],f=~~n[3],e=0;ee&&(255!==t[e]||240!==(240&t[e+1]));e++);for(r.audiosamplerate||(n=o.default.getAudioConfig(this.observer,t,e,p),r.config=n.config,r.audiosamplerate=n.samplerate,r.channelCount=n.channelCount,r.codec=n.codec,r.duration=y,l.logger.log("parsed codec:"+r.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)),c=0,v=9216e4/r.audiosamplerate;u>e+5&&(s=1&t[e+1]?7:9,a=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5,a-=s,a>0&&u>=e+s+a);)for(f=h+c*v,g={unit:t.subarray(e+s,e+s+a),pts:f,dts:f},r.samples.push(g),r.len+=a,e+=a+s,c++;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);this.remuxer.remux(this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:d.payload}]},{samples:[]},m)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,n=new i.default(t);if(n.hasTimeStamp)for(e=n.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();t.default=s},{"../demux/id3":19,"../utils/logger":38,"./adts":14}],14:[function(e,o,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void h.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,a.logger.log("manifest codec:"+n+",ADTS data:type:"+i+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==f.indexOf("firefox")?e>=6?(i=5,t=new Array(4),s=e-3):(i=2,t=new Array(2),s=e):-1!==f.indexOf("android")?(i=2,t=new Array(2),s=e):(i=5,t=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&e>=6?s=e-3:((n&&-1!==n.indexOf("mp4a.40.2")&&e>=6&&1===o||!n&&1===o)&&(i=2,t=new Array(2)),s=e)),t[0]=i<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===i&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+i})}}]),e}();t.default=s},{"../errors":21,"../utils/logger":38}],15:[function(e,y,i){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t1?r-1:0),e=1;r>e;e++)n[e-1]=arguments[e];t.emit.apply(t,[i,i].concat(n))},t.off=function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.removeListener.apply(t,[n].concat(i))},r.addEventListener("message",function(i){var e=i.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.typeSupported);break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}}),t.on(e.default.FRAG_PARSING_INIT_SEGMENT,function(t,e){r.postMessage({event:t,tracks:e.tracks,unique:e.unique})}),t.on(e.default.FRAG_PARSING_DATA,function(i,e){var t={event:i,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,data1:e.data1.buffer,data2:e.data2.buffer,nb:e.nb};r.postMessage(t,[t.data1,t.data2])}),t.on(e.default.FRAG_PARSED,function(e){r.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){r.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)}),t.on(e.default.FRAG_PARSING_USERDATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)})};i.default=o},{"../demux/demuxer-inline":15,"../events":23,events:1}],17:[function(t,v,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new l.default(this.hls));var d=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){d.pushDecrypted(e,r,i,n,a,s,o,u)})}else this.pushDecrypted(t,r,i,n,a,s,o,u)}},{key:"onWorkerMessage",value:function(i){var t=i.data;switch(t.event){case e.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(e.default.FRAG_PARSING_INIT_SEGMENT,r);break;case e.default.FRAG_PARSING_DATA:this.hls.trigger(e.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb});break;case e.default.FRAG_PARSING_METADATA:this.hls.trigger(e.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case e.default.FRAG_PARSING_USERDATA:this.hls.trigger(e.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),r}();i.default=o},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../events":23,"../utils/logger":38,webworkify:2}],18:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(i,r){for(var t=0;te?(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){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&n.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))return this.word<<=e,this.bitsAvailable-=e,e;return this.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(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(n){var t,i,r=8,e=8;for(t=0;n>t;t++)0!==e&&(i=this.readEG(),e=(r+i+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,v,p,l,n,a,i,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),v=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){var g=this.readUEG();if(3===g&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==g?8:12,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(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),n=this.readUEG(),a=this.readUEG(),i=this.readBits(1),0===i&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(n+1)-2*s-2*d)*c),height:(2-i)*(a+1)*16-(i?2:4)*(f+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=a},{"../utils/logger":38}],19:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;tr);return t}},{key:"_parseID3Frames",value:function(r,t,a){for(var n,s,o,l,i;a>=t+8;)switch(n=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,n){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,i=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(i+=47721858.84),i=Math.round(i),e.logger.trace("ID3 timestamp found: "+i),this._timeStamp=i}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),t}();t.default=a},{"../utils/logger":38}],20:[function(t,g,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;tt;t+=188)if(71===i[t]){if(d=!!(64&i[t+1]),u=((31&i[t+1])<<8)+i[t+2],y=(48&i[t+3])>>4,y>1){if(n=t+5+i[t+4],n===t+188)continue}else n=t+4;if(v)if(u===h){if(d){if(s&&(this._parseAVCPES(this._parsePES(s)),b&&this._avcTrack.codec&&(-1===f||this._aacTrack.codec)))return void this.remux(i);s={data:[],size:0}}s&&(s.data.push(i.subarray(n,t+188)),s.size+=t+188-n)}else if(u===f){if(d){if(o&&(this._parseAACPES(this._parsePES(o)),b&&this._aacTrack.codec&&(-1===h||this._avcTrack.codec)))return void this.remux(i);o={data:[],size:0}}o&&(o.data.push(i.subarray(n,t+188)),o.size+=t+188-n)}else u===_&&(d&&(l&&this._parseID3PES(this._parsePES(l)),l={data:[],size:0}),l&&(l.data.push(i.subarray(n,t+188)),l.size+=t+188-n));else d&&(n+=i[n]+1),0===u?this._parsePAT(i,n):u===this._pmtId?(this._parsePMT(i,n),v=this.pmtParsed=!0,h=this._avcTrack.id,f=this._aacTrack.id,_=this._id3Track.id,g&&(e.logger.log("reparse from beginning"),g=!1,t=-188)):(e.logger.log("unknown PID found before PAT/PMT"),g=!0)}else this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s&&this._parseAVCPES(this._parsePES(s)),o&&this._parseAACPES(this._parsePES(o)),l&&this._parseID3PES(this._parsePES(l)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(r,t){var n,a,s,i;for(n=(15&r[t+1])<<8|r[t+2],a=t+3+n-4,s=(15&r[t+10])<<8|r[t+11],t+=12+s;a>t;){switch(i=(31&r[t+1])<<8|r[t+2],r[t]){case 15:this._aacTrack.id=i;break;case 21:this._id3Track.id=i;break;case 27:this._avcTrack.id=i;break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}}},{key:"_parsePES",value:function(o){var e,a,h,d,u,l,i,r,t,f=0,s=o.data;if(e=s[0],h=(e[0]<<16)+(e[1]<<8)+e[2],1===h){for(d=(e[4]<<8)+e[5],a=e[7],192&a&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,i>4294967295&&(i-=8589934592),64&a?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=i),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var n=e.byteLength;if(t){if(t>n){t-=n;continue}e=e.subarray(t),n-=t,t=0}l.set(e,f),f+=n}return{data:l,pts:i,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(i){var t,p,a,l,y=this,r=this._avcTrack,u=r.samples,m=this._parseAVCNALu(i.data),d=[],o=!1,h=!1,c=0;if(0===m.length&&u.length>0){var g=u[u.length-1],f=g.units.units[g.units.units.length-1],v=new Uint8Array(f.data.byteLength+i.data.byteLength);v.set(f.data,0),v.set(i.data,f.data.byteLength),f.data=v,g.units.length+=i.data.byteLength,r.len+=i.data.byteLength}i.data=null;var n="";m.forEach(function(e){switch(e.type){case 1:a=!0,o&&(n+="NDR ");break;case 5:a=!0,o&&(n+="IDR "),h=!0;break;case 6:a=!0,o&&(n+="SEI "),t=new s.default(e.data),t.readUByte();var E=t.readUByte();if(4===E){var v=0;do v=t.readUByte();while(255===v);var R=t.readUByte();if(181===R){var _=t.readUShort();if(49===_){var A=t.readUInt();if(1195456820===A){var k=t.readUByte();if(3===k){var g=t.readUByte(),b=t.readUByte(),T=31&g,f=[g,b];for(l=0;T>l;l++)f.push(t.readUByte()),f.push(t.readUByte()),f.push(t.readUByte());y._txtTrack.samples.push({type:3,pts:i.pts,bytes:f})}}}}}break;case 7:if(a=!0,o&&(n+="SPS "),!r.sps){t=new s.default(e.data);var p=t.readSPS();r.width=p.width,r.height=p.height,r.sps=[e.data],r.duration=y._duration;var L=e.data.subarray(1,4),m="avc1.";for(l=0;3>l;l++){var u=L[l].toString(16);u.length<2&&(u="0"+u),m+=u}r.codec=m}break;case 8:a=!0,o&&(n+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:a=!1,o&&(n+="AUD ");break;default:a=!1,n+="unknown NAL "+e.type+" "}a&&(d.push(e),c+=e.data.byteLength)}),(o||n.length)&&e.logger.log(n),d.length&&(h===!0||r.sps&&(u.length||this.contiguous))&&(p={units:{units:d,length:c},pts:i.pts,dts:i.dts,key:h},u.push(p),r.len+=c,r.nbNalu+=d.length)}},{key:"_parseAVCNALu",value:function(r){for(var a,i,s,p,n,l,t=0,h=r.byteLength,e=0,d=[];h>t;)switch(a=r[t++],e){case 0:0===a&&(e=1);break;case 1:e=0===a?2:0;break;case 2:case 3:if(0===a)e=3;else if(1===a&&h>t){if(p=31&r[t],n)s={data:r.subarray(n,t-e-1),type:l},d.push(s);else if(i=t-e-1){var c=this._avcTrack,f=c.samples;if(f.length){var g=f[f.length-1],v=g.units.units,o=v[v.length-1],u=new Uint8Array(o.data.byteLength+i);u.set(o.data,0),u.set(r.subarray(0,i),o.data.byteLength),o.data=u,g.units.length+=i,c.len+=i}}n=t,l=p,e=0}else e=0}return n&&(s={data:r.subarray(n,h),type:l},d.push(s)),d}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,f,s,_,n=this._aacTrack,i=R.data,g=R.pts,k=0,L=this._duration,A=this.audioCodec,u=this.aacOverFlow,b=this.lastAacPTS;if(u){var m=new Uint8Array(u.byteLength+i.byteLength);m.set(u,0),m.set(i,u.byteLength),i=m}for(t=k,s=i.length;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);if(t){var y,h;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,h=!1):(y="no ADTS header found in AAC PES",h=!0),this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:y}),h)return}if(n.audiosamplerate||(l=c.default.getAudioConfig(this.observer,i,t,A),n.config=l.config,n.audiosamplerate=l.samplerate,n.channelCount=l.channelCount,n.codec=l.codec,n.duration=L,e.logger.log("parsed codec:"+n.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/n.audiosamplerate,u&&b){var v=b+p;Math.abs(v-g)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((v-g)/90)),g=v)}for(;s>t+5&&(d=1&i[t+1]?7:9,o=(3&i[t+3])<<11|i[t+4]<<3|(224&i[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(f=g+E*p,_={unit:i.subarray(t+d,t+d+o),pts:f,dts:f},n.samples.push(_),n.len+=o,t+=o+d,E++;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);u=s>t?i.subarray(t,s):null,this.aacOverFlow=u,this.lastAacPTS=f}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),t}();n.default=o},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.ErrorDetails={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",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],22:[function(e,f,t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d=function(){function e(i,r){for(var t=0;t1?r-1:0),t=1;r>t;t++)i[t-1]=arguments[t];this.handledEvents=i,this.useGenericHandler=!0,this.registerListeners()}return d(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===a(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var i=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{i.call(this,e,t).call()}catch(t){o.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(s.default.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=l},{"./errors":21,"./events":23,"./utils/logger":38}],23:[function(t,e,r){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",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_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",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",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded"}},{}],24:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;td&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=n=i;e=a&&f>i)l=a,n=f,o=n-i;else if(a>i+s){h=a;break}}return{len:o,start:l,end:n,nextStart:h}}}]),e}();e.default=i},{}],25:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;th)return void(i.PTSKnown=!1);for(var r=c;h>=r;r++){var o=f[u+r],n=l[r];d=o.cc-n.cc,isNaN(o.startPTS)||(n.start=n.startPTS=o.startPTS,n.endPTS=o.endPTS,n.duration=o.duration,s=n)}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r=0&&ui.endSN)return 0;o=l-i.startSN,a=i.fragments,r=a[o],isNaN(r.startPTS)||(n=Math.min(n,r.startPTS),s=Math.max(s,r.endPTS));var u=n-r.start;for(r.start=r.startPTS=n,r.endPTS=s,r.duration=s-n,e=o;e>0;e--)t.updatePTS(a,e,e-1);for(e=o;ei?r.start=t.start+t.duration:r.start=t.start-r.duration:n>i?(t.duration=a-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-a,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=a},{"../utils/logger":38}],26:[function(t,I,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t1?t-1:0),e=1;t>e;e++)n[e-1]=arguments[e];i.emit.apply(i,[r,r].concat(n))},i.off=function(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];i.removeListener.apply(i,[n].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),this.playlistLoader=new d.default(this),this.fragmentLoader=new h.default(this),this.levelController=new R.default(this),this.abrController=new r.abrController(this),this.bufferController=new r.bufferController(this),this.capLevelController=new r.capLevelController(this),this.streamController=new r.streamController(this),this.timelineController=new r.timelineController(this),this.keyLoader=new p.default(this)}return a(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"Events",get:function(){return i.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,debug:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,abrController:g.default,bufferController:P.default,capLevelController:m.default,streamController:b.default,timelineController:L.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1,abrEwmaFast:0,abrEwmaSlow:0,abrBandWidthFactor:.8,abrBandWidthUpFactor:.7}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),a(t,[{key:"destroy",value:function(){e.logger.log("destroy"),this.trigger(i.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.streamController.destroy(),this.timelineController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){e.logger.log("attachMedia"),this.media=t,this.trigger(i.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){e.logger.log("detachMedia"),this.trigger(i.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){e.logger.log("loadSource:"+t),this.url=t,this.trigger(i.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0];e.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t)}},{key:"stopLoad",value:function(){e.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad()}},{key:"swapAudioCodec",value:function(){e.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){e.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){e.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){e.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){e.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){e.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){e.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){e.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}}]),t}();n.default=l},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":7,"./controller/stream-controller":8,"./controller/timeline-controller":9,"./errors":21,"./events":23,"./loader/fragment-loader":28,"./loader/key-loader":29,"./loader/playlist-loader":30,"./utils/logger":38,"./utils/xhr-loader":40,events:1}],27:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":26}],28:[function(r,c,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(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 s(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)}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(L,s,A){var e,b,u,a,g=0,o=0,i={url:s,fragments:[],live:!0,startSN:0},r={method:null,key:null,iv:null,uri:null},y=0,d=null,t=null;for(b=/(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*)[\r\n]+([^#|\r\n]+)?)/g;null!==(e=b.exec(L));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"MEDIA-SEQUENCE":g=i.startSN=parseInt(e[1]);break;case"TARGETDURATION":i.targetduration=parseFloat(e[1]);break;case"ENDLIST":i.live=!1;break;case"DIS":y++;break;case"BYTERANGE":var h=e[1].split("@");a=1===h.length?u:parseInt(h[1]),u=parseInt(h[0])+a,t&&!t.url&&(t.byteRangeStartOffset=a,t.byteRangeEndOffset=u,t.url=this.resolve(e[2],s));break;case"INF":var c=parseFloat(e[1]);if(!isNaN(c)){var f,m=g++;if(r.method&&r.uri&&!r.iv){f=this.cloneObj(r);for(var E=new Uint8Array(16),l=12;16>l;l++)E[l]=m>>8*(15-l)&255;f.iv=E}else f=r;var k=e[2]?this.resolve(e[2],s):null;t={url:k,duration:c,start:o,sn:m,level:A,cc:y,byteRangeStartOffset:a,byteRangeEndOffset:u,decryptdata:f,programDateTime:d},i.fragments.push(t),o+=c,a=null,d=null}break;case"KEY":var R=e[1],v=new n.default(R),p=v.enumeratedString("METHOD"),_=v.URI,T=v.hexadecimalInteger("IV");p&&(r={method:null,key:null,iv:null,uri:null},_&&"AES-128"===p&&(r.method=p,r.uri=this.resolve(_,s),r.key=null,r.iv=T));break;case"PROGRAM-DATE-TIME":d=new Date(Date.parse(e[1])),t&&!t.url&&e.length>=3&&(t.url=this.resolve(e[2],s),t.programDateTime=d)}return t&&!t.url&&(i.fragments.pop(),o-=t.duration),i.totalduration=o,i.endSN=g-1,i}},{key:"loadsuccess",value:function(u,i){var s,o=u.currentTarget,a=o.responseText,r=o.responseURL,l=this.id,d=this.id2,n=this.hls;if(this.loading=!1,void 0===r&&(r=this.url),i.tload=performance.now(),i.mtime=new Date(o.getResponseHeader("Last-Modified")),0===a.indexOf("#EXTM3U"))if(a.indexOf("#EXTINF:")>0)if(null===this.id)n.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r}],url:r,stats:i});else{var f=this.parseLevelPlaylist(a,r,l);i.tparsed=performance.now(),n.trigger(t.default.LEVEL_LOADED,{details:f,level:l,id:d,stats:i})}else s=this.parseMasterPlaylist(a,r),s.length?n.trigger(t.default.MANIFEST_LOADED,{levels:s,url:r,stats:i}):n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"});else n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(n){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_ERROR,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,response:n.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),r}(a.default);s.default=u},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/url":39}],31:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(n,4),r=0,e=8;a>r;r++)t.set(i[r],e),e+=i[r].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return r*=t,e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))}},{key:"mvex",value:function(r){for(var t=r.length,i=[];t--;)i[t]=e.trex(r[t]);return e.box.apply(null,[e.types.mvex].concat(i))}},{key:"mvhd",value:function(t,r){r*=t;var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,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 e.box(e.types.mvhd,i)}},{key:"sdtp",value:function(a){var r,t,i=a.samples||[],n=new Uint8Array(4+i.length);for(t=0;t>>8&255),i.push(255&a),i=i.concat(Array.prototype.slice.call(n));for(r=0;r>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(n));var u=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=t.height;return e.box(e.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,o>>8&255,255&o,l>>8&255,255&l,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value: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]))}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration*t.timescale,n=t.width,a=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,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,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(i,t){var n=e.sdtp(i),r=i.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(i,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(h,o){var i,n,a,s,t,l,d=h.samples||[],r=d.length,f=12+16*r,u=new Uint8Array(f);for(o+=8+f,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),i=0;r>i;i++)n=d[i],a=n.duration,s=n.size,t=n.flags,l=n.cts,u.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(i){e.types||e.init();var t,r=e.moov(i);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=i},{}],32:[function(i,h,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;tMath.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};i.timescale=i.audiosamplerate/e(i.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+i.timescale),l.audio={container:"audio/mp4",codec:i.codec,initSegment:r.default.initSegment([i]),metadata:{channelCount:i.channelCount}},u&&(a=o=g[0].pts-f*h)),n.sps&&n.pps&&d.length&&(n.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:n.codec,initSegment:r.default.initSegment([n]),metadata:{width:n.width,height:n.height}},u&&(a=Math.min(a,d[0].pts-f*h),o=Math.min(o,d[0].dts-f*h))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,u&&(this._initPTS=a,this._initDTS=o)):c.trigger(t.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(n,w,S){var L,s,p,A,f,d,T,k,R,g,_,v,o,i,a,E=8,c=this.PES_TIMESCALE,h=this.PES2MP4SCALEFACTOR,u=[];for(d=new Uint8Array(n.len+4*n.nbNalu+8),L=new DataView(d.buffer),L.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4);n.samples.length;){for(s=n.samples.shift(),A=0;s.units.units.length;)f=s.units.units.shift(),L.setUint32(E,f.data.byteLength),E+=4,d.set(f.data,E),E+=f.data.byteLength,A+=4+f.data.byteLength;if(_=s.pts-this._initDTS,v=s.dts-this._initDTS,v=Math.min(_,v),void 0!==g){o=this._PTSNormalize(_,g),i=this._PTSNormalize(v,g);var m=(i-g)/h;0>=m&&(e.logger.log("invalid sample duration at PTS/DTS: "+s.pts+"/"+s.dts+":"+m),m=1),p.duration=m}else{var y=void 0,l=void 0;y=S?this.nextAvcDts:w*c,o=this._PTSNormalize(_,y),i=this._PTSNormalize(v,y),l=Math.round((i-y)/90),S&&l&&(l>1?e.logger.log("AVC:"+l+" ms hole between fragments detected,filling it"):-1>l&&e.logger.log("AVC:"+-l+" ms overlapping between fragments detected"),i=y,o=Math.max(o-l,i),e.logger.log("Video/PTS/DTS adjusted: "+o+"/"+i+",delta:"+l)),k=Math.max(0,o),R=Math.max(0,i)}p={size:A,duration:0,cts:(o-i)/h,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},a=p.flags,s.key===!0?(a.dependsOn=2,a.isNonSync=0):(a.dependsOn=1,a.isNonSync=1),u.push(p),g=i}var b=0;u.length>=2&&(b=u[u.length-2].duration,p.duration=b),this.nextAvcDts=i+b*h,n.len=0,n.nbNalu=0,u.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(a=u[0].flags,a.dependsOn=2,a.isNonSync=0),n.samples=u,T=r.default.moof(n.sequenceNumber++,R/h,n),n.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:T,data2:d,startPTS:k/c,endPTS:(o+h*b)/c,startDTS:R/c,endDTS:this.nextAvcDts/c,type:"video",nb:u.length})}},{key:"remuxAudio",value:function(i,O,S){var T,p,a,h,d,k,L,b,u,v,R,o,n,A=8,s=this.PES_TIMESCALE,w=i.timescale,f=s/w,E=1024*i.timescale/i.audiosamplerate,m=[],_=[];for(i.samples.sort(function(e,t){return e.pts-t.pts}),_=i.samples;_.length;){if(p=_.shift(),h=p.unit,v=p.pts-this._initDTS,R=p.dts-this._initDTS,void 0!==u)o=this._PTSNormalize(v,u),n=this._PTSNormalize(R,u),a.duration=(n-u)/f,Math.abs(a.duration-E)>E/10&&e.logger.log("invalid AAC sample duration at PTS "+Math.round(v/90)+",should be 1024,found :"+Math.round(a.duration*i.audiosamplerate/i.timescale)),a.duration=E,o=n=E*f+u;else{var c=void 0,l=void 0;if(c=S?this.nextAacPts:O*s,o=this._PTSNormalize(v,c),n=this._PTSNormalize(R,c),l=Math.round(1e3*(o-c)/s),S&&l){if(l>0)e.logger.log(l+" ms hole between AAC samples detected,filling it");else if(-12>l){e.logger.log(-l+" ms overlapping between AAC samples detected, drop frame"),i.len-=h.byteLength;continue}o=n=c}if(L=Math.max(0,o),b=Math.max(0,n),!(i.len>0))return;d=new Uint8Array(i.len+8),T=new DataView(d.buffer),T.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4)}d.set(h,A),A+=h.byteLength,a={size:h.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},m.push(a),u=n}var y=0,g=m.length;g>=2&&(y=m[g-2].duration,a.duration=y),g&&(this.nextAacPts=o+f*y,i.len=0,i.samples=m,k=r.default.moof(i.sequenceNumber++,b/f,i),i.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:k,data2:d,startPTS:L/s,endPTS:this.nextAacPts/s,startDTS:b/s,endDTS:(n+f*y)/s,type:"audio",nb:g}))}},{key:"remuxID3",value:function(r,n){var e,a=r.samples.length;if(a){for(var i=0;a>i;i++)e=r.samples[i],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{samples:r.samples})}r.samples=[],n=n}},{key:"remuxText",value:function(e,n){e.samples.sort(function(e,t){return e.pts-t.pts});var r,a=e.samples.length;if(a){for(var i=0;a>i;i++)r=e.samples[i],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],n=n}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),i}();n.default=d},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(n){for(var t,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=a.exec(n));){var e=t[2],i='"';0===e.indexOf(i)&&e.lastIndexOf(i)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=i},{}],35:[function(r,e,i){"use strict";var t={search:function(n,s){for(var t=0,r=n.length-1,e=null,i=null;r>=t;){e=(t+r)/2|0,i=n[e];var a=s(i);if(a>0)t=e+1;else{if(!(0>a))return i;r=e-1}}return null}};e.exports=t},{}],36:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t0;)e.removeCue(e.cues[0])}},{key:"push",value:function(r,i){this.cue||this._createCue();for(var n,t,e,s,o,u=31&i[0],a=2,l=0;u>l;l++)if(n=i[a++],t=127&i[a++],e=127&i[a++],s=0!==(4&n),o=3&n,(0!==t||0!==e)&&s&&0===o){if(32&t||64&t)this.cue.text+=this._fromCharCode(t)+this._fromCharCode(e);else if((17===t||25===t)&&e>=48&&63>=e)switch(e){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===t||25===t)&&e>=32&&47>=e)switch(e){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===t||28===t)&&e>=32&&47>=e)switch(e){case 32:this._clearActiveCues(r);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(r);break;case 42:break;case 43:break;case 44:this._clearActiveCues(r);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(r)}if((23===t||31===t)&&e>=33&&35>=e)switch(e){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(s){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var e=!0,i=!1,n=void 0;try{for(var a,t=this.memory[Symbol.iterator]();!(e=(a=t.next()).done);e=!0){var r=a.value;r.startTime=s,this._textTrack.addCue(r),this.display.push(r)}}catch(e){i=!0,n=e}finally{try{!e&&t.return&&t.return()}finally{if(i)throw n}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(a){var e=!0,r=!1,i=void 0;try{for(var n,t=this.display[Symbol.iterator]();!(e=(n=t.next()).done);e=!0){var s=n.value;s.endTime=a}}catch(e){r=!0,i=e}finally{try{!e&&t.return&&t.return()}finally{if(r)throw i}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();e.default=i},{}],37:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t "+e}function a(t){var r=window.console[t];return r?function(){for(var a=arguments.length,e=Array(a),i=0;a>i;i++)e[i]=arguments[i];e[0]&&(e[0]=n(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];n.forEach(function(e){t[e]=r[e]?r[e].bind(r):a(e)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=i;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=i}}else t=i},r.logger=t},{}],39:[function(r,t,i){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var l=null,o=null,a=/^([^#]*)(.*)$/.exec(t);a&&(o=a[2],t=a[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(l=s[2],t=s[1]);var f=/^([^#]*)(.*)$/.exec(r);f&&(r=f[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var i=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(r);if(!i)throw new Error("Error trying to parse base URL.");var h=i[2]||"",d=i[1]||"",c=i[4],n=null;return n=/^\/\//.test(t)?h+"//"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+"/"+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),l&&(n+=l),o&&(n+=o),n},buildAbsolutePath:function(a,s){for(var i,e,o=s,n="",t=a.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+i)i=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,n=(n+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return n+t.substr(r)}};t.exports=e},{}],40:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t=200&&300>r?(window.clearTimeout(this.timeoutHandle),t.tload=performance.now(),this.onSuccess(i,t)):t.retrye||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,a,n,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],i(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),e.apply(this,a)}else if(r(e))for(a=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,n=0;u>n;n++)o[n].apply(this,a);return!0},e.prototype.addListener=function(a,n){var s;if(!t(n))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,t(n.listener)?n.listener:n),this._events[a]?r(this._events[a])?this._events[a].push(n):this._events[a]=[this._events[a],n]:this._events[a]=n,r(this._events[a])&&!this._events[a].warned&&(s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[a].length>s&&(this._events[a].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(i,e){function r(){this.removeListener(i,r),a||(a=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var a=!1;return r.listener=e,this.on(i,r),this},e.prototype.removeListener=function(a,i){var e,s,o,n;if(!t(i))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(e=this._events[a],o=e.length,s=-1,e===i||t(e.listener)&&e.listener===i)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,i);else if(r(e)){for(n=o;n-- >0;)if(e[n]===i||e[n].listener&&e[n].listener===i){s=n;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[a]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",a,i)}return this},e.prototype.removeAllListeners=function(r){var i,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(i in this._events)"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(n,i,s){var a=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;i.exports=function(l){for(var i,s=Object.keys(r),n=0,d=s.length;d>n;n++){var o=s[n],u=r[o].exports;if(u===l||u.default===l){i=o;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},n=0,d=s.length;d>n;n++){var o=s[n];f[o]=o}e[i]=[Function(["require","module","exports"],"("+l+")(self)"),f]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[i]=i,e[h]=[Function(["require"],"var f = require("+t(i)+");(f.default ? f.default : f)(self);"),c];var g="("+a+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(h)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(v.createObjectURL(new Blob([g],{type:"text/javascript"})))}},{}],3:[function(e,m,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 g(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)}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;t500*e.duration){var f=Math.max(1,1e3*e.loaded/u);e.expectedLens){var l=void 0,r=void 0;for(r=e.level-1;r>=0&&(l=e.duration*a.levels[r].bitrate/(6.4*f),i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+d.toFixed(1)+"/"+s.toFixed(1)+"/"+l.toFixed(1)),!(s>l));r--);d>l&&(r=Math.max(0,r),a.nextLoadLevel=r,this.bwEstimator.sample(u,e.loaded),i.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),a.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(e){var t=e.stats;void 0===t.aborted&&1===e.frag.loadCounter&&this.bwEstimator.sample(performance.now()-t.trequest,t.loaded),this.clearTimer(),this.lastLoadedFragLevel=e.frag.level,this._nextAutoLevel=-1}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var e,r,i=this.hls,t=i.levels,a=i.config;if(r=-1===this._autoLevelCapping&&t&&t.length?t.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,r);var n=this.bwEstimator.getEstimate(),s=void 0;for(e=0;r>=e;e++)if(s=e<=this.lastLoadedFragLevel?a.abrBandWidthFactor*n:a.abrBandWidthUpFactor*n,sn.config.appendErrorMaxRetry)return t.logger.log("fail "+n.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),a=[],i.fatal=!0,void n.trigger(e.default.ERROR,i);i.fatal=!1,n.trigger(e.default.ERROR,i)}else a=[],i.details=r.ErrorDetails.BUFFER_FULL_ERROR,n.trigger(e.default.ERROR,i)}}}}},{key:"flushBuffer",value:function(l,s){var e,r,o,n,i,a;if(this.flushBufferCounter.5)return this.flushBufferCounter++,t.logger.log("flush "+u+" ["+i+","+a+"], of ["+o+","+n+"], pos:"+this.media.currentTime),e.remove(i,a),!1}else t.logger.warn("abort flushing too many retries");return t.logger.log("buffer flushed"),!0}}]),i}(s.default);a.default=o},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(e,h,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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 f(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)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;tthis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(n){var r=void 0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,i=0,a=0;for(e=0;n>=e&&(t=this.levels[e],r=e,i=t.width,a=t.height,!(i>=s||a>=o));e++);return r}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}},{key:"mediaWidth",get:function(){var e=void 0;return this.media&&(e=this.media.width||this.media.clientWidth||this.media.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0;return this.media&&(e=this.media.height||this.media.clientHeight||this.media.offsetHeight,e*=this.contentScaleFactor),e}}]),e}(s.default);t.default=u},{"../event-handler":22,"../events":23}],6:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t=0&&ie&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this._manualLevel?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,-1===this._manualLevel&&(this.hls.abrController.nextAutoLevel=e)}}]),i}(f.default);a.default=o},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(a,A,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 g(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)}Object.defineProperty(o,"__esModule",{value:!0});var m=function(){function e(i,r){for(var t=0;t1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var _,l,n,E=this,f=this.hls,o=f.config;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:var b=f.startLevel;-1===b&&(b=0,this.fragBitrateTest=!0),this.level=f.nextLoadLevel=b,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!this.media&&(this.startFragRequested||!o.startFragPrefetch))break;_=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition,l=f.nextLoadLevel;var h,R=s.default.bufferInfo(this.media,_,o.maxBufferHole),T=R.len,u=R.end,c=this.fragPrevious;if(this.levels[l].hasOwnProperty("bitrate")?(h=Math.max(8*o.maxBufferSize/this.levels[l].bitrate,o.maxBufferLength),h=Math.min(h,o.maxMaxBufferLength)):h=o.maxBufferLength,h>T){if(f.nextLoadLevel=l,this.level=l,n=this.levels[l].details,"undefined"==typeof n||n.live&&this.levelLastLoaded!==l){this.state=e.WAITING_LEVEL;break}var d=n.fragments,g=d.length,v=d[0].start,y=d[g-1].start+d[g-1].duration,a=void 0;if(n.live){var S=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*n.targetduration;if(uy)break;if(this.startFragRequested&&!n.PTSKnown){if(c){var m=c.sn+1;m>=n.startSN&&m<=n.endSN&&(a=d[m-n.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+a.sn))}a||(a=d[Math.min(g-1,Math.round(g/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+a.sn))}}else v>u&&(a=d[0]);if(a||!function(){var i=void 0,s=o.maxFragLookUpTolerance;y>u?(u>y-s&&(s=0),i=p.default.search(d,function(e){return e.start+e.duration-s<=u?1:e.start-s>u?-1:0})):i=d[g-1],i&&(a=i,v=i.start,c&&a.level===c.level&&a.sn===c.sn&&(a.sn1&&(a.expectedLen=Math.round(a.duration*this.levels[l].bitrate/8),a.trequest=performance.now()),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,a.loadCounter){a.loadCounter++;var A=o.fragLoadingLoopThreshold;if(a.loadCounter>A&&Math.abs(this.fragLoadIdx-a.loadIdx)=L||O)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(i){var e,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],i>=t.start&&i<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){var i=this.media;if(i)for(var t=i.buffered,e=0;e=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,i=this.media;if(i&&i.seeking===!1&&(e=i.currentTime,e>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var a=t.frag;a!==this.fragPlaying&&(this.fragPlaying=a,this.hls.trigger(r.default.FRAG_CHANGED,{frag:a}))}}},{key:"immediateLevelSwitch",value:function(){t.logger.log("immediateLevelSwitch"),this.immediateSwitch||(this.immediateSwitch=!0,this.previouslyPaused=this.media.paused,this.media.pause());var i=this.fragCurrent;i&&i.loader&&i.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;var e=this.media;e&&e.readyState&&(e.currentTime-=1e-4,this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var t=this.media;if(t&&t.readyState){var n=void 0,a=void 0,i=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,a=this.getBufferRange(t.currentTime),a&&a.start>1&&(this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:a.start-1})),t.paused)n=0;else{var l=this.hls.nextLoadLevel,u=this.levels[l],o=this.fragLastKbps;n=o&&this.fragCurrent?this.fragCurrent.duration*u.bitrate/(1e3*o)+1:0}if(i=this.getBufferRange(t.currentTime+n),i&&(i=this.followingBufferRange(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:i.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(t){var e=this.media=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),this.levels&&this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),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=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){if(this.state===e.FRAG_LOADING){if(0===s.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var r=this.fragCurrent;r&&(r.loader&&r.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=e.IDLE}}else this.state===e.ENDED&&(this.state=e.IDLE);this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){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(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,i=!1,a=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(i=!0),-1!==e.indexOf("mp4a.40.5")&&(a=!0))}),this.audioCodecSwitch=i&&a,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1,this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onLevelLoaded",value:function(s){var i=s.details,a=s.level,o=this.levels[a],l=i.totalduration,n=0;if(t.logger.log("level "+a+" loaded ["+i.startSN+","+i.endSN+"],duration:"+l),this.levelLastLoaded=a,i.live){var d=o.details;d?(u.default.mergeDetails(d,i),n=i.fragments[0].start,i.PTSKnown?t.logger.log("live playlist sliding:"+n.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(i.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else i.PTSKnown=!1;if(o.details=i,this.hls.trigger(r.default.LEVEL_UPDATED,{details:i,level:a}),this.startFragRequested===!1){if(i.live){var f=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*i.targetduration;this.startPosition=Math.max(0,n+l-f)}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(a){var i=this.fragCurrent;if(this.state===e.FRAG_LOADING&&i&&a.frag.level===i.level&&a.frag.sn===i.sn)if(t.logger.log("Loaded "+i.sn+" of level "+i.level),this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,a.stats.tparsed=a.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:a.stats,frag:i});else{this.state=e.PARSING,this.stats=a.stats;var s=this.levels[this.level],o=s.details,f=o.totalduration,h=void 0!==i.startDTS?i.startDTS:i.start,l=i.level,u=i.sn,n=s.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===n&&(n=this.lastAudioCodec),n&&(n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l);var d=this.demuxer;d&&d.push(a.payload,n,s.videoCodec,h,i.cc,l,u,f,i.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(l){if(this.state===e.PARSING){var o,i,a=l.tracks;if(i=a.audio){var n=this.levels[this.level].audioCodec,u=navigator.userAgent.toLowerCase();n&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===u.indexOf("firefox")&&(n="mp4a.40.5"),-1!==u.indexOf("android")&&(n="mp4a.40.2",t.logger.log("Android: force audio codec to"+n)),i.levelCodec=n}if(i=a.video,i&&(i.levelCodec=this.levels[this.level].videoCodec),l.unique){var s={codec:"",levelCodec:""};for(o in l.tracks)i=a[o],s.container=i.container,s.codec&&(s.codec+=",",s.levelCodec+=","),i.codec&&(s.codec+=i.codec),i.levelCodec&&(s.levelCodec+=i.levelCodec);a={audiovideo:s}}this.hls.trigger(r.default.BUFFER_CODECS,a);for(o in a){i=a[o],t.logger.log("track:"+o+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var d=i.initSegment;d&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:o,data:d}))}this.tick()}}},{key:"onFragParsingData",value:function(i){var o=this;if(this.state===e.PARSING){this.tparse2=Date.now();var a=this.levels[this.level],n=this.fragCurrent;t.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb);var l=u.default.updateFragPTSDTS(a.details,n.sn,i.startPTS,i.endPTS,i.startDTS,i.endDTS),s=this.hls;s.trigger(r.default.LEVEL_PTS_UPDATED,{details:a.details,level:this.level,drift:l}),[i.data1,i.data2].forEach(function(e){e&&(o.pendingAppending++,s.trigger(r.default.BUFFER_APPENDING,{type:i.type,data:e}))}),this.nextLoadPosition=i.endPTS,this.bufferRange.push({type:i.type,start:i.startPTS,end:i.endPTS,frag:n}),this.tick()}else t.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var a=this.fragCurrent,i=this.stats;a&&(this.fragPrevious=a,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i,frag:a}),t.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=e.IDLE),this.tick()}}},{key:"onError",value:function(a){switch(a.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!a.fatal){var n=this.fragLoadError;if(n?n++:n=1,n<=this.config.fragLoadingMaxRetry){this.fragLoadError=n,a.frag.loadCounter=0;var s=Math.min(Math.pow(2,n-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+a.details+" reaches max retry, redispatch as fatal ..."),a.fatal=!0,this.hls.trigger(r.default.ERROR,a),this.state=e.ERROR}break;case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=a.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+a.details+" while loading frag,switch to "+this.state+" state ..."));break;case i.ErrorDetails.BUFFER_FULL_ERROR:this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError"),this.nextLevelSwitch()}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e){var v=e.readyState;if(v){var a,n,d=this.seekAfterBuffered;if(d)e.duration>=d&&(a=d,this.seekAfterBuffered=void 0);else{n=e.currentTime;var p=this.loadedmetadata;!p&&e.buffered.length&&(this.loadedmetadata=!0,n||n===this.startPosition||(a=this.startPosition))}a&&(n=a,t.logger.log("target seek position:"+a));var l=s.default.bufferInfo(e,n,0),m=!(e.paused||e.ended||e.seeking||0===e.buffered.length),f=.4,h=n>e.playbackRate*this.lastCurrentTime;if(this.stalled&&h&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+n)),m&&l.len<=f){if(h?(f=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+n),this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),l.len<=f){var o=l.nextStart,c=o-n;if(o&&c0&&!e.seeking){t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration);var y=o+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:y})}}}else{var g=e.currentTime;if(a&&g!==a){if(0===l.len){var u=l.nextStart;void 0!==u&&u-ae;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),a}(l.default);o.default=f},{"../demux/demuxer":17,"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../helper/level-helper":25,"../utils/binary-search":35,"../utils/logger":38}],9:[function(t,g,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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 s(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)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;te;e++)c[(a[e]=e<<1^283*(e>>7))^e]=e;for(i=r=0;!h[i];i^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,h[i]=t,g[t]=i,d=a[f=a[u=a[i]]],l=16843009*d^65537*f^257*u^16843008*i,s=257*a[t]^16843008*t,e=0;4>e;e++)n[e][i]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)n[e]=n[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var h,v,g,n,e=this._key[1],t=R^e[0],i=b^e[1],a=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],f=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(n=0;y>n;n++)h=f[t>>>24]^d[i>>16&255]^u[a>>8&255]^l[255&r]^e[s],v=f[i>>>24]^d[a>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],g=f[a>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&i]^e[s+2],r=f[r>>>24]^d[t>>16&255]^u[i>>8&255]^l[255&a]^e[s+3],s+=4,t=h,i=v,a=g;for(n=0;4>n;n++)E[(3&-n)+m]=c[t>>>24]<<24^c[i>>16&255]<<16^c[a>>8&255]<<8^c[255&r]^e[s++],h=t,t=i,i=a,a=r,r=h}}]),e}();e.default=i},{}],11:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t>8|e>>>24}},{key:"doDecrypt",value:function(i,v,a){var u,h,o,f,l,c,d,n,e,r=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),p=new s.default(Array.prototype.slice.call(v)),g=new Uint8Array(i.byteLength),t=new Int32Array(g.buffer);for(u=~~a[0],h=~~a[1],o=~~a[2],f=~~a[3],e=0;ee&&(255!==t[e]||240!==(240&t[e+1]));e++);for(r.audiosamplerate||(a=o.default.getAudioConfig(this.observer,t,e,p),r.config=a.config,r.audiosamplerate=a.samplerate,r.channelCount=a.channelCount,r.codec=a.codec,r.duration=y,l.logger.log("parsed codec:"+r.codec+",rate:"+a.samplerate+",nb channel:"+a.channelCount)),c=0,v=9216e4/r.audiosamplerate;u>e+5&&(s=1&t[e+1]?7:9,n=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5,n-=s,n>0&&u>=e+s+n);)for(f=h+c*v,g={unit:t.subarray(e+s,e+s+n),pts:f,dts:f},r.samples.push(g),r.len+=n,e+=n+s,c++;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);this.remuxer.remux(this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:d.payload}]},{samples:[]},m)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,a=new i.default(t);if(a.hasTimeStamp)for(e=a.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();t.default=s},{"../demux/id3":19,"../utils/logger":38,"./adts":14}],14:[function(e,o,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void h.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,n.logger.log("manifest codec:"+a+",ADTS data:type:"+i+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==f.indexOf("firefox")?e>=6?(i=5,t=new Array(4),s=e-3):(i=2,t=new Array(2),s=e):-1!==f.indexOf("android")?(i=2,t=new Array(2),s=e):(i=5,t=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&e>=6?s=e-3:((a&&-1!==a.indexOf("mp4a.40.2")&&e>=6&&1===o||!a&&1===o)&&(i=2,t=new Array(2)),s=e)),t[0]=i<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===i&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+i})}}]),e}();t.default=s},{"../errors":21,"../utils/logger":38}],15:[function(e,y,i){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t1?r-1:0),e=1;r>e;e++)a[e-1]=arguments[e];t.emit.apply(t,[i,i].concat(a))},t.off=function(a){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.removeListener.apply(t,[a].concat(i))},r.addEventListener("message",function(i){var e=i.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.typeSupported);break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}}),t.on(e.default.FRAG_PARSING_INIT_SEGMENT,function(t,e){r.postMessage({event:t,tracks:e.tracks,unique:e.unique})}),t.on(e.default.FRAG_PARSING_DATA,function(i,e){var t={event:i,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,data1:e.data1.buffer,data2:e.data2.buffer,nb:e.nb};r.postMessage(t,[t.data1,t.data2])}),t.on(e.default.FRAG_PARSED,function(e){r.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){r.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)}),t.on(e.default.FRAG_PARSING_USERDATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)})};i.default=o},{"../demux/demuxer-inline":15,"../events":23,events:1}],17:[function(t,v,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new l.default(this.hls));var d=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){d.pushDecrypted(e,r,i,a,n,s,o,u)})}else this.pushDecrypted(t,r,i,a,n,s,o,u)}},{key:"onWorkerMessage",value:function(i){var t=i.data;switch(t.event){case e.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(e.default.FRAG_PARSING_INIT_SEGMENT,r);break;case e.default.FRAG_PARSING_DATA:this.hls.trigger(e.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb});break;case e.default.FRAG_PARSING_METADATA:this.hls.trigger(e.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case e.default.FRAG_PARSING_USERDATA:this.hls.trigger(e.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),r}();i.default=o},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../events":23,"../utils/logger":38,webworkify:2}],18:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(i,r){for(var t=0;te?(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){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&a.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))return this.word<<=e,this.bitsAvailable-=e,e;return this.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(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(a){var t,i,r=8,e=8;for(t=0;a>t;t++)0!==e&&(i=this.readEG(),e=(r+i+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,v,p,l,a,n,i,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),v=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){var g=this.readUEG();if(3===g&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==g?8:12,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(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),a=this.readUEG(),n=this.readUEG(),i=this.readBits(1),0===i&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(a+1)-2*s-2*d)*c),height:(2-i)*(n+1)*16-(i?2:4)*(f+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=n},{"../utils/logger":38}],19:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tr);return t}},{key:"_parseID3Frames",value:function(r,t,n){for(var a,s,o,l,i;n>=t+8;)switch(a=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,a){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,i=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(i+=47721858.84),i=Math.round(i),e.logger.trace("ID3 timestamp found: "+i),this._timeStamp=i}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),t}();t.default=n},{"../utils/logger":38}],20:[function(t,g,a){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;tt;t+=188)if(71===i[t]){if(d=!!(64&i[t+1]),u=((31&i[t+1])<<8)+i[t+2],y=(48&i[t+3])>>4,y>1){if(a=t+5+i[t+4],a===t+188)continue}else a=t+4;if(v)if(u===h){if(d){if(s&&(this._parseAVCPES(this._parsePES(s)),b&&this._avcTrack.codec&&(-1===f||this._aacTrack.codec)))return void this.remux(i);s={data:[],size:0}}s&&(s.data.push(i.subarray(a,t+188)),s.size+=t+188-a)}else if(u===f){if(d){if(o&&(this._parseAACPES(this._parsePES(o)),b&&this._aacTrack.codec&&(-1===h||this._avcTrack.codec)))return void this.remux(i);o={data:[],size:0}}o&&(o.data.push(i.subarray(a,t+188)),o.size+=t+188-a)}else u===_&&(d&&(l&&this._parseID3PES(this._parsePES(l)),l={data:[],size:0}),l&&(l.data.push(i.subarray(a,t+188)),l.size+=t+188-a));else d&&(a+=i[a]+1),0===u?this._parsePAT(i,a):u===this._pmtId?(this._parsePMT(i,a),v=this.pmtParsed=!0,h=this._avcTrack.id,f=this._aacTrack.id,_=this._id3Track.id,g&&(e.logger.log("reparse from beginning"),g=!1,t=-188)):(e.logger.log("unknown PID found before PAT/PMT"),g=!0)}else this.observer.trigger(n.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s&&this._parseAVCPES(this._parsePES(s)),o&&this._parseAACPES(this._parsePES(o)),l&&this._parseID3PES(this._parsePES(l)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(r,t){var a,n,s,i;for(a=(15&r[t+1])<<8|r[t+2],n=t+3+a-4,s=(15&r[t+10])<<8|r[t+11],t+=12+s;n>t;){switch(i=(31&r[t+1])<<8|r[t+2],r[t]){case 15:this._aacTrack.id=i;break;case 21:this._id3Track.id=i;break;case 27:this._avcTrack.id=i;break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}}},{key:"_parsePES",value:function(o){var e,n,h,d,u,l,i,r,t,f=0,s=o.data;if(e=s[0],h=(e[0]<<16)+(e[1]<<8)+e[2],1===h){for(d=(e[4]<<8)+e[5],n=e[7],192&n&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,i>4294967295&&(i-=8589934592),64&n?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=i),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var a=e.byteLength;if(t){if(t>a){t-=a;continue}e=e.subarray(t),a-=t,t=0}l.set(e,f),f+=a}return{data:l,pts:i,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(i){var t,m,n,o,y=this,r=this._avcTrack,u=r.samples,p=this._parseAVCNALu(i.data),d=[],l=!1,c=!1,f=0;if(0===p.length&&u.length>0){var g=u[u.length-1],h=g.units.units[g.units.units.length-1],v=new Uint8Array(h.data.byteLength+i.data.byteLength);v.set(h.data,0),v.set(i.data,h.data.byteLength),h.data=v,g.units.length+=i.data.byteLength,r.len+=i.data.byteLength}i.data=null;var a="",E=function(){d.length&&((c===!0||r.sps&&(u.length||this.contiguous))&&(m={units:{units:d,length:f},pts:i.pts,dts:i.dts,key:c},u.push(m),r.len+=f,r.nbNalu+=d.length),d=[],f=0)};p.forEach(function(e){switch(e.type){case 1:n=!0,l&&(a+="NDR ");break;case 5:n=!0,l&&(a+="IDR "),c=!0;break;case 6:n=!0,l&&(a+="SEI "),t=new s.default(e.data),t.readUByte();var b=t.readUByte();if(4===b){var v=0;do v=t.readUByte();while(255===v);var A=t.readUByte();if(181===A){var R=t.readUShort();if(49===R){var L=t.readUInt();if(1195456820===L){var T=t.readUByte();if(3===T){var g=t.readUByte(),_=t.readUByte(),S=31&g,h=[g,_];for(o=0;S>o;o++)h.push(t.readUByte()),h.push(t.readUByte()),h.push(t.readUByte());y._txtTrack.samples.push({type:3,pts:i.pts,bytes:h})}}}}}break;case 7:if(n=!0,l&&(a+="SPS "),!r.sps){t=new s.default(e.data);var p=t.readSPS();r.width=p.width,r.height=p.height,r.sps=[e.data],r.duration=y._duration;var k=e.data.subarray(1,4),m="avc1.";for(o=0;3>o;o++){var u=k[o].toString(16);u.length<2&&(u="0"+u),m+=u}r.codec=m}break;case 8:n=!0,l&&(a+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:n=!1,l&&(a+="AUD "),E();break;default:n=!1,a+="unknown NAL "+e.type+" "}n&&(d.push(e),f+=e.data.byteLength)}),(l||a.length)&&e.logger.log(a),E()}},{key:"_parseAVCNALu",value:function(r){for(var s,i,l,_,n,d,t=0,v=r.byteLength,e=this.avcNaluState,g=[];v>t;)switch(s=r[t++],e){case 0:0===s&&(e=1);break;case 1:e=0===s?2:0;break;case 2:case 3:if(0===s)e=3;else if(1===s&&v>t){if(_=31&r[t],n)l={data:r.subarray(n,t-e-1),type:d},g.push(l);else{var a=this.avcNaluState;if(a&&4-a>=t){var m=this._avcTrack,c=m.samples;if(c.length){var p=c[c.length-1],R=p.units.units,u=R[R.length-1];u.state&&(u.data=u.data.subarray(0,u.data.byteLength-a),p.units.length-=a,m.len-=a)}}if(i=t-e-1,i>0){var y=this._avcTrack,h=y.samples;if(h.length){var E=h[h.length-1],b=E.units.units,o=b[b.length-1],f=new Uint8Array(o.data.byteLength+i);f.set(o.data,0),f.set(r.subarray(0,i),o.data.byteLength),o.data=f,E.units.length+=i,y.len+=i}}}n=t,d=_,e=0}else e=0}return n&&(l={data:r.subarray(n,v),type:d,state:e},g.push(l),this.avcNaluState=e),g}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,f,s,_,a=this._aacTrack,i=R.data,g=R.pts,k=0,L=this._duration,A=this.audioCodec,u=this.aacOverFlow,b=this.aacLastPTS;if(u){var m=new Uint8Array(u.byteLength+i.byteLength);m.set(u,0),m.set(i,u.byteLength),i=m}for(t=k,s=i.length;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);if(t){var y,h;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,h=!1):(y="no ADTS header found in AAC PES",h=!0),this.observer.trigger(n.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:y}),h)return}if(a.audiosamplerate||(l=c.default.getAudioConfig(this.observer,i,t,A),a.config=l.config,a.audiosamplerate=l.samplerate,a.channelCount=l.channelCount,a.codec=l.codec,a.duration=L,e.logger.log("parsed codec:"+a.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/a.audiosamplerate,u&&b){var v=b+p;Math.abs(v-g)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((v-g)/90)),g=v)}for(;s>t+5&&(d=1&i[t+1]?7:9,o=(3&i[t+3])<<11|i[t+4]<<3|(224&i[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(f=g+E*p,_={unit:i.subarray(t+d,t+d+o),pts:f,dts:f},a.samples.push(_),a.len+=o,t+=o+d,E++;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);u=s>t?i.subarray(t,s):null,this.aacOverFlow=u,this.aacLastPTS=f}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),t}();a.default=o},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.ErrorDetails={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",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],22:[function(e,f,t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d=function(){function e(i,r){for(var t=0;t1?r-1:0),t=1;r>t;t++)i[t-1]=arguments[t];this.handledEvents=i,this.useGenericHandler=!0,this.registerListeners()}return d(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===n(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var i=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{i.call(this,e,t).call()}catch(t){o.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(s.default.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=l},{"./errors":21,"./events":23,"./utils/logger":38}],23:[function(t,e,r){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",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_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",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",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded"}},{}],24:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;td&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=a=i;e=n&&f>i)l=n,a=f,o=a-i;else if(n>i+s){h=n;break}}return{len:o,start:l,end:a,nextStart:h}}}]),e}();e.default=i},{}],25:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;th)return void(i.PTSKnown=!1);for(var r=c;h>=r;r++){var o=f[u+r],n=l[r];d=o.cc-n.cc,isNaN(o.startPTS)||(n.start=n.startPTS=o.startPTS,n.endPTS=o.endPTS,n.duration=o.duration,a=n)}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r=0&&ui.endSN)return 0;o=u-i.startSN,n=i.fragments,e=n[o],isNaN(e.startPTS)||(a=Math.min(a,e.startPTS),s=Math.max(s,e.endPTS),l=Math.min(l,e.startDTS),d=Math.max(d,e.endDTS));var f=a-e.start;for(e.start=e.startPTS=a,e.endPTS=s,e.startDTS=l,e.endDTS=d,e.duration=s-a,r=o;r>0;r--)t.updatePTS(n,r,r-1);for(r=o;ri?r.start=t.start+t.duration:r.start=t.start-r.duration:a>i?(t.duration=n-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-n,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=n},{"../utils/logger":38}],26:[function(t,I,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t1?t-1:0),e=1;t>e;e++)a[e-1]=arguments[e];i.emit.apply(i,[r,r].concat(a))},i.off=function(a){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];i.removeListener.apply(i,[a].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),this.playlistLoader=new d.default(this),this.fragmentLoader=new h.default(this),this.levelController=new R.default(this),this.abrController=new r.abrController(this),this.bufferController=new r.bufferController(this),this.capLevelController=new r.capLevelController(this),this.streamController=new r.streamController(this),this.timelineController=new r.timelineController(this),this.keyLoader=new p.default(this)}return n(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"Events",get:function(){return i.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,debug:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,abrController:g.default,bufferController:P.default,capLevelController:m.default,streamController:b.default,timelineController:L.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1,abrEwmaFast:0,abrEwmaSlow:0,abrBandWidthFactor:.8,abrBandWidthUpFactor:.7}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),n(t,[{key:"destroy",value:function(){e.logger.log("destroy"),this.trigger(i.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.streamController.destroy(),this.timelineController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){e.logger.log("attachMedia"),this.media=t,this.trigger(i.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){e.logger.log("detachMedia"),this.trigger(i.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){e.logger.log("loadSource:"+t),this.url=t,this.trigger(i.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0];e.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t)}},{key:"stopLoad",value:function(){e.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad()}},{key:"swapAudioCodec",value:function(){e.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){e.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){e.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){e.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){e.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){e.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){e.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){e.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}}]),t}();a.default=l},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":7,"./controller/stream-controller":8,"./controller/timeline-controller":9,"./errors":21,"./events":23,"./loader/fragment-loader":28,"./loader/key-loader":29,"./loader/playlist-loader":30,"./utils/logger":38,"./utils/xhr-loader":40,events:1}],27:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":26}],28:[function(r,c,i){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(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 s(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)}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(L,s,A){var e,b,u,n,g=0,o=0,i={url:s,fragments:[],live:!0,startSN:0},r={method:null,key:null,iv:null,uri:null},y=0,d=null,t=null;for(b=/(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*)[\r\n]+([^#|\r\n]+)?)/g;null!==(e=b.exec(L));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"MEDIA-SEQUENCE":g=i.startSN=parseInt(e[1]);break;case"TARGETDURATION":i.targetduration=parseFloat(e[1]);break;case"ENDLIST":i.live=!1;break;case"DIS":y++;break;case"BYTERANGE":var h=e[1].split("@");n=1===h.length?u:parseInt(h[1]),u=parseInt(h[0])+n,t&&!t.url&&(t.byteRangeStartOffset=n,t.byteRangeEndOffset=u,t.url=this.resolve(e[2],s));break;case"INF":var c=parseFloat(e[1]);if(!isNaN(c)){var f,m=g++;if(r.method&&r.uri&&!r.iv){f=this.cloneObj(r);for(var E=new Uint8Array(16),l=12;16>l;l++)E[l]=m>>8*(15-l)&255;f.iv=E}else f=r;var k=e[2]?this.resolve(e[2],s):null;t={url:k,duration:c,start:o,sn:m,level:A,cc:y,byteRangeStartOffset:n,byteRangeEndOffset:u,decryptdata:f,programDateTime:d},i.fragments.push(t),o+=c,n=null,d=null}break;case"KEY":var R=e[1],v=new a.default(R),p=v.enumeratedString("METHOD"),_=v.URI,T=v.hexadecimalInteger("IV");p&&(r={method:null,key:null,iv:null,uri:null},_&&"AES-128"===p&&(r.method=p,r.uri=this.resolve(_,s),r.key=null,r.iv=T));break;case"PROGRAM-DATE-TIME":d=new Date(Date.parse(e[1])),t&&!t.url&&e.length>=3&&(t.url=this.resolve(e[2],s),t.programDateTime=d)}return t&&!t.url&&(i.fragments.pop(),o-=t.duration),i.totalduration=o,i.endSN=g-1,i}},{key:"loadsuccess",value:function(u,i){var s,o=u.currentTarget,n=o.responseText,r=o.responseURL,l=this.id,d=this.id2,a=this.hls;if(this.loading=!1,void 0===r&&(r=this.url),i.tload=performance.now(),i.mtime=new Date(o.getResponseHeader("Last-Modified")),0===n.indexOf("#EXTM3U"))if(n.indexOf("#EXTINF:")>0)if(null===this.id)a.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r}],url:r,stats:i});else{var f=this.parseLevelPlaylist(n,r,l);i.tparsed=performance.now(),a.trigger(t.default.LEVEL_LOADED,{details:f,level:l,id:d,stats:i})}else s=this.parseMasterPlaylist(n,r),s.length?a.trigger(t.default.MANIFEST_LOADED,{levels:s,url:r,stats:i}):a.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"});else a.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(a){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_ERROR,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,response:a.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),r}(n.default);s.default=u},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/url":39}],31:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(a,4),r=0,e=8;n>r;r++)t.set(i[r],e),e+=i[r].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return r*=t,e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))}},{key:"mvex",value:function(r){for(var t=r.length,i=[];t--;)i[t]=e.trex(r[t]);return e.box.apply(null,[e.types.mvex].concat(i))}},{key:"mvhd",value:function(t,r){r*=t;var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,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 e.box(e.types.mvhd,i)}},{key:"sdtp",value:function(n){var r,t,i=n.samples||[],a=new Uint8Array(4+i.length);for(t=0;t>>8&255),i.push(255&n),i=i.concat(Array.prototype.slice.call(a));for(r=0;r>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(a));var u=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=t.height;return e.box(e.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,o>>8&255,255&o,l>>8&255,255&l,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value: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]))}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,n=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,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,a>>8&255,255&a,0,0,n>>8&255,255&n,0,0]))}},{key:"traf",value:function(i,t){var a=e.sdtp(i),r=i.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(i,a.length+16+16+8+16+8+8),a)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(h,o){var i,a,n,s,t,l,d=h.samples||[],r=d.length,f=12+16*r,u=new Uint8Array(f);for(o+=8+f,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),i=0;r>i;i++)a=d[i],n=a.duration,s=a.size,t=a.flags,l=a.cts,u.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(i){e.types||e.init();var t,r=e.moov(i);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=i},{}],32:[function(i,h,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;tMath.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};i.timescale=i.audiosamplerate/e(i.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+i.timescale),l.audio={container:"audio/mp4",codec:i.codec,initSegment:r.default.initSegment([i]),metadata:{channelCount:i.channelCount}},u&&(n=o=g[0].pts-f*h)),a.sps&&a.pps&&d.length&&(a.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:a.codec,initSegment:r.default.initSegment([a]),metadata:{width:a.width,height:a.height}},u&&(n=Math.min(n,d[0].pts-f*h),o=Math.min(o,d[0].dts-f*h))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,u&&(this._initPTS=n,this._initDTS=o)):c.trigger(t.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(a,w,S){var L,s,p,A,f,d,T,k,R,g,_,v,o,i,n,E=8,c=this.PES_TIMESCALE,h=this.PES2MP4SCALEFACTOR,u=[];for(d=new Uint8Array(a.len+4*a.nbNalu+8),L=new DataView(d.buffer),L.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4);a.samples.length;){for(s=a.samples.shift(),A=0;s.units.units.length;)f=s.units.units.shift(),L.setUint32(E,f.data.byteLength),E+=4,d.set(f.data,E),E+=f.data.byteLength,A+=4+f.data.byteLength;if(_=s.pts-this._initDTS,v=s.dts-this._initDTS,v=Math.min(_,v),void 0!==g){o=this._PTSNormalize(_,g),i=this._PTSNormalize(v,g);var m=(i-g)/h;0>=m&&(e.logger.log("invalid sample duration at PTS/DTS: "+s.pts+"/"+s.dts+":"+m),m=1),p.duration=m}else{var y=void 0,l=void 0;y=S?this.nextAvcDts:w*c,o=this._PTSNormalize(_,y),i=this._PTSNormalize(v,y),l=Math.round((i-y)/90),S&&l&&(l>1?e.logger.log("AVC:"+l+" ms hole between fragments detected,filling it"):-1>l&&e.logger.log("AVC:"+-l+" ms overlapping between fragments detected"),i=y,o=Math.max(o-l,i),e.logger.log("Video/PTS/DTS adjusted: "+o+"/"+i+",delta:"+l)),k=Math.max(0,o),R=Math.max(0,i)}p={size:A,duration:0,cts:(o-i)/h,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},n=p.flags,s.key===!0?(n.dependsOn=2,n.isNonSync=0):(n.dependsOn=1,n.isNonSync=1),u.push(p),g=i}var b=0;u.length>=2&&(b=u[u.length-2].duration,p.duration=b),this.nextAvcDts=i+b*h,a.len=0,a.nbNalu=0,u.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(n=u[0].flags,n.dependsOn=2,n.isNonSync=0),a.samples=u,T=r.default.moof(a.sequenceNumber++,R/h,a),a.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:T,data2:d,startPTS:k/c,endPTS:(o+h*b)/c,startDTS:R/c,endDTS:this.nextAvcDts/c,type:"video",nb:u.length})}},{key:"remuxAudio",value:function(i,D,S){var T,p,n,h,d,k,L,b,u,v,R,o,a,A=8,s=this.PES_TIMESCALE,w=i.timescale,f=s/w,E=1024*i.timescale/i.audiosamplerate,m=[],_=[];for(i.samples.sort(function(e,t){return e.pts-t.pts}),_=i.samples;_.length;){if(p=_.shift(),h=p.unit,v=p.pts-this._initDTS,R=p.dts-this._initDTS,void 0!==u)o=this._PTSNormalize(v,u),a=this._PTSNormalize(R,u),n.duration=(a-u)/f,Math.abs(n.duration-E)>E/10&&e.logger.log("invalid AAC sample duration at PTS "+Math.round(v/90)+",should be 1024,found :"+Math.round(n.duration*i.audiosamplerate/i.timescale)),n.duration=E,o=a=E*f+u;else{var c=void 0,l=void 0;if(c=S?this.nextAacPts:D*s,o=this._PTSNormalize(v,c),a=this._PTSNormalize(R,c),l=Math.round(1e3*(o-c)/s),S&&l){if(l>0)e.logger.log(l+" ms hole between AAC samples detected,filling it");else if(-12>l){e.logger.log(-l+" ms overlapping between AAC samples detected, drop frame"),i.len-=h.byteLength;continue}o=a=c}if(L=Math.max(0,o),b=Math.max(0,a),!(i.len>0))return;d=new Uint8Array(i.len+8),T=new DataView(d.buffer),T.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4)}d.set(h,A),A+=h.byteLength,n={size:h.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},m.push(n),u=a}var y=0,g=m.length;g>=2&&(y=m[g-2].duration,n.duration=y),g&&(this.nextAacPts=o+f*y,i.len=0,i.samples=m,k=r.default.moof(i.sequenceNumber++,b/f,i),i.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:k,data2:d,startPTS:L/s,endPTS:this.nextAacPts/s,startDTS:b/s,endDTS:(a+f*y)/s,type:"audio",nb:g}))}},{key:"remuxID3",value:function(r,a){var e,n=r.samples.length;if(n){for(var i=0;n>i;i++)e=r.samples[i],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{samples:r.samples})}r.samples=[],a=a}},{key:"remuxText",value:function(e,a){e.samples.sort(function(e,t){return e.pts-t.pts});var r,n=e.samples.length;if(n){for(var i=0;n>i;i++)r=e.samples[i],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],a=a}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),i}();a.default=d},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(a){for(var t,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=n.exec(a));){var e=t[2],i='"';0===e.indexOf(i)&&e.lastIndexOf(i)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=i},{}],35:[function(r,e,i){"use strict";var t={search:function(a,s){for(var t=0,r=a.length-1,e=null,i=null;r>=t;){e=(t+r)/2|0,i=a[e];var n=s(i);if(n>0)t=e+1;else{if(!(0>n))return i;r=e-1}}return null}};e.exports=t},{}],36:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t0;)e.removeCue(e.cues[0])}},{key:"push",value:function(r,i){this.cue||this._createCue();for(var a,t,e,s,o,u=31&i[0],n=2,l=0;u>l;l++)if(a=i[n++],t=127&i[n++],e=127&i[n++],s=0!==(4&a),o=3&a,(0!==t||0!==e)&&s&&0===o){if(32&t||64&t)this.cue.text+=this._fromCharCode(t)+this._fromCharCode(e);else if((17===t||25===t)&&e>=48&&63>=e)switch(e){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===t||25===t)&&e>=32&&47>=e)switch(e){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===t||28===t)&&e>=32&&47>=e)switch(e){case 32:this._clearActiveCues(r);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(r);break;case 42:break;case 43:break;case 44:this._clearActiveCues(r);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(r)}if((23===t||31===t)&&e>=33&&35>=e)switch(e){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(s){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var e=!0,i=!1,a=void 0;try{for(var n,t=this.memory[Symbol.iterator]();!(e=(n=t.next()).done);e=!0){var r=n.value;r.startTime=s,this._textTrack.addCue(r),this.display.push(r)}}catch(e){i=!0,a=e}finally{try{!e&&t.return&&t.return()}finally{if(i)throw a}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(n){var e=!0,r=!1,i=void 0;try{for(var a,t=this.display[Symbol.iterator]();!(e=(a=t.next()).done);e=!0){var s=a.value;s.endTime=n}}catch(e){r=!0,i=e}finally{try{!e&&t.return&&t.return()}finally{if(r)throw i}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();e.default=i},{}],37:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t "+e}function n(t){var r=window.console[t];return r?function(){for(var n=arguments.length,e=Array(n),i=0;n>i;i++)e[i]=arguments[i];e[0]&&(e[0]=a(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var i=arguments.length,a=Array(i>1?i-1:0),e=1;i>e;e++)a[e-1]=arguments[e];a.forEach(function(e){t[e]=r[e]?r[e].bind(r):n(e)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=i;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=i}}else t=i},r.logger=t},{}],39:[function(r,t,i){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var l=null,o=null,n=/^([^#]*)(.*)$/.exec(t);n&&(o=n[2],t=n[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(l=s[2],t=s[1]);var f=/^([^#]*)(.*)$/.exec(r);f&&(r=f[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var i=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(r);if(!i)throw new Error("Error trying to parse base URL.");var h=i[2]||"",d=i[1]||"",c=i[4],a=null;return a=/^\/\//.test(t)?h+"//"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+"/"+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),l&&(a+=l),o&&(a+=o),a},buildAbsolutePath:function(n,s){for(var i,e,o=s,a="",t=n.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+i)i=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,a=(a+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return a+t.substr(r)}};t.exports=e},{}],40:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t=200&&300>r?(window.clearTimeout(this.timeoutHandle),t.tload=performance.now(),this.onSuccess(i,t)):t.retry dist/hls.js", "postbuild": "npm run minify", - "prerelease": "npm run prebuild && npm run build && npm run postbuild && git add dist/* && git commit -m 'update dist'", + "prerelease": "npm run prebuild && npm run build && npm run postbuild && git add --ignore-errors dist/* && git commit -m 'update dist'", "patch": "npm run prerelease && mversion p", "minor": "npm run prerelease && mversion mi", "major": "npm run prerelease && mversion ma", diff --git a/dashboard-ui/bower_components/hls.js/src/controller/stream-controller.js b/dashboard-ui/bower_components/hls.js/src/controller/stream-controller.js index 624eeff84c..1bffcefe0d 100644 --- a/dashboard-ui/bower_components/hls.js/src/controller/stream-controller.js +++ b/dashboard-ui/bower_components/hls.js/src/controller/stream-controller.js @@ -764,7 +764,7 @@ class StreamController extends EventHandler { var currentLevel = this.levels[this.level], details = currentLevel.details, duration = details.totalduration, - start = fragCurrent.start, + start = fragCurrent.startDTS !== undefined ? fragCurrent.startDTS : fragCurrent.start, level = fragCurrent.level, sn = fragCurrent.sn, audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec; @@ -880,7 +880,7 @@ class StreamController extends EventHandler { logger.log(`parsed ${data.type},PTS:[${data.startPTS.toFixed(3)},${data.endPTS.toFixed(3)}],DTS:[${data.startDTS.toFixed(3)}/${data.endDTS.toFixed(3)}],nb:${data.nb}`); - var drift = LevelHelper.updateFragPTS(level.details,frag.sn,data.startPTS,data.endPTS), + var drift = LevelHelper.updateFragPTSDTS(level.details,frag.sn,data.startPTS,data.endPTS,data.startDTS,data.endDTS), hls = this.hls; hls.trigger(Event.LEVEL_PTS_UPDATED, {details: level.details, level: this.level, drift: drift}); @@ -1024,7 +1024,7 @@ _checkBuffer() { logger.log(`target seek position:${targetSeekPosition}`); } var bufferInfo = BufferHelper.bufferInfo(media,currentTime,0), - expectedPlaying = !(media.paused || media.ended || media.seeking || readyState < 2), + expectedPlaying = !(media.paused || media.ended || media.seeking || media.buffered.length === 0), jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end playheadMoving = currentTime > media.playbackRate*this.lastCurrentTime; diff --git a/dashboard-ui/bower_components/hls.js/src/demux/tsdemuxer.js b/dashboard-ui/bower_components/hls.js/src/demux/tsdemuxer.js index 4cede4eadf..8f24849430 100644 --- a/dashboard-ui/bower_components/hls.js/src/demux/tsdemuxer.js +++ b/dashboard-ui/bower_components/hls.js/src/demux/tsdemuxer.js @@ -37,14 +37,14 @@ switchLevel() { this.pmtParsed = false; this._pmtId = -1; - this.lastAacPTS = null; - this.aacOverFlow = null; this._avcTrack = {container : 'video/mp2t', type: 'video', id :-1, sequenceNumber: 0, samples : [], len : 0, nbNalu : 0}; this._aacTrack = {container : 'video/mp2t', type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0}; this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0}; this._txtTrack = {type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0}; // flush any partial content this.aacOverFlow = null; + this.aacLastPTS = null; + this.avcNaluState = 0; this.remuxer.switchLevel(); } @@ -344,6 +344,23 @@ pes.data = null; var debugString = ''; + var pushAccesUnit = function() { + if (units2.length) { + // only push AVC sample if keyframe already found in this fragment OR + // keyframe found in last fragment (track.sps) AND + // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous + if (key === true || + (track.sps && (samples.length || this.contiguous))) { + avcSample = {units: { units : units2, length : length}, pts: pes.pts, dts: pes.dts, key: key}; + samples.push(avcSample); + track.len += length; + track.nbNalu += units2.length; + } + units2 = []; + length = 0; + } + }; + units.forEach(unit => { switch(unit.type) { //NDR @@ -463,6 +480,7 @@ if(debug) { debugString += 'AUD '; } + pushAccesUnit(); break; default: push = false; @@ -477,25 +495,12 @@ if(debug || debugString.length) { logger.log(debugString); } - //build sample from PES - // Annex B to MP4 conversion to be done - if (units2.length) { - // only push AVC sample if keyframe already found in this fragment OR - // keyframe found in last fragment (track.sps) AND - // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous - if (key === true || - (track.sps && (samples.length || this.contiguous))) { - avcSample = {units: { units : units2, length : length}, pts: pes.pts, dts: pes.dts, key: key}; - samples.push(avcSample); - track.len += length; - track.nbNalu += units2.length; - } - } + pushAccesUnit(); } _parseAVCNALu(array) { - var i = 0, len = array.byteLength, value, overflow, state = 0; + var i = 0, len = array.byteLength, value, overflow, state = this.avcNaluState; var units = [], unit, unitType, lastUnitStart, lastUnitType; //logger.log('PES:' + Hex.hexDump(array)); while (i < len) { @@ -526,14 +531,37 @@ //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); units.push(unit); } else { + // lastUnitStart is undefined => this is the first start code found in this PES packet + // first check if start code delimiter is overlapping between 2 PES packets, + // ie it started in last packet (lastState not zero) + // and ended at the beginning of this PES packet (i <= 4 - lastState) + let lastState = this.avcNaluState; + if(lastState && (i <= 4 - lastState)) { + // start delimiter overlapping between PES packets + // strip start delimiter bytes from the end of last NAL unit + let track = this._avcTrack, + samples = track.samples; + if (samples.length) { + let lastavcSample = samples[samples.length - 1], + lastUnits = lastavcSample.units.units, + lastUnit = lastUnits[lastUnits.length - 1]; + // check if lastUnit had a state different from zero + if (lastUnit.state) { + // strip last bytes + lastUnit.data = lastUnit.data.subarray(0,lastUnit.data.byteLength - lastState); + lastavcSample.units.length -= lastState; + track.len -= lastState; + } + } + } // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit. overflow = i - state - 1; - if (overflow) { - var track = this._avcTrack, + if (overflow > 0) { + let track = this._avcTrack, samples = track.samples; //logger.log('first NALU found with overflow:' + overflow); if (samples.length) { - var lastavcSample = samples[samples.length - 1], + let lastavcSample = samples[samples.length - 1], lastUnits = lastavcSample.units.units, lastUnit = lastUnits[lastUnits.length - 1], tmp = new Uint8Array(lastUnit.data.byteLength + overflow); @@ -557,9 +585,10 @@ } } if (lastUnitStart) { - unit = {data: array.subarray(lastUnitStart, len), type: lastUnitType}; + unit = {data: array.subarray(lastUnitStart, len), type: lastUnitType, state : state}; units.push(unit); - //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); + //logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state); + this.avcNaluState = state; } return units; } @@ -572,7 +601,7 @@ duration = this._duration, audioCodec = this.audioCodec, aacOverFlow = this.aacOverFlow, - lastAacPTS = this.lastAacPTS, + aacLastPTS = this.aacLastPTS, config, frameLength, frameDuration, frameIndex, offset, headerLength, stamp, len, aacSample; if (aacOverFlow) { var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength); @@ -616,8 +645,8 @@ // if last AAC frame is overflowing, we should ensure timestamps are contiguous: // first sample PTS should be equal to last sample PTS + frameDuration - if(aacOverFlow && lastAacPTS) { - var newPTS = lastAacPTS+frameDuration; + if(aacOverFlow && aacLastPTS) { + var newPTS = aacLastPTS+frameDuration; if(Math.abs(newPTS-pts) > 1) { logger.log(`AAC: align PTS for overlapping frames by ${Math.round((newPTS-pts)/90)}`); pts=newPTS; @@ -659,7 +688,7 @@ aacOverFlow = null; } this.aacOverFlow = aacOverFlow; - this.lastAacPTS = stamp; + this.aacLastPTS = stamp; } _parseID3PES(pes) { diff --git a/dashboard-ui/bower_components/hls.js/src/helper/level-helper.js b/dashboard-ui/bower_components/hls.js/src/helper/level-helper.js index d267e5c0f2..f0c3deddbe 100644 --- a/dashboard-ui/bower_components/hls.js/src/helper/level-helper.js +++ b/dashboard-ui/bower_components/hls.js/src/helper/level-helper.js @@ -42,7 +42,7 @@ class LevelHelper { // if at least one fragment contains PTS info, recompute PTS information for all fragments if(PTSFrag) { - LevelHelper.updateFragPTS(newDetails,PTSFrag.sn,PTSFrag.startPTS,PTSFrag.endPTS); + LevelHelper.updateFragPTSDTS(newDetails,PTSFrag.sn,PTSFrag.startPTS,PTSFrag.endPTS,PTSFrag.startDTS,PTSFrag.endDTS); } else { // ensure that delta is within oldfragments range // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61]) @@ -61,7 +61,7 @@ class LevelHelper { return; } - static updateFragPTS(details,sn,startPTS,endPTS) { + static updateFragPTSDTS(details,sn,startPTS,endPTS,startDTS,endDTS) { var fragIdx, fragments, frag, i; // exit if sn out of range if (sn < details.startSN || sn > details.endSN) { @@ -73,12 +73,16 @@ class LevelHelper { if(!isNaN(frag.startPTS)) { startPTS = Math.min(startPTS,frag.startPTS); endPTS = Math.max(endPTS, frag.endPTS); + startDTS = Math.min(startDTS,frag.startDTS); + endDTS = Math.max(endDTS, frag.endDTS); } var drift = startPTS - frag.start; frag.start = frag.startPTS = startPTS; frag.endPTS = endPTS; + frag.startDTS = startDTS; + frag.endDTS = endDTS; frag.duration = endPTS - startPTS; // adjust fragment PTS/duration from seqnum-1 to frag 0 for(i = fragIdx ; i > 0 ; i--) { diff --git a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json index d0996a0614..1baafa9707 100644 --- a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json +++ b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json @@ -30,14 +30,14 @@ "web-component-tester": "polymer/web-component-tester#^3.4.0" }, "ignore": [], - "homepage": "https://github.com/PolymerElements/iron-a11y-announcer", + "homepage": "https://github.com/polymerelements/iron-a11y-announcer", "_release": "1.0.4", "_resolution": { "type": "version", "tag": "v1.0.4", "commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9" }, - "_source": "git://github.com/PolymerElements/iron-a11y-announcer.git", + "_source": "git://github.com/polymerelements/iron-a11y-announcer.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-a11y-announcer" + "_originalSource": "polymerelements/iron-a11y-announcer" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-meta/.bower.json b/dashboard-ui/bower_components/iron-meta/.bower.json index f4bfef4a7c..e1304d174b 100644 --- a/dashboard-ui/bower_components/iron-meta/.bower.json +++ b/dashboard-ui/bower_components/iron-meta/.bower.json @@ -26,14 +26,14 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "main": "iron-meta.html", - "homepage": "https://github.com/polymerelements/iron-meta", + "homepage": "https://github.com/PolymerElements/iron-meta", "_release": "1.1.1", "_resolution": { "type": "version", "tag": "v1.1.1", "commit": "e171ee234b482219c9514e6f9551df48ef48bd9f" }, - "_source": "git://github.com/polymerelements/iron-meta.git", + "_source": "git://github.com/PolymerElements/iron-meta.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-meta" + "_originalSource": "PolymerElements/iron-meta" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json b/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json index 2e765b9324..cca11d8994 100644 --- a/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json +++ b/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json @@ -28,14 +28,14 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "ignore": [], - "homepage": "https://github.com/PolymerElements/iron-resizable-behavior", + "homepage": "https://github.com/polymerelements/iron-resizable-behavior", "_release": "1.0.3", "_resolution": { "type": "version", "tag": "v1.0.3", "commit": "dda1df6aaf452aedf3e52ff0cf69e72439452216" }, - "_source": "git://github.com/PolymerElements/iron-resizable-behavior.git", + "_source": "git://github.com/polymerelements/iron-resizable-behavior.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-resizable-behavior" + "_originalSource": "polymerelements/iron-resizable-behavior" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index 4782b3c50f..e3120e6882 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -39,6 +39,6 @@ "commit": "ce5b9fb2d8aa03c698410e2e55cffcfa0b788a3a" }, "_source": "git://github.com/Polymer/polymer.git", - "_target": "^1.0.0", + "_target": "^1.1.0", "_originalSource": "Polymer/polymer" } \ No newline at end of file diff --git a/dashboard-ui/components/tvproviders/xmltv.js b/dashboard-ui/components/tvproviders/xmltv.js index f432a80da7..0270162890 100644 --- a/dashboard-ui/components/tvproviders/xmltv.js +++ b/dashboard-ui/components/tvproviders/xmltv.js @@ -1,34 +1,53 @@ -define(['jQuery', 'paper-checkbox', 'paper-button', 'paper-input', 'paper-item-body', 'paper-icon-item'], function ($) { +define(['jQuery', 'paper-checkbox', 'paper-button', 'emby-input', 'paper-item-body', 'paper-icon-item'], function ($) { return function (page, providerId, options) { var self = this; + function getListingProvider(config, id) { + + if (config && id) { + return config.ListingProviders.filter(function (i) { + return i.Id == id; + })[0] || getListingProvider(); + } + + return ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/Default')); + } + function reload() { Dashboard.showLoadingMsg(); ApiClient.getNamedConfiguration("livetv").then(function (config) { - var info = config.ListingProviders.filter(function (i) { - return i.Id == providerId; - })[0] || {}; + getListingProvider(config, providerId).then(function (info) { + page.querySelector('.txtPath').value = info.Path || ''; + page.querySelector('.txtKids').value = (info.KidsGenres || []).join('|'); + page.querySelector('.txtNews').value = (info.NewsGenres || []).join('|'); + page.querySelector('.txtSports').value = (info.SportsGenres || []).join('|'); - page.querySelector('.txtPath').value = info.Path || ''; + page.querySelector('.chkAllTuners').checked = info.EnableAllTuners; - page.querySelector('.chkAllTuners').checked = info.EnableAllTuners; + if (page.querySelector('.chkAllTuners').checked) { + page.querySelector('.selectTunersSection').classList.add('hide'); + } else { + page.querySelector('.selectTunersSection').classList.remove('hide'); + } - if (page.querySelector('.chkAllTuners').checked) { - page.querySelector('.selectTunersSection').classList.add('hide'); - } else { - page.querySelector('.selectTunersSection').classList.remove('hide'); - } - - refreshTunerDevices(page, info, config.TunerHosts); - Dashboard.hideLoadingMsg(); + refreshTunerDevices(page, info, config.TunerHosts); + Dashboard.hideLoadingMsg(); + }); }); } + function getGenres(txtInput) { + + var value = txtInput.value; + + return value ? value.split('|') : []; + } + function submitListingsForm() { Dashboard.showLoadingMsg(); @@ -42,7 +61,13 @@ })[0] || {}; info.Type = 'xmltv'; + info.Path = page.querySelector('.txtPath').value; + + info.KidsGenres = getGenres(page.querySelector('.txtKids')); + info.NewsGenres = getGenres(page.querySelector('.txtNews')); + info.SportsGenres = getGenres(page.querySelector('.txtSports')); + info.EnableAllTuners = page.querySelector('.chkAllTuners').checked; info.EnabledTuners = info.EnableAllTuners ? [] : $('.chkTuner', page).get().filter(function (i) { return i.checked; diff --git a/dashboard-ui/components/tvproviders/xmltv.template.html b/dashboard-ui/components/tvproviders/xmltv.template.html index e8a1db0d35..6ef8a519d2 100644 --- a/dashboard-ui/components/tvproviders/xmltv.template.html +++ b/dashboard-ui/components/tvproviders/xmltv.template.html @@ -2,25 +2,39 @@
-
- +
+
-
-
- ${OptionEnableForAllTuners} -
-

-
${HeaderTuners}
-
-
-
+
+ +
${XmlTvKidsGenresHelp}
-

-
- - ${ButtonCancel} +
+ +
+
${XmlTvNewsGenresHelp}
+
+
+ +
${XmlTvSportsGenresHelp}
+
+
+ ${OptionEnableForAllTuners} +
+

+
${HeaderTuners}
+
+
+
+
+

+
+ + ${ButtonCancel} +
+
\ No newline at end of file diff --git a/dashboard-ui/library.html b/dashboard-ui/library.html index 3c7d5cb199..8f8785b346 100644 --- a/dashboard-ui/library.html +++ b/dashboard-ui/library.html @@ -6,7 +6,7 @@
- ${ButtonScanLibrary} + ${ButtonScanLibrary}
diff --git a/dashboard-ui/livetvstatus.html b/dashboard-ui/livetvstatus.html index 196d48103a..c446982816 100644 --- a/dashboard-ui/livetvstatus.html +++ b/dashboard-ui/livetvstatus.html @@ -31,7 +31,7 @@
- ${ButtonRefreshGuideData} + ${ButtonRefreshGuideData}
diff --git a/dashboard-ui/strings/en-US.json b/dashboard-ui/strings/en-US.json index 7837c52c4b..b4d7dbd155 100644 --- a/dashboard-ui/strings/en-US.json +++ b/dashboard-ui/strings/en-US.json @@ -2357,5 +2357,11 @@ "HeaderHealthMonitor": "Health Monitor", "HealthMonitorNoAlerts": "There are no active alerts.", "RecordingPathChangeMessage": "Changing your recording folder will not migrate existing recordings from the old location to the new. You'll need to move them manually if desired.", - "VisualLoginFormHelp": "Select a user or sign in manually" + "VisualLoginFormHelp": "Select a user or sign in manually", + "LabelSportsGenres": "Sports genres:", + "XmlTvSportsGenresHelp": "Programs with these genres will be categorized as sports programs. Separate multiple with '|'.", + "LabelNewsGenres": "News genres:", + "XmlTvNewsGenresHelp": "Programs with these genres will be categorized as news programs. Separate multiple with '|'.", + "LabelKidsGenres": "Children's genres:", + "XmlTvKidsGenresHelp": "Programs with these genres will be categorized as programs for children. Separate multiple with '|'." }