forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hls-demo.js.map
1 lines (1 loc) · 84.3 KB
/
hls-demo.js.map
1
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 18895bdba72edb8b6375","webpack:///./demo/main.js","webpack:///./tests/test-streams.js"],"names":["testStreams","require","defaultTestStreamUrl","url","bufferingIdx","selectedTestStream","lastSeekingIdx","lastStartPosition","lastDuration","lastAudioTrackSwitchingIdx","hls","events","stats","tracks","fmp4Data","enableStreaming","JSON","parse","getURLParam","autoRecoverError","enableWorker","levelCapping","defaultAudioCodec","undefined","widevineLicenseUrl","dumpfMP4","video","$","volume","document","ready","Object","keys","forEach","key","stream","option","Option","description","append","change","val","streamUrl","loadSelectedStream","width","hide","toggle","windowSliding","click","checked","updatePermalink","value","prop","Hls","version","html","decodeURIComponent","resetGlobals","window","t0","performance","now","load","buffer","level","bitrate","recoverDecodingErrorDate","recoverSwapAudioCodecDate","onClickBufferedRange","updateLevelInfo","hideCanvas","isSupported","destroy","bufferTimer","clearInterval","text","unescape","hlsConfig","debug","config","console","log","emeEnabled","loadSource","autoLevelCapping","attachMedia","on","Events","MEDIA_ATTACHED","push","time","type","MEDIA_DETACHED","FRAG_PARSING_INIT_SEGMENT","event","data","showCanvas","id","FRAG_PARSING_METADATA","LEVEL_SWITCHING","Math","round","levels","MANIFEST_PARSED","name","start","end","length","trequest","latency","tfirst","tload","duration","refreshCanvas","levelNb","levelParsed","AUDIO_TRACKS_UPDATED","audioTracks","updateAudioTrackInfo","AUDIO_TRACK_SWITCHING","AUDIO_TRACK_SWITCHED","LEVEL_LOADED","isLive","details","live","startSN","endSN","parsing","tparsed","parsingDuration","sumLevelParsingMs","levelParsingUs","AUDIO_TRACK_LOADED","FRAG_BUFFERED","frag","id2","sn","tbuffered","bw","total","size","pos","setInterval","checkBuffer","process","fragBuffered","fragMinLatency","min","fragMaxLatency","max","fragMinProcess","fragMaxProcess","fragMinKbps","fragMaxKbps","autoLevelCappingMin","autoLevelCappingMax","fragBufferedBytes","sumLatency","sumKbps","sumProcess","sumParsing","fraglastLatency","fragAvgLatency","fragLastProcess","fragAvgProcess","fragLastKbps","fragAvgKbps","fragparsingKbps","fragparsingMs","autoLevelCappingLast","LEVEL_SWITCHED","FRAG_CHANGED","tagList","autoLevel","levelStart","fragChangedAuto","autoLevelMin","autoLevelMax","levelLastAuto","autoLevelLast","autoLevelSwitch","sumAutoLevel","autoLevelAvg","fragChangedManual","manualLevelMin","manualLevelMax","manualLevelLast","manualLevelSwitch","FRAG_LOAD_EMERGENCY_ABORTED","fragLoadEmergencyAborted","FRAG_DECRYPTED","fragDecrypted","totalDecryptTime","fragAvgDecryptTime","tdecrypt","tstart","ERROR","warn","ErrorDetails","MANIFEST_LOAD_ERROR","context","response","code","err","MANIFEST_LOAD_TIMEOUT","MANIFEST_PARSING_ERROR","reason","LEVEL_LOAD_ERROR","LEVEL_LOAD_TIMEOUT","LEVEL_SWITCH_ERROR","FRAG_LOAD_ERROR","FRAG_LOAD_TIMEOUT","FRAG_LOOP_LOADING_ERROR","FRAG_DECRYPT_ERROR","FRAG_PARSING_ERROR","KEY_LOAD_ERROR","decryptdata","uri","KEY_LOAD_TIMEOUT","BUFFER_APPEND_ERROR","BUFFER_ADD_CODEC_ERROR","mimeType","message","BUFFER_APPENDING_ERROR","fatal","ErrorTypes","MEDIA_ERROR","handleMediaError","NETWORK_ERROR","fatalError","stringify","sortObject","BUFFER_CREATED","BUFFER_APPENDING","FPS_DROP","evt","currentDropped","currentDecoded","fpsDropEvent","fpsTotalDroppedFrames","totalDroppedFrames","addEventListener","handleVideoEvent","navigator","userAgent","toLowerCase","indexOf","target","videoWidth","videoHeight","currentTime","errorTxt","mediaError","currentTarget","error","MEDIA_ERR_ABORTED","MEDIA_ERR_DECODE","MEDIA_ERR_NETWORK","MEDIA_ERR_SRC_NOT_SUPPORTED","recoverMediaError","swapAudioCodec","timeRangesToString","r","i","v","canvas","ctx","getContext","buffered","bufferingDuration","fillStyle","fillRect","height","clientWidth","bufferLen","paused","bufEvents","bufEventLen","event0","event1","slopeBuf0","slopeBuf1","slopePos0","slopePos1","abs","pop","seekable","played","media","videoPlaybackQuality","getVideoPlaybackQuality","Function","droppedVideoFrames","corruptedVideoFrames","webkitDroppedFrameCount","x","obj","temp","sort","index","showMetrics","show","hideMetrics","getMetrics","json","jsonpacked","jsonpack","pack","btoa","copyMetricsToClipBoard","copyTextToClipboard","textArea","createElement","body","appendChild","select","successful","execCommand","msg","removeChild","goToMetrics","URL","substr","lastIndexOf","open","goToMetricsPermaLink","b64","minsecs","ts","m","floor","s","clientX","offsetLeft","button_template","button_enabled","button_disabled","html1","autoLevelEnabled","html2","html3","html4","currentLevel","levelName","label","level2label","loadLevel","nextLevel","audioTrackId","audioTrack","len","sParam","defaultValue","sPageURL","location","search","substring","sURLVariables","split","sParameterName","hlsLink","encodeURIComponent","escape","createfMP4","blob","Blob","arrayConcat","filename","Date","toISOString","saveAs","inputArray","totalLength","reduce","prev","cur","result","Uint8Array","offset","element","set","createTestStream","abr","blacklist_ua","createTestStreamWithConfig","testStream","module","exports","bbb","bigBuckBunny480p","arte","deltatreDAI","issue666","issue649","closedCaptions","oceansAES","bbbAES","mp3Audio","mpegAudioOnly","fmp4","fmp4Bitmovin","offset_pts","uspHLSAteam","angelOneShakaWidevine"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;A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\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"HlsDemo\"] = factory();\n\telse\n\t\troot[\"HlsDemo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 18895bdba72edb8b6375","const testStreams = require('../tests/test-streams');\n\nconst defaultTestStreamUrl = testStreams['bbb'].url;\n\nlet bufferingIdx = -1;\n\nlet selectedTestStream = null;\n\nlet lastSeekingIdx,\n lastStartPosition,\n lastDuration,\n lastAudioTrackSwitchingIdx;\n\nlet hls,\n url,\n events,\n stats,\n tracks,\n fmp4Data,\n enableStreaming = JSON.parse(getURLParam('enableStreaming', true));\n autoRecoverError = JSON.parse(getURLParam('autoRecoverError', true)),\n enableWorker = JSON.parse(getURLParam('enableWorker', true)),\n levelCapping = JSON.parse(getURLParam('levelCapping', -1)),\n defaultAudioCodec = getURLParam('defaultAudioCodec', undefined),\n widevineLicenseUrl = getURLParam('widevineLicenseURL', undefined),\n dumpfMP4 = getURLParam('dumpfMP4', false);\n\nlet video = $('#video')[0];\n\nvideo.volume = 0.05;\n\n$(document).ready(function() {\n\n //console.log(testStreams)\n\n Object.keys(testStreams).forEach((key) => {\n const stream = testStreams[key];\n const option = new Option(stream.description, key);\n $('#streamSelect').append(option);\n })\n\n $('#streamSelect').change(function() {\n selectedTestStream = testStreams[$('#streamSelect').val()];\n const streamUrl = selectedTestStream.url;\n $('#streamURL').val(streamUrl);\n loadSelectedStream();\n });\n\n $('#streamURL').change(function() {\n selectedTestStream = null;\n loadSelectedStream();\n });\n\n $('#videoSize').change(function() {\n $('#video').width($('#videoSize').val());\n $('#buffered_c').width($('#videoSize').val());\n });\n\n $('#PlaybackControl').hide();\n $('#QualityLevelControl').hide();\n $('#AudioTrackControl').hide();\n $('#MetricsDisplay').hide();\n $('#StatsDisplay').hide();\n $('#metricsButtonWindow').toggle(windowSliding);\n $('#metricsButtonFixed').toggle(!windowSliding);\n\n $('#enableStreaming').click(function() {\n enableStreaming = this.checked;\n loadSelectedStream();\n });\n\n $('#autoRecoverError').click(function() {\n autoRecoverError = this.checked;\n updatePermalink();\n });\n\n $('#enableWorker').click(function() {\n enableWorker = this.checked;\n updatePermalink();\n });\n\n $('#dumpfMP4').click(function() {\n dumpfMP4 = this.checked;\n updatePermalink();\n });\n\n $('#levelCapping').change(function() {\n levelCapping = this.value;\n updatePermalink();\n });\n\n $('#defaultAudioCodec').change(function() {\n defaultAudioCodec = this.value;\n updatePermalink();\n });\n\n $('#enableStreaming').prop( 'checked', enableStreaming );\n $('#autoRecoverError').prop( 'checked', autoRecoverError );\n $('#enableWorker').prop( 'checked', enableWorker );\n $('#dumpfMP4').prop( 'checked', dumpfMP4 );\n $('#levelCapping').val(levelCapping);\n $('#defaultAudioCodec').val(defaultAudioCodec || 'undefined');\n $('h2').append(' <a target=_blank href=https://github.com/video-dev/hls.js/releases/tag/v' + Hls.version + '>v' + Hls.version + '</a>');\n\n $('#currentVersion').html('Hls version:' + Hls.version);\n\n $('#streamURL').val(decodeURIComponent(getURLParam('src', defaultTestStreamUrl)))\n\n loadSelectedStream();\n\n});\n\nfunction resetGlobals() {\n window.events = events = {\n url : url,\n t0 : performance.now(),\n load : [],\n buffer : [],\n video : [],\n level : [],\n bitrate: []\n };\n\n // actual values, only on window\n window.recoverDecodingErrorDate = null;\n window.recoverSwapAudioCodecDate = null;\n\n window.fmp4Data = fmp4Data = {\n 'audio': [],\n 'video': []\n };\n\n window.onClickBufferedRange = onClickBufferedRange;\n\n window.updateLevelInfo = updateLevelInfo;\n window.updatePermalink = updatePermalink;\n}\n\nfunction loadSelectedStream() {\n\n url = $('#streamURL').val()\n\n hideCanvas();\n\n if(Hls.isSupported()) {\n\n if(hls) {\n hls.destroy();\n if(hls.bufferTimer) {\n clearInterval(hls.bufferTimer);\n hls.bufferTimer = undefined;\n }\n hls = null;\n }\n\n if(!enableStreaming) {\n $('#HlsStatus').text('Streaming disabled');\n return;\n }\n\n $('#HlsStatus').text('loading ' + url);\n\n resetGlobals();\n\n if (widevineLicenseUrl) {\n widevineLicenseUrl = unescape(widevineLicenseUrl)\n }\n\n const hlsConfig = {\n debug : true,\n enableWorker : enableWorker,\n defaultAudioCodec: defaultAudioCodec,\n widevineLicenseUrl: widevineLicenseUrl\n };\n\n if (selectedTestStream && selectedTestStream.config) {\n Object.assign(hlsConfig, selectedTestStream.config)\n console.log('Using Hls.js config:', hlsConfig);\n }\n\n if (hlsConfig.widevineLicenseUrl) {\n $('#widevineLicenseUrl').val(hlsConfig.widevineLicenseUrl);\n }\n\n widevineLicenseUrl = hlsConfig.widevineLicenseUrl = $('#widevineLicenseUrl').val();\n\n if (hlsConfig.widevineLicenseUrl) {\n hlsConfig.emeEnabled = true;\n }\n\n updatePermalink();\n\n window.hls = hls = new Hls(hlsConfig);\n\n $('#HlsStatus').text('loading manifest and attaching video element...');\n\n hls.loadSource(url);\n hls.autoLevelCapping = levelCapping;\n hls.attachMedia(video);\n\n hls.on(Hls.Events.MEDIA_ATTACHED, function() {\n $('#HlsStatus').text('MediaSource attached...');\n bufferingIdx = -1;\n events.video.push({\n time: performance.now() - events.t0,\n type: 'Media attached'\n });\n });\n\n hls.on(Hls.Events.MEDIA_DETACHED, function() {\n $('#HlsStatus').text('MediaSource detached...');\n bufferingIdx = -1;\n tracks = [];\n events.video.push({\n time: performance.now() - events.t0,\n type: 'Media detached'\n });\n });\n\n hls.on(Hls.Events.FRAG_PARSING_INIT_SEGMENT, function(event, data) {\n showCanvas();\n var event = {\n time: performance.now() - events.t0,\n type: data.id + ' init segment'\n };\n events.video.push(event);\n });\n\n hls.on(Hls.Events.FRAG_PARSING_METADATA, function(event, data) {\n //console.log(\"Id3 samples \", data.samples);\n });\n\n hls.on(Hls.Events.LEVEL_SWITCHING, function(event, data) {\n events.level.push({\n time : performance.now() - events.t0,\n id : data.level,\n bitrate: Math.round(hls.levels[data.level].bitrate/1000)\n });\n updateLevelInfo();\n });\n\n hls.on(Hls.Events.MANIFEST_PARSED, function(event, data) {\n var event = {\n type : 'manifest',\n name : '',\n start : 0,\n end : data.levels.length,\n time : data.stats.trequest - events.t0,\n latency : data.stats.tfirst - data.stats.trequest,\n load : data.stats.tload - data.stats.tfirst,\n duration: data.stats.tload - data.stats.tfirst,\n };\n events.load.push(event);\n refreshCanvas();\n });\n\n hls.on(Hls.Events.MANIFEST_PARSED, function(event, data) {\n $('#HlsStatus').text('manifest successfully loaded,' + hls.levels.length + ' levels found');\n stats = {\n levelNb : data.levels.length,\n levelParsed: 0\n };\n updateLevelInfo();\n });\n\n hls.on(Hls.Events.AUDIO_TRACKS_UPDATED, function(event, data) {\n $('#HlsStatus').text(data.audioTracks.length + ' audio tracks found');\n updateAudioTrackInfo();\n });\n\n hls.on(Hls.Events.AUDIO_TRACK_SWITCHING, function(event, data) {\n updateAudioTrackInfo();\n var event = {\n time: performance.now() - events.t0,\n type: 'audio switching',\n name: '@' + data.id\n };\n events.video.push(event);\n lastAudioTrackSwitchingIdx = events.video.length-1;\n });\n\n hls.on(Hls.Events.AUDIO_TRACK_SWITCHED, function(event, data) {\n updateAudioTrackInfo();\n var event = {\n time: performance.now() - events.t0,\n type: 'audio switched',\n name: '@' + data.id\n };\n if (lastAudioTrackSwitchingIdx !== undefined) {\n events.video[lastAudioTrackSwitchingIdx].duration = event.time - events.video[lastAudioTrackSwitchingIdx].time;\n lastAudioTrackSwitchingIdx = undefined;\n }\n events.video.push(event);\n });\n\n hls.on(Hls.Events.LEVEL_LOADED, function(event, data) {\n events.isLive = data.details.live;\n var event = {\n type : 'level',\n id : data.level,\n start : data.details.startSN,\n end : data.details.endSN,\n time : data.stats.trequest - events.t0,\n latency : data.stats.tfirst - data.stats.trequest,\n load : data.stats.tload - data.stats.tfirst,\n parsing : data.stats.tparsed - data.stats.tload,\n duration: data.stats.tload - data.stats.tfirst\n };\n const parsingDuration = data.stats.tparsed - data.stats.tload;\n if (stats.levelParsed)\n {this.sumLevelParsingMs += parsingDuration;}\n else\n {this.sumLevelParsingMs = parsingDuration;}\n\n stats.levelParsed++;\n stats.levelParsingUs = Math.round(1000*this.sumLevelParsingMs / stats.levelParsed);\n console.log('parsing level duration :' + stats.levelParsingUs + 'us,count:' + stats.levelParsed);\n events.load.push(event);\n refreshCanvas();\n });\n\n hls.on(Hls.Events.AUDIO_TRACK_LOADED, function(event, data) {\n events.isLive = data.details.live;\n var event = {\n type : 'audio track',\n id : data.id,\n start : data.details.startSN,\n end : data.details.endSN,\n time : data.stats.trequest - events.t0,\n latency : data.stats.tfirst - data.stats.trequest,\n load : data.stats.tload - data.stats.tfirst,\n parsing : data.stats.tparsed - data.stats.tload,\n duration: data.stats.tload - data.stats.tfirst\n };\n events.load.push(event);\n refreshCanvas();\n });\n\n hls.on(Hls.Events.FRAG_BUFFERED, function(event, data) {\n var event = {\n type : data.frag.type + ' fragment',\n id : data.frag.level,\n id2 : data.frag.sn,\n time : data.stats.trequest - events.t0,\n latency : data.stats.tfirst - data.stats.trequest,\n load : data.stats.tload - data.stats.tfirst,\n parsing : data.stats.tparsed - data.stats.tload,\n buffer : data.stats.tbuffered - data.stats.tparsed,\n duration: data.stats.tbuffered - data.stats.tfirst,\n bw : Math.round(8*data.stats.total/(data.stats.tbuffered - data.stats.trequest)),\n size : data.stats.total\n };\n events.load.push(event);\n events.bitrate.push({\n time : performance.now() - events.t0,\n bitrate : event.bw,\n duration: data.frag.duration,\n level : event.id\n });\n if(hls.bufferTimer === undefined) {\n events.buffer.push({\n time : 0,\n buffer: 0,\n pos : 0\n });\n hls.bufferTimer = window.setInterval(checkBuffer, 100);\n }\n refreshCanvas();\n updateLevelInfo();\n\n let latency = data.stats.tfirst - data.stats.trequest,\n parsing = data.stats.tparsed - data.stats.tload,\n process = data.stats.tbuffered - data.stats.trequest,\n bitrate = Math.round(8 * data.stats.length / (data.stats.tbuffered - data.stats.tfirst));\n if (stats.fragBuffered) {\n stats.fragMinLatency = Math.min(stats.fragMinLatency, latency);\n stats.fragMaxLatency = Math.max(stats.fragMaxLatency, latency);\n stats.fragMinProcess = Math.min(stats.fragMinProcess, process);\n stats.fragMaxProcess = Math.max(stats.fragMaxProcess, process);\n stats.fragMinKbps = Math.min(stats.fragMinKbps, bitrate);\n stats.fragMaxKbps = Math.max(stats.fragMaxKbps, bitrate);\n stats.autoLevelCappingMin = Math.min(stats.autoLevelCappingMin, hls.autoLevelCapping);\n stats.autoLevelCappingMax = Math.max(stats.autoLevelCappingMax, hls.autoLevelCapping);\n stats.fragBuffered++;\n } else {\n stats.fragMinLatency = stats.fragMaxLatency = latency;\n stats.fragMinProcess = stats.fragMaxProcess = process;\n stats.fragMinKbps = stats.fragMaxKbps = bitrate;\n stats.fragBuffered = 1;\n stats.fragBufferedBytes = 0;\n stats.autoLevelCappingMin = stats.autoLevelCappingMax = hls.autoLevelCapping;\n this.sumLatency = 0;\n this.sumKbps = 0;\n this.sumProcess = 0;\n this.sumParsing = 0;\n }\n stats.fraglastLatency = latency;\n this.sumLatency += latency;\n stats.fragAvgLatency = Math.round(this.sumLatency / stats.fragBuffered);\n stats.fragLastProcess = process;\n this.sumProcess += process;\n this.sumParsing += parsing;\n stats.fragAvgProcess = Math.round(this.sumProcess / stats.fragBuffered);\n stats.fragLastKbps = bitrate;\n this.sumKbps += bitrate;\n stats.fragAvgKbps = Math.round(this.sumKbps / stats.fragBuffered);\n stats.fragBufferedBytes += data.stats.total;\n stats.fragparsingKbps = Math.round(8*stats.fragBufferedBytes / this.sumParsing);\n stats.fragparsingMs = Math.round(this.sumParsing);\n stats.autoLevelCappingLast = hls.autoLevelCapping;\n });\n\n hls.on(Hls.Events.LEVEL_SWITCHED, function(event, data) {\n var event = {\n time: performance.now() - events.t0,\n type: 'level switched',\n name: data.level\n };\n events.video.push(event);\n refreshCanvas();\n updateLevelInfo();\n });\n\n hls.on(Hls.Events.FRAG_CHANGED, function(event, data) {\n var event = {\n time: performance.now() - events.t0,\n type: 'frag changed',\n name: data.frag.sn + ' @ ' + data.frag.level\n };\n events.video.push(event);\n refreshCanvas();\n updateLevelInfo();\n stats.tagList = data.frag.tagList;\n\n let level = data.frag.level, autoLevel = data.frag.autoLevel;\n if (stats.levelStart === undefined)\n {stats.levelStart = level;}\n\n if (autoLevel) {\n if (stats.fragChangedAuto) {\n stats.autoLevelMin = Math.min(stats.autoLevelMin, level);\n stats.autoLevelMax = Math.max(stats.autoLevelMax, level);\n stats.fragChangedAuto++;\n if (this.levelLastAuto && level !== stats.autoLevelLast)\n {stats.autoLevelSwitch++;}\n\n } else {\n stats.autoLevelMin = stats.autoLevelMax = level;\n stats.autoLevelSwitch = 0;\n stats.fragChangedAuto = 1;\n this.sumAutoLevel = 0;\n }\n this.sumAutoLevel += level;\n stats.autoLevelAvg = Math.round(1000 * this.sumAutoLevel / stats.fragChangedAuto) / 1000;\n stats.autoLevelLast = level;\n } else {\n if (stats.fragChangedManual) {\n stats.manualLevelMin = Math.min(stats.manualLevelMin, level);\n stats.manualLevelMax = Math.max(stats.manualLevelMax, level);\n stats.fragChangedManual++;\n if (!this.levelLastAuto && level !== stats.manualLevelLast)\n {stats.manualLevelSwitch++;}\n\n } else {\n stats.manualLevelMin = stats.manualLevelMax = level;\n stats.manualLevelSwitch = 0;\n stats.fragChangedManual = 1;\n }\n stats.manualLevelLast = level;\n }\n this.levelLastAuto = autoLevel;\n });\n\n hls.on(Hls.Events.FRAG_LOAD_EMERGENCY_ABORTED, function(event, data) {\n if (stats) {\n if (stats.fragLoadEmergencyAborted === undefined)\n {stats.fragLoadEmergencyAborted = 1;}\n else\n {stats.fragLoadEmergencyAborted++;}\n\n }\n });\n\n hls.on(Hls.Events.FRAG_DECRYPTED, function(event, data) {\n if (!stats.fragDecrypted) {\n stats.fragDecrypted = 0;\n this.totalDecryptTime = 0;\n stats.fragAvgDecryptTime = 0;\n }\n stats.fragDecrypted++;\n this.totalDecryptTime += data.stats.tdecrypt - data.stats.tstart;\n stats.fragAvgDecryptTime = this.totalDecryptTime / stats.fragDecrypted;\n });\n\n hls.on(Hls.Events.ERROR, function(event, data) {\n console.warn(data);\n switch(data.details) {\n case Hls.ErrorDetails.MANIFEST_LOAD_ERROR:\n try {\n $('#HlsStatus').html('cannot Load <a href=\"' + data.context.url + '\">' + url + '</a><br>HTTP response code:' + data.response.code + ' <br>' + data.response.text);\n if(data.response.code === 0)\n {$('#HlsStatus').append('this might be a CORS issue, consider installing <a href=\"https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi\">Allow-Control-Allow-Origin</a> Chrome Extension');}\n\n } catch(err) {\n $('#HlsStatus').html('cannot Load <a href=\"' + data.context.url + '\">' + url + '</a><br>Reason:Load ' + data.response.text);\n }\n break;\n case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT:\n $('#HlsStatus').text('timeout while loading manifest');\n break;\n case Hls.ErrorDetails.MANIFEST_PARSING_ERROR:\n $('#HlsStatus').text('error while parsing manifest:' + data.reason);\n break;\n case Hls.ErrorDetails.LEVEL_LOAD_ERROR:\n $('#HlsStatus').text('error while loading level playlist');\n break;\n case Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT:\n $('#HlsStatus').text('timeout while loading level playlist');\n break;\n case Hls.ErrorDetails.LEVEL_SWITCH_ERROR:\n $('#HlsStatus').text('error while trying to switch to level ' + data.level);\n break;\n case Hls.ErrorDetails.FRAG_LOAD_ERROR:\n $('#HlsStatus').text('error while loading fragment ' + data.frag.url);\n break;\n case Hls.ErrorDetails.FRAG_LOAD_TIMEOUT:\n $('#HlsStatus').text('timeout while loading fragment ' + data.frag.url);\n break;\n case Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR:\n $('#HlsStatus').text('Frag Loop Loading Error');\n break;\n case Hls.ErrorDetails.FRAG_DECRYPT_ERROR:\n $('#HlsStatus').text('Decrypting Error:' + data.reason);\n break;\n case Hls.ErrorDetails.FRAG_PARSING_ERROR:\n $('#HlsStatus').text('Parsing Error:' + data.reason);\n break;\n case Hls.ErrorDetails.KEY_LOAD_ERROR:\n $('#HlsStatus').text('error while loading key ' + data.frag.decryptdata.uri);\n break;\n case Hls.ErrorDetails.KEY_LOAD_TIMEOUT:\n $('#HlsStatus').text('timeout while loading key ' + data.frag.decryptdata.uri);\n break;\n case Hls.ErrorDetails.BUFFER_APPEND_ERROR:\n $('#HlsStatus').text('Buffer Append Error');\n break;\n case Hls.ErrorDetails.BUFFER_ADD_CODEC_ERROR:\n $('#HlsStatus').text('Buffer Add Codec Error for ' + data.mimeType + ':' + data.err.message);\n break;\n case Hls.ErrorDetails.BUFFER_APPENDING_ERROR:\n $('#HlsStatus').text('Buffer Appending Error');\n break;\n default:\n break;\n }\n if(data.fatal) {\n console.log('fatal error :' + data.details);\n switch(data.type) {\n case Hls.ErrorTypes.MEDIA_ERROR:\n handleMediaError();\n break;\n case Hls.ErrorTypes.NETWORK_ERROR:\n $('#HlsStatus').append(',network error ...');\n break;\n default:\n $('#HlsStatus').append(', unrecoverable error');\n hls.destroy();\n break;\n }\n console.log($('#HlsStatus').text());\n }\n if(!stats) {\n stats = {\n };\n }\n // track all errors independently\n if (stats[data.details] === undefined)\n {stats[data.details] = 1;}\n else\n {stats[data.details] += 1;}\n\n // track fatal error\n if (data.fatal) {\n if (stats.fatalError === undefined)\n {stats.fatalError = 1;}\n else\n {stats.fatalError += 1;}\n\n }\n $('#HlsStats').text(JSON.stringify(sortObject(stats), null, '\\t'));\n });\n\n hls.on(Hls.Events.BUFFER_CREATED, function(event, data) {\n tracks = data.tracks;\n });\n\n hls.on(Hls.Events.BUFFER_APPENDING, function(event, data) {\n if (dumpfMP4)\n {fmp4Data[data.type].push(data.data);}\n\n });\n\n hls.on(Hls.Events.FPS_DROP, function(event, data) {\n let evt = {\n time: performance.now() - events.t0,\n type: 'frame drop',\n name: data.currentDropped + '/' + data.currentDecoded\n };\n events.video.push(evt);\n if (stats) {\n if (stats.fpsDropEvent === undefined)\n {stats.fpsDropEvent = 1;}\n else\n {stats.fpsDropEvent++;}\n\n stats.fpsTotalDroppedFrames = data.totalDroppedFrames;\n }\n });\n video.addEventListener('resize', handleVideoEvent);\n video.addEventListener('seeking', handleVideoEvent);\n video.addEventListener('seeked', handleVideoEvent);\n video.addEventListener('pause', handleVideoEvent);\n video.addEventListener('play', handleVideoEvent);\n video.addEventListener('canplay', handleVideoEvent);\n video.addEventListener('canplaythrough', handleVideoEvent);\n video.addEventListener('ended', handleVideoEvent);\n video.addEventListener('playing', handleVideoEvent);\n video.addEventListener('error', handleVideoEvent);\n video.addEventListener('loadedmetadata', handleVideoEvent);\n video.addEventListener('loadeddata', handleVideoEvent);\n video.addEventListener('durationchange', handleVideoEvent);\n } else {\n if(navigator.userAgent.toLowerCase().indexOf('firefox') !== -1)\n {$('#HlsStatus').text('you are using Firefox, it looks like MediaSource is not enabled,<br>please ensure the following keys are set appropriately in <b>about:config</b><br>media.mediasource.enabled=true<br>media.mediasource.mp4.enabled=true<br><b>media.mediasource.whitelist=false</b>');}\n else\n {$('#HlsStatus').text('your Browser does not support MediaSourceExtension / MP4 mediasource');}\n\n }\n}\n\nfunction handleVideoEvent(evt) {\n let data = '';\n switch(evt.type) {\n case 'durationchange':\n if(evt.target.duration - lastDuration <= 0.5) {\n // some browsers reports several duration change events with almost the same value ... avoid spamming video events\n return;\n }\n lastDuration = evt.target.duration;\n data = Math.round(evt.target.duration*1000);\n break;\n case 'resize':\n data = evt.target.videoWidth + '/' + evt.target.videoHeight;\n break;\n case 'loadedmetadata':\n // data = 'duration:' + evt.target.duration + '/videoWidth:' + evt.target.videoWidth + '/videoHeight:' + evt.target.videoHeight;\n // break;\n case 'loadeddata':\n case 'canplay':\n case 'canplaythrough':\n case 'ended':\n case 'seeking':\n case 'seeked':\n case 'play':\n case 'playing':\n lastStartPosition = evt.target.currentTime;\n case 'pause':\n case 'waiting':\n case 'stalled':\n case 'error':\n data = Math.round(evt.target.currentTime*1000);\n if(evt.type === 'error') {\n let errorTxt, mediaError=evt.currentTarget.error;\n switch(mediaError.code) {\n case mediaError.MEDIA_ERR_ABORTED:\n errorTxt = 'You aborted the video playback';\n break;\n case mediaError.MEDIA_ERR_DECODE:\n errorTxt = 'The video playback was aborted due to a corruption problem or because the video used features your browser did not support';\n handleMediaError();\n break;\n case mediaError.MEDIA_ERR_NETWORK:\n errorTxt = 'A network error caused the video download to fail part-way';\n break;\n case mediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:\n errorTxt = 'The video could not be loaded, either because the server or network failed or because the format is not supported';\n break;\n }\n if (mediaError.message)\n {errorTxt += ' - ' + mediaError.message;}\n\n $('#HlsStatus').text(errorTxt);\n console.error(errorTxt);\n }\n break;\n // case 'progress':\n // data = 'currentTime:' + evt.target.currentTime + ',bufferRange:[' + this.video.buffered.start(0) + ',' + this.video.buffered.end(0) + ']';\n // break;\n default:\n break;\n }\n let event = {\n time: performance.now() - events.t0,\n type: evt.type,\n name: data\n };\n events.video.push(event);\n if(evt.type === 'seeking')\n {lastSeekingIdx = events.video.length-1;}\n\n if(evt.type === 'seeked')\n {events.video[lastSeekingIdx].duration = event.time - events.video[lastSeekingIdx].time;}\n\n}\n\nfunction handleMediaError() {\n if(autoRecoverError) {\n let now = performance.now();\n if(!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {\n recoverDecodingErrorDate = performance.now();\n $('#HlsStatus').append(',try to recover media Error ...');\n hls.recoverMediaError();\n } else {\n if(!recoverSwapAudioCodecDate || (now - recoverSwapAudioCodecDate) > 3000) {\n recoverSwapAudioCodecDate = performance.now();\n $('#HlsStatus').append(',try to swap Audio Codec and recover media Error ...');\n hls.swapAudioCodec();\n hls.recoverMediaError();\n } else {\n $('#HlsStatus').append(',cannot recover, last media error recovery failed ...');\n }\n }\n }\n}\n\nfunction timeRangesToString(r) {\n let log = '';\n for (let i=0; i<r.length; i++)\n {log += '[' + r.start(i) + ',' + r.end(i) + ']';}\n\n return log;\n}\n\nfunction checkBuffer() {\n let v = $('#video')[0];\n let canvas = $('#buffered_c')[0];\n let ctx = canvas.getContext('2d');\n let r = v.buffered;\n let bufferingDuration;\n ctx.fillStyle = 'black';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.fillStyle = 'gray';\n if (r) {\n if(!canvas.width || canvas.width !== v.clientWidth)\n {canvas.width = v.clientWidth;}\n\n var pos = v.currentTime, bufferLen;\n for (var i=0, bufferLen=0; i<r.length; i++) {\n let start = r.start(i)/v.duration * canvas.width;\n let end = r.end(i)/v.duration * canvas.width;\n ctx.fillRect(start, 3, Math.max(2, end-start), 10);\n if(pos >= r.start(i) && pos < r.end(i)) {\n // play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length\n bufferLen = r.end(i) - pos;\n }\n }\n // check if we are in buffering / or playback ended state\n if(bufferLen <= 0.1 && v.paused === false && (pos-lastStartPosition) > 0.5) {\n // don't create buffering event if we are at the end of the playlist, don't report ended for live playlist\n if(lastDuration -pos <= 0.5 && events.isLive === false) {\n } else {\n // we are not at the end of the playlist ... real buffering\n if(bufferingIdx !== -1) {\n bufferingDuration = performance.now() - events.t0 - events.video[bufferingIdx].time;\n events.video[bufferingIdx].duration = bufferingDuration;\n events.video[bufferingIdx].name = bufferingDuration;\n } else {\n events.video.push({\n type: 'buffering',\n time: performance.now() - events.t0\n });\n // we are in buffering state\n bufferingIdx = events.video.length-1;\n }\n }\n }\n\n if(bufferLen > 0.1 && bufferingIdx !=-1) {\n bufferingDuration = performance.now() - events.t0 - events.video[bufferingIdx].time;\n events.video[bufferingIdx].duration = bufferingDuration;\n events.video[bufferingIdx].name = bufferingDuration;\n // we are out of buffering state\n bufferingIdx = -1;\n }\n\n // update buffer/position for current Time\n let event = {\n time : performance.now() - events.t0,\n buffer: Math.round(bufferLen*1000),\n pos : Math.round(pos*1000)\n };\n let bufEvents = events.buffer, bufEventLen = bufEvents.length;\n if(bufEventLen > 1) {\n let event0 = bufEvents[bufEventLen-2], event1 = bufEvents[bufEventLen-1];\n let slopeBuf0 = (event0.buffer - event1.buffer)/(event0.time-event1.time);\n let slopeBuf1 = (event1.buffer - event.buffer)/(event1.time-event.time);\n\n let slopePos0 = (event0.pos - event1.pos)/(event0.time-event1.time);\n let slopePos1 = (event1.pos - event.pos)/(event1.time-event.time);\n // compute slopes. if less than 30% difference, remove event1\n if((slopeBuf0 === slopeBuf1 || Math.abs(slopeBuf0/slopeBuf1 -1) <= 0.3) &&\n (slopePos0 === slopePos1 || Math.abs(slopePos0/slopePos1 -1) <= 0.3))\n {bufEvents.pop();}\n\n }\n events.buffer.push(event);\n refreshCanvas();\n\n let log = 'Duration:'\n + v.duration + '<br>'\n + 'Buffered:'\n + timeRangesToString(v.buffered) + '<br>'\n + 'Seekable:'\n + timeRangesToString(v.seekable) + '<br>'\n + 'Played:'\n + timeRangesToString(v.played) + '<br>';\n\n if (hls.media) {\n for(let type in tracks)\n {log += type + ' Buffered:' + timeRangesToString(tracks[type].buffer.buffered) + '<br>';}\n\n\n let videoPlaybackQuality = v.getVideoPlaybackQuality;\n if(videoPlaybackQuality && typeof (videoPlaybackQuality) === typeof (Function)) {\n log+='Dropped Frames:'+ v.getVideoPlaybackQuality().droppedVideoFrames + '<br>';\n log+='Corrupted Frames:'+ v.getVideoPlaybackQuality().corruptedVideoFrames + '<br>';\n } else if(v.webkitDroppedFrameCount) {\n log+='Dropped Frames:'+ v.webkitDroppedFrameCount + '<br>';\n }\n }\n $('#buffered_log').html(log);\n $('#HlsStats').text(JSON.stringify(sortObject(stats), null, '\\t'));\n ctx.fillStyle = 'blue';\n let x = v.currentTime / v.duration * canvas.width;\n ctx.fillRect(x, 0, 2, 15);\n }\n\n}\n\nfunction sortObject(obj) {\n if(typeof obj !== 'object')\n {return obj;}\n let temp = {\n };\n let keys = [];\n for(let key in obj)\n {keys.push(key);}\n keys.sort();\n for(let index in keys)\n {temp[keys[index]] = sortObject(obj[keys[index]]);}\n return temp;\n}\n\nfunction showCanvas() {\n showMetrics();\n $('#buffered_log').show();\n $('#buffered_c').show();\n}\n\nfunction hideCanvas() {\n hideMetrics();\n $('#buffered_log').hide();\n $('#buffered_c').hide();\n}\n\nfunction getMetrics() {\n let json = JSON.stringify(events);\n let jsonpacked = jsonpack.pack(json);\n console.log('packing JSON from ' + json.length + ' to ' + jsonpacked.length + ' bytes');\n return btoa(jsonpacked);\n}\n\nfunction copyMetricsToClipBoard() {\n copyTextToClipboard(getMetrics());\n}\n\nfunction copyTextToClipboard(text) {\n let textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.select();\n try {\n let successful = document.execCommand('copy');\n let msg = successful ? 'successful' : 'unsuccessful';\n console.log('Copying text command was ' + msg);\n } catch (err) {\n console.log('Oops, unable to copy');\n }\n document.body.removeChild(textArea);\n}\n\nfunction goToMetrics() {\n let url = document.URL;\n url = url.substr(0, url.lastIndexOf('/')+1) + 'metrics.html';\n console.log(url);\n window.open(url, '_blank');\n}\n\nfunction goToMetricsPermaLink() {\n let url = document.URL;\n let b64 = getMetrics();\n url = url.substr(0, url.lastIndexOf('/')+1) + 'metrics.html#data=' + b64;\n console.log(url);\n window.open(url, '_blank');\n}\n\nfunction minsecs(ts) {\n let m = Math.floor(Math.floor(ts % 3600) / 60);\n let s = Math.floor(ts % 60);\n return m + ':' + (s < 10 ? '0' : '') + s;\n}\n\nfunction onClickBufferedRange(event) {\n let canvas = $('#buffered_c')[0];\n let v = $('#video')[0];\n let target = (event.clientX - canvas.offsetLeft) / canvas.width * v.duration;\n v.currentTime = target;\n}\n\nfunction updateLevelInfo() {\n\n if (!hls.levels) {\n return;\n }\n\n let button_template = '<button type=\"button\" class=\"btn btn-sm ';\n let button_enabled = 'btn-primary\" ';\n let button_disabled = 'btn-success\" ';\n\n let html1 = button_template;\n if(hls.autoLevelEnabled) {\n html1 += button_enabled;\n } else {\n html1 += button_disabled;\n }\n\n html1 += 'onclick=\"hls.currentLevel=-1\">auto</button>';\n\n let html2 = button_template;\n if(hls.autoLevelEnabled) {\n html2 += button_enabled;\n } else {\n html2 += button_disabled;\n }\n\n html2 += 'onclick=\"hls.loadLevel=-1\">auto</button>';\n\n let html3 = button_template;\n if(hls.autoLevelCapping === -1) {\n html3 += button_enabled;\n } else {\n html3 += button_disabled;\n }\n\n html3 += 'onclick=\"levelCapping=hls.autoLevelCapping=-1;updateLevelInfo();updatePermalink();\">auto</button>';\n\n let html4 = button_template;\n if(hls.autoLevelEnabled) {\n html4 += button_enabled;\n } else {\n html4 += button_disabled;\n }\n\n html4 += 'onclick=\"hls.nextLevel=-1\">auto</button>';\n\n for (let i=0; i < hls.levels.length; i++) {\n html1 += button_template;\n if(hls.currentLevel === i) {\n html1 += button_enabled;\n } else {\n html1 += button_disabled;\n }\n\n let levelName = i, label = level2label(i);\n if(label) {\n levelName += '(' + level2label(i) + ')';\n }\n\n html1 += 'onclick=\"hls.currentLevel=' + i + '\">' + levelName + '</button>';\n\n html2 += button_template;\n if(hls.loadLevel === i) {\n html2 += button_enabled;\n } else {\n html2 += button_disabled;\n }\n\n html2 += 'onclick=\"hls.loadLevel=' + i + '\">' + levelName + '</button>';\n\n html3 += button_template;\n if(hls.autoLevelCapping === i) {\n html3 += button_enabled;\n } else {\n html3 += button_disabled;\n }\n\n html3 += 'onclick=\"levelCapping=hls.autoLevelCapping=' + i + ';updateLevelInfo();updatePermalink();\">' + levelName + '</button>';\n\n html4 += button_template;\n if(hls.nextLevel === i) {\n html4 += button_enabled;\n } else {\n html4 += button_disabled;\n }\n\n html4 += 'onclick=\"hls.nextLevel=' + i + '\">' + levelName + '</button>';\n }\n\n let v = $('#video')[0];\n\n if(v.videoWidth && v.videoHeight) {\n $('#currentResolution').html(v.videoWidth + ' x ' + v.videoHeight);\n }\n\n if($('#currentLevelControl').html() != html1) {\n $('#currentLevelControl').html(html1);\n }\n\n if($('#loadLevelControl').html() != html2) {\n $('#loadLevelControl').html(html2);\n }\n\n if($('#levelCappingControl').html() != html3) {\n $('#levelCappingControl').html(html3);\n }\n\n if($('#nextLevelControl').html() != html4) {\n $('#nextLevelControl').html(html4);\n }\n}\n\nfunction updateAudioTrackInfo() {\n let button_template = '<button type=\"button\" class=\"btn btn-sm ';\n let button_enabled = 'btn-primary\" ';\n let button_disabled = 'btn-success\" ';\n let html1 = '';\n let audioTrackId = hls.audioTrack, len = hls.audioTracks.length;\n\n for (let i=0; i < len; i++) {\n html1 += button_template;\n if(audioTrackId === i) {\n html1 += button_enabled;\n } else {\n html1 += button_disabled;\n }\n\n html1 += 'onclick=\"hls.audioTrack=' + i + '\">' + hls.audioTracks[i].name + '</button>';\n }\n $('#audioTrackControl').html(html1);\n}\n\nfunction level2label(index) {\n if(hls && hls.levels.length-1 >= index) {\n let level = hls.levels[index];\n if (level.name) {\n return level.name;\n } else {\n if (level.height) {\n return(level.height + 'p / ' + Math.round(level.bitrate / 1024) + 'kb');\n } else {\n if(level.bitrate)\n {return(Math.round(level.bitrate / 1024) + 'kb');}\n else\n {return null;}\n\n }\n }\n }\n}\n\nfunction getURLParam(sParam, defaultValue) {\n let sPageURL = window.location.search.substring(1);\n let sURLVariables = sPageURL.split('&');\n for (let i = 0; i < sURLVariables.length; i++) {\n let sParameterName = sURLVariables[i].split('=');\n if (sParameterName[0] == sParam)\n {return 'undefined' == sParameterName[1] ? undefined : 'false' == sParameterName[1] ? false : sParameterName[1];}\n\n }\n return defaultValue;\n}\n\nfunction updatePermalink() {\n\n const url = $('#streamURL').val();\n const hlsLink = document.URL.split('?')[0] + '?src=' + encodeURIComponent(url) +\n '&enableStreaming=' + enableStreaming +\n '&autoRecoverError=' + autoRecoverError +\n '&enableWorker=' + enableWorker +\n '&dumpfMP4=' + dumpfMP4 +\n '&levelCapping=' + levelCapping +\n '&defaultAudioCodec=' + defaultAudioCodec +\n '&widevineLicenseURL=' + escape(widevineLicenseUrl);\n\n $('#StreamPermalink').html('<a href=\"' + hlsLink + '\">' + hlsLink + '</a>');\n}\n\nfunction createfMP4(type) {\n if (fmp4Data[type].length) {\n let blob = new Blob([arrayConcat(fmp4Data[type])], {\n type: 'application/octet-stream'\n });\n let filename = type + '-' + new Date().toISOString() + '.mp4';\n saveAs(blob, filename);\n //$('body').append('<a download=\"hlsjs-' + filename + '\" href=\"' + window.URL.createObjectURL(blob) + '\">Download ' + filename + ' track</a><br>');\n }\n}\n\nfunction arrayConcat(inputArray) {\n let totalLength = inputArray.reduce( function(prev, cur) { return prev+cur.length; }, 0);\n let result = new Uint8Array(totalLength);\n let offset = 0;\n inputArray.forEach(function(element) {\n result.set(element, offset);\n offset += element.length;\n });\n return result;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./demo/main.js","function createTestStream(url, description, live = false, abr = true, blacklist_ua = []) {\n return {\n url,\n description,\n live,\n abr,\n blacklist_ua\n }\n}\n\nfunction createTestStreamWithConfig(url, description, config) {\n const testStream = createTestStream(url, description);\n\n testStream.config = config;\n\n return testStream;\n}\n\nmodule.exports = {\n bbb: createTestStream(\n \"https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8\",\n \"Big Buck Bunny - adaptive qualities\"\n ),\n bigBuckBunny480p: {\n \"url\": \"https://video-dev.github.io/streams/x36xhzz/url_6/193039199_mp4_h264_aac_hq_7.m3u8\",\n \"description\": \"Big Buck Bunny - 480p only\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"internet explorer\"]\n },\n arte: {\n \"url\": \"https://video-dev.github.io/streams/test_001/stream.m3u8\",\n \"description\": \"ARTE China,ABR\",\n \"live\": false,\n \"abr\": true\n },\n deltatreDAI: {\n \"url\": \"https://video-dev.github.io/streams/dai-discontinuity-deltatre/manifest.m3u8\",\n \"description\": \"Ad-insertion in event stream\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"internet explorer\"]\n },\n issue666: {\n \"url\": \"http://www.streambox.fr/playlists/cisq0gim60007xzvi505emlxx.m3u8\",\n \"description\": \"hls.js/issues/666\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"internet explorer\"]\n },\n issue649: {\n \"url\": \"http://cdn3.screen9.com/media/c/W/cW87csHkxsgu5TV1qs78aA_auto_hls.m3u8?auth=qlUjeCtbVdtkDfZYrtveTIVUXX1yuSqgF8wfWabzKpX72r-d5upW88-FHuyRRdnZA_1PKRTGAtTt_6Z-aj22kw\",\n \"description\": \"hls.js/issues/649\",\n \"live\": false,\n \"abr\": false\n },\n closedCaptions: {\n \"url\": \"http://playertest.longtailvideo.com/adaptive/captions/playlist.m3u8\",\n \"description\": \"CNN special report, with CC\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"safari\"]\n },\n oceansAES: {\n \"url\": \"http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8\",\n \"description\": \"AES encrypted,ABR\",\n \"live\": false,\n \"abr\": true\n },\n bbbAES: {\n \"url\": \"http://streambox.fr/playlists/sample_aes/index.m3u8\",\n \"description\": \"SAMPLE-AES encrypted\",\n \"live\": false,\n \"abr\": false\n },\n mp3Audio: {\n \"url\": \"https://player.webvideocore.net/CL1olYogIrDWvwqiIKK7eLBkzvO18gwo9ERMzsyXzwt_t-ya8ygf2kQBZww38JJT/8i4vvznv8408.m3u8\",\n \"description\": \"MP3 VOD demo\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"safari\"]\n },\n mpegAudioOnly: {\n \"url\": \"https://pl.streamingvideoprovider.com/mp3-playlist/playlist.m3u8\",\n \"description\": \"MPEG Audio Only demo\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"internet explorer\", \"MicrosoftEdge\", \"safari\", \"firefox\"]\n },\n fmp4: {\n \"url\": \"https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8\",\n \"description\": \"HLS fMP4 Angel-One multiple audio-tracks\",\n \"live\": false,\n \"abr\": false,\n \"blacklist_ua\": [\"safari\", \"internet explorer\"]\n },\n fmp4Bitmovin: {\n \"url\": \"https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8\",\n \"description\": \"HLS fMP4 by Bitmovin\",\n \"live\": false,\n \"abr\": true,\n \"blacklist_ua\": [\"safari\", \"internet explorer\"]\n },\n offset_pts: {\n \"url\": \"https://video-dev.github.io/streams/pts_shift/master.m3u8\",\n \"description\": \"DK Turntable, PTS shifted by 2.3s\",\n \"live\": false,\n \"abr\": false\n },\n uspHLSAteam: createTestStream(\n \"http://demo.unified-streaming.com/video/ateam/ateam.ism/ateam.m3u8?session_id=27199\",\n \"A-Team movie trailer - HLS by Unified Streaming Platform\"\n ),\n angelOneShakaWidevine: createTestStreamWithConfig(\n \"https://storage.googleapis.com/shaka-demo-assets/angel-one-widevine-hls/hls.m3u8\",\n \"Shaka-packager Widevine DRM (EME) HLS-fMP4 - Angel One Demo\",\n {\n widevineLicenseUrl: \"https://cwip-shaka-proxy.appspot.com/no_auth\",\n emeEnabled: true,\n }\n )\n}\n\n\n\n// WEBPACK FOOTER //\n// ./tests/test-streams.js"],"sourceRoot":""}