From ac7659614a8823f3736978d7e24d147e9d09a953 Mon Sep 17 00:00:00 2001 From: Cat <carinasadres@gmail.com> Date: Tue, 23 Jan 2018 10:37:05 +0100 Subject: [PATCH] Embed rework --- CMakeLists.txt | 103 +- embed/controls.js | 122 + embed/core.js | 1501 -- embed/imgs/fullscreen_plain.svg | 14 +- embed/imgs/fullscreen_plain_.svg | 3 + embed/imgs/gear.svg | 61 + embed/imgs/gear_plain.svg | 3 + embed/imgs/loading.svg | 1 + embed/imgs/loop.svg | 56 +- embed/imgs/muted_plain.svg | 7 + embed/imgs/pause_plain.svg | 2 +- embed/imgs/play.svg | 51 +- embed/imgs/popout.svg | 3 + embed/imgs/speaker.svg | 80 +- embed/imgs/speaker_.svg | 59 + embed/imgs/speaker_plain.svg | 2 +- embed/imgs/switchvideo.svg | 4 + embed/imgs/timeout.svg | 19 + embed/imgs/volume.svg | 63 +- embed/imgs/volume_plain.svg | 45 +- embed/imgs/volume_rect_dot_plain.svg | 6 + embed/min/player.js | 1 + embed/min/skins/default.css | 92 + embed/min/skins/dev.css | 116 + embed/min/wrappers/dashjs.js | 1 + embed/min/wrappers/flash_strobe.js | 1 + embed/min/wrappers/html5.js | 1 + embed/min/wrappers/videojs.js | 1 + embed/min/wrappers/webrtc.js | 1 + embed/minimize.sh | 48 + embed/mist.css | 1633 -- embed/player.js | 1127 + embed/players/dash.all.min.js | 46 +- embed/players/update.sh | 8 + embed/players/video.js | 24722 --------------------- embed/players/video.min.js | 13 +- embed/players/videojs-contrib-hls.js | 19848 ----------------- embed/players/videojs-contrib-hls.min.js | 7 - embed/players/webrtc.js | 1 + embed/skins.js | 2559 +++ embed/skins/default.css | 131 + embed/skins/dev.css | 105 + embed/skins/general.css | 224 + embed/skins/video-js.css | 1279 ++ embed/util.js | 954 + embed/wrappers/dashjs.js | 328 +- embed/wrappers/flash_strobe.js | 105 +- embed/wrappers/html5.js | 405 +- embed/wrappers/img.js | 23 - embed/wrappers/jwplayer.js | 40 - embed/wrappers/polytrope.js | 101 - embed/wrappers/silverlight.js | 56 - embed/wrappers/template.js | 24 - embed/wrappers/theoplayer.js | 53 - embed/wrappers/videojs.js | 323 +- embed/wrappers/webrtc.js | 429 + src/embed.js | 327 - src/output/output_http_internal.cpp | 127 +- 58 files changed, 8278 insertions(+), 49187 deletions(-) create mode 100644 embed/controls.js delete mode 100644 embed/core.js create mode 100644 embed/imgs/fullscreen_plain_.svg create mode 100644 embed/imgs/gear.svg create mode 100644 embed/imgs/gear_plain.svg create mode 100644 embed/imgs/loading.svg create mode 100644 embed/imgs/muted_plain.svg create mode 100644 embed/imgs/popout.svg create mode 100644 embed/imgs/speaker_.svg create mode 100644 embed/imgs/switchvideo.svg create mode 100644 embed/imgs/timeout.svg create mode 100644 embed/imgs/volume_rect_dot_plain.svg create mode 100644 embed/min/player.js create mode 100644 embed/min/skins/default.css create mode 100644 embed/min/skins/dev.css create mode 100644 embed/min/wrappers/dashjs.js create mode 100644 embed/min/wrappers/flash_strobe.js create mode 100644 embed/min/wrappers/html5.js create mode 100644 embed/min/wrappers/videojs.js create mode 100644 embed/min/wrappers/webrtc.js create mode 100755 embed/minimize.sh delete mode 100644 embed/mist.css create mode 100644 embed/player.js create mode 100755 embed/players/update.sh delete mode 100644 embed/players/video.js delete mode 100644 embed/players/videojs-contrib-hls.js delete mode 100644 embed/players/videojs-contrib-hls.min.js create mode 100644 embed/players/webrtc.js create mode 100644 embed/skins.js create mode 100644 embed/skins/default.css create mode 100644 embed/skins/dev.css create mode 100644 embed/skins/general.css create mode 100644 embed/skins/video-js.css create mode 100644 embed/util.js delete mode 100644 embed/wrappers/img.js delete mode 100644 embed/wrappers/jwplayer.js delete mode 100644 embed/wrappers/polytrope.js delete mode 100644 embed/wrappers/silverlight.js delete mode 100644 embed/wrappers/template.js delete mode 100644 embed/wrappers/theoplayer.js create mode 100644 embed/wrappers/webrtc.js delete mode 100644 src/embed.js diff --git a/CMakeLists.txt b/CMakeLists.txt index 728c8972..8ca0eb25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -370,22 +370,19 @@ add_executable(MistOutHTTP src/output/output_http.cpp src/output/output_http_internal.cpp src/io.cpp - generated/silverlight.js.h - generated/embed.js.h + generated/player.js.h generated/html5.js.h generated/flash_strobe.js.h - generated/theoplayer.js.h - generated/jwplayer.js.h - generated/polytrope.js.h generated/dashjs.js.h generated/videojs.js.h - generated/img.js.h - generated/playerdash.js.h - generated/playerdashlic.js.h - generated/playervideo.js.h - generated/playerhlsvideo.js.h - generated/core.js.h - generated/mist.css.h + generated/webrtc.js.h + generated/player_dash.js.h + generated/player_dash_lic.js.h + generated/player_video.js.h + generated/player_webrtc.js.h + generated/skin_default.css.h + generated/skin_dev.css.h + generated/skin_videojs.css.h ) set_target_properties(MistOutHTTP PROPERTIES COMPILE_DEFINITIONS "OUTPUTTYPE=\"output_http_internal.h\"" @@ -445,69 +442,61 @@ endif() ######################################## # Embed Code # ######################################## -add_custom_command(OUTPUT generated/silverlight.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/silverlight.js silverlight_js generated/silverlight.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/silverlight.js -) -add_custom_command(OUTPUT generated/embed.js.h - COMMAND ./sourcery ${SOURCE_DIR}/src/embed.js embed_js generated/embed.js.h - DEPENDS sourcery ${SOURCE_DIR}/src/embed.js +# main +add_custom_command(OUTPUT generated/player.js.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/player.js player_js generated/player.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/player.js ) +# wrappers add_custom_command(OUTPUT generated/html5.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/html5.js html5_js generated/html5.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/html5.js + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/wrappers/html5.js html5_js generated/html5.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/wrappers/html5.js ) add_custom_command(OUTPUT generated/flash_strobe.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/flash_strobe.js flash_strobe_js generated/flash_strobe.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/flash_strobe.js -) -add_custom_command(OUTPUT generated/theoplayer.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/theoplayer.js theoplayer_js generated/theoplayer.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/theoplayer.js -) -add_custom_command(OUTPUT generated/jwplayer.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/jwplayer.js jwplayer_js generated/jwplayer.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/jwplayer.js -) -add_custom_command(OUTPUT generated/polytrope.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/polytrope.js polytrope_js generated/polytrope.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/polytrope.js + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/wrappers/flash_strobe.js flash_strobe_js generated/flash_strobe.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/wrappers/flash_strobe.js ) add_custom_command(OUTPUT generated/dashjs.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/dashjs.js dash_js generated/dashjs.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/dashjs.js + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/wrappers/dashjs.js dash_js generated/dashjs.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/wrappers/dashjs.js ) add_custom_command(OUTPUT generated/videojs.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/videojs.js video_js generated/videojs.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/videojs.js + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/wrappers/videojs.js video_js generated/videojs.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/wrappers/videojs.js ) -add_custom_command(OUTPUT generated/img.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/wrappers/img.js img_js generated/img.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/wrappers/img.js +add_custom_command(OUTPUT generated/webrtc.js.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/wrappers/webrtc.js webrtc_js generated/webrtc.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/wrappers/webrtc.js ) -add_custom_command(OUTPUT generated/playerdashlic.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/players/dash.js.license.js playerdashlic_js generated/playerdashlic.js.h +# players +add_custom_command(OUTPUT generated/player_dash_lic.js.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/players/dash.js.license.js player_dash_lic_js generated/player_dash_lic.js.h DEPENDS sourcery ${SOURCE_DIR}/embed/players/dash.js.license.js ) -add_custom_command(OUTPUT generated/playerdash.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/players/dash.all.min.js playerdash_js generated/playerdash.js.h +add_custom_command(OUTPUT generated/player_dash.js.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/players/dash.all.min.js player_dash_js generated/player_dash.js.h DEPENDS sourcery ${SOURCE_DIR}/embed/players/dash.all.min.js ) -add_custom_command(OUTPUT generated/playervideo.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/players/video.min.js playervideo_js generated/playervideo.js.h +add_custom_command(OUTPUT generated/player_video.js.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/players/video.min.js player_video_js generated/player_video.js.h DEPENDS sourcery ${SOURCE_DIR}/embed/players/video.min.js ) -add_custom_command(OUTPUT generated/playerhlsvideo.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/players/videojs-contrib-hls.min.js playerhlsvideo_js generated/playerhlsvideo.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/players/videojs-contrib-hls.min.js +add_custom_command(OUTPUT generated/player_webrtc.js.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/players/webrtc.js player_webrtc_js generated/player_webrtc.js.h + DEPENDS sourcery ${SOURCE_DIR}/embed/players/webrtc.js ) -add_custom_command(OUTPUT generated/core.js.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/core.js core_js generated/core.js.h - DEPENDS sourcery ${SOURCE_DIR}/embed/core.js +# css +add_custom_command(OUTPUT generated/skin_default.css.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/skins/default.css skin_default_css generated/skin_default.css.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/skins/default.css ) -add_custom_command(OUTPUT generated/mist.css.h - COMMAND ./sourcery ${SOURCE_DIR}/embed/mist.css mist_css generated/mist.css.h - DEPENDS sourcery ${SOURCE_DIR}/embed/mist.css +add_custom_command(OUTPUT generated/skin_dev.css.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/min/skins/dev.css skin_dev_css generated/skin_dev.css.h + DEPENDS sourcery ${SOURCE_DIR}/embed/min/skins/dev.css +) +add_custom_command(OUTPUT generated/skin_videojs.css.h + COMMAND ./sourcery ${SOURCE_DIR}/embed/skins/video-js.css skin_videojs_css generated/skin_videojs.css.h + DEPENDS sourcery ${SOURCE_DIR}/embed/skins/video-js.css ) ######################################## diff --git a/embed/controls.js b/embed/controls.js new file mode 100644 index 00000000..cec629de --- /dev/null +++ b/embed/controls.js @@ -0,0 +1,122 @@ +function MistUI(MistVideo,structure) { + MistVideo.UI = this; + this.elements = []; + + this.buildStructure = function(structure){ + if (typeof structure == "function") { structure = structure.call(MistVideo); } + + if ("if" in structure) { + var result = false; + if (structure.if.call(MistVideo,structure)) { + result = structure.then; + } + else if ("else" in structure) { + result = structure.else; + } + + if (!result) { return; } + + //append the result with structure options + for (var i in structure) { + if (["if","then","else"].indexOf(i) < 0) { + if (i in result) { + if (!(result[i] instanceof Array)) { + result[i] = [result[i]]; + } + result[i] = result[i].concat(structure[i]); + } + else { + result[i] = structure[i]; + } + } + } + return this.buildStructure(result); + } + + if ("type" in structure) { + if (structure.type in MistVideo.skin.blueprints) { + + //create the element; making sure to pass "this" to blueprint function + var container = MistVideo.skin.blueprints[structure.type].call(MistVideo,structure); + if (!container) { return; } + MistUtil.class.add(container,"mistvideo-"+structure.type); + + if ("css" in structure) { + var uid = MistUtil.createUnique(); + structure.css = [].concat(structure.css); //convert to array; should be in string format with colors already applied + + for (var i in structure.css) { + var style = MistUtil.css.createStyle(structure.css[i],uid); + container.appendChild(style); + } + MistUtil.class.add(container,uid); + container.uid = uid; + } + + if ("classes" in structure) { + for (var i in structure.classes) { + MistUtil.class.add(container,structure.classes[i]); + } + } + + if ("title" in structure) { + container.title = structure.title; + } + + if ("style" in structure) { + for (var i in structure.style) { + container.style[i] = structure.style[i]; + } + } + + if ("children" in structure) { + for (var i in structure.children) { + var child = this.buildStructure(structure.children[i]); + if (child) { + container.appendChild(child); + } + } + } + //save the returned element so they can be killed on unload + MistVideo.UI.elements.push(container); + return container; + } + } + + return false; + }; + this.build = function(){ + return this.buildStructure(structure ? structure : MistVideo.skin.structure.main); + }; + + var container = this.build(); + + //apply skin CSS + var uid = MistUtil.createUnique(); + var toload = MistVideo.skin.css.length; + if (toload) { container.style.opacity = "0"; } + for (var i in MistVideo.skin.css) { + var style = MistVideo.skin.css[i]; + style.callback = function(css) { + this.textContent = MistUtil.css.prependClass(css,uid,true); + toload--; + if (toload <= 0) { + container.style.opacity = ""; + } + }; + if (style.textContent != "") { + //it has already loaded + style.callback(style.textContent); + } + container.appendChild(style); + } + MistUtil.class.add(container,uid); + + //add browser class + var browser = MistUtil.getBrowser(); + if (browser) { + MistUtil.class.add(container,"browser-"+browser); + } + + return container; +} diff --git a/embed/core.js b/embed/core.js deleted file mode 100644 index 4aae50e0..00000000 --- a/embed/core.js +++ /dev/null @@ -1,1501 +0,0 @@ -///////////////////////////////////// -// DECLARE MISTPLAYER BASE CLASS // -///////////////////////////////////// - -var mistplayers = {}; -var mistplayer_session_id = Math.round(Math.random()*1e12); - -function MistPlayer() {}; -MistPlayer.prototype.sendEvent = function(type,message,target) { - try { - var event = new Event(type,{ - bubbles: true, - cancelable: true - }); - event.message = message; - target.dispatchEvent(event); - } - catch (e) { - try { - var event = document.createEvent('Event'); - event.initEvent(type,true,true); - event.message = message; - target.dispatchEvent(event); - } - catch (e) { return false; } - } - return true; -} -MistPlayer.prototype.addlog = function(msg) { - this.sendEvent('log',msg,(this.element ? this.element: this.target)); -} -MistPlayer.prototype.adderror = function(msg) { - this.sendEvent('error',msg,(this.element ? this.element: this.target)); -} -MistPlayer.prototype.build = function (options,callback) { - this.addlog('Error in player implementation'); - var err = document.createElement('div'); - var msgnode = document.createTextNode(msg); - err.appendChild(msgnode); - err.className = 'error'; - return err; -} -MistPlayer.prototype.timer = { - timers: {}, - add: function(callback,delay,isInterval){ - var me = this; - var i = setTimeout(function(){ - delete me.timers[i]; - callback(); - },delay); - this.timers[i] = { - delay: delay, - callback: callback, - interval: isInterval || false - }; - return i; - }, - remove: function(i){ - if (i in this.timers) { - if (this.timers[i].interval) { - clearInterval(i); - } - else { - clearTimeout(i); - } - delete this.timers[i]; - } - }, - clear: function(){ - for (var i in this.timers) { - this.remove(i); - } - this.timers = {}; - } -}; - -//creates the player element, including custom functions -MistPlayer.prototype.getElement = function(tag){ - var ele = document.createElement(tag); - ele.className = 'mistplayer'; - this.element = ele; - return ele; -}; -MistPlayer.prototype.onready = function(dothis){ - this.onreadylist.push(dothis); -}; -MistPlayer.prototype.play = false; -MistPlayer.prototype.pause = false; -MistPlayer.prototype.paused = false; -MistPlayer.prototype.volume = false; -MistPlayer.prototype.loop = false; -MistPlayer.prototype.fullscreen = false; -MistPlayer.prototype.setTracks = function(usetracks){ - if (usetracks == false) { - if (!('updateSrc' in this)) { return false; } - return true; - } - - function urlAddParam(url,params) { - var spliturl = url.split('?'); - var ret = [spliturl.shift()]; - var splitparams = []; - if (spliturl.length) { - splitparams = spliturl[0].split('&'); - } - for (var i in params) { - splitparams.push(i+'='+params[i]); - } - if (splitparams.length) { ret.push(splitparams.join('&')); } - return ret.join('?'); - } - - if ('subtitle' in usetracks) { - //remove previous subtitles - var ts = this.element.getElementsByTagName('track'); - for (var i = ts.length - 1; i >= 0; i--) { - this.element.removeChild(ts[i]); - } - var tracks = this.tracks.subtitle; - for (var i in tracks) { - if (tracks[i].trackid == usetracks.subtitle) { - var t = document.createElement('track'); - this.element.appendChild(t); - t.kind = 'subtitles'; - t.label = tracks[i].desc; - t.srclang = tracks[i].lang; - t.src = this.subtitle+'?track='+tracks[i].trackid; - t.setAttribute('default',''); - break; - } - } - delete usetracks.subtitle; - if (Object.keys(usetracks).length == 0) { return true; } - } - - var time = this.element.currentTime; - var newurl; - if (this.options.source.type == 'html5/application/vnd.apple.mpegurl') { //for HLS, use a different format for track selection - newurl = this.options.src.split('/'); - var m3u8 = newurl.pop(); //take this off now, it will be added back later - var hlstracks = []; - for (var i in usetracks) { - //for audio or video tracks, just add the tracknumber between slashes - switch (i) { - case 'audio': - case 'video': - if (usetracks[i] == 0) { continue; } - hlstracks.push(usetracks[i]); - break; - } - } - if (hlstracks.length) { newurl.push(hlstracks.join('_')); } - newurl.push(m3u8); //put back index.m3u8 - newurl = newurl.join('/'); - } - else { - newurl = urlAddParam(this.options.src,usetracks); - } - this.updateSrc(newurl); - if (this.element.readyState) { - this.element.load(); - } - - - if (this.element.currentTime != time) { - try { - this.element.currentTime = time; - } - catch (e) { - var f = function(){ - this.currentTime = time; - this.removeEventListener("loadeddata",f); - }; - this.element.addEventListener("loadeddata",f); - } - } - - if ('trackselects' in this) { - for (var i in usetracks) { - if (i in this.trackselects) { this.trackselects[i].value = usetracks[i]; } - } - } - - return true; -}; -MistPlayer.prototype.resize = false; -MistPlayer.prototype.buildMistControls = function(){ - if (!('flex' in document.head.style) || (['iPad','iPod','iPhone'].indexOf(navigator.platform) != -1)) { - //this browser does not support MistControls - this.addlog('Mist controls are not supported'); - return false; - } - this.addlog('Building Mist controls..'); - - var ele = this.element; - var options = this.options; - var me = this; //to allow nested functions to access the player class itself - - function formatTime(secs) { - var hours = Math.floor(secs / 3600); - secs = secs - hours * 3600; - var mins = Math.floor(secs / 60); - secs = Math.floor(secs - mins * 60); - var str = []; - if (hours) { - str.push(hours); - } - str.push(('0'+mins).slice(-2)); - str.push(('0'+secs).slice(-2)); - return str.join(':'); - } - var timestampValue, bar; - function whilePlaying() { - timestampValue.nodeValue = formatTime(ele.currentTime); - bar.style.width = ((ele.currentTime-ele.startTime)/ele.duration*100)+'%'; - me.timer.add(function(){ - if (!ele.paused) { - whilePlaying(); - } - },0.5e3); - }; - function whileLivePlaying(track) { - - //var playtime = (new Date()) - options.initTime; - var playtime = ele.currentTime*1e3; - timestampValue.nodeValue = formatTime((playtime + track.lastms)/1e3); - - - me.timer.add(function(){ - if (!ele.paused) { - whileLivePlaying(track); - } - },0.5e3); - }; - - - var controls = document.createElement('div'); - ele.parentNode.appendChild(controls); - controls.className = 'controls'; - controls.onclick = function(e){ e.stopPropagation(); }; - - //if the video is very small, zoom the controls - var zoom = options.width/480; - if (zoom < 1) { - zoom = Math.max(zoom,0.5); - if ('zoom' in controls.style) { controls.style.zoom = zoom; } - else { - controls.className += ' smaller'; //if css doesn't support zoom, apply smaller class to use smaller controls - } - } - else { zoom = 1; } - ele.style['min-width'] = zoom*400+'px'; - ele.style['min-height'] = zoom*160+'px'; - - var play = document.createElement('div'); - controls.appendChild(play); - play.className = 'button play'; - play.title = 'Play / Pause'; - play.setAttribute('data-state','paused'); - play.onclick = function(){ - if (ele.paused) { - if (options.live) { - me.load(); - } - else { - me.play(); - } - } - else { - me.pause(); - } - }; - - var progressCont = document.createElement('div'); - controls.appendChild(progressCont); - progressCont.className = 'progress_container'; - ele.startTime = 0; - if (!options.live) { - var progress = document.createElement('div'); - progressCont.appendChild(progress); - progress.className = 'button progress'; - progress.getPos = function(e){ - if (!isFinite(ele.duration)) { return 0; } - var style = progress.currentStyle || window.getComputedStyle(progress, null); - var zoom = Number(!('zoom' in controls.style) || controls.style.zoom == '' ? 1 : controls.style.zoom); - - var pos0 = progress.getBoundingClientRect().left - parseInt(style.borderLeftWidth,10); - var perc = (e.clientX - pos0 * zoom) / progress.offsetWidth / zoom; - var secs = Math.max(0,perc) * ele.duration; - return secs; - } - progress.onmousemove = function(e) { - if (ele.duration) { - var pos = this.getPos(e); - hintValue.nodeValue = formatTime(pos); - hint.style.display = 'block'; - hint.style.left = (pos / ele.duration)*100+'%'; - } - }; - progress.onmouseout = function() { - hint.style.display = 'none'; - }; - progress.onmouseup = function(e) { - ele.currentTime = this.getPos(e); - ele.startTime = ele.currentTime; - bar.style.left = (ele.startTime/ele.duration*100)+'%'; - }; - progress.ondragstart = function() { return false; }; - bar = document.createElement('div'); - progress.appendChild(bar); - bar.className = 'bar'; - var buffers = []; - var hint = document.createElement('div'); - progressCont.appendChild(hint); - hint.className = 'hint'; - var hintValue = document.createTextNode('-:--'); - hint.appendChild(hintValue); - - ele.addEventListener('seeking',function(){ - me.target.setAttribute('data-loading',''); - }); - ele.addEventListener('seeked',function(){ - me.target.removeAttribute('data-loading'); - bar.style.left = (ele.currentTime/ele.duration*100)+'%'; - //TODO reset lasttime - }); - ele.addEventListener('canplay',function(){ - me.target.removeAttribute('data-loading'); - }); - ele.addEventListener('playing',function(){ - me.target.removeAttribute('data-loading'); - }); - ele.addEventListener('progress',function(){ - me.target.removeAttribute('data-loading'); - }); - } - - var timestamp = document.createElement('div'); - controls.appendChild(timestamp); - timestamp.className = 'button timestamp'; - timestampValue = document.createTextNode('-:--'); - timestamp.title = 'Time'; - timestamp.appendChild(timestampValue); - - var sound = document.createElement('div'); - controls.appendChild(sound); - sound.className = 'button sound'; - var volume = document.createElement('div'); - sound.appendChild(volume); - sound.getPos = function(ypos){ - var style = this.currentStyle || window.getComputedStyle(this, null); - - var zoom = Number(!('zoom' in controls.style) || controls.style.zoom == '' ? 1 : controls.style.zoom); - - var pos0 = sound.getBoundingClientRect().top - parseInt(style.borderTopWidth,10); - var perc = (ypos - pos0 * zoom) / sound.offsetHeight / zoom; - - perc = 1 - Math.min(1,Math.max(0,perc)); //linear range between 0 and 1 - perc = 1 - Math.pow((1-perc),1/2); //transform to quadratic range between 0 and 1 - - return perc; - } - volume.className = 'volume'; - sound.title = 'Volume'; - if (('localStorage' in window) && (localStorage != null) && ('mistVolume' in localStorage)) { - ele.volume = localStorage['mistVolume']; - volume.style.height = ele.volume*100+'%'; - } - var mousedown = function(e){ - var mousemove = function(e){ - ele.volume = sound.getPos(e.clientY); - }; - var mouseup = function(e){ - document.removeEventListener('mousemove',mousemove); - controls.removeEventListener('mousemove',mousemove); - document.removeEventListener('touchmove',mousemove); - document.removeEventListener('mouseup',mouseup); - document.removeEventListener('touchend',mouseup); - try { - localStorage['mistVolume'] = ele.volume; - } - catch (e) {} - }; - document.addEventListener('mousemove',mousemove); - controls.addEventListener('mousemove',mousemove); //this one is added because the controls hiding mechanism stops propagation to the document - document.addEventListener('touchmove',mousemove); - document.addEventListener('mouseup',mouseup); - document.addEventListener('touchend',mouseup); - ele.volume = sound.getPos(e.clientY); - }; - sound.onmousedown = mousedown; - sound.ontouchstart = mousedown; - sound.ondragstart = function() { return false; }; - sound.onclick = function(e){ - ele.volume = sound.getPos(e.clientY); - try { - localStorage['mistVolume'] = ele.volume; - } - catch (e) {} - }; - var speaker = document.createElement('div'); - speaker.title = 'Mute / Unmute'; - sound.appendChild(speaker); - speaker.className = 'button speaker'; - speaker.onclick = function(e) { - if (ele.volume) { - lastvolume = ele.volume; - ele.volume = 0; - } - else { - ele.volume = lastvolume; - } - e.stopPropagation(); - }; - speaker.onmousedown = function(e){ - e.stopPropagation(); - }; - - var buttons = document.createElement('div'); - buttons.className = 'column'; - controls.appendChild(buttons); - - if ( - (this.setTracks(false)) - && (this.tracks.video.length + this.tracks.audio.length + this.tracks.subtitle.length > 1) - && (this.options.source.type != 'html5/video/ogg') - ) { - - /* - - the player supports setting tracks; - - there is something to choose - - it's not OGG, which doesn't have track selection yet - */ - - //prepare the html stuff - var tracks = this.tracks; - var tracksc = document.createElement('div'); - tracksc.innerHTML = 'Tracks'; - tracksc.className = 'button tracks'; - buttons.appendChild(tracksc); - - var settings = document.createElement('div'); - tracksc.appendChild(settings); - settings.className = 'settings'; - - me.trackselects = {}; - for (var i in tracks) { //for each track type (video, audio, subtitle..) - if (tracks[i].length) { - var l = document.createElement('label'); - settings.appendChild(l); - var p = document.createElement('span'); - l.appendChild(p); - var t = document.createTextNode(i+':'); - p.appendChild(t); - var s = document.createElement('select'); - l.appendChild(s); - me.trackselects[i] = s; - s.setAttribute('data-type',i); - for (var j in tracks[i]) { //for each track - var o = document.createElement('option'); - s.appendChild(o); - o.value = tracks[i][j].trackid; - - //make up something logical for the track name - var name; - if ('name' in tracks[i][j]) { - name = tracks[i][j].name; - } - else if ('desc' in tracks[i][j]) { - name = tracks[i][j].desc; - } - else if ('lang' in tracks[i][j]) { - name = tracks[i][j].lang; - o.setAttribute('data-lang',tracks[i][j].lang); - } - else { - name = 'Track '+(Number(j)+1); - } - o.appendChild(document.createTextNode(name)); - } - var o = document.createElement('option'); - s.appendChild(o); - o.value = 0; - var t = document.createTextNode('No '+i); - o.appendChild(t); - s.onchange = function(){ - var usetracks = {}; - if (this.getAttribute('data-type') == 'subtitle') { - usetracks.subtitle = this.value; - try { - localStorage['mistSubtitle'] = this.querySelector('[value="'+this.value+'"]').getAttribute('data-lang'); - } - catch (e) {} - } - else { - for (var i in me.trackselects) { - usetracks[me.trackselects[i].getAttribute('data-type')] = me.trackselects[i].value - } - if (this.value == 0) { - //if we are disabling a video or audio track, dont allow us to disable another video or audio track because there will be no data - var optiontags = this.parentNode.parentNode.querySelectorAll('select:not([data-type="subtitle"]) option[value="0"]'); - for (var i = 0; i < optiontags.length; i++) { - optiontags[i].setAttribute('disabled',''); - } - } - else { - //put back the disabled track options - var optiontags = this.parentNode.parentNode.querySelectorAll('option[value="0"][disabled]'); - for (var i = 0; i < optiontags.length; i++) { - optiontags[i].removeAttribute('disabled'); - } - } - } - me.setTracks(usetracks); - - } - if (i == 'subtitle') { - s.value = 0; - if (('localStorage' in window) && (localStorage != null) && ('mistSubtitle' in localStorage)) { - var option = s.querySelector('[data-lang="'+localStorage['mistSubtitle']+'"]'); - if (option) { - s.value = option.value; - s.onchange(); - } - } - } - } - } - - var l = document - } - - var buttons2 = document.createElement('div'); - buttons2.className = 'row'; - buttons.appendChild(buttons2); - - if ((me.loop) && (!options.live)) { - var loop = document.createElement('div'); - buttons2.appendChild(loop); - loop.className = 'button loop'; - loop.title = 'Loop'; - if (me.loop()) { loop.setAttribute('data-on',''); } - loop.onclick = function(){ - if (me.loop()) { - this.removeAttribute('data-on'); - me.loop(false); - } - else { - this.setAttribute('data-on',''); - me.loop(true); - if ((me.element.paused) && (me.element.currentTime == me.element.duration)) { - me.play(); - } - } - }; - } - if (me.fullscreen) { - var fullscreen = document.createElement('div'); - buttons2.appendChild(fullscreen); - fullscreen.className = 'button fullscreen'; - fullscreen.title = 'Fullscreen' - fullscreen.onclick = function(){ - me.fullscreen(); - }; - } - - ele.addEventListener('play',function(){ - play.setAttribute('data-state','playing'); - }); - ele.addEventListener('pause',function(){ - play.setAttribute('data-state','paused'); - }); - ele.addEventListener('ended',function(){ - play.setAttribute('data-state','paused'); - if (options.live) { - me.load(); - } - }); - ele.addEventListener('volumechange',function(){ - var vol = 1 - Math.pow(1-ele.volume,2); //transform back from quadratic - volume.style.height = vol*100+'%'; - if (ele.volume == 0) { - speaker.setAttribute('data-muted',''); - } - else { - speaker.removeAttribute('data-muted',''); - } - }); - if (options.live) { - ele.addEventListener('playing',function(){ - var track = { - firstms: 0, - lastms: 0 - }; - for (var i in options.meta.tracks) { - track = options.meta.tracks[i]; - break; - } - whileLivePlaying(track); - }); - } - else { - ele.addEventListener('playing',function(){ - whilePlaying(); - }); - ele.addEventListener('durationchange',function(){ - timestampValue.nodeValue = formatTime(ele.duration); - }); - ele.addEventListener('progress',function(){ - for (var i in buffers) { - progress.removeChild(buffers[i]); - } - buffers = []; - - var start,end; - for (var i = 0; i < ele.buffered.length; i++) { - var b = document.createElement('div'); - b.className = 'buffer'; - progress.appendChild(b); - buffers.push(b); - start = ele.buffered.start(i); - end = ele.buffered.end(i); - b.setAttribute('style','left:'+(start/ele.duration*100)+'%; width:'+((end-start)/ele.duration*100 )+'%'); - } - }); - } - - //hide the cursor and controls if it is over the video (not the controls) and hasn't moved for 5 secs - var position = { - x: 0, - y: 0, - lastpos: { x: 0, y: 0 }, - counter: 0, - element: false, - interval: setInterval(function(){ - if (position.element == 'video') { - if ((position.x == position.lastpos.x) && (position.y == position.lastpos.y)) { - position.counter++; - if (position.counter >= 5) { - position.element = false; - ele.parentNode.setAttribute('data-hide',''); - return; - } - } - position.lastpos.x = position.x; - position.lastpos.y = position.y; - return; - } - position.counter = 0; - },1e3) - }; - ele.addEventListener('mousemove',function(e){ - position.x = e.pageX; - position.y = e.pageY; - position.element = 'video'; - ele.parentNode.removeAttribute('data-hide'); - }); - controls.addEventListener('mousemove',function(e){ - position.element = 'controls'; - e.stopPropagation(); - }); - ele.addEventListener('mouseout',function(e){ - position.element = false; - }); - - return true; -} -MistPlayer.prototype.askNextCombo = function(msg){ - var me = this; - if (me.errorstate) { return; } - me.errorstate = true; - me.report({ - type: 'playback', - warn: 'Showing error window', - msg: msg - }); - - //show the error - var err = document.createElement('div'); - var msgnode = document.createTextNode(msg ? msg : 'Player or stream error detected'); - err.appendChild(msgnode); - err.className = 'error'; - err.style.position = 'absolute'; - err.style.width = '100%'; - err.style['margin-left'] = 0; - this.target.appendChild(err); - if (this.element) { - this.element.style.opacity = '0.2'; - if (this.element.parentElement != this.target) { - err.style.position = ''; - } - } - - //if there is a next source/player, show a button to activate it - var opts = this.mistplaySettings.options; - if (mistCheck(mistvideo[this.mistplaySettings.streamname],opts)) { - var button = document.createElement('button'); - var t = document.createTextNode('Try next source/player'); - button.appendChild(t); - err.appendChild(button); - button.onclick = function(){ - me.nextCombo(); - } - } - - //show a button to reload with the current settings - var button = document.createElement('button'); - var i = document.createElement('div'); //a css countdown clock for 10sec - i.className = 'countdown'; - button.appendChild(i); - var t = document.createTextNode('Reload this player'); - button.appendChild(t); - err.appendChild(button); - button.onclick = function(){ - me.addlog('Reloading player because the reload button was triggered'); - me.reload(); - } - - //after 20 seconds, reload the player - err.timeOut = me.timer.add(function(){ - me.report({ - type: 'playback', - warn: 'Automatically reloaded the current player after playback error' - }); - me.addlog('Triggering reload button because of timeout'); - button.click(); - },20e3); - -}; -MistPlayer.prototype.cancelAskNextCombo = function(){ - if (this.errorstate) { - this.errorstate = false; - this.addlog('Removing error window'); - this.element.style.opacity = 1; - var err = this.target.querySelector('.error'); - if (err) { - this.target.removeChild(err); - if (err.timeOut) { this.timer.remove(err.timeOut); } - } - } -}; -MistPlayer.prototype.reload = function(){ - this.unload(); - mistPlay(this.mistplaySettings.streamname,this.mistplaySettings.options); - this.report({ - type: 'init', - info: 'Reloading player' - }); -}; -MistPlayer.prototype.nextCombo = function(){ - this.unload(); - var opts = this.mistplaySettings.options; - opts.startCombo = this.mistplaySettings.startCombo; - mistPlay(this.mistplaySettings.streamname,opts); -}; -///send information back to mistserver -///\param msg object containing the information to report -MistPlayer.prototype.report = function(msg) { - - ///send a http post request - ///\param url (string) url to send to - ///\param params object containing post parameters - function httpPost(url,params) { - var http = new XMLHttpRequest(); - - var postdata = []; - for (var i in params) { - postdata.push(i+'='+params[i]); - } - - http.open("POST", url, true); - http.send(postdata.join('&')); - } - - //add some extra information - msg.userinfo = { - page: location.href, - stream: this.streamname, - session: mistplayer_session_id - }; - if ('index' in this) { msg.userinfo.playerindex = this.index; } - if ('playername' in this) { msg.userinfo.player = this.playername; } - if ('options' in this) { - if ('source' in this.options) { - msg.userinfo.source = { - src: this.options.source.url, - type: this.options.source.type - }; - } - msg.userinfo.resolution = this.options.width+'x'+this.options.height; - msg.userinfo.time = Math.round(((new Date) - this.options.initTime)/1e3); //seconds since the info js was loaded - } - - this.sendEvent('report',JSON.stringify(msg),this.element); - - return false; ///\todo Remove this when the backend reporting function has been coded - - try { - httpPost(this.options.host+'/report',{ - report: JSON.stringify(msg) - }); - } - catch (e) { } -} -MistPlayer.prototype.unload = function(){ - this.addlog('Unloading..'); - if (this.element) { - if (('pause' in this) && (this.pause)) { this.pause(); } - if ('updateSrc' in this) { - this.updateSrc(''); - this.element.load(); //dont use this.load() to avoid interrupting play/pause - } - this.element.innerHTML = ''; - } - this.timer.clear(); - this.target.innerHTML = ''; -}; - -function mistCheck(streaminfo,options,embedLog) { - if (typeof embedLog != 'function') { embedLog = function(){}; } - - embedLog('Checking available players..'); - - var source = false; - var mistPlayer = false; - - if (options.startCombo) { - options.startCombo.started = { - player: false, - source: false - }; - } - - function checkPlayer(p_shortname) { - if ((options.startCombo) && (!options.startCombo.started.player)) { - if (p_shortname != options.startCombo.player) { return false; } - else { - options.startCombo.started.player = true; - } - } - - embedLog('Checking '+mistplayers[p_shortname].name+' (priority: '+mistplayers[p_shortname].priority+') ..'); - - //loop over the available sources and check if this player can play it - var loop; - if (options.forceSource) { - loop = [streaminfo.source[options.forceSource]]; - } - else { - loop = streaminfo.source; - } - for (var s in loop) { - if ((options.startCombo) && (!options.startCombo.started.source)) { - if (s == options.startCombo.source) { - options.startCombo.started.source = true; - } - continue; - } - if ((options.forceType) && (loop[s].type != options.forceType)) { - continue; - } - - if (mistplayers[p_shortname].isMimeSupported(loop[s].type)) { - //this player supports this mime - if (mistplayers[p_shortname].isBrowserSupported(loop[s].type,loop[s],options,streaminfo,embedLog)) { - //this browser is supported - embedLog('Found a working combo: '+mistplayers[p_shortname].name+' with '+loop[s].type+' @ '+loop[s].url); - mistPlayer = p_shortname; - source = loop[s]; - source.index = s; - return p_shortname; - } - else { - embedLog('This browser does not support '+loop[s].type+' via '+loop[s].url); - } - } - } - - return false; - } - - if (options.forcePlayer) { - checkPlayer(options.forcePlayer); - } - else { - //sort the players - var sorted = Object.keys(mistplayers); - sorted.sort(function(a,b){ - return mistplayers[a].priority - mistplayers[b].priority; - }); - for (var n in sorted) { - var p_shortname = sorted[n]; - if (checkPlayer(p_shortname)) { break; } - } - } - - return ((source && mistPlayer) ? { - source: source, - mistPlayer: mistPlayer - } : false); -} - -///////////////////////////////////////////////// -// SELECT AND ADD A VIDEO PLAYER TO THE TARGET // -///////////////////////////////////////////////// - -function mistPlay(streamName,options) { - - var protoplay = new MistPlayer(); - protoplay.streamname = streamName; - var embedLog = function(msg) { - protoplay.sendEvent('log',msg,options.target); - }; - function mistError(msg) { - var info = {}; - if ((typeof mistvideo != 'undefined') && (streamName in mistvideo)) { info = mistvideo[streamName]; } - var displaymsg = msg; - if ('on_error' in info) { displaymsg = info.on_error; } - - var err = document.createElement('div'); - err.innerHTML = displaymsg.replace(new RegExp("\n",'g'),'<br>')+'<br>'; - err.className = 'error'; - var button = document.createElement('button'); - var i = document.createElement('div'); - button.appendChild(i); - var t = document.createTextNode('Reload'); - button.appendChild(t); - err.appendChild(button); - button.onclick = function(){ - if (err.parentElement) { err.parentElement.removeChild(err); } - delete options.startCombo; - if (err.timeOut) { - clearTimeout(err.timeOut); - } - mistPlay(streamName,options); - } - - options.target.appendChild(err); - - protoplay.sendEvent('error',msg,options.target); - - if (!('type' in info) || (info.type != 'vod')) { //always show the button timer, unless its a vod - //reload timeout - var delay = 20; - if (!("type" in info)) { - if ("reloadDelay" in options) { - delay = options.reloadDelay; - - try { - var css = document.createElement("style"); - i.appendChild(css); - css.sheet.insertRule(".countdown[data-delay=\""+delay+"\"] { animation-duration: "+delay+"s; }"); - css.sheet.insertRule(".countdown[data-delay=\""+delay+"\"]:before { animation-duration: "+delay/2+"s,"+delay+"s; }"); - } - catch (e) {} - } - else { - delay = 60; - } - } - i.className = 'countdown'; - i.setAttribute("data-delay",delay); - err.timeOut = protoplay.timer.add(function(){ - protoplay.report({ - type: 'playback', - warn: 'Automatically checking if the stream is working now' - }); - embedLog('Triggering reload button because of timeout'); - button.click(); - },delay*1e3); - } - - return err; - } - - //merge local and global options - var local = options; - var global = (typeof mistoptions == 'undefined' ? {} : mistoptions); - var options = { - host: null, //override mistserver host (default is the host that player.js is loaded from) - autoplay: true, //start playing when loaded - controls: true, //show controls (MistControls when available) - loop: false, //don't loop when the stream has finished - poster: null, //don't show an image before the stream has started - callback: false, //don't call a function when the player has finished building - streaminfo: false, //don't use this streaminfo but collect it from the mistserverhost - startCombo: false, //start looking for a player/source match at the start - forceType: false, //don't force a mimetype - forcePlayer: false, //don't force a player - forceSource: false //don't force a source - }; - for (var i in global) { - options[i] = global[i]; - } - for (var i in local) { - options[i] = local[i]; - } - - if (!options.host) { - mistError('MistServer host undefined.'); - return; - } - if (!options.target) { - mistError('Target container undefined'); - return; - } - - options.host = options.host.replace(/\/$/,""); //remove trailing slash - - options.target.setAttribute('data-loading',''); - - var classes = options.target.className.split(' '); - if (classes.indexOf('mistvideo') == -1) { - classes.push('mistvideo'); - options.target.className = classes.join(' '); - } - - //check if the css is loaded - if (!document.getElementById('mist_player_css')) { - var css = document.createElement('link'); - css.rel = 'stylesheet'; - css.href = options.host+'/player.css'; - css.id = 'mist_player_css'; - //prepend it to the head: don't use append, because the customer might want to override our default css - if (document.head.children.length) { - document.head.insertBefore(css,document.head.firstChild); - } - else { - document.head.appendChild(css); - } - } - - function onstreaminfo() { - options.target.innerHTML = ''; - options.target.removeAttribute('data-loading'); - embedLog('Stream info was loaded succesfully.'); - - //get streaminfo data - var streaminfo = mistvideo[streamName]; - //embedLog('Stream info contents: '+JSON.stringify(streaminfo)); - streaminfo.initTime = new Date(); - - if (!('source' in streaminfo)) { - if ((streaminfo.type) && (streaminfo.type == 'live')) { - mistError('The live stream is currently offline.'); - return; - } - else if ('error' in streaminfo) { - mistError(streaminfo.error); - return; - } - else { - mistError('Error while parsing stream info.'); - protoplay.report({ - type: 'init', - error: 'No sources' - }); - return; - } - } - - if (('forceType' in options) && (options.forceType)) { - embedLog('Forcing '+options.forceType); - } - if (('forceSource' in options) && (options.forceSource)) { - options.forceType = streaminfo.source[options.forceSource].type; - embedLog('Forcing source '+options.forceSource+': '+options.forceType+' @ '+streaminfo.source[options.forceSource].url); - } - if (('forcePlayer' in options) && (options.forcePlayer)) { - if (options.forcePlayer in mistplayers) { - embedLog('Forcing '+mistplayers[options.forcePlayer].name); - } - else { - embedLog('The forced player ('+options.forcePlayer+') isn\'t known, ignoring. Possible values are: '+Object.keys(mistplayers).join(', ')); - options.forcePlayer = false; - } - } - if (('startCombo' in options) && (options.startCombo)) { - embedLog('Selecting a new player/source combo, starting after '+mistplayers[options.startCombo.player].name+' with '+streaminfo.source[options.startCombo.source].type+' @ '+streaminfo.source[options.startCombo.source].url); - } - - //sort the sources by simultracks, priority and mime, but prefer HTTPS - streaminfo.source.sort(function(a,b){ - return (b.simul_tracks - a.simul_tracks) || (b.priority - a.priority) || a.type.localeCompare(b.type) || b.url.localeCompare(a.url); - }); - - var r = mistCheck(streaminfo,options,embedLog); - var mistPlayer = r.mistPlayer; - var source = r.source; - - options.target.innerHTML = ''; - if (mistPlayer) { - - //create the options to send to the player - var playerOpts = { - src: source.url+(('urlappend' in options) && (options.urlappend) ? options.urlappend : '' ), - live: (streaminfo.type == 'live' ? true : false), - initTime: streaminfo.initTime, - meta: streaminfo.meta, - source: source, - host: options.host - }; - //pass player options and handle defaults - playerOpts.autoplay = options.autoplay; - playerOpts.controls = options.controls; - playerOpts.loop = (playerOpts.live ? false : options.loop); - playerOpts.poster = options.poster; - - function calcSize() { - //calculate desired width and height - var fw = ('width' in options && options.width ? options.width : false ); //force this width - var fh = ('height' in options && options.height ? options.height : false ); //force this height - if (!(fw && fh)) { - var ratio = streaminfo.width / streaminfo.height; - if (fw || fh) { - if (fw) { - fh = fw/ratio; - } - else { - fw = fh*ratio; - } - } - else { - //neither width or height are being forced. Set them to the minimum of video and target size - var cw = ('maxwidth' in options && options.maxwidth ? options.maxwidth : options.target.clientWidth || window.innerWidth); - var ch = ('maxheight' in options && options.maxheight ? options.maxheight : options.target.clientHeight || window.innerHeight); - var fw = streaminfo.width; - var fh = streaminfo.height; - - var factor; //resize factor - if ((cw) && (fw > cw)) { //rescale if video width is larger than the target - factor = fw / cw; - fw /= factor; - fh /= factor; - } - if ((ch) && (fh > ch)) { //rescale if video height is (still?) larger than the target - factor = fh / ch; - fw /= factor; - fh /= factor; - } - } - } - return { - width: fw, - height: fh - }; - } - - var lastsize = calcSize(); - playerOpts.width = lastsize.width; - playerOpts.height = lastsize.height; - - //save the objects for future reference - var player = new mistplayers[mistPlayer].player(); - player.playername = mistPlayer; - player.target = options.target; - if (!('embedded' in streaminfo)) { streaminfo.embedded = []; } - streaminfo.embedded.push({ - options: options, - selectedPlayer: mistPlayer, - player: player, - playerOptions: playerOpts - }); - player.index = streaminfo.embedded.length-1; - - if (player.setTracks(false)) { - //gather track info - //tracks - var tracks = { - video: [], - audio: [], - subtitle: [] - }; - for (var i in streaminfo.meta.tracks) { - var t = streaminfo.meta.tracks[i]; - var skip = false; - switch (t.type) { - case 'video': - t.desc = [ - ("lang" in t ? t.language : "unknown"), - t.width+'x'+t.height, - (t.bps == 0 ? "unknown": (t.bps > 1024*1024/8 ? Math.round(t.bps/1024/1024*8)+'mbps': Math.round(t.bps/1024*8)+'kbps')), - (t.fpks == 0 ? "unknown" : t.fpks/1e3+'fps'), - t.codec - ]; - break; - case 'audio': - t.desc = [ - ("lang" in t ? t.language : "unknown"), - (t.channels == 2 ? 'Stereo' : (t.channels == 1 ? 'Mono' : "Surround ("+t.channels+'ch)')), - (t.bps == 0 ? "unknown": (t.bps > 1024*1024/8 ? Math.round(t.bps/1024/1024*8)+'mbps': Math.round(t.bps/1024*8)+'kbps')), - Math.round(t.rate/1000)+'kHz', - t.codec - ]; - break; - case 'meta': - case 'subtitle': - //subtitles are type meta and codec subtitle in Mist > v2.13, still support type subtitle though - if ((t.type == 'subtitle') || (t.codec == 'subtitle')) { - t.type = "subtitle"; - t.desc = [("lang" in t ? t.language : "unknown")]; - break; - } - default: - skip = true; - break; - } - if (skip) { continue; } - tracks[t.type].push(t); - } - //loop through the tracks again and compare them to one another to decide what to display as description - for (var cat in tracks) { - if (tracks[cat].length == 1) { - //there is only one track, show all info that isn't "unknown" - for (var i in tracks[cat]) { - var t = tracks[cat][i]; - for (var j = t.desc.length-1; j >= 0; j--) { - if ((t.desc[j] == "unknown") && (t.desc.length > 1)) { - t.desc.splice(j,1); - } - } - t.desc = t.desc.join(" "); - } - } - else { - var equal = false; - var show = []; - //sort by track id - tracks[cat].sort(function(a,b){ - return a.trackid - b.trackid; - }); - - for (var i in tracks[cat]) { - var t = tracks[cat][i]; - if (equal == false) { - //set equal to the first track description - equal = t.desc; - continue; - } - for (var j in t.desc) { - //compare each value to the one in equal, if it's not the same, mark it - if ((t.desc[j] != equal[j]) && (show.indexOf(j) < 0)) { - show.push(j); - } - } - } - if (show.length) { - for (var i in tracks[cat]) { - var t = tracks[cat][i]; - //gather indexes in show - var str = []; - for (var j in show) { - str.push(t.desc[show[j]]); - } - t.desc = str.join(" "); - } - } - else { - //all info is the same, show a track index - for (var i in tracks[cat]) { - var t = tracks[cat][i]; - t.desc = "Track "+(Number(i)+1); - } - } - } - } - player.tracks = tracks; - if (tracks.subtitle.length) { - var vttsrc = false; - player.subtitle = false; - for (var i in streaminfo.source) { - if (streaminfo.source[i].type == 'html5/text/vtt') { - vttsrc = streaminfo.source[i].url; - break; - } - } - if (vttsrc) { - player.subtitle = vttsrc.replace(/.srt$/,'.vtt'); - } - } - var usetracks = {}; - for (var i in tracks) { - if (i == 'subtitle') { continue; } - if (tracks[i].length) { - tracks[i].sort(function(a,b){ - return a.trackid - b.trackid; - }); - usetracks[i] = tracks[i][0].trackid; - } - } - } - - function onplayerbuilt(element) { - options.target.appendChild(element); - element.setAttribute('data-player',mistPlayer); - element.setAttribute('data-mime',source.type); - player.report({ - type: 'init', - info: 'Player built' - }); - - if (player.setTracks(false)) { - player.onready(function(){ - //player.setTracks(usetracks); - if ('setTracks' in options) { player.setTracks(options.setTracks); } - }); - } - - //monitor for errors - element.sendPingTimeout = setInterval(function(){ - if (player.paused) { return; } - player.report({ - type: 'playback', - info: 'ping' - }); - },150e3); - element.addEventListener('error',function(e){ - player.askNextCombo('The player has thrown an error'); - var r = { - type: 'playback', - error: 'The player has thrown an error' - }; - if ('readyState' in player.element) { - r.readyState = player.element.readyState; - } - if ('networkState' in player.element) { - r.networkState = player.element.networkState; - } - if (('error' in player.element) && (player.element.error) && ('code' in player.element.error)) { - r.code = player.element.error.code; - } - player.report(r); - }); - element.checkStalledTimeout = false; - var stalled = function(e){ - if (element.checkStalledTimeout) { return; } - var curpos = player.element.currentTime; - if (curpos == 0) { return; } - element.checkStalledTimeout = player.timer.add(function(){ - if ((player.paused) || (curpos != player.element.currentTime)) { return; } - player.askNextCombo('Playback has stalled'); - player.report({ - 'type': 'playback', - 'warn': 'Playback was stalled for > 30 sec' - }); - },30e3); - }; - element.addEventListener('stalled',stalled,true); - element.addEventListener('waiting',stalled,true); - - if (playerOpts.live) { - element.checkProgressTimeout = false; - var progress = function(e){ - if (element.checkStalledTimeout) { - player.timer.remove(element.checkStalledTimeout); - element.checkStalledTimeout = false; - player.cancelAskNextCombo(); - } - }; - //element.addEventListener('progress',progress,true); //sometimes, there is progress but no playback - element.addEventListener('playing',progress,true); - element.addEventListener('play',function(){ - player.paused = false; - if ((!element.checkProgressTimeout) && (player.element) && ('currentTime' in player.element)) { - //check if the progress made is equal to the time spent - var lasttime = player.element.currentTime; - element.checkProgressTimeout = player.timer.add(function(){ - var newtime = player.element.currentTime; - var progress = newtime - lasttime; - lasttime = newtime; - if (progress < 0) { return; } //its probably a looping VOD or we've just seeked - if (progress == 0) { - var msg = 'There should be playback but nothing was played'; - var r = { - type: 'playback', - warn: msg - }; - player.addlog(msg); - if ('readyState' in player.element) { - r.readyState = player.element.readyState; - } - if ('networkState' in player.element) { - r.networkState = player.element.networkState; - } - if (('error' in player.element) && (player.element.error) && ('code' in player.element.error)) { - r.code = player.element.error.code; - } - player.report(r); - player.askNextCombo('No playback'); - return; - } - player.cancelAskNextCombo(); - if (progress < 20) { - var msg = 'It seems playback is lagging (progressed '+Math.round(progress*100)/100+'/30s)' - player.addlog(msg); - player.report({ - type: 'playback', - warn: msg - }); - return; - } - },30e3,true); - } - },true); - element.addEventListener('pause',function(){ - player.paused = true; - if (element.checkProgressTimeout) { - player.timer.remove(element.checkProgressTimeout); - element.checkProgressTimeout = false; - } - },true); - } - - if (player.resize) { - //monitor for resizes and fire if needed - window.addEventListener('resize',function(){ - player.resize(calcSize()); - }); - } - - for (var i in player.onreadylist) { - player.onreadylist[i](); - } - - protoplay.sendEvent('initialized','',options.target); - if (options.callback) { options.callback(player); } - } - - //build the player - player.mistplaySettings = { - streamname: streamName, - options: options, - startCombo: { - player: mistPlayer, - source: source.index - } - }; - player.options = playerOpts; - try { - var element = player.build(playerOpts,onplayerbuilt); - } - catch (e) { - //show the next player/reload buttons if there is an error in the player build code - player.askNextCombo('Error while building player'+("stack" in e ? ": "+e.stack : "")); - throw e; - player.report({ - type: 'init', - error: 'Error while building player' - }); - return; - } - } - else { - if (streaminfo.error) { - var str = streaminfo.error; - } - else if (('source' in streaminfo) && (streaminfo.source.length)) { - var str = 'Could not find a compatible player and protocol combination for this stream and browser. '; - if (options.forceType) { str += "\n"+'The mimetype '+options.forceType+' was enforced. '; } - if (options.forcePlayer) { str += "\n"+'The player '+options.forcePlayer+' was enforced. '; } - } - else { - var str = 'Stream not found.'; - } - protoplay.report({ - type: 'init', - error: str - }); - mistError(str); - } - } - if ((options.streaminfo) && (typeof options.streaminfo == 'object') && ('type' in options.streaminfo) - && ('source' in options.streaminfo) && (options.streaminfo.source.length) - && ('meta' in options.streaminfo) && ('tracks' in options.streaminfo.meta)) { //catch some of the most problematic stuff - if (typeof mistvideo == 'undefined') { mistvideo = {}; } - mistvideo[streamName] = options.streaminfo; - onstreaminfo(); - } - else { - //get info js - var info = document.createElement('script'); - info.src = options.host+'/info_'+encodeURIComponent(streamName)+'.js'+(('urlappend' in options) && (options.urlappend) ? options.urlappend : '' ); - embedLog('Retrieving stream info from '+info.src); - document.head.appendChild(info); - info.onerror = function(){ - options.target.innerHTML = ''; - options.target.removeAttribute('data-loading'); - mistError('Error while loading stream info.'); - protoplay.report({ - type: 'init', - error: 'Failed to load '+info.src - }); - } - info.onload = function(){ - //clean up info script - document.head.removeChild(info); - - onstreaminfo(); - } - } -} diff --git a/embed/imgs/fullscreen_plain.svg b/embed/imgs/fullscreen_plain.svg index 82bf326d..d9c9d9ce 100644 --- a/embed/imgs/fullscreen_plain.svg +++ b/embed/imgs/fullscreen_plain.svg @@ -1 +1,13 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg3937" height="45" width="45"><defs id="defs3939" /><metadata id="metadata3942"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g transform="translate(0,-1007.3622)" id="layer1"><g transform="translate(0,-1.109375)" id="g4563"><g id="g4558"><path id="rect3945" transform="translate(0,1007.3622)" d="M 5.15625,10 C 3.6913461,10 2.5,11.191346 2.5,12.65625 l 0,19.6875 C 2.5,33.808654 3.6913461,35 5.15625,35 l 34.6875,0 C 41.308654,35 42.5,33.808654 42.5,32.34375 l 0,-19.6875 C 42.5,11.191346 41.308654,10 39.84375,10 L 5.15625,10 z M 5,12.53125 l 35,0 0,20 -35,0 0,-20 z" style="fill:#fff;fill-opacity:1;stroke:none" /><rect ry="0" y="1019.8622" x="5" height="20" width="35" id="rect3947" style="fill:#fff;fill-opacity:0.39215686;stroke:none" /><path id="path3949" transform="translate(0,1007.3622)" d="m 18.78125,35.40625 c -1.53661,0.379809 -2.971465,0.991557 -4.28125,1.8125 l 15.65625,0 c -1.313005,-0.822961 -2.762825,-1.432953 -4.3125,-1.8125 l -7.0625,0 z" style="fill:#fff;fill-opacity:1;stroke:none" /></g><g id="g4007" transform="matrix(2.0353985,0,0,1.1630828,-99.321734,-141.54581)" style="fill:#000"><path id="rect3958" d="m 65.533646,1001.4758 -2.032932,0 0.662913,0.6629 -2.253903,2.2539 0.707107,0.7071 2.253903,-2.2539 0.662912,0.6629 0,-2.0329 z" style="fill:#fff;fill-opacity:1;stroke:none" /><path id="rect3958-5" d="m 65.533646,1012.84 0,-2.033 -0.662836,0.6629 -2.253901,-2.2539 -0.707104,0.7071 2.253902,2.2539 -0.662906,0.6629 2.032845,1e-4 z" style="fill:#fff;fill-opacity:1;stroke:none" /><path id="rect3958-51" d="m 54.16943,1001.4758 2.032932,0 -0.662913,0.6629 2.253903,2.2539 -0.707107,0.7071 -2.253903,-2.2539 -0.662912,0.6629 0,-2.0329 z" style="fill:#fff;fill-opacity:1;stroke:none" /><path id="rect3958-5-7" d="m 54.16943,1012.84 0,-2.033 0.662836,0.6629 2.253901,-2.2539 0.707104,0.7071 -2.253902,2.2539 0.662906,0.6629 -2.032845,1e-4 z" style="fill:#fff;fill-opacity:1;stroke:none" /></g></g></g></svg> +<svg width="45" height="45" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <g fill="#fff"> + <path d="m5.1562 8.8906c-1.4649 0-2.6562 1.1913-2.6562 2.6562v19.688c0 1.4649 1.1913 2.6562 2.6562 2.6562h34.688c1.4649 0 2.6562-1.1913 2.6562-2.6562v-19.688c0-1.4649-1.1913-2.6562-2.6562-2.6562h-34.688m-0.15625 2.5312h35v20h-35v-20"/> + <rect transform="translate(0 -1008.5)" x="5" y="1019.9" width="35" height="20" ry="0" fill-opacity=".39216"/> + <path d="m18.781 34.297c-1.5366 0.37981-2.9715 0.99156-4.2812 1.8125h15.656c-1.313-0.82296-2.7628-1.433-4.3125-1.8125h-7.0625"/> + <g> + <path d="m34.065 14.782h-4.1378l1.3493 0.77101-4.5876 2.6215 1.4392 0.82242 4.5876-2.6215s1.3493 0.77101 1.3493 0.77101v-2.3644"/> + <path d="m34.065 27.999v-2.3645s-1.3491 0.77101-1.3491 0.77101l-4.5876-2.6215-1.4392 0.82242 4.5876 2.6215-1.3493 0.77101 4.1376 1.1631e-4"/> + <path d="m10.935 14.782h4.1378l-1.3493 0.77101 4.5876 2.6215-1.4392 0.82242-4.5876-2.6215s-1.3493 0.77101-1.3493 0.77101v-2.3644"/> + <path d="m10.935 27.999v-2.3645s1.3491 0.77101 1.3491 0.77101l4.5876-2.6215s1.4392 0.82242 1.4392 0.82242l-4.5876 2.6215 1.3493 0.77101-4.1376 1.1631e-4"/> + </g> + </g> +</svg> diff --git a/embed/imgs/fullscreen_plain_.svg b/embed/imgs/fullscreen_plain_.svg new file mode 100644 index 00000000..4cfd9335 --- /dev/null +++ b/embed/imgs/fullscreen_plain_.svg @@ -0,0 +1,3 @@ +<svg width="45" height="45" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <path d="m2.5 10.928v8.5898l4.9023-2.8008 9.6172 5.7832-9.6172 5.7832-4.9023-2.8008v8.5898h15.031l-4.9004-2.8008 9.8691-5.6387 9.8691 5.6387-4.9004 2.8008h15.031v-8.5898l-4.9023 2.8008-9.6172-5.7832 9.6172-5.7832 4.9023 2.8008v-8.5898h-15.033l4.9023 2.8008-9.8691 5.6387-9.8691-5.6387 4.9023-2.8008z" fill="#fff"/> +</svg> diff --git a/embed/imgs/gear.svg b/embed/imgs/gear.svg new file mode 100644 index 00000000..9aa62d09 --- /dev/null +++ b/embed/imgs/gear.svg @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="svg4659" + height="45" + width="45" + sodipodi:docname="gear.svg" + inkscape:version="0.92.2 5c3e80d, 2017-08-06"> + <sodipodi:namedview + pagecolor="#4cc5a0" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1868" + inkscape:window-height="1049" + id="namedview8" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="6.675088" + inkscape:cx="62.439695" + inkscape:cy="43.399157" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4659" + inkscape:snap-page="true" /> + <defs + id="defs4661" /> + <metadata + id="metadata4664"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.50001693;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 24.139007,3.834512 -1.477875,4.3213185 c -1.101822,0.0088 -2.274313,0.1330197 -3.204775,0.3369163 L 17.128868,4.5441522 C 15.631516,4.9971895 14.196746,5.635837 12.858006,6.4452068 l 1.34441,4.3668912 c -0.878085,0.62225 -1.683392,1.341293 -2.400733,2.14357 L 7.6056909,11.132739 c -0.9476032,1.24558 -1.7355288,2.604902 -2.3453935,4.046251 l 3.6523686,2.739277 c -0.3489484,1.021477 -0.5815406,2.079062 -0.6933641,3.15269 L 3.7661466,22.05892 c -0.00716,0.146959 -0.012582,0.293997 -0.016276,0.441084 0.00628,1.417863 0.173364,2.830439 0.4980503,4.21064 l 4.5703436,0.06998 c 0.3217092,1.027112 0.7579402,2.014774 1.3004645,2.944356 l -3.0387575,3.435896 c 0.8950189,1.282782 1.947035,2.448529 3.1315315,3.470075 l 3.735377,-2.628599 c 0.86307,0.64582 1.796153,1.192348 2.781594,1.629243 l -0.436201,4.539419 c 1.475447,0.52082 3.010282,0.854908 4.568716,0.994474 l 1.477875,-4.321319 c 0.05369,0.003 0.107408,0.0057 0.161134,0.0082 1.023951,-0.0061 2.044309,-0.121786 3.043641,-0.345054 l 2.327489,3.948594 c 1.497352,-0.453037 2.932122,-1.091685 4.270862,-1.901055 l -1.34441,-4.366891 c 0.878085,-0.622249 1.683392,-1.341292 2.400733,-2.14357 l 4.195992,1.82293 c 0.947603,-1.245581 1.735529,-2.604903 2.345394,-4.046252 l -3.652368,-2.739276 c 0.348948,-1.021478 0.58154,-2.079063 0.693363,-3.152691 l 4.453156,-0.987963 c 0.0072,-0.146984 0.01258,-0.294022 0.01628,-0.441108 -0.0062,-1.417863 -0.173364,-2.83044 -0.49805,-4.210641 l -4.570344,-0.06998 c -0.321709,-1.027116 -0.75794,-2.014777 -1.300465,-2.94436 l 3.038754,-3.435928 C 37.025006,10.556342 35.97299,9.3905941 34.788493,8.3690481 L 31.053116,10.997647 C 30.190046,10.351826 29.256963,9.8052988 28.271521,9.3684038 L 28.707723,4.8289849 C 27.232276,4.308166 25.697441,3.9740781 24.139007,3.834512 Z" + id="path4541" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccc" /> +</svg> diff --git a/embed/imgs/gear_plain.svg b/embed/imgs/gear_plain.svg new file mode 100644 index 00000000..e10c6e60 --- /dev/null +++ b/embed/imgs/gear_plain.svg @@ -0,0 +1,3 @@ +<svg width="45" height="45" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <path d="m24.139 3.834-1.4785 4.3223c-1.1018 0.0088-2.2727 0.13204-3.2031 0.33594l-2.3281-3.9473c-1.4974 0.45304-2.9327 1.091-4.2715 1.9004l1.3457 4.3672c-0.87808 0.62225-1.685 1.3403-2.4023 2.1426l-4.1953-1.8223c-0.9476 1.2456-1.7358 2.6055-2.3457 4.0469l3.6523 2.7383c-0.34895 1.0215-0.58154 2.0787-0.69336 3.1523l-4.4531 0.98828c-0.00716 0.14696-0.011931 0.29432-0.015625 0.44141 0.00628 1.4179 0.17336 2.8307 0.49805 4.2109l4.5703 0.070312c0.32171 1.0271 0.75826 2.0138 1.3008 2.9434l-3.0391 3.4355c0.89502 1.2828 1.9464 2.4492 3.1309 3.4707l3.7363-2.6289c0.86307 0.64582 1.7958 1.192 2.7812 1.6289l-0.43555 4.541c1.4754 0.52082 3.0099 0.85458 4.5684 0.99414l1.4766-4.3223c0.05369 3e-3 0.10838 0.005313 0.16211 0.007812 1.024-0.0061 2.0436-0.12048 3.043-0.34375l2.3281 3.9473c1.4974-0.45304 2.9327-1.091 4.2715-1.9004l-1.3457-4.3672c0.87808-0.62225 1.685-1.3403 2.4023-2.1426l4.1953 1.8223c0.9476-1.2456 1.7358-2.6055 2.3457-4.0469l-3.6523-2.7383c0.34895-1.0215 0.58154-2.0787 0.69336-3.1523l4.4531-0.98828c0.0072-0.14698 0.011925-0.29432 0.015625-0.44141-0.0062-1.4179-0.17336-2.8307-0.49805-4.2109l-4.5703-0.070312c-0.32171-1.0271-0.75826-2.0138-1.3008-2.9434l3.0391-3.4355c-0.89502-1.2828-1.9464-2.4492-3.1309-3.4707l-3.7363 2.6289c-0.86307-0.64582-1.7958-1.192-2.7812-1.6289l0.43555-4.541c-1.4754-0.52082-3.0099-0.85457-4.5684-0.99414zm-1.6387 7.8789a10.786 10.786 0 0 1 10.787 10.787 10.786 10.786 0 0 1-10.787 10.787 10.786 10.786 0 0 1-10.787-10.787 10.786 10.786 0 0 1 10.787-10.787z" fill="#fff"/> +</svg> diff --git a/embed/imgs/loading.svg b/embed/imgs/loading.svg new file mode 100644 index 00000000..40ede465 --- /dev/null +++ b/embed/imgs/loading.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="100%" width="100%"><path d="m49.998 8.7797e-4c-0.060547 0.0018431-0.12109 0.0037961-0.18164 0.0058593-0.1251 0.0015881-0.25012 0.0061465-0.375 0.013672h-0.001954c-27.388 0.30599-49.432 22.59-49.439 49.98 0.020074 2.6488 0.25061 5.292 0.68945 7.904 3.8792-24.231 24.77-42.065 49.311-42.096v-0.0058582h0.001954c4.3638 3.0803e-4 7.9013-3.5366 7.9021-7.9002 1.474e-4 -2.0958-0.83235-4.106-2.3144-5.5879-1.482-1.482-3.492-2.3145-5.5879-2.3144-6.5007e-4 -7.9369e-8 -0.0013001-7.9369e-8 -0.001954 0" class="semiFill"/></svg> diff --git a/embed/imgs/loop.svg b/embed/imgs/loop.svg index 85fafb66..dd80934e 100644 --- a/embed/imgs/loop.svg +++ b/embed/imgs/loop.svg @@ -11,8 +11,9 @@ id="svg3937" height="45" width="45" - inkscape:version="0.91 r13725" - sodipodi:docname="loop.svg"> + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="loop.svg" + viewBox="0 0 45 45"> <sodipodi:namedview pagecolor="#8bff39" bordercolor="#666666" @@ -22,8 +23,8 @@ guidetolerance="10" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1055" + inkscape:window-width="1868" + inkscape:window-height="1049" id="namedview3591" showgrid="false" showguides="true" @@ -40,37 +41,17 @@ inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true" inkscape:zoom="14.833529" - inkscape:cx="30.216329" - inkscape:cy="21.135445" + inkscape:cx="21.722684" + inkscape:cy="25.7616" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" - inkscape:current-layer="svg3937"> - <sodipodi:guide - position="0,0" - orientation="0,45" - id="guide3615" /> - <sodipodi:guide - position="45,0" - orientation="-45,0" - id="guide3617" /> - <sodipodi:guide - position="45,45" - orientation="0,-45" - id="guide3619" /> - <sodipodi:guide - position="0,45" - orientation="45,0" - id="guide3621" /> - <sodipodi:guide - position="0,0" - orientation="-0.70710678,0.70710678" - id="guide3624" /> - <sodipodi:guide - position="0,45" - orientation="0.70710678,0.70710678" - id="guide4491" /> - </sodipodi:namedview> + inkscape:current-layer="svg3937" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + scale-x="1" /> <defs id="defs3939" /> <metadata @@ -86,11 +67,8 @@ </rdf:RDF> </metadata> <path - style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - d="M 0 0 L 0 45 L 45 45 L 45 0 L 0 0 z M 22.5 11.25 A 11.25 11.25 0 0 1 33.75 22.5 A 11.25 11.25 0 0 1 22.5 33.75 A 11.25 11.25 0 0 1 14.550781 30.449219 L 12.714844 32.285156 L 12.714844 25.785156 L 19.214844 25.785156 L 17.376953 27.623047 A 7.25 7.25 0 0 0 22.5 29.75 A 7.25 7.25 0 0 0 29.75 22.5 A 7.25 7.25 0 0 0 22.5 15.25 A 7.25 7.25 0 0 0 17.376953 17.376953 L 14.550781 14.550781 A 11.25 11.25 0 0 1 22.5 11.25 z " - id="rect4511" /> - <path - style="opacity:1;fill:none;fill-opacity:0.8584475;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - d="M 22.5 11.25 A 11.25 11.25 0 0 0 14.550781 14.550781 L 17.376953 17.376953 A 7.25 7.25 0 0 1 22.5 15.25 A 7.25 7.25 0 0 1 29.75 22.5 A 7.25 7.25 0 0 1 22.5 29.75 A 7.25 7.25 0 0 1 17.376953 27.623047 L 19.214844 25.785156 L 12.714844 25.785156 L 12.714844 32.285156 L 14.550781 30.449219 A 11.25 11.25 0 0 0 22.5 33.75 A 11.25 11.25 0 0 0 33.75 22.5 A 11.25 11.25 0 0 0 22.5 11.25 z " - id="path4495" /> + style="opacity:1;fill:none;fill-opacity:0.8584475;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.50002718;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="M 21.279283,3.749797 A 18.750203,18.750203 0 0 0 8.0304417,9.2511582 L 12.740779,13.961496 A 12.083464,12.083464 0 0 1 21.279283,10.416536 12.083464,12.083464 0 0 1 33.362748,22.5 12.083464,12.083464 0 0 1 21.279283,34.583464 12.083464,12.083464 0 0 1 12.740779,31.038504 l 3.063185,-3.063185 H 4.9705135 V 38.80877 L 8.0304417,35.748842 A 18.750203,18.750203 0 0 0 21.279283,41.250203 18.750203,18.750203 0 0 0 40.029486,22.5 18.750203,18.750203 0 0 0 21.279283,3.749797 Z" + id="path4495" + inkscape:connector-curvature="0" /> </svg> diff --git a/embed/imgs/muted_plain.svg b/embed/imgs/muted_plain.svg new file mode 100644 index 00000000..aeacbbfc --- /dev/null +++ b/embed/imgs/muted_plain.svg @@ -0,0 +1,7 @@ +<svg width="45" height="45" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <path class="stroke semiFill toggle" d="m25.587 5.2036c-1.8324-1.1012-4.2007-0.8622-5.7719 0.77112 0 0-7.7388 8.0444-7.7388 8.0444h-3.418c-1.9537 0-3.547 1.6562-3.547 3.6869v9.5864c0 2.0309 1.5933 3.6871 3.547 3.6871h3.418s7.7388 8.0447 7.7388 8.0447c1.5721 1.634 3.9389 1.8747 5.7719 0.77076v-34.591" fill="none" stroke="#000"/> + <g fill="none" stroke="#000" stroke-linecap="round" stroke-width="1.4142"> + <path d="m30.032 27.86 9.8517-9.8517"/> + <path d="m30.032 18.008 9.8517 9.8517"/> + </g> +</svg> diff --git a/embed/imgs/pause_plain.svg b/embed/imgs/pause_plain.svg index a408a218..7a4f7861 100644 --- a/embed/imgs/pause_plain.svg +++ b/embed/imgs/pause_plain.svg @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg2" height="45" width="45"><defs id="defs4" /><metadata id="metadata7"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g transform="translate(0,-1007.3622)" id="layer1"><g style="fill:#fff" transform="translate(3.0304575,47.729705)" id="g3779"><path id="path3823-7" d="m 4.4695429,998.16377 a 4.0011916,4.0011916 0 0 0 3.749999,3.96873 l 2.2812501,0 a 4.0011916,4.0011916 0 0 0 3.96875,-3.75003 l 0,-32.28123 a 4.0011916,4.0011916 0 0 0 -3.75,-3.96875 l -2.2812501,0 a 4.0011916,4.0011916 0 0 0 -3.968749,3.75 l 0,32.28128 z" style="fill:#fff;fill-opacity:1;stroke:none" /><path id="path3823-7-4" d="m 24.469542,998.1638 a 4.0011916,4.0011916 0 0 0 3.75,3.9687 l 2.28125,0 a 4.0011916,4.0011916 0 0 0 3.96875,-3.75 l 0,-32.28126 a 4.0011916,4.0011916 0 0 0 -3.75,-3.96875 l -2.28125,0 a 4.0011916,4.0011916 0 0 0 -3.96875,3.75 l 0,32.28131 z" style="fill:#fff;fill-opacity:1;stroke:none" /></g></g></svg> +<svg width="25" height="25" version="1.1" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg"><g transform="matrix(.55556 0 0 .55556 0 -559.65)"><g transform="translate(3.0305 47.73)" fill="#fff"><path d="m4.4695 998.16a4.0012 4.0012 0 0 0 3.75 3.9687h2.2813a4.0012 4.0012 0 0 0 3.9688-3.75v-32.281a4.0012 4.0012 0 0 0-3.75-3.9688h-2.2813a4.0012 4.0012 0 0 0-3.9687 3.75z"/><path d="m24.47 998.16a4.0012 4.0012 0 0 0 3.75 3.9687h2.2812a4.0012 4.0012 0 0 0 3.9688-3.75v-32.281a4.0012 4.0012 0 0 0-3.75-3.9688h-2.2812a4.0012 4.0012 0 0 0-3.9688 3.75z"/></g></g></svg> diff --git a/embed/imgs/play.svg b/embed/imgs/play.svg index e6584b9b..5b945967 100644 --- a/embed/imgs/play.svg +++ b/embed/imgs/play.svg @@ -13,10 +13,8 @@ height="45" id="svg2" version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="New document 1"> - <defs - id="defs4" /> + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="play.svg"> <sodipodi:namedview id="base" pagecolor="#000000" @@ -39,28 +37,34 @@ inkscape:snap-page="true" inkscape:object-nodes="true" inkscape:snap-nodes="false" - inkscape:window-width="981" - inkscape:window-height="709" - inkscape:window-x="856" - inkscape:window-y="240" + inkscape:window-width="1868" + inkscape:window-height="1049" + inkscape:window-x="0" + inkscape:window-y="0" inkscape:window-maximized="0"> <sodipodi:guide - position="0,0" + inkscape:locked="false" + id="guide3785" orientation="0,45" - id="guide3785" /> + position="0,0" /> <sodipodi:guide - position="45,0" + inkscape:locked="false" + id="guide3787" orientation="-45,0" - id="guide3787" /> + position="45,0" /> <sodipodi:guide - position="45,45" + inkscape:locked="false" + id="guide3789" orientation="0,-45" - id="guide3789" /> + position="45,45" /> <sodipodi:guide - position="0,45" + inkscape:locked="false" + id="guide3791" orientation="45,0" - id="guide3791" /> + position="0,45" /> </sodipodi:namedview> + <defs + id="defs4" /> <metadata id="metadata7"> <rdf:RDF> @@ -69,22 +73,17 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" id="layer1" - transform="translate(0,-1007.3622)"> + inkscape:groupmode="layer" + inkscape:label="Layer 1"> <path - sodipodi:type="inkscape:offset" - inkscape:radius="0" - inkscape:original="M 10.3125 -6.34375 A 2.9416186 2.9416186 0 0 0 7.90625 -4.875 L -6.21875 19.625 A 2.9416186 2.9416186 0 0 0 -3.65625 24.03125 L 24.625 24.03125 A 2.9416186 2.9416186 0 0 0 27.15625 19.625 L 13 -4.875 A 2.9416186 2.9416186 0 0 0 10.3125 -6.34375 z " - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" + d="M6.26004984594 3.0550109625C5.27445051914 3.68940862462 4.67905105702 4.78142391497 4.67968264562 5.95354422781C4.67968264562 5.95354422781 4.70004942312 39.0717540916 4.70004942312 39.0717540916C4.70302341604 40.3033886636 5.36331656075 41.439734231 6.43188211452 42.0521884912C7.50044766829 42.6646427515 8.81469531629 42.6600161659 9.87892235656 42.0400537716C9.87892235656 42.0400537716 38.5612768409 25.4802882606 38.5612768409 25.4802882606C39.6181165777 24.8606067582 40.2663250096 23.7262617523 40.2636734301 22.5011460995C40.2610218505 21.2760304467 39.6079092743 20.1445019555 38.5483970356 19.5294009803C38.5483970356 19.5294009803 9.84567577375 2.9709566275 9.84567577375 2.9709566275C8.72898008118 2.32550764609 7.34527425735 2.35794451351 6.26004984594 3.0550109625C6.26004984594 3.0550109625 6.26004984594 3.0550109625 6.26004984594 3.0550109625" id="path3809" - d="M 10.3125,-6.34375 A 2.9416186,2.9416186 0 0 0 7.90625,-4.875 l -14.125,24.5 a 2.9416186,2.9416186 0 0 0 2.5625,4.40625 l 28.28125,0 A 2.9416186,2.9416186 0 0 0 27.15625,19.625 L 13,-4.875 a 2.9416186,2.9416186 0 0 0 -2.6875,-1.46875 z" - transform="matrix(1.0141827,-0.58553867,0.58553867,1.0141827,-0.48419831,1022.8893)" /> + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> </g> </svg> diff --git a/embed/imgs/popout.svg b/embed/imgs/popout.svg new file mode 100644 index 00000000..bd677e3b --- /dev/null +++ b/embed/imgs/popout.svg @@ -0,0 +1,3 @@ +<svg width="45" height="45" version="1.1" viewBox="0 0 45 45" xmlns="http://www.w3.org/2000/svg"> + <path d="m24.721 11.075c-12.96 0.049575-32.113 15.432-10.336 28.834-7.6763-7.9825-2.4795-21.824 10.336-22.19v5.5368l15.276-8.862-15.276-8.86v5.5419" fill="none" stroke="#000" stroke-width="1.4142"/> +</svg> diff --git a/embed/imgs/speaker.svg b/embed/imgs/speaker.svg index b4a3bd4f..3eb2b0e1 100644 --- a/embed/imgs/speaker.svg +++ b/embed/imgs/speaker.svg @@ -1,6 +1,4 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" @@ -9,49 +7,38 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="25" - height="25" - id="svg4659" version="1.1" - inkscape:version="0.91 r13725" - sodipodi:docname="speaker.svg"> - <defs - id="defs4661" /> + id="svg4659" + height="45" + width="45" + sodipodi:docname="speaker.svg" + inkscape:version="0.92.2 5c3e80d, 2017-08-06"> <sodipodi:namedview - id="base" - pagecolor="#de43da" + pagecolor="#4cc5a0" bordercolor="#666666" - borderopacity="1.0" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:zoom="19.289873" - inkscape:cx="-2.0603844" - inkscape:cy="14.079113" - inkscape:document-units="px" - inkscape:current-layer="layer1" + inkscape:window-width="1868" + inkscape:window-height="1049" + id="namedview8" showgrid="false" - inkscape:window-width="1918" - inkscape:window-height="1040" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="13.350176" + inkscape:cx="0.054475841" + inkscape:cy="20.133193" inkscape:window-x="0" - inkscape:window-y="19" - inkscape:window-maximized="0"> - <sodipodi:guide - position="0,0" - orientation="0,25" - id="guide4151" /> - <sodipodi:guide - position="25,0" - orientation="-25,0" - id="guide4153" /> - <sodipodi:guide - position="25,25" - orientation="0,-25" - id="guide4155" /> - <sodipodi:guide - position="0,25" - orientation="25,0" - id="guide4157" /> - </sodipodi:namedview> + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4659" /> + <defs + id="defs4661" /> <metadata id="metadata4664"> <rdf:RDF> @@ -65,19 +52,18 @@ </rdf:RDF> </metadata> <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(0,-1027.3622)"> + transform="matrix(1.8,0,0,1.8,0,-1849.252)" + id="layer1"> <path - style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" - d="M 0 0 L 0 25 L 25 25 L 25 0 L 0 0 z M 16.955078 2.5175781 C 17.381507 2.5360023 17.80574 2.6612 18.1875 2.890625 L 18.1875 22.109375 C 17.169206 22.722675 15.85386 22.587487 14.980469 21.679688 L 10.681641 17.210938 L 8.7832031 17.210938 C 7.6978331 17.210938 6.8125 16.290409 6.8125 15.162109 L 6.8125 9.8359375 C 6.8125 8.7077375 7.6978331 7.7890625 8.7832031 7.7890625 L 10.681641 7.7890625 L 14.980469 3.3183594 C 15.526019 2.7512344 16.244363 2.4868711 16.955078 2.5175781 z " + id="rect4139" transform="translate(0,1027.3622)" - id="rect4139" /> + d="M 0,0 V 25 H 25 V 0 Z M 16.955078,2.5175781 C 17.381507,2.5360023 17.80574,2.6612 18.1875,2.890625 v 19.21875 c -1.018294,0.6133 -2.33364,0.478112 -3.207031,-0.429687 l -4.298828,-4.46875 H 8.7832031 c -1.08537,0 -1.9707031,-0.920529 -1.9707031,-2.048829 V 9.8359375 c 0,-1.1282 0.8853331,-2.046875 1.9707031,-2.046875 h 1.8984379 l 4.298828,-4.4707031 c 0.54555,-0.567125 1.263894,-0.8314883 1.974609,-0.8007813 z" + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + inkscape:connector-curvature="0" /> <path - style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 18.187674,1030.2531 c -1.018026,-0.6118 -2.333715,-0.479 -3.206595,0.4284 l -4.299344,4.4691 -1.8988757,0 c -1.0853708,0 -1.9705331,0.9201 -1.9705331,2.0483 l 0,5.3258 c 0,1.1283 0.8851623,2.0484 1.9705331,2.0484 l 1.8988757,0 4.299344,4.4693 c 0.873391,0.9078 2.188301,1.0415 3.206595,0.4282 l 0,-19.2175 z" id="rect4574" + d="m 18.187674,1030.2531 c -1.018026,-0.6118 -2.333715,-0.479 -3.206595,0.4284 l -4.299344,4.4691 H 8.7828593 c -1.0853708,0 -1.9705331,0.9201 -1.9705331,2.0483 v 5.3258 c 0,1.1283 0.8851623,2.0484 1.9705331,2.0484 h 1.8988757 l 4.299344,4.4693 c 0.873391,0.9078 2.188301,1.0415 3.206595,0.4282 z" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" inkscape:connector-curvature="0" /> </g> </svg> diff --git a/embed/imgs/speaker_.svg b/embed/imgs/speaker_.svg new file mode 100644 index 00000000..18317c66 --- /dev/null +++ b/embed/imgs/speaker_.svg @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="svg4659" + height="45" + width="45" + sodipodi:docname="speaker_.svg" + inkscape:version="0.92.2 5c3e80d, 2017-08-06"> + <sodipodi:namedview + pagecolor="#4cc5a0" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1868" + inkscape:window-height="1049" + id="namedview8" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="6.675088" + inkscape:cx="-34.245466" + inkscape:cy="20.740429" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4659" /> + <defs + id="defs4661" /> + <metadata + id="metadata4664"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <path + inkscape:connector-curvature="0" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.81837654;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 32.737813,5.2037363 c -1.832447,-1.10124 -4.200687,-0.8622 -5.771871,0.77112 0,0 -7.738819,8.0443797 -7.738819,8.0443797 0,0 -3.417976,0 -3.417976,0 -1.953668,0 -3.54696,1.65618 -3.54696,3.68694 0,0 0,9.58644 0,9.58644 0,2.03094 1.593292,3.68712 3.54696,3.68712 0,0 3.417976,0 3.417976,0 0,0 7.738819,8.04474 7.738819,8.04474 1.572104,1.63404 3.938942,1.8747 5.771871,0.77076 0,0 0,-34.5914997 0,-34.5914997 z" + id="rect4574-3" /> +</svg> diff --git a/embed/imgs/speaker_plain.svg b/embed/imgs/speaker_plain.svg index 170df4cf..6f725f88 100644 --- a/embed/imgs/speaker_plain.svg +++ b/embed/imgs/speaker_plain.svg @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg4659" height="25" width="25"> <defs id="defs4661" /> <metadata id="metadata4664"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <g transform="translate(0,-1027.3622)" id="layer1"> <path id="rect4139" transform="translate(0,1027.3622)" d="M 0 0 L 0 25 L 25 25 L 25 0 L 0 0 z M 16.955078 2.5175781 C 17.381507 2.5360023 17.80574 2.6612 18.1875 2.890625 L 18.1875 22.109375 C 17.169206 22.722675 15.85386 22.587487 14.980469 21.679688 L 10.681641 17.210938 L 8.7832031 17.210938 C 7.6978331 17.210938 6.8125 16.290409 6.8125 15.162109 L 6.8125 9.8359375 C 6.8125 8.7077375 7.6978331 7.7890625 8.7832031 7.7890625 L 10.681641 7.7890625 L 14.980469 3.3183594 C 15.526019 2.7512344 16.244363 2.4868711 16.955078 2.5175781 z " style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> <path id="rect4574" d="m 18.187674,1030.2531 c -1.018026,-0.6118 -2.333715,-0.479 -3.206595,0.4284 l -4.299344,4.4691 -1.8988757,0 c -1.0853708,0 -1.9705331,0.9201 -1.9705331,2.0483 l 0,5.3258 c 0,1.1283 0.8851623,2.0484 1.9705331,2.0484 l 1.8988757,0 4.299344,4.4693 c 0.873391,0.9078 2.188301,1.0415 3.206595,0.4282 l 0,-19.2175 z" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g></svg> +<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg4659" height="25" width="25"> <defs id="defs4661" /> <metadata id="metadata4664"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <path d="m 32.737813,5.2037363 c -1.832447,-1.10124 -4.200687,-0.8622 -5.771871,0.77112 0,0 -7.738819,8.0443797 -7.738819,8.0443797 0,0 -3.417976,0 -3.417976,0 -1.953668,0 -3.54696,1.65618 -3.54696,3.68694 0,0 0,9.58644 0,9.58644 0,2.03094 1.593292,3.68712 3.54696,3.68712 0,0 3.417976,0 3.417976,0 0,0 7.738819,8.04474 7.738819,8.04474 1.572104,1.63404 3.938942,1.8747 5.771871,0.77076 0,0 0,-34.5914997 0,-34.5914997 z" class="stroke semiFill toggle"></path></svg> diff --git a/embed/imgs/switchvideo.svg b/embed/imgs/switchvideo.svg new file mode 100644 index 00000000..ac9e59d8 --- /dev/null +++ b/embed/imgs/switchvideo.svg @@ -0,0 +1,4 @@ +<svg width="45" height="45" version="1.1" viewBox="0 0 45 45" xmlns="http://www.w3.org/2000/svg"> + <path d="m8.4925 18.786c-3.9578 1.504-6.4432 3.632-6.4434 5.9982 2.183e-4 4.1354 7.5562 7.5509 17.399 8.1467v4.7777l10.718-6.2573-10.718-6.2529v4.5717c-6.9764-0.4712-12.229-2.5226-12.227-4.9859 6.693e-4 -0.72127 0.45868-1.4051 1.2714-2.0267zm28.015 0v3.9715c0.81164 0.62126 1.2685 1.3059 1.2692 2.0267-0.0014 1.4217-1.791 2.75-4.8021 3.6968-2.0515 0.82484-0.93693 3.7696 1.2249 2.9659 5.3088-1.8593 8.7426-3.8616 8.7514-6.6627-1.26e-4 -2.3662-2.4856-4.4942-6.4434-5.9982z"/> + <rect x="10.166" y="7.7911" width="24.668" height="15.432" fill="none" stroke="#000" stroke-linecap="round"/> +</svg> diff --git a/embed/imgs/timeout.svg b/embed/imgs/timeout.svg new file mode 100644 index 00000000..13691ba0 --- /dev/null +++ b/embed/imgs/timeout.svg @@ -0,0 +1,19 @@ +<svg width="25" height="25" version="1.1" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg"> + <defs> + <mask id="a"> + <rect x="0" y="0" width="25" height="25" fill="#fff"/> + <rect x="-5" y="-5" width="17.5" height="35" fill="#000" transform="rotate(180,12.5,12.5)"> + <animateTransform attributeName="transform" type="rotate" from="0,12.5,12.5" to="180,12.5,12.5" dur="5" repeatCount="1"/> + </rect> + <rect x="0" y="0" width="12.5" height="25" fill="#fff"/> + <rect x="-5" y="-5" width="17.5" height="35" fill="#000" transform="rotate(360,12.5,12.5)"> + <animate attributeType="CSS" attributeName="opacity" from="0" to="1" dur="10" calcMode="discrete" repeatCount="1" /> + <animateTransform attributeName="transform" type="rotate" from="180,12.5,12.5" to="360,12.5,12.5" begin="5" dur="5" repeatCount="1"/> + </rect> + <circle cx="12.5" cy="12.5" r="8" fill="#000"/> + </mask> + </defs> + <g mask="url(#a)"> + <circle cx="12.5" cy="12.5" r="12.5" class="fill"/> + </g> +</svg> diff --git a/embed/imgs/volume.svg b/embed/imgs/volume.svg index 9176e6e1..b774b7d7 100644 --- a/embed/imgs/volume.svg +++ b/embed/imgs/volume.svg @@ -9,14 +9,25 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="30" - height="65" + width="65.000015" + height="30" id="svg3937" version="1.1" - inkscape:version="0.91 r13725" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="volume.svg"> <defs - id="defs3939" /> + id="defs3939"> + <mask + maskUnits="userSpaceOnUse" + id="mask4516"> + <path + inkscape:connector-curvature="0" + id="path4518" + d="m -14.830002,1027.1553 58.614316,-18.8626 c 1.795162,-0.5777 3.231854,0.5139 3.231854,2.1982 v 19.0111 c 0,1.3165 -1.098401,2.3764 -2.462782,2.3764 h -59.106775 c -2.946621,0 -3.449835,-3.6727 -0.276613,-4.7231 z" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.96767992;stroke-opacity:1" + sodipodi:nodetypes="cccsscc" /> + </mask> + </defs> <sodipodi:namedview id="base" pagecolor="#dc39f7" @@ -24,16 +35,16 @@ borderopacity="1.0" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:zoom="4" - inkscape:cx="-36.653402" - inkscape:cy="38.029112" + inkscape:zoom="14.580651" + inkscape:cx="30.208524" + inkscape:cy="17.533448" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:snap-bbox="true" inkscape:bbox-paths="false" - inkscape:window-width="1920" - inkscape:window-height="1055" + inkscape:window-width="1868" + inkscape:window-height="1049" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" @@ -41,7 +52,13 @@ inkscape:object-paths="true" inkscape:snap-page="true" inkscape:snap-global="true" - borderlayer="true" /> + borderlayer="true" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + showguides="true" + inkscape:guide-bbox="true" /> <metadata id="metadata3942"> <rdf:RDF> @@ -50,7 +67,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> + <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> @@ -58,16 +75,20 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-987.3622)"> + transform="translate(17.50001,-1004.8622)"> <path - style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;marker:none;enable-background:accumulate" - d="m 0,1052.3622 0,-65 5,0 c -0.172588,0 -0.337256,0.0295 -0.5,0.0625 -0.489111,0.1 -0.942345,0.31725 -1.28125,0.65625 -0.226206,0.2262 -0.404743,0.5135 -0.53125,0.8125 -0.126507,0.2991 -0.1875,0.62365 -0.1875,0.96875 0,0 0.075978,0.44705 0.1875,0.78125 l 19.84375,59.49995 c 0.142777,1.2451 1.185414,2.2188 2.46875,2.2188 l -25,0 z m 25,0 c 0.877549,0 1.647663,-0.441 2.09375,-1.125 0.06381,-0.098 0.1062,-0.2046 0.15625,-0.3125 0.02962,-0.062 0.06926,-0.1225 0.09375,-0.1875 0.04501,-0.1212 0.06741,-0.2459 0.09375,-0.375 0.009,-0.044 0.02457,-0.08 0.03125,-0.125 0.01878,-0.1235 0.03125,-0.2462 0.03125,-0.375 l 0,-60 c 0,-1.385 -1.114999,-2.5 -2.5,-2.5 l 5,0 0,65 -5,0 z" - id="rect4674" - inkscape:connector-curvature="0" /> - <path - style="fill:#ffffff;fill-opacity:1;stroke:none" - d="m 25,1052.3617 c -1.283336,0 -2.325973,-0.9737 -2.46875,-2.2187 L 2.6875,990.6429 C 2.575978,990.3087 2.5,989.8617 2.5,989.8617 c 0,-0.3451 0.060993,-0.6697 0.1875,-0.9688 0.126507,-0.299 0.305044,-0.5863 0.53125,-0.8125 0.338905,-0.339 0.792139,-0.5562 1.28125,-0.6562 0.162744,-0.033 0.327412,-0.062 0.5,-0.062 l 20,0 c 1.385001,0 2.5,1.115 2.5,2.5 l 0,60 c 0,0.1288 -0.01247,0.2515 -0.03125,0.375 -0.0067,0.045 -0.02225,0.081 -0.03125,0.125 -0.02634,0.1292 -0.04874,0.2538 -0.09375,0.375 -0.02449,0.065 -0.06413,0.1252 -0.09375,0.1875 -0.05005,0.1079 -0.09244,0.2145 -0.15625,0.3125 -0.446087,0.684 -1.216201,1.125 -2.09375,1.125 z m 0,-1.2187 c 0.474106,0 0.864734,-0.2114 1.09375,-0.5625 -0.02112,0.032 -0.0059,-0.01 0.0625,-0.1563 a 1.204452,1.204452 0 0 1 0,-0.031 c 0.0235,-0.049 0.05198,-0.052 0.0625,-0.062 0.0055,-0.016 0.0094,-0.035 0,-0.031 0.0017,-0.01 0.0055,-0.061 0.03125,-0.1875 0.008,-0.039 0.02555,-0.039 0.03125,-0.062 0.0098,-0.066 0.0055,-0.1027 0,-0.094 -0.0016,-0.03 0,-0.068 0,-0.094 l 0,-60 c 0,-0.7386 -0.542617,-1.2813 -1.28125,-1.2813 l -20,0 c -0.035353,0 -0.105322,0 -0.25,0.031 -0.296863,0.061 -0.546343,0.1713 -0.6875,0.3125 -0.089394,0.089 -0.205263,0.258 -0.28125,0.4375 -0.055315,0.1308 -0.058661,0.2832 -0.0625,0.4687 -2.52e-4,0.012 0,0.019 0,0.031 0.027982,0.1353 0.082499,0.2789 0.125,0.4062 l 19.84375,59.5005 a 1.204452,1.204452 0 0 1 0.03125,0.25 c 0.07527,0.6564 0.607054,1.125 1.28125,1.125 z" - id="path4697-6" - inkscape:connector-curvature="0" /> + inkscape:connector-curvature="0" + id="path4505" + d="m -14.830002,1027.1553 58.614316,-18.8626 c 1.795162,-0.5777 3.231854,0.5139 3.231854,2.1982 v 19.0111 c 0,1.3165 -1.098401,2.3764 -2.462782,2.3764 h -59.106775 c -2.946621,0 -3.449835,-3.6727 -0.276613,-4.7231 z" + style="fill:none;fill-opacity:1;stroke:#fdfdfd;stroke-width:0.96767992;stroke-opacity:1" + sodipodi:nodetypes="cccsscc" /> + <rect + style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:0.60986549;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4507" + width="33.400429" + height="30" + x="-17.50001" + y="1004.8622" + mask="url(#mask4516)" /> </g> </svg> diff --git a/embed/imgs/volume_plain.svg b/embed/imgs/volume_plain.svg index f3947a33..90a20721 100644 --- a/embed/imgs/volume_plain.svg +++ b/embed/imgs/volume_plain.svg @@ -1,38 +1,11 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - version="1.1" - id="svg3937" - height="65" - width="30"> - <defs - id="defs3939" /> - <metadata - id="metadata3942"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <g - transform="translate(0,-987.3622)" - id="layer1"> - <path - id="rect4674" - d="m 0,1052.3622 0,-65 5,0 c -0.172588,0 -0.337256,0.0295 -0.5,0.0625 -0.489111,0.1 -0.942345,0.31725 -1.28125,0.65625 -0.226206,0.2262 -0.404743,0.5135 -0.53125,0.8125 -0.126507,0.2991 -0.1875,0.62365 -0.1875,0.96875 0,0 0.075978,0.44705 0.1875,0.78125 l 19.84375,59.49995 c 0.142777,1.2451 1.185414,2.2188 2.46875,2.2188 l -25,0 z m 25,0 c 0.877549,0 1.647663,-0.441 2.09375,-1.125 0.06381,-0.098 0.1062,-0.2046 0.15625,-0.3125 0.02962,-0.062 0.06926,-0.1225 0.09375,-0.1875 0.04501,-0.1212 0.06741,-0.2459 0.09375,-0.375 0.009,-0.044 0.02457,-0.08 0.03125,-0.125 0.01878,-0.1235 0.03125,-0.2462 0.03125,-0.375 l 0,-60 c 0,-1.385 -1.114999,-2.5 -2.5,-2.5 l 5,0 0,65 -5,0 z" - style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;marker:none;enable-background:accumulate" /> - <path - id="path4697-6" - d="m 25,1052.3617 c -1.283336,0 -2.325973,-0.9737 -2.46875,-2.2187 L 2.6875,990.6429 C 2.575978,990.3087 2.5,989.8617 2.5,989.8617 c 0,-0.3451 0.060993,-0.6697 0.1875,-0.9688 0.126507,-0.299 0.305044,-0.5863 0.53125,-0.8125 0.338905,-0.339 0.792139,-0.5562 1.28125,-0.6562 0.162744,-0.033 0.327412,-0.062 0.5,-0.062 l 20,0 c 1.385001,0 2.5,1.115 2.5,2.5 l 0,60 c 0,0.1288 -0.01247,0.2515 -0.03125,0.375 -0.0067,0.045 -0.02225,0.081 -0.03125,0.125 -0.02634,0.1292 -0.04874,0.2538 -0.09375,0.375 -0.02449,0.065 -0.06413,0.1252 -0.09375,0.1875 -0.05005,0.1079 -0.09244,0.2145 -0.15625,0.3125 -0.446087,0.684 -1.216201,1.125 -2.09375,1.125 z m 0,-1.2187 c 0.474106,0 0.864734,-0.2114 1.09375,-0.5625 -0.02112,0.032 -0.0059,-0.01 0.0625,-0.1563 a 1.204452,1.204452 0 0 1 0,-0.031 c 0.0235,-0.049 0.05198,-0.052 0.0625,-0.062 0.0055,-0.016 0.0094,-0.035 0,-0.031 0.0017,-0.01 0.0055,-0.061 0.03125,-0.1875 0.008,-0.039 0.02555,-0.039 0.03125,-0.062 0.0098,-0.066 0.0055,-0.1027 0,-0.094 -0.0016,-0.03 0,-0.068 0,-0.094 l 0,-60 c 0,-0.7386 -0.542617,-1.2813 -1.28125,-1.2813 l -20,0 c -0.035353,0 -0.105322,0 -0.25,0.031 -0.296863,0.061 -0.546343,0.1713 -0.6875,0.3125 -0.089394,0.089 -0.205263,0.258 -0.28125,0.4375 -0.055315,0.1308 -0.058661,0.2832 -0.0625,0.4687 -2.52e-4,0.012 0,0.019 0,0.031 0.027982,0.1353 0.082499,0.2789 0.125,0.4062 l 19.84375,59.5005 a 1.204452,1.204452 0 0 1 0.03125,0.25 c 0.07527,0.6564 0.607054,1.125 1.28125,1.125 z" - style="fill:#ffffff;fill-opacity:1;stroke:none" /> +<svg width="100" height="45" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <defs> + <mask id="a" maskUnits="userSpaceOnUse"> + <rect width="57.288" height="30" fill="#fff" fill-opacity=".74439"/> + </mask> + </defs> + <path d="m6.202 33.254 86.029-28.394c2.6348-0.86966 4.7433 0.77359 4.7433 3.3092v28.617c0 1.9819-1.6122 3.5773-3.6147 3.5773h-86.75c-4.3249 0-5.0634-5.5287-0.40598-7.1098" fill="none" stroke="#fdfdfd" stroke-width="6.0417"/> + <g transform="translate(16.609 9.9991)" fill="#fff" mask="url(#a)"> + <path d="m4.2605 21.935 55.47-18.308c1.6989-0.56074 3.0584 0.4988 3.0584 2.1337v18.452c0 1.2779-1.0395 2.3066-2.3307 2.3066h-55.935c-2.7886 0-3.2648-3.5648-0.26177-4.5843" fill="#fff"/> </g> </svg> diff --git a/embed/imgs/volume_rect_dot_plain.svg b/embed/imgs/volume_rect_dot_plain.svg new file mode 100644 index 00000000..00ac04de --- /dev/null +++ b/embed/imgs/volume_rect_dot_plain.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="100" height="50" version="1.1" viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg"> + <rect y="21" width="100" height="8" fill="#fff"/> + <ellipse cx="50" cy="25" rx="10" ry="10" fill="#008000"/> + <rect y="21" width="50" height="8" fill="#008000"/> +</svg> diff --git a/embed/min/player.js b/embed/min/player.js new file mode 100644 index 00000000..12de5898 --- /dev/null +++ b/embed/min/player.js @@ -0,0 +1 @@ +var MistUtil={format:{time:function(e,t){if(isNaN(e)||!isFinite(e))return e;t||(t={});var i=e<0?" ago":"";e=Math.abs(e);var r=Math.floor(e/86400);e-=86400*r;var n=Math.floor(e/3600);e-=3600*n;var a=Math.floor(e/60),s=Math.round(e%1*1e3);e=Math.floor(e-60*a);var o=[];return r&&(r=r+" day"+(r>1?"s":"")+", "),n||r?(o.push(n),o.push(("0"+a).slice(-2))):o.push(a),o.push(("0"+Math.floor(e)).slice(-2)),t.ms&&(o[o.length-1]+="."+("000"+s).slice(-3)),(r||"")+o.join(":")+i},ucFirst:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},number:function(e){if(isNaN(Number(e))||0==e)return e;var t=Math.max(3,Math.ceil(Math.log(e)/Math.LN10)),i=Math.pow(10,t-Math.floor(Math.log(e)/Math.LN10)-1);if((e=Math.round(e*i)/i)>=1e4){number=e.toString().split(".");for(var r=/(\d+)(\d{3})/;r.test(number[0]);)number[0]=number[0].replace(r,"$1 $2");e=number.join(".")}return e},bytes:function(e){if(isNaN(Number(e)))return e;var t=["bytes","KB","MB","GB","TB","PB"];if(0==e)unit=t[0];else{var i=Math.floor(Math.log(Math.abs(e))/Math.log(1024));i<0?unit=t[0]:(e/=Math.pow(1024,i),unit=t[i])}return this.number(e)+unit},mime2human:function(e){switch(e){case"html5/video/webm":return"WebM";case"html5/application/vnd.apple.mpegurl":return"HLS";case"flash/10":return"Flash (RTMP)";case"flash/11":return"Flash (HDS)";case"flash/7":return"Flash (Progressive)";case"html5/video/mpeg":return"TS";case"html5/application/vnd.ms-ss":return"Smooth streaming";case"dash/video/mp4":return"DASH";case"webrtc":return"WebRTC";case"silverlight":return"Smooth streaming (Silverlight)";case"html5/text/vtt":return"VTT subtitles";case"html5/text/plain":return"SRT subtitles";default:return e.replace("html5/","").replace("video/","").replace("audio/","").toLocaleUpperCase()}}},class:{add:function(e,t){if("classList"in e)e.classList.add(t);else{var i=this.get(e);i.push(t),this.set(e,i)}},remove:function(e,t){if("classList"in e)e.classList.remove(t);else{for(var i=this.get(e),r=i.length-1;r>=0;r--)i[r]==t&&i.splice(r);this.set(e,i)}},get:function(e){var t=e.getAttribute("class");return t&&""!=t?t.split(" "):[]},set:function(e,t){e.setAttribute("class",t.join(" "))},has:function(e,t){return e.className.split(" ").indexOf(t)>=0}},object:{extend:function(e,t,i){for(var r in t)!i||"object"!=typeof t[r]||"nodeType"in t[r]?e[r]=t[r]:(r in e||(MistUtil.array.is(t[r])?e[r]=[]:e[r]={}),this.extend(e[r],t[r],!0));return e},keys:function(e,t){var i=[];for(var r in e)i.push(r);return t&&("function"!=typeof t&&(t=function(e,t){return e>t?1:e<t?-1:0}),i.sort(function(i,r){return t(i,r,e[i],e[r])})),i},values:function(e,t){var i=this.keys(e,t);for(var r in values=[],i)values.push(e[i[r]]);return values}},array:{indexOf:function(e,t){if(!(e instanceof Array))throw"Tried to use indexOf on something that is not an array";if("indexOf"in e)return e.indexOf(t);for(var i;i<e.length;i++)if(e[i]==t)return i;return-1},is:function(e){return"isArray"in Array?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)},multiSort:function(e,t){var i=function(e,t){return isNaN(e)||isNaN(t)?e.localeCompare(t):Math.sign(e-t)};if(!t.length)return e.sort(i);function r(e,t){function i(e,t,i){if(!(t in e))throw"Invalid sorting rule: "+JSON.stringify([t,i])+'. "'+t+'" is not a key of '+JSON.stringify(e);if("number"==typeof i&&t in e)return e[t]*i;var r=i.indexOf(e[t]);return r>=0?r:i.length}if("function"==typeof e)return e(t);if("object"==typeof e){if(e instanceof Array)return i(t,e[0],e[1]);for(var r in e)return i(t,r,e[r])}if(e in t)return t[e];throw"Invalid sorting rule: "+e+". This should be a function, object or key of "+JSON.stringify(t)+"."}return e.sort(function(e,n){var a=0;for(var s in t){var o=t[s];if(0!=(a=i(r(o,e),r(o,n))))break}return a}),e}},createUnique:function(){var e="uid"+Math.random().toString().replace("0.","");return document.querySelector("."+e)?createUnique():e},http:{getpost:function(e,t,i,r,n){var a=new XMLHttpRequest;if(a.open(e,t,!0),"POST"==e&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n&&(a.timeout=8e3),a.onload=function(){var e=a.status;e>=200&&e<300?r(a.response):n&&(a.onerror=function(){n(a)})},n&&(a.onerror=function(){n(a)},a.ontimeout=a.onerror),"POST"==e){var s,o=[];for(var l in i)o.push(l+"="+encodeURIComponent(i[l]));o.length&&(s=o.join("&")),a.send(s)}else a.send()},get:function(e,t,i){this.getpost("GET",e,null,t,i)},post:function(e,t,i,r){this.getpost("POST",e,t,i,r)},url:{addParam:function(e,t){var i=e.split("?"),r=[i.shift()],n=[];for(var a in i.length&&(n=i[0].split("&")),t)n.push(a+"="+t[a]);return n.length&&r.push(n.join("&")),r.join("?")},split:function(e){var t=document.createElement("a");return t.href=e,{protocol:t.protocol,host:t.hostname,hash:t.hash,port:t.port,path:t.pathname.replace(/\/*$/,"")}},sanitizeHost:function(e){var t=MistUtil.http.url.split(e);return t.protocol+"//"+t.host+(t.port&&""!=t.port?":"+t.port:"")+(t.hash&&""!=t.hash?"#"+t.hash:"")+(t.path?t.path:"")}}},css:{cache:{},load:function(e,t,i){var r=document.createElement("style");r.type="text/css",r.setAttribute("data-source",e),i&&(r.callback=i);var n=this.cache;function a(e){var i=MistUtil.css.applyColors(e,t);"callback"in r?r.callback(i):r.textContent=i}return e in n?n[e]instanceof Array?n[e].push(a):a(n[e]):(n[e]=[a],MistUtil.http.get(e,function(t){for(var i in n[e])n[e][i](t);n[e]=t},function(){throw"Failed to load CSS from "+e})),r},applyColors:function(e,t){return e.replace(/\$([^\s^;^}]*)/g,function(e,i){var r=i.split("."),n=t;for(var a in r)n=n[r[a]];return n})},createStyle:function(e,t,i){var r=document.createElement("style");return r.type="text/css",e&&(t&&(e=this.prependClass(e,t,i)),r.textContent=e),r},prependClass:function(e,t,i){var r=!1;"string"!=typeof e&&("unprepended"in(r=e)||(r.unprepended=r.textContent),e=r.unprepended);var n=(e=e.replace(/\/\*.*?\*\//g,"")).match(/@.*?{.*}/g);for(var a in n)e=e.replace(n[a],"@@@@");for(var a in e=e.replace(/[^@]*?{[^]*?}/g,function(e){var r=e.split("{"),n=r[0].split(","),a="{"+r.slice(1).join("}");for(var s in n){n[s]=n[s].trim();var o="."+t+n[s];i&&(o+=",\n."+t+" "+n[s]),n[s]=o}return"\n"+n+" "+a}),n)e=e.replace(/@@@@/,n[a]);if(!r)return e;r.textContent=e}},empty:function(e){for(;e.lastChild;){if(e.lastChild.lastChild&&this.empty(e.lastChild),"attachedListeners"in e.lastChild)for(var t in e.lastChild.attachedListeners)MistUtil.event.removeListener(e.lastChild.attachedListeners[t]);e.removeChild(e.lastChild)}},event:{send:function(e,t,i){try{(r=new Event(e,{bubbles:!0,cancelable:!0})).message=t,i.dispatchEvent(r)}catch(n){try{var r;(r=document.createEvent("Event")).initEvent(e,!0,!0),r.message=t,i.dispatchEvent(r)}catch(e){return!1}}return!0},addListener:function(e,t,i,r){e.addEventListener(t,i),r||(r=e),"attachedListeners"in r||(r.attachedListeners=[]);var n={element:e,type:t,callback:i};return r.attachedListeners.push(n),n},removeListener:function(e){e.element.removeEventListener(e.type,e.callback)}},scripts:{list:{},insert:function(e,t,i){var r=this;if(i&&i.errorListeners.push({src:e,onevent:t}),e in this.list)return this.list[e].subscribers.push(t.onerror),void("onload"in t&&(this.hasLoaded?t.onload():MistUtil.event.addListener(this.list[e].tag,"load",t.onload)));var n=document.createElement("script");n.hasLoaded=!1,n.setAttribute("src",e),n.setAttribute("crossorigin","anonymous"),document.head.appendChild(n),n.onerror=function(e){t.onerror(e)},n.onload=function(e){this.hasLoaded=!0,i.destroyed||t.onload(e)},n.addEventListener("error",function(e){t.onerror(e)});var a=!1;return window.onerror&&(a=window.onerror),window.onerror=function(i,n,s,o,l){if(a&&a.apply(this,arguments),n==e)for(var c in t.onerror(l),r.list[e].subscribers)r.list[e].subscribers[c](l)},this.list[e]={subscribers:[t.onerror],tag:n},n}},tracks:{parse:function(e){var t={};for(var i in e){var r=MistUtil.object.extend({},e[i]);"meta"==r.type&&(r.type=r.codec,r.codec="meta"),r.type in t||(t[r.type]={}),t[r.type][r.trackid]=r;var n={};for(var a in r)switch(a){case"width":n[a]=r.width+"×"+r.height;break;case"bps":if("meta"==r.codec)continue;var s;if(r.bps>0)s=r.bps>131072?Math.round(r.bps/1024/1024*8)+"mbps":Math.round(r.bps/1024*8)+"kbps",n[a]=s;break;case"fpks":r.fpks>0&&(n[a]=r.fpks/1e3+"fps");break;case"channels":r.channels>0&&(n[a]=1==r.channels?"Mono":2==r.channels?"Stereo":"Surround ("+r.channels+"ch)");break;case"rate":n[a]=Math.round(r.rate)+"Khz";break;case"language":"Undetermined"!=r[a]&&(n[a]=r[a]);break;case"codec":if("meta"==r.codec)continue;n[a]=r[a]}r.describe=n}for(var o in t){var l=!1;for(var i in t[o])if(l){if(MistUtil.object.keys(t[o]).length>1)for(var a in t[o][i].describe)l[a]!=t[o][i].describe[a]&&delete l[a]}else l=MistUtil.object.extend({},t[o][i].describe);for(var i in t[o]){var c={},d={};for(var a in t[o][i].describe)a in l?d[a]=t[o][i].describe[a]:c[a]=t[o][i].describe[a];t[o][i].different=c,t[o][i].same=d;var u=MistUtil.object.values(c);t[o][i].displayName=u.length?u.join(", "):MistUtil.object.values(t[o][i].describe).join(" ")}}return t}},isTouchDevice:function(){return"ontouchstart"in window||navigator.msMaxTouchPoints>0},getPos:function(e,t){e.currentStyle||window.getComputedStyle(e,null);for(var i=1,r=e;r;)r.style.zoom&&""!=r.style.zoom&&(i*=parseFloat(r.style.zoom,10)),r=r.parentElement;var n=e.getBoundingClientRect().left-(parseInt(e.borderLeftWidth,10)||0),a=e.getBoundingClientRect().width,s=Math.max(0,(t.clientX/i-n)/a);return s=Math.min(s,1)},createGraph:function(e,t){var i="http://www.w3.org/2000/svg",r=document.createElementNS(i,"svg");r.setAttributeNS(null,"height","100%"),r.setAttributeNS(null,"width","100%"),r.setAttributeNS(null,"class","mist icon graph"),r.setAttributeNS(null,"preserveAspectRatio","none");var n=e.x[0],a=e.y[0];if(t.differentiate)for(var s=1;s<e.y.length;s++){var o=e.y[s]-a;a=e.y[s],e.y[s]=o}var l=[],c={x:{min:e.x[0]-n,max:e.x[0]-n},y:{min:-1*e.y[0],max:-1*e.y[0]}};function d(e,t){if(arguments.length)c.x.min=Math.min(c.x.min,e),c.x.max=Math.max(c.x.max,e),c.y.min=Math.min(c.y.min,-1*t),c.y.max=Math.max(c.y.max,-1*t);else{var i=l[0].split(",");c={x:{min:i[0],max:i[0]},y:{min:i[1],max:i[1]}};for(var r=1;r<l.length;r++){d((i=l[r].split(","))[0],-1*i[1])}}}l.push([e.x[0]-n,-1*e.y[0]].join(","));for(s=1;s<e.y.length;s++)d(e.x[s]-n,-1*e.y[s]),l.push("L "+[e.x[s]-n,-1*e.y[s]].join(","));var u=document.createElementNS(i,"defs");r.appendChild(u);var p=document.createElementNS(i,"linearGradient");function h(){"x"in t&&("min"in t.x&&(c.x.min=t.x.min),"max"in t.x&&(c.x.max=t.x.max),"count"in t.x&&(c.x.min=c.x.max-t.x.count)),"y"in t&&("min"in t.y&&(c.y.min=-1*t.y.max),"max"in t.y&&(c.y.max=-1*t.y.min)),r.setAttributeNS(null,"viewBox",[c.x.min,c.y.min,c.x.max-c.x.min,c.y.max-c.y.min].join(" ")),p.setAttributeNS(null,"x1",0),p.setAttributeNS(null,"x2",0),t.reverseGradient?(p.setAttributeNS(null,"y1",c.y.max),p.setAttributeNS(null,"y2",c.y.min)):(p.setAttributeNS(null,"y1",c.y.min),p.setAttributeNS(null,"y2",c.y.max))}u.appendChild(p),p.setAttributeNS(null,"id",MistUtil.createUnique()),p.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),p.innerHTML+='<stop offset="0" stop-color="green"/>',p.innerHTML+='<stop offset="0.33" stop-color="yellow"/>',p.innerHTML+='<stop offset="0.66" stop-color="orange"/>',p.innerHTML+='<stop offset="1" stop-color="red"/>',h();var m=document.createElementNS(i,"path");return r.appendChild(m),m.setAttributeNS(null,"stroke-width","0.1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"stroke","url(#"+p.getAttribute("id")+")"),m.setAttributeNS(null,"d","M"+l.join(" L")),m.addData=function(e){if(t.differentiate){var i=e.y-a;a=e.y,e.y=i}l.push([e.x-n,-1*e.y].join(",")),t.x&&t.x.count&&l.length>t.x.count&&(l.shift(),d()),d(e.x-n,-1*e.y),this.setAttributeNS(null,"d","M"+l.join(" L")),h()},r.addData=function(e){m.addData(e)},r},getBrowser:function(){var e=window.navigator.userAgent;return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0?"ie":e.indexOf("Edge/")>=0?"edge":e.indexOf("Opera")>=0||e.indexOf("OPR")>=0?"opera":e.indexOf("Chrome")>=0?"chrome":e.indexOf("Safari")>=0?"safari":e.indexOf("Firefox")>=0&&"firefox"}};if(void 0===MistSkins)var MistSkins={};if("undefined"!=typeof mistoptions&&"host"in mistoptions)var misthost=MistUtil.http.url.sanitizeHost(mistoptions.host);else misthost="..";function MistSkin(e){e.skin=this,this.applySkinOptions=function(t){var i;return"string"==typeof t&&t in MistSkins&&(t=MistUtil.object.extend({},MistSkins[t],!0)),i="inherit"in t&&t.inherit?this.applySkinOptions(t.inherit):MistSkins.default,this.structure=MistUtil.object.extend({},i.structure),t&&"structure"in t&&MistUtil.object.extend(this.structure,t.structure),this.blueprints=MistUtil.object.extend({},i.blueprints),t&&"blueprints"in t&&MistUtil.object.extend(this.blueprints,t.blueprints),this.icons=MistUtil.object.extend({},i.icons,!0),t&&"icons"in t&&MistUtil.object.extend(this.icons.blueprints,t.icons),this.icons.build=function(t,i,r){i||(i=22);var n,a=this.blueprints[t];n="function"==typeof a.svg?a.svg.call(e,r):a.svg,"object"!=typeof i&&(i={height:i,width:i}),"object"!=typeof a.size&&(a.size={height:a.size,width:a.size}),(!("width"in i)&&"height"in i||!("height"in i)&&"width"in i)&&("width"in i&&(i.height=i.width*a.size.height/a.size.width),"height"in i&&(i.width=i.height*a.size.width/a.size.height));var s="";s+='<svg viewBox="0 0 '+a.size.width+" "+a.size.height+'"'+("width"in i?' width="'+i.width+'"':"")+("height"in i?' height="'+i.height+'"':"")+' class="mist icon '+t+'">',s+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="100%" width="100%">',s+=n,s+="</svg>",s+="</svg>";var o=document.createElement("div");return o.innerHTML=s,o.firstChild},this.colors=MistUtil.object.extend({},i.colors),t&&"colors"in t&&MistUtil.object.extend(this.colors,t.colors,!0),this.css=MistUtil.object.extend({},i.css),t&&"css"in t&&MistUtil.object.extend(this.css,t.css),this},this.applySkinOptions("skin"in e.options?e.options.skin:"default");var t=[];for(var i in this.css)"string"==typeof this.css[i]&&t.push(MistUtil.css.load(e.urlappend(this.css[i]),this.colors));this.css=t}function MistUI(e,t){e.UI=this,this.elements=[],this.buildStructure=function(t){if("function"==typeof t&&(t=t.call(e)),"if"in t){var i=!1;if(t.if.call(e,t)?i=t.then:"else"in t&&(i=t.else),!i)return;for(var r in t)["if","then","else"].indexOf(r)<0&&(r in i?(i[r]instanceof Array||(i[r]=[i[r]]),i[r]=i[r].concat(t[r])):i[r]=t[r]);return this.buildStructure(i)}if("type"in t&&t.type in e.skin.blueprints){var n=e.skin.blueprints[t.type].call(e,t);if(!n)return;if(MistUtil.class.add(n,"mistvideo-"+t.type),"css"in t){var a=MistUtil.createUnique();for(var r in t.css=[].concat(t.css),t.css){var s=MistUtil.css.createStyle(t.css[r],a);n.appendChild(s)}MistUtil.class.add(n,a),n.uid=a}if("classes"in t)for(var r in t.classes)MistUtil.class.add(n,t.classes[r]);if("title"in t&&(n.title=t.title),"style"in t)for(var r in t.style)n.style[r]=t.style[r];if("children"in t)for(var r in t.children){var o=this.buildStructure(t.children[r]);o&&n.appendChild(o)}return e.UI.elements.push(n),n}return!1},this.build=function(){return this.buildStructure(t||e.skin.structure.main)};var i=this.build(),r=MistUtil.createUnique(),n=e.skin.css.length;for(var a in n&&(i.style.opacity="0"),e.skin.css){var s=e.skin.css[a];s.callback=function(e){this.textContent=MistUtil.css.prependClass(e,r,!0),--n<=0&&(i.style.opacity="")},""!=s.textContent&&s.callback(s.textContent),i.appendChild(s)}MistUtil.class.add(i,r);var o=MistUtil.getBrowser();return o&&MistUtil.class.add(i,"browser-"+o),i}MistSkins.default={structure:{main:{if:function(){return!!this.info.hasVideo&&"audio"!=this.source.type.split("/")[1]},then:{type:"placeholder",classes:["mistvideo"],children:[{type:"hoverWindow",mode:"pos",style:{position:"relative"},transition:{hide:"left: 0; right: 0; bottom: -43px;",show:"bottom: 0;",viewport:"left:0; right: 0; top: -1000px; bottom: 0;"},button:{type:"videocontainer"},children:[{type:"loading"},{type:"error"}],window:{type:"controls"}}]},else:{type:"container",classes:["mistvideo"],style:{overflow:"visible"},children:[{type:"controls",classes:["mistvideo-novideo"],style:{width:"480px"}},{type:"loading"},{type:"error"},{if:function(){return"stock"==this.options.controls},then:{type:"video",style:{position:"absolute"}},else:{type:"video",style:{position:"absolute",display:"none"}}}]}},videocontainer:{type:"video"},controls:{if:function(){return!!(this.player&&this.player.api&&this.player.api.play)},then:{type:"container",classes:["mistvideo-column"],children:[{type:"progress",classes:["mistvideo-pointer"]},{type:"container",classes:["mistvideo-main","mistvideo-padding","mistvideo-row","mistvideo-background"],children:[{type:"play",classes:["mistvideo-pointer"]},{type:"currentTime"},{type:"totalTime"},{type:"container",classes:["mistvideo-align-right"],children:[{type:"container",children:[{type:"container",classes:["mistvideo-volume_container"],children:[{type:"volume",mode:"horizontal",size:{height:22}}]},{type:"speaker",classse:["mistvideo-pointer"],style:{"margin-left":"-2px"}}]},{if:function(){return"size"in this&&this.size.width>200||!this.info.hasVideo||"audio"==this.source.type.split("/")[1]},then:{type:"container",children:[{type:"loop",classes:["mistvideo-pointer"]},{type:"fullscreen",classes:["mistvideo-pointer"]}]}},{type:"hoverWindow",mode:"pos",transition:{hide:"right: -1000px; bottom: 44px;",show:"right: 5px;",viewport:"right: 0; left: 0; bottom: 0; top: -1000px"},button:{type:"settings"},window:{type:"submenu"}}]}]}]},else:{if:function(){return!(!this.player||!this.player.api)},then:{type:"hoverWindow",mode:"pos",transition:{hide:"right: -1000px; bottom: 44px;",show:"right: 2.5px;",viewport:"right: 0; left: -1000px; bottom: 0; top: -1000px"},style:{right:"5px",left:"auto"},button:{type:"settings",classes:["mistvideo-background","mistvideo-padding"]},window:{type:"submenu"}}}},submenu:{type:"container",style:{width:"80%",maxWidth:"25em",zIndex:2},classes:["mistvideo-padding","mistvideo-column","mistvideo-background"],children:[{type:"tracks"},{if:function(){return"size"in this&&this.size.width<=200},then:{type:"container",classes:["mistvideo-center"],children:[{type:"loop",classes:["mistvideo-pointer"]},{type:"fullscreen",classes:["mistvideo-pointer"]}]}}]},placeholder:{type:"container",classes:["mistvideo","mistvideo-delay-display"],children:[{type:"placeholder"},{type:"loading"},{type:"error"}]},secondaryVideo:function(e){return{type:"hoverWindow",classes:["mistvideo"],mode:"pos",transition:{hide:"left: 10px; bottom: -40px;",show:"bottom: 10px;"},button:{type:"container",children:[{type:"video"}]},window:{type:"switchVideo",classes:["mistvideo-controls","mistvideo-padding","mistvideo-background"],containers:e}}}},css:{skin:misthost+"/skins/default.css"},icons:{blueprints:{play:{size:45,svg:'<path d="M6.26004984594 3.0550109625C5.27445051914 3.68940862462 4.67905105702 4.78142391497 4.67968264562 5.95354422781C4.67968264562 5.95354422781 4.70004942312 39.0717540916 4.70004942312 39.0717540916C4.70302341604 40.3033886636 5.36331656075 41.439734231 6.43188211452 42.0521884912C7.50044766829 42.6646427515 8.81469531629 42.6600161659 9.87892235656 42.0400537716C9.87892235656 42.0400537716 38.5612768409 25.4802882606 38.5612768409 25.4802882606C39.6181165777 24.8606067582 40.2663250096 23.7262617523 40.2636734301 22.5011460995C40.2610218505 21.2760304467 39.6079092743 20.1445019555 38.5483970356 19.5294009803C38.5483970356 19.5294009803 9.84567577375 2.9709566275 9.84567577375 2.9709566275C8.72898008118 2.32550764609 7.34527425735 2.35794451351 6.26004984594 3.0550109625C6.26004984594 3.0550109625 6.26004984594 3.0550109625 6.26004984594 3.0550109625" class="fill" />'},largeplay:{size:45,svg:'<path d="M6.26004984594 3.0550109625C5.27445051914 3.68940862462 4.67905105702 4.78142391497 4.67968264562 5.95354422781C4.67968264562 5.95354422781 4.70004942312 39.0717540916 4.70004942312 39.0717540916C4.70302341604 40.3033886636 5.36331656075 41.439734231 6.43188211452 42.0521884912C7.50044766829 42.6646427515 8.81469531629 42.6600161659 9.87892235656 42.0400537716C9.87892235656 42.0400537716 38.5612768409 25.4802882606 38.5612768409 25.4802882606C39.6181165777 24.8606067582 40.2663250096 23.7262617523 40.2636734301 22.5011460995C40.2610218505 21.2760304467 39.6079092743 20.1445019555 38.5483970356 19.5294009803C38.5483970356 19.5294009803 9.84567577375 2.9709566275 9.84567577375 2.9709566275C8.72898008118 2.32550764609 7.34527425735 2.35794451351 6.26004984594 3.0550109625C6.26004984594 3.0550109625 6.26004984594 3.0550109625 6.26004984594 3.0550109625" class="stroke" />'},pause:{size:45,svg:'<g><path d="m 7.5,38.531275 a 4.0011916,4.0011916 0 0 0 3.749999,3.96873 l 2.2812501,0 a 4.0011916,4.0011916 0 0 0 3.96875,-3.75003 l 0,-32.28123 a 4.0011916,4.0011916 0 0 0 -3.75,-3.96875 l -2.2812501,0 a 4.0011916,4.0011916 0 0 0 -3.968749,3.75 l 0,32.28128 z" class="fill" /><path d="m 27.5,38.531275 a 4.0011916,4.0011916 0 0 0 3.75,3.9687 l 2.28125,0 a 4.0011916,4.0011916 0 0 0 3.96875,-3.75 l 0,-32.28126 a 4.0011916,4.0011916 0 0 0 -3.75,-3.96875 l -2.28125,0 a 4.0011916,4.0011916 0 0 0 -3.96875,3.75 l 0,32.28131 z" class="fill" /></g>'},speaker:{size:45,svg:'<path d="m 32.737813,5.2037363 c -1.832447,-1.10124 -4.200687,-0.8622 -5.771871,0.77112 0,0 -7.738819,8.0443797 -7.738819,8.0443797 0,0 -3.417976,0 -3.417976,0 -1.953668,0 -3.54696,1.65618 -3.54696,3.68694 0,0 0,9.58644 0,9.58644 0,2.03094 1.593292,3.68712 3.54696,3.68712 0,0 3.417976,0 3.417976,0 0,0 7.738819,8.04474 7.738819,8.04474 1.572104,1.63404 3.938942,1.8747 5.771871,0.77076 0,0 0,-34.5914997 0,-34.5914997 z" class="stroke semiFill toggle" />'},volume:{size:{width:100,height:45},svg:function(){var e=MistUtil.createUnique();return'<defs><mask id="'+e+'"><path d="m6.202 33.254 86.029-28.394c2.6348-0.86966 4.7433 0.77359 4.7433 3.3092v28.617c0 1.9819-1.6122 3.5773-3.6147 3.5773h-86.75c-4.3249 0-5.0634-5.5287-0.40598-7.1098" fill="#fff" /></mask></defs><rect mask="url(#'+e+')" class="slider horizontal semiFill" width="100%" height="100%" /><path d="m6.202 33.254 86.029-28.394c2.6348-0.86966 4.7433 0.77359 4.7433 3.3092v28.617c0 1.9819-1.6122 3.5773-3.6147 3.5773h-86.75c-4.3249 0-5.0634-5.5287-0.40598-7.1098" class="stroke" /><rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.001)"/>'}},muted:{size:45,svg:'<g class="stroke" stroke-linecap="round" vector-effect="none" stroke-width="2"><path d="m25.587 5.2036c-1.8324-1.1012-4.2007-0.8622-5.7719 0.77112 0 0-7.7388 8.0444-7.7388 8.0444h-3.418c-1.9537 0-3.547 1.6562-3.547 3.6869v9.5864c0 2.0309 1.5933 3.6871 3.547 3.6871h3.418s7.7388 8.0447 7.7388 8.0447c1.5721 1.634 3.9389 1.8747 5.7719 0.77076v-34.591 z" /><path d="m30.032 27.86 9.8517-9.8517"/><path d="m30.032 18.008 9.8517 9.8517"/></g>'},fullscreen:{size:45,svg:'<path d="m2.5 10.928v8.5898l4.9023-2.8008 9.6172 5.7832-9.6172 5.7832-4.9023-2.8008v8.5898h15.031l-4.9004-2.8008 9.8691-5.6387 9.8691 5.6387-4.9004 2.8008h15.031v-8.5898l-4.9023 2.8008-9.6172-5.7832 9.6172-5.7832 4.9023 2.8008v-8.5898h-15.033l4.9023 2.8008-9.8691 5.6387-9.8691-5.6387 4.9023-2.8008z" class="fill">'},loop:{size:45,svg:'<path d="M 21.279283,3.749797 A 18.750203,18.750203 0 0 0 8.0304417,9.2511582 L 12.740779,13.961496 A 12.083464,12.083464 0 0 1 21.279283,10.416536 12.083464,12.083464 0 0 1 33.362748,22.5 12.083464,12.083464 0 0 1 21.279283,34.583464 12.083464,12.083464 0 0 1 12.740779,31.038504 l 3.063185,-3.063185 H 4.9705135 V 38.80877 L 8.0304417,35.748842 A 18.750203,18.750203 0 0 0 21.279283,41.250203 18.750203,18.750203 0 0 0 40.029486,22.5 18.750203,18.750203 0 0 0 21.279283,3.749797 Z" class="stroke semiFill toggle" />'},settings:{size:45,svg:'<path d="m24.139 3.834-1.4785 4.3223c-1.1018 0.0088-2.2727 0.13204-3.2031 0.33594l-2.3281-3.9473c-1.4974 0.45304-2.9327 1.091-4.2715 1.9004l1.3457 4.3672c-0.87808 0.62225-1.685 1.3403-2.4023 2.1426l-4.1953-1.8223c-0.9476 1.2456-1.7358 2.6055-2.3457 4.0469l3.6523 2.7383c-0.34895 1.0215-0.58154 2.0787-0.69336 3.1523l-4.4531 0.98828c-0.00716 0.14696-0.011931 0.29432-0.015625 0.44141 0.00628 1.4179 0.17336 2.8307 0.49805 4.2109l4.5703 0.070312c0.32171 1.0271 0.75826 2.0138 1.3008 2.9434l-3.0391 3.4355c0.89502 1.2828 1.9464 2.4492 3.1309 3.4707l3.7363-2.6289c0.86307 0.64582 1.7958 1.192 2.7812 1.6289l-0.43555 4.541c1.4754 0.52082 3.0099 0.85458 4.5684 0.99414l1.4766-4.3223c0.05369 3e-3 0.10838 0.005313 0.16211 0.007812 1.024-0.0061 2.0436-0.12048 3.043-0.34375l2.3281 3.9473c1.4974-0.45304 2.9327-1.091 4.2715-1.9004l-1.3457-4.3672c0.87808-0.62225 1.685-1.3403 2.4023-2.1426l4.1953 1.8223c0.9476-1.2456 1.7358-2.6055 2.3457-4.0469l-3.6523-2.7383c0.34895-1.0215 0.58154-2.0787 0.69336-3.1523l4.4531-0.98828c0.0072-0.14698 0.011925-0.29432 0.015625-0.44141-0.0062-1.4179-0.17336-2.8307-0.49805-4.2109l-4.5703-0.070312c-0.32171-1.0271-0.75826-2.0138-1.3008-2.9434l3.0391-3.4355c-0.89502-1.2828-1.9464-2.4492-3.1309-3.4707l-3.7363 2.6289c-0.86307-0.64582-1.7958-1.192-2.7812-1.6289l0.43555-4.541c-1.4754-0.52082-3.0099-0.85457-4.5684-0.99414zm-1.6387 7.8789a10.786 10.786 0 0 1 10.787 10.787 10.786 10.786 0 0 1-10.787 10.787 10.786 10.786 0 0 1-10.787-10.787 10.786 10.786 0 0 1 10.787-10.787z" class="fill"/>'},loading:{size:100,svg:'<path d="m49.998 8.7797e-4c-0.060547 0.0018431-0.12109 0.0037961-0.18164 0.0058593-0.1251 0.0015881-0.25012 0.0061465-0.375 0.013672h-0.001954c-27.388 0.30599-49.432 22.59-49.439 49.98 0.020074 2.6488 0.25061 5.292 0.68945 7.904 3.8792-24.231 24.77-42.065 49.311-42.096v-0.0058582h0.001954c4.3638 3.0803e-4 7.9013-3.5366 7.9021-7.9002 1.474e-4 -2.0958-0.83235-4.106-2.3144-5.5879-1.482-1.482-3.492-2.3145-5.5879-2.3144-6.5007e-4 -7.9369e-8 -0.0013001-7.9369e-8 -0.001954 0" class="semiFill spin"></path>'},timeout:{size:25,svg:function(e){e&&e.delay||(e={delay:10});var t=e.delay,i=MistUtil.createUnique();return'<defs><mask id="'+i+'"><rect x="0" y="0" width="25" height="25" fill="#fff"/><rect x="-5" y="-5" width="17.5" height="35" fill="#000" transform="rotate(180,12.5,12.5)"><animateTransform attributeName="transform" type="rotate" from="0,12.5,12.5" to="180,12.5,12.5" begin="DOMNodeInsertedIntoDocument" dur="'+t/2+'s" repeatCount="1"/></rect><rect x="0" y="0" width="12.5" height="25" fill="#fff"/><rect x="-5" y="-5" width="17.5" height="35" fill="#000" transform="rotate(360,12.5,12.5)"><animate attributeType="CSS" attributeName="opacity" from="0" to="1" begin="DOMNodeInsertedIntoDocument" dur="'+t+'s" calcMode="discrete" repeatCount="1" /><animateTransform attributeName="transform" type="rotate" from="180,12.5,12.5" to="360,12.5,12.5" begin="DOMNodeInsertedIntoDocument+'+t/2+'s" dur="'+t/2+'s" repeatCount="1"/></rect><circle cx="12.5" cy="12.5" r="8" fill="#000"/></mask></defs><circle cx="12.5" cy="12.5" r="12.5" class="fill" mask="url(#'+i+')"/>'}},popout:{size:45,svg:'<path d="m24.721 11.075c-12.96 0.049575-32.113 15.432-10.336 28.834-7.6763-7.9825-2.4795-21.824 10.336-22.19v5.5368l15.276-8.862-15.276-8.86v5.5419z" class="stroke fill"/>'},switchvideo:{size:45,svg:'<path d="m8.4925 18.786c-3.9578 1.504-6.4432 3.632-6.4434 5.9982 2.183e-4 4.1354 7.5562 7.5509 17.399 8.1467v4.7777l10.718-6.2573-10.718-6.2529v4.5717c-6.9764-0.4712-12.229-2.5226-12.227-4.9859 6.693e-4 -0.72127 0.45868-1.4051 1.2714-2.0267zm28.015 0v3.9715c0.81164 0.62126 1.2685 1.3059 1.2692 2.0267-0.0014 1.4217-1.791 2.75-4.8021 3.6968-2.0515 0.82484-0.93693 3.7696 1.2249 2.9659 5.3088-1.8593 8.7426-3.8616 8.7514-6.6627-1.26e-4 -2.3662-2.4856-4.4942-6.4434-5.9982z" class="fill"/><rect rect x="10.166" y="7.7911" width="24.668" height="15.432" class="stroke"/>'}}},blueprints:{container:function(){return document.createElement("div")},video:function(){var e=this;return MistUtil.event.addListener(e.video,"contextmenu",function(t){t.preventDefault(),e.container.setAttribute("data-show-submenu",""),e.container.removeAttribute("data-hidecursor");var i=function(){e.container.removeAttribute("data-show-submenu"),e.container.removeEventListener("mouseout",i)};MistUtil.event.addListener(e.container,"mouseout",i)}),e.video.hideTimer=!1,e.video.hideCursor=function(){this.hideTimer&&clearTimeout(this.hideTimer),this.hideTimer=e.timers.start(function(){e.container.setAttribute("data-hidecursor","");var t=e.container.querySelector(".mistvideo-controls");t&&t.parentNode.setAttribute("data-hidecursor","")},3e3)},MistUtil.event.addListener(e.video,"mousemove",function(){e.container.removeAttribute("data-hidecursor");var t=e.container.querySelector(".mistvideo-controls");t&&t.parentNode.removeAttribute("data-hidecursor"),e.video.hideCursor()}),MistUtil.event.addListener(e.video,"mouseout",function(){e.video.hideTimer&&e.timers.stop(e.video.hideTimer)}),e.options.autoplay&&MistUtil.event.addListener(e.video,"canplay",function(){if(e.player.api.paused){var t=e.player.api.play();t&&t.catch(function(t){if(!e.destroyed&&(e.log("Autoplay failed. Retrying with muted audio.."),e.info.hasVideo)){e.player.api.muted=!0,MistUtil.event.send("volumechange",null,e.video);var i=e.player.api.play();i&&i.catch(function(){if(!e.destroyed){e.log("Autoplay failed even with muted video. Unmuting and showing play button."),e.player.api.muted=!1;var t=e.skin.icons.build("largeplay",150);MistUtil.class.add(t,"mistvideo-pointer"),e.container.appendChild(t),MistUtil.event.addListener(t,"click",function(){e.player.api.paused&&e.player.api.play()});var i=function(){e.container.removeChild(t),e.video.removeEventListener("play",i)};MistUtil.event.addListener(e.video,"play",i)}}).then(function(){if(!e.destroyed){e.log("Autoplay worked! Video will be unmuted on mouseover if the page has been interacted with.");var t=e.skin.icons.build("muted",100);MistUtil.class.add(t,"mistvideo-pointer"),e.container.appendChild(t),MistUtil.event.addListener(t,"click",function(){e.player.api.muted=!1,e.container.removeChild(t)});var i=!1,r=function(){i=!0,document.body.removeEventListener("click",r)};MistUtil.event.addListener(document.body,"click",r,e.video);var n=function(){i&&(e.player.api.muted=!1,e.video.removeEventListener("mouseenter",n),e.log("Re-enabled sound"))};MistUtil.event.addListener(e.video,"mouseenter",n);var a=function(){e.video.muted||(e.container.removeChild(t),e.video.removeEventListener("volumechange",a),document.body.removeEventListener("click",r),e.video.removeEventListener("mouseenter",n))};MistUtil.event.addListener(e.video,"volumechange",a)}})}})}}),this.video},videocontainer:function(){return this.UI.buildStructure(this.skin.structure.videocontainer)},secondaryVideo:function(e){e||(e={}),e.options||(e.options={});var t=this;"secondary"in t||(t.secondary=[]);var i=MistUtil.object.extend(e.options,t.options,!0);t.secondary.push(i);var r={primary:t,secondary:!1};return i.target=document.createElement("div"),i.callback=function(e){i.MistVideo=e,r.secondary=e,e.player.api.muted=!0,e.player.api.loop=!1;for(var n=i.target.querySelectorAll(".controls"),a=0;a<n.length;a++)MistUtil.event.addListener(n[a],"click",function(e){e.stopPropagation()});MistUtil.event.addListener(t.video,"play",function(){e.player.api.paused&&e.player.api.play()},i.target),MistUtil.event.addListener(t.video,"pause",function(t){e.player.api.paused||e.player.api.pause()},i.target),MistUtil.event.addListener(t.video,"seeking",function(){e.player.api.currentTime=this.currentTime},i.target),MistUtil.event.addListener(t.video,"timeupdate",function(){if(!e.player.api.pausedesync){var t=this.currentTime-e.player.api.currentTime,i=Math.abs(t);if(i>30)e.player.api.pausedesync=!0,e.player.api.currentTime=this.currentTime,e.log("Re-syncing with main video by seeking (desync: "+t+"s)");else if(i>.01){var r=.1;i<1&&(r=.05),(r=1+r*Math.sign(t))!=e.player.api.playbackRate&&e.log("Re-syncing by changing the playback rate (desync: "+Math.round(1e3*t)+"ms, rate: "+r+")"),e.player.api.playbackRate=r}else 1!=e.player.api.playbackRate&&(e.player.api.playbackRate=1,e.log("Sync with main video achieved (desync: "+Math.round(1e3*t)+"ms)"))}},i.target),MistUtil.event.addListener(e.video,"seeked",function(){e.player.api.pausedesync=!1})},i.skin=MistUtil.object.extend({},t.skin,!0),i.skin.structure.main=MistUtil.object.extend({},t.skin.structure.secondaryVideo(r)),mistPlay(t.stream,i),i.target},switchVideo:function(e){var t=document.createElement("div");return t.appendChild(this.skin.icons.build("switchvideo")),MistUtil.event.addListener(t,"click",function(){var t=e.containers.primary,i=e.containers.secondary;function r(e,t){if(e.video.currentTarget==t)return e.video;if(e.secondary)for(var i=0;i<e.secondary.length;i++){var n=r(e.secondary[i].MistVideo,t);if(n)return n}return!1}var n=r(t,t.options.target),a=r(t,i.options.target),s=!n.paused,o=document.createElement("div");if(a.parentElement.insertBefore(o,a),n.parentElement.insertBefore(a,n),o.parentElement.insertBefore(n,o),o.parentElement.removeChild(o),s)try{n.play(),a.play()}catch(e){}var l={width:n.style.width,height:n.style.height,currentTarget:n.currentTarget};n.currentTarget=a.currentTarget,a.currentTarget=l.currentTarget,t.player.resizeAll()}),t},controls:function(){if(this.options.controls&&"stock"!=this.options.controls){var e=this.UI.buildStructure(this.skin.structure.controls);return MistUtil.isTouchDevice()&&(e.style.zoom=1.5),e}},submenu:function(){return this.UI.buildStructure(this.skin.structure.submenu)},hoverWindow:function(e){var t={type:"container",classes:"classes"in e?e.classes:[],children:"children"in e?e.children:[]};switch(t.classes.push("hover_window_container"),"classes"in e.window||(e.window.classes=[]),e.window.classes.push("inner_window"),e.window.classes.push("mistvideo-container"),e.window={type:"container",classes:["outer_window"],children:[e.window]},"classes"in e.button||(e.button.classes=[]),e.button.classes.push("pointer"),e.mode){case"left":t.classes.push("horizontal"),t.children=[e.window,e.button];break;case"right":t.classes.push("horizontal"),t.children=[e.button,e.window];break;case"top":t.classes.push("vertical"),t.children=[e.button,e.window];break;case"bottom":t.classes.push("vertical"),t.children=[e.window,e.button];break;case"pos":t.children=[e.button,e.window],"classes"in e.window||(e.window.classes=[]);break;default:throw"Unsupported mode for structure type hoverWindow"}return"transition"in e&&("css"in t||(t.css=[]),t.css.push(".hover_window_container:hover > .outer_window:not([data-hidecursor]) > .inner_window { "+e.transition.show+" }\n.hover_window_container > .outer_window { "+e.transition.viewport+" }\n.hover_window_container > .outer_window > .inner_window { "+e.transition.hide+" }")),t.classes.push(e.mode),this.UI.buildStructure(t)},draggable:function(e){var t=this.skin.blueprints.container(e),i=this,r=this.skin.icons.build("fullscreen",16);t.appendChild(r),r.style.alignSelf="flex-end",r.style.position="absolute",r.style.cursor="move";var n={},a=function(e){t.style.left=e.clientX-n.x+"px",t.style.top=e.clientY-n.y+"px"},s=function(e){window.removeEventListener("mousemove",a),window.removeEventListener("click",s),MistUtil.event.addListener(r,"click",o)},o=function(e){e.stopPropagation(),r.removeEventListener("click",o),n.x=i.container.getBoundingClientRect().left-(t.getBoundingClientRect().left-e.clientX),n.y=i.container.getBoundingClientRect().top-(t.getBoundingClientRect().top-e.clientY),t.style.position="absolute",t.style.right="auto",t.style.bottom="auto",i.container.appendChild(t),a(e),MistUtil.event.addListener(window,"mousemove",a,t),MistUtil.event.addListener(window,"click",s,t)};return MistUtil.event.addListener(r,"click",o),t},progress:function(){var e=document.createElement("div"),t=document.createElement("div");e.appendChild(t),t.kids={},t.kids.bar=document.createElement("div"),t.kids.bar.className="bar",t.appendChild(t.kids.bar);var i=this.video,r=this.player.api,n=this;t.updateBar=function(e){if(this.kids.bar){if(!isFinite(r.duration))return void(this.kids.bar.style.display="none");this.kids.bar.style.display="",w=Math.min(1,Math.max(0,this.time2perc(e))),this.kids.bar.style.width=100*w+"%"}},t.time2perc=function(e){if(!isFinite(r.duration))return 0;var t=0;if("live"==n.info.type){var i=.001*n.info.meta.buffer_window;t=(e-r.duration+i)/i}else t=e/r.duration;return Math.min(1,Math.max(0,t))},t.buildBuffer=function(e,t){var i=document.createElement("div");return i.className="buffer",i.style.left=100*this.time2perc(e)+"%",i.style.width=100*(this.time2perc(t)-this.time2perc(e))+"%",i},t.updateBuffers=function(e){for(var t=this.querySelectorAll(".buffer"),i=0;i<t.length;i++)this.removeChild(t[i]);if(e)for(i=0;i<e.length;i++)this.appendChild(this.buildBuffer(e.start(i),e.end(i)))},MistUtil.event.addListener(i,"progress",function(){t.updateBuffers(r.buffered)},t),MistUtil.event.addListener(i,"timeupdate",function(){s||t.updateBar(r.currentTime)},t),MistUtil.event.addListener(i,"seeking",function(){t.updateBar(r.currentTime)},t),t.getPos=function(e){var t=MistUtil.getPos(this,e);return"live"==n.info.type?(t-1)*(.001*n.info.meta.buffer_window)+n.player.api.duration:!!isFinite(r.duration)&&t*r.duration},t.seek=function(e){var t=this.getPos(e);r.currentTime=t},MistUtil.event.addListener(e,"mouseup",function(e){1==e.which&&t.seek(e)});var a=n.UI.buildStructure({type:"tooltip"});a.style.opacity=0,t.appendChild(a),MistUtil.event.addListener(e,"mouseout",function(){s||(a.style.opacity=0)}),t.moveTooltip=function(e){var t=this.getPos(e);if(!1!==t){a.setText(MistUtil.format.time(t)),a.style.opacity=1;var i=MistUtil.getPos(this,e),r={bottom:20};i>.5?(r.right=100*(1-i)+"%",a.triangle.setMode("bottom","right")):(r.left=100*i+"%",a.triangle.setMode("bottom","left")),a.setPos(r)}else a.style.opacity=0},MistUtil.event.addListener(e,"mousemove",function(e){t.moveTooltip(e)});var s=!1;return MistUtil.event.addListener(e,"mousedown",function(i){if(1==i.which){s=!0,t.updateBar(t.getPos(i));var r=MistUtil.event.addListener(document,"mousemove",function(e){t.updateBar(t.getPos(e)),t.moveTooltip(e)},t),n=MistUtil.event.addListener(document,"mouseup",function(i){1==i.which&&(s=!1,MistUtil.event.removeListener(r),MistUtil.event.removeListener(n),a.style.opacity=0,(!i.path||MistUtil.array.indexOf(i.path,e)<0)&&t.seek(i))},t)}}),e},play:function(){var e=this,t=document.createElement("div");t.appendChild(this.skin.icons.build("play")),t.appendChild(this.skin.icons.build("pause")),t.setState=function(e){this.setAttribute("data-state",e)},t.setState("paused");var i=this.video;return MistUtil.event.addListener(i,"playing",function(){t.setState("playing")},t),MistUtil.event.addListener(i,"pause",function(){t.setState("paused")},t),MistUtil.event.addListener(i,"paused",function(){t.setState("paused")},t),MistUtil.event.addListener(i,"ended",function(){t.setState("paused")},t),MistUtil.event.addListener(t,"click",function(){e.player.api.error&&e.player.api.load(),e.player.api.paused?e.player.api.play():e.player.api.pause()}),e.player.api&&MistUtil.event.addListener(e.video,"click",function(){e.player.api.paused?e.player.api.play():MistUtil.isTouchDevice()||e.player.api.pause()},t),t},speaker:function(){var e=!1,t=this.info.meta.tracks;for(var i in t)if("audio"==t[i].type){e=!0;break}if(!e)return!1;var r=this.skin.icons.build("speaker"),n=this,a=this.video;return MistUtil.event.addListener(a,"volumechange",function(){n.player.api.volume&&!n.player.api.muted?MistUtil.class.remove(r,"off"):MistUtil.class.add(r,"off")},r),MistUtil.event.addListener(r,"click",function(e){n.player.api.muted=!n.player.api.muted}),r},volume:function(e){var t=!1,i=this.info.meta.tracks;for(var r in i)if("audio"==i[r].type){t=!0;break}if(!t)return!1;var n=document.createElement("div"),a=this.skin.icons.build("volume","size"in e&&e.size);n.appendChild(a);var s=this;a.mode="mode"in e?e.mode:"vertical","vertical"==a.mode&&(a.style.transform="rotate(90deg)"),a.margin={start:.15,end:.1};var o=this.video;a.set=function(e){100!=(e=100-100*Math.pow(1-e/100,2))&&0!=e&&(e=100*this.addPadding(e/100));for(var t=a.querySelectorAll(".slider"),i=0;i<t.length;i++)t[i].setAttribute("vertical"==a.mode?"height":"width",e+"%")},MistUtil.event.addListener(o,"volumechange",function(){a.set(s.player.api.muted?0:100*s.player.api.volume)},a),"localStorage"in window&&null!=localStorage&&"mistVolume"in localStorage&&(s.player.api.volume=localStorage.mistVolume),a.addPadding=function(e){return e*(1-(this.margin.start+this.margin.end))+this.margin.start},a.removePadding=function(e){var t=(e-this.margin.start)/(1-(this.margin.start+this.margin.end));return t=Math.max(t,0),t=Math.min(t,1)},a.getPos=function(e){return this.addPadding(MistUtil.getPos(this,e))},a.setVolume=function(e){s.player.api.muted=!1;var t=this.removePadding(MistUtil.getPos(this,e));t=1-Math.pow(1-t,.5),s.player.api.volume=t;try{localStorage.mistVolume=s.player.api.volume}catch(e){}},MistUtil.event.addListener(a,"mouseup",function(e){1==e.which&&a.setVolume(e)});var l=s.UI.buildStructure({type:"tooltip"});l.style.opacity=0,l.triangle.setMode("bottom","right"),n.style.position="relative",n.appendChild(l),MistUtil.event.addListener(a,"mouseover",function(){l.style.opacity=1}),MistUtil.event.addListener(a,"mouseout",function(){c||(l.style.opacity=0)}),a.moveTooltip=function(e){l.style.opacity=1;var t=MistUtil.getPos(this,e);l.setText(Math.round(100*this.removePadding(t))+"%"),l.setPos({bottom:46,right:100*(1-t)+"%"})},MistUtil.event.addListener(a,"mousemove",function(e){a.moveTooltip(e)});var c=!1;return MistUtil.event.addListener(a,"mousedown",function(e){if(1==e.which){c=!0,a.setVolume(e),l.style.opacity=1;var t=MistUtil.event.addListener(document,"mousemove",function(e){a.setVolume(e),a.moveTooltip(e)},a),i=MistUtil.event.addListener(document,"mouseup",function(e){1==e.which&&(c=!1,MistUtil.event.removeListener(t),MistUtil.event.removeListener(i),l.style.opacity=0,(!e.path||MistUtil.array.indexOf(e.path,a)<0)&&a.setVolume(e))},a)}}),n},currentTime:function(){var e=this,t=document.createElement("div"),i=document.createTextNode("");t.appendChild(i);e.player.api;var r=MistUtil.format.time;return t.set=function(){var t=e.player.api.currentTime;i.nodeValue=r(t)},t.set(),MistUtil.event.addListener(e.video,"timeupdate",function(){t.set()},t),MistUtil.event.addListener(e.video,"seeking",function(){t.set()},t),t},totalTime:function(){var e=this,t=document.createElement("div"),i=document.createTextNode("");t.appendChild(i);this.player.api;return"live"==e.info.type?(i.nodeValue="live",t.className="live"):(t.set=function(e){!isNaN(e)&&isFinite(e)?(this.style.display="",i.nodeValue=MistUtil.format.time(e)):this.style.display="none"},MistUtil.event.addListener(e.video,"durationchange",function(){var i=e.player.api.duration;t.set(i)},t)),t},playername:function(){if(this.playerName&&this.playerName in mistplayers){var e=document.createElement("span");return e.appendChild(document.createTextNode(mistplayers[this.playerName].name)),e}},mimetype:function(){if(this.source){var e=document.createElement("a");return e.href=this.source.url,e.target="_blank",e.title=e.href+" ("+this.source.type+")",e.appendChild(document.createTextNode(MistUtil.format.mime2human(this.source.type))),e}},logo:function(e){if("element"in e)return e.element;if("src"in e){var t=document.createElement("img");return t.src=e.src,t}},settings:function(){return this.skin.icons.build("settings")},loop:function(){if("loop"in this.player.api&&"live"!=this.info.type){var e=this.skin.icons.build("loop"),t=(this.video,this.player.api);return e.set=function(){t.loop?MistUtil.class.remove(this,"off"):MistUtil.class.add(this,"off")},MistUtil.event.addListener(e,"click",function(e){t.loop=!t.loop,this.set()}),e.set(),e}},fullscreen:function(){if("setSize"in this.player&&this.info.hasVideo&&"audio"!=this.source.type.split("/")[1]){var e=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],t=!1;for(var i in e)if(e[i]in document.body){(t={}).request=e[i];t.cancel=["exitFullscreen","webkitCancelFullScreen","mozCancelFullScreen","msExitFullscreen"][i],t.element=["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"][i],t.event=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"][i];break}if(t){var r=this.skin.icons.build("fullscreen"),n=this;return MistUtil.event.addListener(r,"click",a),MistUtil.event.addListener(n.video,"dblclick",a),MistUtil.event.addListener(document,t.event,function(){document[t.element]==n.container?n.container.setAttribute("data-fullscreen",""):n.container.hasAttribute("data-fullscreen")&&n.container.removeAttribute("data-fullscreen"),n.player.resizeAll()},r),r}}function a(){document[t.element]?document[t.cancel]():n.container[t.request]()}},tracks:function(){if(this.info&&this.video){var e=this,t=document.createElement("table");return i(this.info.meta.tracks),MistUtil.event.addListener(e.video,"metaUpdate_tracks",function(e){i(e.message.meta.tracks)},t),t}function i(i){MistUtil.empty(t),i=MistUtil.tracks.parse(i);var r={},n={};function a(t,i){if(e.log("User selected "+t+" track with id "+i),"setTrack"in e.player.api)e.player.api.setTrack(t,i);else{var n={};for(var a in r)"subtitle"!=a&&(n[a]=r[a].value);n[t]=i,"setTracks"in e.player.api&&e.player.api.setTracks(n),"setSource"in e.player.api&&e.player.api.setSource(MistUtil.http.url.addParam(e.source.url,n))}}var s=MistUtil.object.keys(i,function(e,t){function i(e){switch(e){case"audio":return"aaaaaaa";case"video":return"aaaaaab";default:return e}}return i(e)>i(t)?1:i(e)<i(t)?-1:0});for(var o in s){var l=s[o],c=i[l];if("subtitle"==l){if(!("player"in e&&"api"in e.player&&"setSubtitle"in e.player.api)){e.log("Subtitle selection was disabled as this player does not support it.");continue}var d=!1;for(var u in e.info.source){var p=e.info.source[u];if("html5/text/vtt"==p.type&&MistUtil.http.url.split(p.url).protocol==MistUtil.http.url.split(e.source.url).protocol){d=p.url.replace(/.srt$/,".vtt");break}}if(!d){e.log("Subtitle selection was disabled as an SRT source could not be found.");continue}c[""]={trackid:"",different:{none:"None"}}}var h=document.createElement("tr");if(h.title="The current "+l+" track",t.appendChild(h),"decodingIssues"in e.skin.blueprints){var m=document.createElement("td");if(h.appendChild(m),"subtitle"!=l){var f=document.createElement("input");f.setAttribute("type","checkbox"),f.setAttribute("checked",""),f.setAttribute("title","Whether or not to play "+l),f.trackType=l,m.appendChild(f),n[l]=f,MistUtil.event.addListener(f,"change",function(){var e=0;for(var t in n)n[t].checked&&e++;if(0==e)for(var t in n)if(t!=this.trackType&&!n[t].checked){n[t].checked=!0;break}var i=0;i=this.checked?this.trackType in r?r[this.trackType].value:"auto":0,a(this.trackType,this.checked?i:0)})}}var v=document.createElement("td");h.appendChild(v),v.appendChild(document.createTextNode(MistUtil.format.ucFirst(l)+":"));m=document.createElement("td");h.appendChild(m);var y=MistUtil.object.keys(c);function g(e){var t={width:1,bps:2,fpks:4,channels:5,rate:7,language:0,codec:6};return MistUtil.object.values(e,function(e,i,r,n){return t[e]>t[i]?1:t[e]<t[i]?-1:0})}if(y.length>1&&"player"in e&&"api"in e.player&&("setTrack"in e.player.api||"setTracks"in e.player.api||"setSource"in e.player.api)){var b=document.createElement("select");b.title="Select another "+l+" track",r[l]=b,b.trackType=l,m.appendChild(b);var M=g(c[MistUtil.object.keys(c)[0]].same);if(M.length)(C=document.createElement("span")).className="mistvideo-description",m.appendChild(C),m.appendChild(document.createTextNode(M.join(" ")));var k=MistUtil.object.keys(c,!0);for(var u in k){var w=c[k[u]],U=document.createElement("option");b.appendChild(U),U.value=w.trackid,MistUtil.object.keys(w.different).length?U.appendChild(document.createTextNode(g(w.different).join(" "))):U.appendChild(document.createTextNode("Track "+(Number(u)+1)))}if("subtitle"==l){if(MistUtil.event.addListener(b,"change",function(){try{localStorage.mistSubtitleLanguage=c[this.value].lang}catch(e){}if(""!=this.value){var t=MistUtil.object.extend({},c[this.value]);t.label=g(t.describe).join(" "),t.src=MistUtil.http.url.addParam(d,{track:this.value}),e.player.api.setSubtitle(t)}else e.player.api.setSubtitle()}),"localStorage"in window&&null!=localStorage&&"mistSubtitleLanguage"in localStorage)for(var u in c)if(c[u].lang==localStorage.mistSubtitleLanguage){b.value=u;var x=document.createEvent("Event");x.initEvent("change"),b.dispatchEvent(x);break}}else MistUtil.event.addListener(b,"change",function(){this.trackType in n&&(n[this.trackType].checked=!0),a(this.trackType,this.value)}),"live"==e.info.type?b.value=MistUtil.object.keys(c).pop():b.value=MistUtil.object.keys(c).shift(),MistUtil.event.addListener(e.video,"playerUpdate_trackChanged",function(t){t.message.type==l&&(b.value=t.message.trackid,e.log("Player selected "+l+" track with id "+t.message.trackid))},b)}else{var C;(C=document.createElement("span")).className="mistvideo-description",m.appendChild(C),C.appendChild(document.createTextNode(g(c[y[0]].same).join(" ")))}}}},text:function(e){var t=document.createElement("span");return t.appendChild(document.createTextNode(e.text)),t},placeholder:function(){var e=document.createElement("div"),t=this.calcSize();return e.style.width=t.width+"px",e.style.height=t.height+"px",this.options.poster&&(e.style.background="url('"+this.options.poster+"') no-repeat 50%/contain"),e},timeout:function(e){if(!(!1 in e)){var t="delay"in e?e.delay:5,i=this.skin.icons.build("timeout",!1,{delay:t});return i.timeout=this.timers.start(function(){e.function()},1e3*t),i}},polling:function(){var e=document.createElement("div"),t=this.skin.icons.build("loading");return e.appendChild(t),e},loading:function(){var e=this,t=this.skin.icons.build("loading",50);if("player"in e&&e.player.api){var i=!1;function r(t){e.container.setAttribute("data-loading",t.type),function t(){i||(i=e.timers.start(function(){i=!1,e.monitor.vars&&e.monitor.vars.score>=.999?n():t()},1e3))}()}function n(){e.container.removeAttribute("data-loading"),i&&e.timers.stop(i),i=!1}var a=["waiting","seeking","stalled"];for(var s in a)MistUtil.event.addListener(e.video,a[s],function(t){!this.paused&&"container"in e&&r(t)},t);a=["seeked","playing","canplay","paused"];for(var s in a)MistUtil.event.addListener(e.video,a[s],function(t){"container"in e&&n()},t),MistUtil.event.addListener(e.video,"progress",function(t){"container"in e&&"monitor"in e&&"vars"in e.monitor&&"score"in e.monitor.vars&&e.monitor.vars.score>.99&&n()},t)}return t},error:function(){var e=this,t=document.createElement("div");t.message=function(t,i,r){MistUtil.empty(this);var n=document.createElement("div");if(n.className="message",this.appendChild(n),!r.polling&&!r.passive){var a=document.createElement("h3");n.appendChild(a),a.appendChild(document.createTextNode("The player has encountered a problem"))}var s=document.createElement("p");if(n.appendChild(s),n.update=function(e){MistUtil.empty(s),s.appendChild(document.createTextNode(e))},t){e.info.on_error&&(t=e.info.on_error.replace(/\<error>/,t)),n.update(t);var o=document.createElement("p");if(o.className="details mistvideo-description",n.appendChild(o),i)o.appendChild(document.createTextNode(i));else if("decodingIssues"in e.skin.blueprints){if("player"in e&&"api"in e.player){if(i=[],void 0!==e.player.api.currentTime&&i.push(["Current video time:",MistUtil.format.time(e.player.api.currentTime)]),"video"in e&&"getVideoPlaybackQuality"in e.video){var l=e.video.getVideoPlaybackQuality();"droppedVideoFrames"in l&&"totalVideoFrames"in l&&l.totalVideoFrames&&i.push(["Frames dropped/total:",MistUtil.format.number(l.droppedVideoFrames)+"/"+MistUtil.format.number(l.totalVideoFrames)]),"corruptedVideoFrames"in l&&l.corruptedVideoFrames&&i.push(["Corrupted frames:",MistUtil.format.number(l.corruptedVideoFrames)])}i.push({0:["NETWORK EMPTY:","not yet initialized"],1:["NETWORK IDLE:","resource selected, but not in use"],2:["NETWORK LOADING:","data is being downloaded"],3:["NETWORK NO SOURCE:","could not locate source"]}[e.video.networkState]);if(i.push({0:["HAVE NOTHING:","no information about ready state"],1:["HAVE METADATA:","metadata has been loaded"],2:["HAVE CURRENT DATA:","data for the current playback position is available, but not for the next frame"],3:["HAVE FUTURE DATA:","data for current and next frame is available"],4:["HAVE ENOUGH DATA:","can start playing"]}[e.video.readyState]),!r.passive){var c=document.createElement("table");for(var d in i){var u=document.createElement("tr");for(var p in c.appendChild(u),i[d]){var h=document.createElement("td");u.appendChild(h),h.appendChild(document.createTextNode(i[d][p]))}}o.appendChild(c)}}var m,f=document.createElement("div");f.className="mistvideo-container mistvideo-column",f.style.textAlign="left",f.style.marginBottom="1em",n.appendChild(f),(m=e.UI.buildStructure({type:"forcePlayer"}))&&f.appendChild(m),(m=e.UI.buildStructure({type:"forceType"}))&&f.appendChild(m)}}return n};var i,r=!1,n=!1,a={};if(this.showError=function(s,o){o||(o={softReload:!0,reload:!0,nextCombo:!!e.info,polling:!1,passive:!1});var l=o.type?o.type:s;if(!(l in a)){if(!0===o.reload&&(e.options.reloadDelay&&!isNaN(Number(e.options.reloadDelay))?o.reload=Number(e.options.reloadDelay):o.reload=10),o.passive){if(!0===r)return;if(r)return i.update(s),void(n=(new Date).getTime());t.setAttribute("data-passive","")}else t.removeAttribute("data-passive");r=!o.passive||"passive",n=(new Date).getTime(),this.log(s,"error");var c=t.message(s,!1,o);i=c;var d=document.createElement("div");if(d.className="mistvideo-buttoncontainer",c.appendChild(d),MistUtil.empty(d),o.softReload){var u={type:"button",label:"Reload video",onclick:function(){e.player.api.load()}};isNaN(o.softReload+"")||(u.delay=o.softReload),d.appendChild(e.UI.buildStructure(u))}if(o.reload){u={type:"button",label:"Reload player",onclick:function(){e.reload()}};isNaN(o.reload+"")||(u.delay=o.reload),d.appendChild(e.UI.buildStructure(u))}if(o.nextCombo){u={type:"button",label:"Next source",onclick:function(){e.nextCombo()}};isNaN(o.nextCombo+"")||(u.delay=o.nextCombo),d.appendChild(e.UI.buildStructure(u))}if(o.ignore){u={type:"button",label:"Ignore",onclick:function(){this.clearError(),a[l]=!0}};isNaN(o.ignore+"")||(u.delay=o.ignore),d.appendChild(e.UI.buildStructure(u))}o.polling&&d.appendChild(e.UI.buildStructure({type:"polling"})),MistUtil.class.add(t,"show"),"container"in e&&e.container.removeAttribute("data-loading")}},t.clear=function(i){for(var n=t.querySelectorAll("svg.icon.timeout"),a=0;a<n.length;a++)e.timers.stop(n[a].timeout);MistUtil.empty(t),MistUtil.class.remove(t,"show"),r=!1},this.clearError=t.clear,"video"in e){var s=["timeupdate","playing","canplay"];for(var o in s)MistUtil.event.addListener(e.video,s[o],function(i){if(r){if("timeupdate"==i.type){if(0==e.player.api.currentTime)return;if((new Date).getTime()-n<2e3)return}e.log("Removing error window because of "+i.type+" event"),t.clear()}},t)}return t},tooltip:function(){var e=document.createElement("div"),t=document.createTextNode("");e.appendChild(t),e.setText=function(e){t.nodeValue=e};var i=document.createElement("div");return e.triangle=i,i.className="triangle",e.appendChild(i),i.setMode=function(e,t){e||(e="bottom"),t||(t="left");var i=["bottom","top","right","left"];for(var r in i){this.style[i[r]]="";var n=MistUtil.format.ucFirst(i[r]);this.style["border"+n]="",this.style["border"+n+"Color"]=""}var a={top:"bottom",bottom:"top",left:"right",right:"left"};this.style[e]="-10px",this.style["border"+MistUtil.format.ucFirst(a[e])]="none",this.style["border"+MistUtil.format.ucFirst(e)+"Color"]="transparent",this.style[t]=0,this.style["border"+MistUtil.format.ucFirst(a[t])]="none"},e.setPos=function(e){var t={left:"auto",right:"auto",top:"auto",bottom:"auto"};for(var i in MistUtil.object.extend(t,e),t)isNaN(t[i])||(t[i]+="px"),this.style[i]=t[i]},e},button:function(e){var t=document.createElement("button"),i=this;if(e.onclick&&(MistUtil.event.addListener(t,"click",function(){e.onclick.call(i,arguments)}),e.delay)){var r=this.UI.buildStructure({type:"timeout",delay:e.delay,function:e.onclick});r&&t.appendChild(r)}return t.appendChild(document.createTextNode(e.label)),t}},colors:{fill:"#fff",semiFill:"rgba(255,255,255,0.5)",stroke:"#fff",strokeWidth:1.5,background:"rgba(0,0,0,0.8)",progressBackground:"#333",accent:"#0f0"}},MistSkins.dev={structure:MistUtil.object.extend({},MistSkins.default.structure,!0),blueprints:{timeout:function(){return!1},log:function(){var e=document.createElement("div");e.appendChild(document.createTextNode("Logs"));var t=document.createElement("div");t.className="logs",e.appendChild(t);var i=document.createElement("table");t.appendChild(i);var r=this,n={message:!1},a=!1,s=!0;function o(e,r,o){if(o||(o={}),n.message==r)return a++,n.counter.nodeValue=a,void(2==a&&n.counter.parentElement&&(n.counter.parentElement.style.display=""));a=1;var l=document.createElement("tr");l.className="entry",o.type&&"log"!=o.type&&(MistUtil.class.add(l,"type-"+o.type),r=MistUtil.format.ucFirst(o.type)+": "+r),i.appendChild(l);var c=document.createElement("td");c.className="timestamp",l.appendChild(c);var d=e.toLocaleTimeString().split(" ");d[0]+="."+("00"+e.getMilliseconds()).slice(-3),c.appendChild(document.createTextNode(d[0])),"currentTime"in o&&(c.title="Video playback time: "+MistUtil.format.time(o.currentTime,{ms:!0}));var u=document.createElement("td");l.appendChild(u);var p=document.createElement("span");p.className="message",u.appendChild(p),p.appendChild(document.createTextNode(r));var h=document.createElement("span");h.style.display="none",h.className="counter",u.appendChild(h);var m=document.createTextNode(a);h.appendChild(m),s&&(t.scrollTop=t.scrollHeight),n={message:r,counter:m}}for(var l in MistUtil.event.addListener(t,"scroll",function(){s=t.scrollTop+t.clientHeight>=t.scrollHeight-5}),r.logs)o(r.logs[l].time,r.logs[l].message,r.logs[l].data);return MistUtil.event.addListener(r.options.target,"log",function(e){if(e.message){var t={};r.player&&r.player.api&&"currentTime"in r.player.api&&(t.currentTime=r.player.api.currentTime),o(new Date,e.message,t)}},e),MistUtil.event.addListener(r.options.target,"error",function(e){if(e.message){var t={type:"error"};r.player&&r.player.api&&"currentTime"in r.player.api&&(t.currentTime=r.player.api.currentTime),o(new Date,e.message,t)}},e),e},decodingIssues:function(){if(this.player){var e=this,t=document.createElement("div");if(e.player.api){var i={"Playback score":function(){if("monitor"in e){if("vars"in e.monitor&&"score"in e.monitor.vars&&e.monitor.vars.values.length){var t=e.monitor.vars.values[e.monitor.vars.values.length-1];if("score"in t){Math.min(1,Math.max(0,t.score));return{x:t.clock,y:Math.min(1,Math.max(0,t.score)),options:{y:{min:0,max:1},x:{count:10}},val:Math.round(100*Math.min(1,Math.max(0,e.monitor.vars.score)))+"%"}}}return 0}},"Corrupted frames":function(){if(e.player.api&&"getVideoPlaybackQuality"in e.player.api){var t=e.player.api.getVideoPlaybackQuality();if(t)return t.corruptedVideoFrames?{val:MistUtil.format.number(t.corruptedVideoFrames),x:.001*(new Date).getTime(),y:t.corruptedVideoFrames,options:{x:{count:10}}}:0}},"Dropped frames":function(){if(e.player.api&&"getVideoPlaybackQuality"in e.player.api){var t=e.player.api.getVideoPlaybackQuality();if(t)return t.droppedVideoFrames?MistUtil.format.number(t.droppedVideoFrames):0}},"Total frames":function(){if(e.player.api&&"getVideoPlaybackQuality"in e.player.api){var t=e.player.api.getVideoPlaybackQuality();if(t)return MistUtil.format.number(t.totalVideoFrames)}},"Decoded audio":function(){if(e.player.api)return MistUtil.format.bytes(e.player.api.webkitAudioDecodedByteCount)},"Decoded video":function(){if(e.player.api)return MistUtil.format.bytes(e.player.api.webkitVideoDecodedByteCount)},"Negative acknowledgements":function(){if(e.player.api)return MistUtil.format.number(e.player.api.nackCount)},"Picture losses":function(){return MistUtil.format.number(e.player.api.pliCount)},"Packets lost":function(){return MistUtil.format.number(e.player.api.packetsLost)},"Packets received":function(){return MistUtil.format.number(e.player.api.packetsReceived)},"Bytes received":function(){if(e.player.api)return MistUtil.format.bytes(e.player.api.bytesReceived)}},r=[];for(var n in i)void 0!==i[n]()&&a({name:n,function:i[n]});t.update=function(){for(var i in r)r[i]();e.timers.start(function(){t.update()},1e3)},t.update()}return t}function a(e){var i=document.createElement("label");t.appendChild(i),i.style.display="none";var n=document.createElement("span");i.appendChild(n),n.appendChild(document.createTextNode(e.name+":")),n.className="mistvideo-description";var a=document.createElement("span");i.appendChild(a);var s=document.createTextNode(e.value?e.value:"");a.appendChild(s);var o=document.createElement("span");a.appendChild(o),i.set=function(e){if(0!==e&&(this.style.display=""),"object"==typeof e){if("val"in e&&(s.nodeValue=e.val,a.className="value"),o.children.length)return(t=o.children[0]).addData(e);var t=MistUtil.createGraph({x:[e.x],y:[e.y]},e.options);return o.style.display="",MistUtil.empty(o),o.appendChild(t)}return s.nodeValue=e},t.appendChild(i),r.push(function(){var t=e.function();i.set(t)})}},forcePlayer:function(){var e=document.createElement("label");e.title="Reload MistVideo and use the selected player";var t=this,i=document.createElement("span");e.appendChild(i),i.appendChild(document.createTextNode("Force player: "));var r=document.createElement("select");e.appendChild(r);var n=document.createElement("option");for(var a in r.appendChild(n),n.value="",n.appendChild(document.createTextNode("Automatic")),mistplayers){n=document.createElement("option");r.appendChild(n),n.value=a,n.appendChild(document.createTextNode(mistplayers[a].name))}return this.options.forcePlayer&&(r.value=this.options.forcePlayer),MistUtil.event.addListener(r,"change",function(){t.options.forcePlayer=""!=this.value&&this.value,t.options.forcePlayer!=t.playerName&&t.reload()}),e},forceType:function(){if(this.info){var e=document.createElement("label");e.title="Reload MistVideo and use the selected protocol";var t=this,i=document.createElement("span");e.appendChild(i),i.appendChild(document.createTextNode("Force protocol: "));var r=document.createElement("select");e.appendChild(r);var n=document.createElement("option");r.appendChild(n),n.value="",n.appendChild(document.createTextNode("Automatic"));var a={};for(var s in t.info.source){var o=t.info.source[s];if(!(o.type in a)){a[o.type]=1;n=document.createElement("option");r.appendChild(n),n.value=o.type,n.appendChild(document.createTextNode(MistUtil.format.mime2human(o.type)))}}return this.options.forceType&&(r.value=this.options.forceType),MistUtil.event.addListener(r,"change",function(){t.options.forceType=""!=this.value&&this.value,t.source&&t.options.forceType==t.source.type||t.reload()}),e}},forceSource:function(){var e=document.createElement("label");e.title="Reload MistVideo and use the selected source";var t=this,i=document.createElement("span");e.appendChild(i),i.appendChild(document.createTextNode("Force source: "));var r=document.createElement("select");e.appendChild(r);var n=document.createElement("option");for(var a in r.appendChild(n),n.value="",n.appendChild(document.createTextNode("Automatic")),t.info.source){var s=t.info.source[a];n=document.createElement("option");r.appendChild(n),n.value=a,n.appendChild(document.createTextNode(s.url+" ("+MistUtil.format.mime2human(s.type)+")"))}return this.options.forceSource&&(r.value=this.options.forceSource),MistUtil.event.addListener(r,"change",function(){t.options.forceSource=""!=this.value&&this.value,t.options.forceSource!=t.source.index&&t.reload()}),e}}},MistSkins.dev.css={skin:misthost+"/skins/dev.css"},MistSkins.dev.structure.submenu=MistUtil.object.extend({},MistSkins.default.structure.submenu,!0),MistSkins.dev.structure.submenu.type="draggable",MistSkins.dev.structure.submenu.style.width="25em",MistSkins.dev.structure.submenu.children.unshift({type:"container",style:{flexShrink:1},classes:["mistvideo-column"],children:[{if:function(){return this.playerName&&this.source},then:{type:"container",classes:["mistvideo-description"],style:{display:"block"},children:[{type:"playername",style:{display:"inline"}},{type:"text",text:"is playing",style:{margin:"0 0.2em"}},{type:"mimetype"}]}},{type:"log"},{type:"decodingIssues"},{type:"container",classes:["mistvideo-column","mistvideo-devcontrols"],style:{"font-size":"0.9em"},children:[{type:"text",text:"Player control"},{type:"container",classes:["mistvideo-devbuttons"],style:{"flex-wrap":"wrap"},children:[{if:function(){return!(!this.player||!this.player.api)},then:{type:"button",title:"Reload the video source",label:"video.load();",onclick:function(){this.player.api.load()}}},{type:"button",title:"Build MistVideo again",label:"MistVideo.reload();",onclick:function(){this.reload()}},{type:"button",title:"Switch to the next available player and source combination",label:"MistVideo.nextCombo();",onclick:function(){this.nextCombo()}}]},{type:"forcePlayer"},{type:"forceType"}]}]});var mistplayers={};function MistPlayer(){}function mistPlay(e,t){return new MistVideo(e,t)}function MistVideo(e,t){var i=this;function r(e){if("meta"in e&&"tracks"in e.meta){var t=e.meta.tracks;for(var i in t)if("video"==t[i].type)return!0}return!1}function n(e){if(i.info=e,i.info.updated=new Date,MistUtil.event.send("haveStreamInfo",e,i.options.target),i.log("Stream info was loaded succesfully."),"error"in e){var n=data.error;return"on_error"in e&&(i.log(n),n=data.on_error),void i.showError(n,{reload:!0})}if(i.calcSize=function(e){e||(e={width:!1,height:!1});var r=e.width||!!("width"in t&&t.width)&&t.width,n=e.height||!!("height"in t&&t.height)&&t.height;if("source"in this.info)if(this.info.hasVideo&&"audio"!=this.source.type.split("/")[1]){if(!r||!n){var a=i.info.width/i.info.height;if(r||n)r?n=r/a:r=n*a;else{var s="maxwidth"in t&&t.maxwidth?t.maxwidth:window.innerWidth,o="maxheight"in t&&t.maxheight?t.maxheight:window.innerHeight;r=i.info.width,n=i.info.height;function l(e){r/=e,n/=e}r<426&&l(r/426),n<240&&l(n/240),s&&r>s&&l(r/s),o&&n>o&&l(n/o)}}}else r||(r=480),n||(n=42);else r=640,n=480;return this.size={width:Math.round(r),height:Math.round(n)},this.size},e.hasVideo=r(e),"live"==e.type){var a=0;for(var s in i.info.meta.tracks)a=Math.max(a,i.info.meta.tracks[s].lastms);e.lastms=a}i.choosePlayer()?(i.player=new mistplayers[i.playerName].player,i.player.onreadylist=[],i.player.onready=function(e){this.onreadylist.push(e)},i.player.build(i,function(e){if(i.container.removeAttribute("data-loading"),i.video=e,"api"in i.player){i.monitor={MistVideo:i,delay:1,averagingSteps:20,threshold:function(){return"webrtc"==this.MistVideo.source.type?.97:.75},init:function(){if(!this.vars||!this.vars.active){this.MistVideo.log("Enabling monitor"),this.vars={values:[],score:!1,active:!0};var e=this;!function t(){e.vars&&e.vars.active&&(e.vars.timer=e.MistVideo.timers.start(function(){var i=e.calcScore();!1!==i&&e.check(i)&&e.action(),t()},1e3*e.delay))}()}},destroy:function(){this.vars&&this.vars.active&&(this.MistVideo.log("Disabling monitor"),this.MistVideo.timers.stop(this.vars.timer),delete this.vars)},reset:function(){this.vars&&this.vars.active?(this.MistVideo.log("Resetting monitor"),this.vars.values=[]):this.init()},calcScore:function(){var e=this.vars.values;if(e.push(this.getValue()),e.length<=1)return!1;var t=this.valueToScore(e[0],e[e.length-1]);return e.length>this.averagingSteps&&e.shift(),t=Math.max(t,e[e.length-1].score),this.vars.score=t,t},valueToScore:function(e,t){var i=1;return"player"in this.MistVideo&&"api"in this.MistVideo.player&&"playbackRate"in this.MistVideo.player.api&&(i=this.MistVideo.player.api.playbackRate),(t.video-e.video)/(t.clock-e.clock)/i},getValue:function(){var e={clock:.001*(new Date).getTime(),video:this.MistVideo.player.api.currentTime};return this.vars.values.length&&(e.score=this.valueToScore(this.vars.values[this.vars.values.length-1],e)),e},check:function(e){return!(this.vars.values.length<.5*this.averagingSteps)&&(e<this.threshold()||void 0)},action:function(){var e=this.vars.score;this.MistVideo.showError("Poor playback: "+Math.max(0,Math.round(100*e))+"%",{passive:!0,reload:!0,nextCombo:!0,ignore:!0,type:"poor_playback"})}},"monitor"in i.options&&(i.monitor.default=MistUtil.object.extend({},i.monitor),MistUtil.object.extend(i.monitor,i.options.monitor));var r=["loadstart","play","playing"];for(var n in r)MistUtil.event.addListener(i.video,r[n],function(){i.monitor.init()});r=["loadeddata","pause","abort","emptied","ended"];for(var n in r)MistUtil.event.addListener(i.video,r[n],function(){i.monitor&&i.monitor.destroy()});r=["seeking","seeked","ratechange"];for(var n in r)MistUtil.event.addListener(i.video,r[n],function(){i.monitor&&i.monitor.reset()})}MistUtil.empty(i.options.target),new MistSkin(i),i.container=new MistUI(i),i.options.target.appendChild(i.container),i.container.setAttribute("data-loading",""),i.video.p=i.player;r=["abort","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","loadstart","pause","play","playing","ratechange","seeked","seeking","stalled","volumechange","waiting","metaUpdate_tracks","resizing"];for(var n in r)MistUtil.event.addListener(i.video,r[n],function(e){i.log("Player event fired: "+e.type)});for(var n in MistUtil.event.addListener(i.video,"error",function(e){var t;if("player"in i&&"api"in i.player&&"error"in i.player.api&&i.player.api.error)if("message"in i.player.api.error)t=i.player.api.error.message;else if("code"in i.player.api.error&&i.player.api.error instanceof MediaError){var r={1:"MEDIA_ERR_ABORTED: The fetching of the associated resource was aborted by the user's request.",2:"MEDIA_ERR_NETWORK: Some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available.",3:"MEDIA_ERR_DECODE: Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error.",4:"MEDIA_ERR_SRC_NOT_SUPPORTED: The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable."};t=i.player.api.error.code in r?r[i.player.api.error.code]:"MediaError code "+i.player.api.error.code}else"string"!=typeof(t=i.player.api.error)&&(t=JSON.stringify(t));else t="An error was encountered.";i.showError(t)}),"setSize"in i.player&&(i.player.videocontainer=i.video.parentNode,i.video.currentTarget=i.options.target,MistUtil.class.has(i.options.target,"secondaryVideo")||(i.player.resizeAll=function(){function e(t,i){if(t.video.currentTarget==i)return t.video;if(t.secondary)for(var r=0;r<t.secondary.length;r++){var n=e(t.secondary[r].MistVideo,i);if(n)return n}return!1}if(e(i,i.options.target).p.resize(),"secondary"in i){function t(r){r.MistVideo?"player"in r.MistVideo&&e(i,r.MistVideo.options.target).p.resize():i.timers.start(function(){t(r)},100)}for(var r in i.secondary)t(i.secondary[r])}}),i.player.resize=function(e){if(i.container.hasAttribute("data-fullscreen")){return this.setSize({height:window.innerHeight,width:window.innerWidth}),!0}return size=i.calcSize(e),this.setSize(size),i.container.style.width=size.width+"px",i.container.style.height=size.height+"px",!i.options.fillSpace||e&&e.reiterating?i.video.currentTarget.clientHeight&&i.video.currentTarget.clientHeight<size.height?this.resize({width:!1,height:i.video.currentTarget.clientHeight,reiterating:!0}):i.video.currentTarget.clientWidth&&i.video.currentTarget.clientWidth<size.width?this.resize({width:i.video.currentTarget.clientWidth,height:!1,reiterating:!0}):(i.log("Player size calculated: "+size.width+" x "+size.height+" px"),!0):this.resize({width:window.innerWidth,height:!1,reiterating:!0})},MistUtil.class.has(i.options.target,"secondaryVideo")||(MistUtil.event.addListener(window,"resize",function(){i.destroyed||i.player.resizeAll()},i.video),MistUtil.event.addListener(i.options.target,"resize",function(){i.player.resizeAll()},i.video),i.player.resizeAll())),i.player.api&&"setSource"in i.player.api&&(i.sourceParams={},i.player.api.setSourceParams=function(e,t){MistUtil.object.extend(i.sourceParams,t),i.player.api.setSource(MistUtil.http.url.addParam(e,t))},"setTrack"in i.player.api||(i.player.api.setTracks=function(e){var t=MistUtil.tracks.parse(i.info.meta.tracks);for(var r in e)r in t&&(e[r]in t[r]||0==e[r])||(i.log("Skipping trackselection of "+r+" track "+e[r]+" because it does not exist"),delete e[r]);if(MistUtil.object.keys(e).length){var n;if("html5/application/vnd.apple.mpegurl"==i.source.type){var a=(n=i.source.url.split("/")).pop(),s=[];for(var r in e)switch(r){case"audio":case"video":if(0==e[r])continue;s.push(e[r])}s.length&&n.push(s.join("_")),n.push(a),n=n.join("/"),e={}}else n=i.source.url;var o=i.player.api.currentTime;this.setSourceParams(n,e);var l=function(){this.currentTime=o,this.removeEventListener("loadedmetadata",l)};MistUtil.event.addListener(i.video,"loadedmetadata",l)}}),t.setTracks&&("setTrack"in i.player.api?i.player.onready(function(){for(var e in t.setTracks)i.player.api.setTrack(e,t.setTracks[e])}):"setTracks"in i.player.api&&i.player.onready(function(){i.player.api.setTracks(t.setTracks)}))),i.player.onreadylist)i.player.onreadylist[n]();MistUtil.event.send("initialized",null,t.target),i.log("Initialized"),i.options.callback&&t.callback(i)})):i.options.startCombo?(delete i.options.startCombo,i.unload(),i=mistPlay(i.stream,i.options)):(i.showError("No compatible player/source combo found.",{reload:!0}),MistUtil.event.send("initializeFailed",null,t.target),i.log("Initialization failed"))}if(t||(t={}),"undefined"!=typeof mistoptions&&(t=MistUtil.object.extend(MistUtil.object.extend({},mistoptions),t)),(t=MistUtil.object.extend({host:null,autoplay:!0,controls:!0,loop:!1,poster:null,callback:!1,streaminfo:!1,startCombo:!1,forceType:!1,forcePlayer:!1,forceSource:!1,forcePriority:!1,monitor:!1,reloadDelay:!1,urlappend:!1,setTracks:!1,fillSpace:!1,width:!1,height:!1,maxwidth:!1,maxheight:!1,MistVideoObject:!1},t)).host&&(t.host=MistUtil.http.url.sanitizeHost(t.host)),this.options=t,this.stream=e,this.info=!1,this.logs=[],this.log=function(e,r){r||(r="log"),MistUtil.event.send(r,e,t.target);var n={type:r};if(this.logs.push({time:new Date,message:e,data:n}),"dev"==this.options.skin)try{var a="["+(r||"log")+"] "+(i.destroyed?"[DESTROYED] ":"")+(this.player&&this.player.api?MistUtil.format.time(this.player.api.currentTime,{ms:!0})+" ":"")+e;r&&"log"!=r?console.warn(a):console.log(a)}catch(e){}},this.log("Initializing.."),this.timers={list:{},start:function(e,t){var r=setTimeout(function(){delete i.timers.list[r],e()},t);return this.list[r]=new Date((new Date).getTime()+t),r},stop:function(e){var t;for(var i in"all"==e?t=this.list:(t={})[e]=1,t)clearTimeout(i),delete this.list[i]}},this.errorListeners=[],this.urlappend=function(e){return this.options.urlappend&&(e+=this.options.urlappend),e},new MistSkin(this),this.checkPlayer=function(e,t){e||(e={});var r,n,a=!1;(e=MistUtil.object.extend(MistUtil.object.extend({},this.options),e)).startCombo&&(e.startCombo.started={player:!1,source:!1}),e.forceSource?(r=[i.info.source[e.forceSource]],i.log("Forcing source "+e.forceSource+": "+r[0].type+" @ "+r[0].url)):e.forceType?(r=i.info.source.filter(function(t){return t.type==e.forceType}),i.log("Forcing type "+e.forceType)):r=i.info.source,e.forcePlayer?(n=[e.forcePlayer],i.log("Forcing player "+e.forcePlayer)):n=MistUtil.object.keys(mistplayers),r=[].concat(r);var s={first:"source",source:[function(e){return"origIndex"in e?e.origIndex:(e.origIndex=i.info.source.indexOf(e),e.origIndex)}],player:[{priority:-1}]},o={inner:"player",outer:"source"};if(e.forcePriority){if("source"in e.forcePriority){if(!(e.forcePriority.source instanceof Array))throw"forcePriority.source is not an array.";s.source=e.forcePriority.source.concat(s.source),MistUtil.array.multiSort(r,s.source)}if("player"in e.forcePriority){if(!(e.forcePriority.player instanceof Array))throw"forcePriority.player is not an array.";s.player=e.forcePriority.player.concat(s.player),MistUtil.array.multiSort(n,s.players)}"first"in e.forcePriority&&(sortopions.first=e.forcePriority.first),"player"==s.first&&(o.outer="player",o.inner="source")}var l={player:{list:n,current:!1},source:{list:r,current:!1}};function c(t){return e.startCombo&&!e.startCombo.started[t]?e.startCombo[t]==l[t].current||e.startCombo[t]==l[t].list[l[t].current]?(e.startCombo.started[t]=!0,1):2:0}for(var d in l[o.outer].list)if(l[o.outer].current=d,!(c(o.outer)>=2))for(var u in l[o.inner].list)if(l[o.inner].current=u,!(c(o.inner)>=1)){a=l.source.list[l.source.current];var p=l.player.list[l.player.current],h=mistplayers[p];if(h.isMimeSupported(a.type)&&h.isBrowserSupported(a.type,a,i))return{player:p,source:a,source_index:l.source.current};t||i.log("Checking "+h.name+" with "+a.type+".. Nope.")}return!1},this.choosePlayer=function(){i.log("Checking available players..");var e=this.checkPlayer();if(!e)return!1;var t=mistplayers[e.player],r=e.source;return i.log("Found a working combo: "+t.name+" with "+r.type+" @ "+r.url),i.playerName=e.player,(r=MistUtil.object.extend({},r)).index=e.source_index,r.url=i.urlappend(r.url),i.source=r,MistUtil.event.send("playerChosen","Player/source combination selected",i.options.target),!0},i.calcSize=function(){return{width:640,height:480}},MistUtil.empty(i.options.target),new MistSkin(i),i.container=new MistUI(i,i.skin.structure.placeholder),i.options.target.appendChild(i.container),i.container.setAttribute("data-loading",""),"WebSocket"in window){!function e(){i.log("Opening stream status stream..");var a=i.options.host.replace(/^http/i,"ws"),s=new WebSocket(i.urlappend(a+"/json_"+encodeURIComponent(i.stream)+".js"));i.socket=s,s.die=!1,s.destroy=function(){this.die=!0,this.close()},s.onopen=function(e){this.wasConnected=!0},s.onclose=function(r){if(!this.die){if(this.wasConnected)return i.log("Reopening websocket.."),void e();i.showError("Connection failed: the media server may be offline.",{reload:30}),i.info||(MistUtil.event.send("initializeFailed",null,t.target),i.log("Initialization failed"))}},s.addEventListener("message",function(e){var t=JSON.parse(e.data);if(t||i.showError("Error while parsing stream status stream. Obtained: "+e.data.toString(),{reload:!0}),"error"in t){var a;switch(e=t.error,"on_error"in t&&(i.log(e),e=t.on_error),t.error){case"Stream is offline":i.info=!1;case"Stream is initializing":case"Stream is booting":case"Stream is waiting for data":case"Stream is shutting down":a={polling:!0};break;default:a={reload:!0}}i.showError(e,a)}else{if(!i.info)return void n(t);var s=function e(t,i){if(t==i)return!1;if("object"==typeof t&&void 0!==i){var r={};for(var n in t)if(!(MistUtil.array.indexOf(["lastms","hasVideo"],n)>=0)){var a=e(t[n],i[n]);a&&(r[n]=!0===a?[t[n],i[n]]:a)}for(var n in i)MistUtil.array.indexOf(["lastms","hasVideo"],n)>=0||n in t||(r[n]=[t[n],i[n]]);return!!MistUtil.object.keys(r).length&&r}return!0}(t,i.info);if(s){if("source"in s)return void("error"in i.info&&i.reload());i.info=MistUtil.object.extend(i.info,t),i.info.updated=new Date;var o=!1;for(var l in s)switch(l){case"meta":for(var c in s[l])switch(c){case"tracks":i.info.hasVideo=r(i.info),MistUtil.event.send("metaUpdate_tracks",t,i.video)}break;case"width":case"height":o=!0}o&&i.player.resize()}else i.log("Metachange: no differences detected")}})}()}else{var a=this.urlappend(t.host+"/json_"+encodeURIComponent(this.stream)+".js");this.log("Requesting stream info from "+a),MistUtil.http.get(a,function(e){i.destroyed||n(JSON.parse(e))},function(e){var r="Connection failed (failed to load "+a+")";i.showError(r,{reload:!0}),MistUtil.event.send("initializeFailed",null,t.target),i.log("Initialization failed")})}return this.unload=function(){if(!this.destroyed){for(var e in this.log("Unloading.."),this.destroyed=!0,this.timers.stop("all"),this.errorListeners){var t=this.errorListeners[e];if(t.src in MistUtil.scripts.list){var r=MistUtil.array.indexOf(MistUtil.scripts.list[t.src].subscribers);r>=0&&MistUtil.scripts.list[t.src].subscribers.splice(r,1)}}if("monitor"in i&&"destroy"in i.monitor&&i.monitor.destroy(),this.socket&&this.socket.destroy(),this.player&&this.player.api&&("pause"in this.player.api&&this.player.api.pause(),"setSource"in this.player.api&&this.player.api.setSource(""),"unload"in this.player.api))try{this.player.api.unload()}catch(n){}if(this.UI&&this.UI.elements)for(var e in this.UI.elements){var n=this.UI.elements[e];n.parentNode&&n.parentNode.removeChild(n)}this.video&&MistUtil.empty(this.video),"container"in this&&(MistUtil.empty(this.container),delete this.container),MistUtil.empty(this.options.target),delete this.video}},this.reload=function(){var e="player"in this&&"api"in this.player&&this.player.api.currentTime;if(this.unload(),i=mistPlay(this.stream,this.options),e&&"live"!=this.info.type){var t=function(){i.player&&i.player.api&&(i.player.api.currentTime=e),this.removeEventListener("initialized",t)};MistUtil.event.addListener(this.options.target,"initialized",t)}return i},this.nextCombo=function(){var e=!1;"player"in this&&"api"in this.player&&(e=this.player.api.currentTime);var t={source:this.source.index,player:this.playerName};if(!this.checkPlayer({startCombo:t},!0)){if(!this.checkPlayer({startCombo:!1},!0))return;t=!1}this.unload();var r=this.options;if(r.startCombo=t,i=mistPlay(this.stream,r),e&&isFinite(e)){var n=function(){"player"in i&&"api"in i.player&&(i.player.api.currentTime=e),this.removeEventListener("initialized",n)};MistUtil.event.addListener(r.target,"initialized",n)}},this.onPlayerBuilt=function(){},t.MistVideoObject&&(t.MistVideoObject.reference=this),this} \ No newline at end of file diff --git a/embed/min/skins/default.css b/embed/min/skins/default.css new file mode 100644 index 00000000..6ac59a8f --- /dev/null +++ b/embed/min/skins/default.css @@ -0,0 +1,92 @@ +.mistvideo{display:inline-block;position:relative;color:$stroke;font-family:sans-serif;background-color:#000;justify-content:center;align-items:center} +.mistvideo-controls{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} +.mistvideo.novideo{overflow:visible} +.mistvideo-video{overflow:hidden} +svg.icon.loading{z-index:-1;position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;opacity:0} +[data-loading]{position:relative} +[data-loading=stalled] svg.icon.loading{transition:opacity 0s 3s} +[data-loading] svg.icon.loading{z-index:2;opacity:1} +[data-loading-css] .mistvideo-controls{display:none} +[data-hidecursor],[data-hidecursor] *,[data-hidecursor] .mistvideo-pointer{cursor:none} +.mistvideo-error{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background-color:$background;align-items:center;justify-content:center;text-align:center;z-index:2;cursor:default;min-height:fit-content;min-width:fit-content} +.mistvideo-error.show{display:flex} +.mistvideo-error .message{max-width:80%} +.mistvideo-error .message .details table{text-align:left} +.mistvideo-controls button,.mistvideo-error button,.mistvideo-video:not(.video-js) button{color:$stroke;border:1px solid $semiFill;background-color:$background;margin:.25em;padding:.5em 1em;opacity:.5;cursor:pointer} +button:hover{opacity:1} +select{background-color:transparent;color:$stroke;border:none;margin:0 .5em;font-size:inherit;cursor:pointer;-ms-background-color:red} +select>option{background-color:$background} +.browser-edge select,.browser-safari select{border:1px solid $semiFill;border-top:none;border-left:none;margin-top:2px} +@keyframes spin{ +0%{transform:rotate(0)} +100%{transform:rotate(360deg)} +} +[data-fullscreen]{position:fixed;top:0;left:0;right:0;bottom:0;width:100%!important;height:100%!important} +video{display:block;flex-shrink:0} +table{color:inherit;font-size:inherit;font-style:inherit} +audio:not([controls]){display:block!important} +.mistvideo-padding{padding:5px 10px} +.mistvideo-pointer{cursor:pointer} +.description{color:$semiFill;font-size:.9em} +.mistvideo-container{display:flex;flex-wrap:nowrap} +.mistvideo-container.mistvideo{display:inline-flex;max-width:100%} +.mistvideo-container.mistvideo-row{flex-direction:row} +.mistvideo-container.mistvideo-column{flex-direction:column} +.mistvideo-container.mistvideo-center{justify-content:center} +.mistvideo-align-right{margin-left:auto;margin-right:0} +.hover_window_container.pos>.outer_window{position:absolute;pointer-events:none;overflow:hidden} +.hover_window_container.pos>.outer_window>.inner_window{position:absolute;pointer-events:all} +.hover_window_container:not(:hover)>.outer_window>.inner_window,.hover_window_container>.outer_window[data-hidecursor]>.inner_window{transition:all .5s ease-in .5s} +.outer_window>.inner_window{flex-grow:1} +.hover_window_container>.outer_window>.inner_window>*{flex-shrink:0} +.mistvideo-draggable{overflow:hidden} +.mistvideo-tooltip{position:absolute;background-color:$background;padding:.5em 1em;z-index:2} +:not(:hover)>.mistvideo-tooltip{transition:opacity .25s ease-in} +.mistvideo-tooltip .triangle{border:10px solid $background;position:absolute} +.mistvideo-tracks label{display:block} +.mistvideo-tracks label>span{margin-right:1em} +a{color:$accent} +.mistvideo-log .logs{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text} +.mistvideo-placeholder{max-width:100%;max-height:100%} +.mistvideo-topright{position:absolute;top:0;right:0} +.mistvideo-topleft{position:absolute;top:0;left:0} +.mistvideo-delay-display{animation:appear 1s;animation-iteration-count:1;animation-timing-function:steps(1,end)} +@keyframes appear{ +from{opacity:0} +to{opacity:1} +} +svg.icon{display:block;stroke-width:$strokeWidth;fill:none;stroke:none} +svg.icon .fill,svg.icon.fill{fill:$fill} +svg.icon .semiFill,svg.icon.semiFill{fill:$semiFill} +svg.icon .stroke,svg.icon.stroke{stroke:$stroke;vector-effect:non-scaling-stroke} +svg.icon.off .toggle .fill,svg.icon.off .toggle .semiFill,svg.icon.off .toggle.fill,svg.icon.off .toggle.semiFill{fill:none} +svg.icon .spin,svg.icon.spin{animation:spin 1.5s infinite linear;transform-origin:50% 50%} +.mistvideo{line-height:1.2;font-size:14.5px} +.mistvideo svg{margin:2.5px} +.mistvideo-background{background-color:$background} +.mistvideo-totalTime:before{content:'/';margin:.2em} +.mistvideo-progress{padding:10px 0;margin:-10px 0;z-index:2} +.mistvideo-progress>*{height:2px;background-color:$progressBackground;opacity:.95;position:relative} +.mistvideo-novideo .mistvideo-progress>*,.mistvideo-progress:hover>*{height:10px} +.mistvideo-progress:not(:hover)>*{transition:height .25s ease-in .5s} +.mistvideo-progress .bar{height:inherit;width:0;position:absolute;border-right:inherit;background-color:$accent;z-index:2} +.mistvideo-progress .buffer{height:inherit;width:0;position:absolute;background-color:$semiFill} +.mistvideo-progress .bar:after{content:'';border:5px solid $accent;border-radius:5px;position:absolute;right:-5px;top:50%;transform:translateY(-50%)} +.mistvideo-play[data-state=playing] svg.play{display:none} +.mistvideo-play[data-state=paused] svg.pause{display:none} +.mistvideo-main{align-items:center} +svg.icon.timeout{display:inline-block;height:1em;width:1em;margin:0;margin-right:.25em;vertical-align:top} +.mist.largeplay,.mist.muted{position:absolute;opacity:.5} +.mist.largeplay{top:50%;left:0;right:0;margin:auto;transform:translateY(-50%)} +.mist.muted{top:0;right:0;margin:1em} +.mistvideo-secondaryVideo{z-index:1;width:50%;height:50%} +.mistvideo-polling{display:inline-block;position:relative;width:25px;height:25px} +.mistvideo-polling svg.icon.loading{z-index:0;opacity:1} +.mistvideo[data-show-submenu] .mistvideo-submenu{right:5px} +.mistvideo[data-show-submenu] .mistvideo-controls{bottom:0} +.mistvideo-error[data-passive]{bottom:auto;left:auto;margin:.5em;padding:.5em} +.mistvideo-error[data-passive] .message{max-width:none} +.mistvideo-error .mistvideo-buttoncontainer{display:flex;flex-flow:row nowrap;justify-content:center} +.mistvideo-error .mistvideo-buttoncontainer .mistvideo-button{white-space:nowrap} +.browser-ie .mist.icon.loading{animation:spin 1.5s infinite linear;transform-origin:50% 50%} +.browser-ie .mist.icon.loading .spin{animation:none} \ No newline at end of file diff --git a/embed/min/skins/dev.css b/embed/min/skins/dev.css new file mode 100644 index 00000000..cbd7bb24 --- /dev/null +++ b/embed/min/skins/dev.css @@ -0,0 +1,116 @@ +.mistvideo{display:inline-block;position:relative;color:$stroke;font-family:sans-serif;background-color:#000;justify-content:center;align-items:center} +.mistvideo-controls{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} +.mistvideo.novideo{overflow:visible} +.mistvideo-video{overflow:hidden} +svg.icon.loading{z-index:-1;position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;opacity:0} +[data-loading]{position:relative} +[data-loading=stalled] svg.icon.loading{transition:opacity 0s 3s} +[data-loading] svg.icon.loading{z-index:2;opacity:1} +[data-loading-css] .mistvideo-controls{display:none} +[data-hidecursor],[data-hidecursor] *,[data-hidecursor] .mistvideo-pointer{cursor:none} +.mistvideo-error{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background-color:$background;align-items:center;justify-content:center;text-align:center;z-index:2;cursor:default;min-height:fit-content;min-width:fit-content} +.mistvideo-error.show{display:flex} +.mistvideo-error .message{max-width:80%} +.mistvideo-error .message .details table{text-align:left} +.mistvideo-controls button,.mistvideo-error button,.mistvideo-video:not(.video-js) button{color:$stroke;border:1px solid $semiFill;background-color:$background;margin:.25em;padding:.5em 1em;opacity:.5;cursor:pointer} +button:hover{opacity:1} +select{background-color:transparent;color:$stroke;border:none;margin:0 .5em;font-size:inherit;cursor:pointer;-ms-background-color:red} +select>option{background-color:$background} +.browser-edge select,.browser-safari select{border:1px solid $semiFill;border-top:none;border-left:none;margin-top:2px} +@keyframes spin{ +0%{transform:rotate(0)} +100%{transform:rotate(360deg)} +} +[data-fullscreen]{position:fixed;top:0;left:0;right:0;bottom:0;width:100%!important;height:100%!important} +video{display:block;flex-shrink:0} +table{color:inherit;font-size:inherit;font-style:inherit} +audio:not([controls]){display:block!important} +.mistvideo-padding{padding:5px 10px} +.mistvideo-pointer{cursor:pointer} +.description{color:$semiFill;font-size:.9em} +.mistvideo-container{display:flex;flex-wrap:nowrap} +.mistvideo-container.mistvideo{display:inline-flex;max-width:100%} +.mistvideo-container.mistvideo-row{flex-direction:row} +.mistvideo-container.mistvideo-column{flex-direction:column} +.mistvideo-container.mistvideo-center{justify-content:center} +.mistvideo-align-right{margin-left:auto;margin-right:0} +.hover_window_container.pos>.outer_window{position:absolute;pointer-events:none;overflow:hidden} +.hover_window_container.pos>.outer_window>.inner_window{position:absolute;pointer-events:all} +.hover_window_container:not(:hover)>.outer_window>.inner_window,.hover_window_container>.outer_window[data-hidecursor]>.inner_window{transition:all .5s ease-in .5s} +.outer_window>.inner_window{flex-grow:1} +.hover_window_container>.outer_window>.inner_window>*{flex-shrink:0} +.mistvideo-draggable{overflow:hidden} +.mistvideo-tooltip{position:absolute;background-color:$background;padding:.5em 1em;z-index:2} +:not(:hover)>.mistvideo-tooltip{transition:opacity .25s ease-in} +.mistvideo-tooltip .triangle{border:10px solid $background;position:absolute} +.mistvideo-tracks label{display:block} +.mistvideo-tracks label>span{margin-right:1em} +a{color:$accent} +.mistvideo-log .logs{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text} +.mistvideo-placeholder{max-width:100%;max-height:100%} +.mistvideo-topright{position:absolute;top:0;right:0} +.mistvideo-topleft{position:absolute;top:0;left:0} +.mistvideo-delay-display{animation:appear 1s;animation-iteration-count:1;animation-timing-function:steps(1,end)} +@keyframes appear{ +from{opacity:0} +to{opacity:1} +} +svg.icon{display:block;stroke-width:$strokeWidth;fill:none;stroke:none} +svg.icon .fill,svg.icon.fill{fill:$fill} +svg.icon .semiFill,svg.icon.semiFill{fill:$semiFill} +svg.icon .stroke,svg.icon.stroke{stroke:$stroke;vector-effect:non-scaling-stroke} +svg.icon.off .toggle .fill,svg.icon.off .toggle .semiFill,svg.icon.off .toggle.fill,svg.icon.off .toggle.semiFill{fill:none} +svg.icon .spin,svg.icon.spin{animation:spin 1.5s infinite linear;transform-origin:50% 50%} +.mistvideo{line-height:1.2;font-size:14.5px} +.mistvideo svg{margin:2.5px} +.mistvideo-background{background-color:$background} +.mistvideo-totalTime:before{content:'/';margin:.2em} +.mistvideo-progress{padding:10px 0;margin:-10px 0;z-index:2} +.mistvideo-progress>*{height:2px;background-color:$progressBackground;opacity:.95;position:relative} +.mistvideo-novideo .mistvideo-progress>*,.mistvideo-progress:hover>*{height:10px} +.mistvideo-progress:not(:hover)>*{transition:height .25s ease-in .5s} +.mistvideo-progress .bar{height:inherit;width:0;position:absolute;border-right:inherit;background-color:$accent;z-index:2} +.mistvideo-progress .buffer{height:inherit;width:0;position:absolute;background-color:$semiFill} +.mistvideo-progress .bar:after{content:'';border:5px solid $accent;border-radius:5px;position:absolute;right:-5px;top:50%;transform:translateY(-50%)} +.mistvideo-play[data-state=playing] svg.play{display:none} +.mistvideo-play[data-state=paused] svg.pause{display:none} +.mistvideo-main{align-items:center} +svg.icon.timeout{display:inline-block;height:1em;width:1em;margin:0;margin-right:.25em;vertical-align:top} +.mist.largeplay,.mist.muted{position:absolute;opacity:.5} +.mist.largeplay{top:50%;left:0;right:0;margin:auto;transform:translateY(-50%)} +.mist.muted{top:0;right:0;margin:1em} +.mistvideo-secondaryVideo{z-index:1;width:50%;height:50%} +.mistvideo-polling{display:inline-block;position:relative;width:25px;height:25px} +.mistvideo-polling svg.icon.loading{z-index:0;opacity:1} +.mistvideo[data-show-submenu] .mistvideo-submenu{right:5px} +.mistvideo[data-show-submenu] .mistvideo-controls{bottom:0} +.mistvideo-error[data-passive]{bottom:auto;left:auto;margin:.5em;padding:.5em} +.mistvideo-error[data-passive] .message{max-width:none} +.mistvideo-error .mistvideo-buttoncontainer{display:flex;flex-flow:row nowrap;justify-content:center} +.mistvideo-error .mistvideo-buttoncontainer .mistvideo-button{white-space:nowrap} +.browser-ie .mist.icon.loading{animation:spin 1.5s infinite linear;transform-origin:50% 50%} +.browser-ie .mist.icon.loading .spin{animation:none} +.mistvideo-log{margin:.5em 0} +.mistvideo-log .logs{max-height:10em;min-height:5em;width:100%;padding:.2em 0;padding-right:1em;overflow-y:auto;overflow-x:hidden;font-size:.9em} +.mistvideo-log .logs table td{vertical-align:top;padding:0} +.mistvideo-log .logs .entry .message{margin:0 .2em} +.mistvideo-log .logs .entry.type-error{color:$accent} +.mistvideo-log .logs .counter,.mistvideo-log .logs .timestamp{color:$semiFill} +.mistvideo-log .logs .timestamp:before{content:'['} +.mistvideo-log .logs .timestamp:after{content:']'} +.mistvideo-log .logs .counter:before{content:'('} +.mistvideo-log .logs .counter:after{content:'\00d7)'} +.mistvideo-devbuttons{font-size:.9em} +.mistvideo-devbuttons button{font-size:.8em;margin:.1em;padding:.2em .4em} +.mistvideo-forcePlayer>span,.mistvideo-forceSource>span,.mistvideo-forceType>span{display:inline-block;width:7em} +.mistvideo-forcePlayer>select,.mistvideo-forceSource>select,.mistvideo-forceType>select{width:15em;min-width:auto} +.mistvideo-devcontrols{margin:.5em 0} +.mistvideo-decodingIssues>*{display:flex;width:50%;max-width:20em;flex-flow:row nowrap;align-items:flex-end;justify-content:space-between} +.mistvideo-decodingIssues>*>:last-child{margin-right:.5em} +.mistvideo-decodingIssues{display:flex;flex-flow:row wrap;justify-content:space-between} +.mistvideo-decodingIssues label{position:relative} +.mistvideo-decodingIssues label .value{font-size:.8em} +svg.icon.graph{position:absolute;right:0;top:0;bottom:0;width:6em} +select{border-radius:0} +input[type=checkbox]{margin:0;margin-right:.2em;border:1px solid $semiFill;border-radius:0;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;width:.8em;height:.8em;color:inherit;position:relative;cursor:pointer} +input[type=checkbox]:checked:after{content:"\2713";position:absolute;bottom:-.2em;left:0;font-size:1.2em} \ No newline at end of file diff --git a/embed/min/wrappers/dashjs.js b/embed/min/wrappers/dashjs.js new file mode 100644 index 00000000..f5c0737e --- /dev/null +++ b/embed/min/wrappers/dashjs.js @@ -0,0 +1 @@ +mistplayers.dashjs={name:"Dash.js player",mimes:["dash/video/mp4"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(t){return MistUtil.array.indexOf(this.mimes,t)==-1?false:true},isBrowserSupported:function(t,e,i){if(location.protocol!=MistUtil.http.url.split(e.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}if(location.protocol=="file:"){i.log("This source ("+t+") won't load if the page is run via file://");return false}return"MediaSource"in window},player:function(){this.onreadylist=[]},scriptsrc:function(t){return t+"/dashjs.js"}};var p=mistplayers.dashjs.player;p.prototype=new MistPlayer;p.prototype.build=function(t,e){var i=this;this.onDashLoad=function(){if(t.destroyed){return}t.log("Building DashJS player..");var r=document.createElement("video");if("Proxy"in window){var a={get:{},set:{}};t.player.api=new Proxy(r,{get:function(t,e,i){if(e in a.get){return a.get[e].apply(t,arguments)}var r=t[e];if(typeof r==="function"){return function(){return r.apply(t,arguments)}}return r},set:function(t,e,i){if(e in a.set){return a.set[e].call(t,i)}return t[e]=i}});if(t.info.type=="live"){a.get.duration=function(){var e=0;if(this.buffered.length){e=this.buffered.end(this.buffered.length-1)}var i=((new Date).getTime()-t.player.api.lastProgress.getTime())*.001;return e+i+-1*t.player.api.liveOffset+45};a.set.currentTime=function(e){var i=e-t.player.api.duration;t.log("Seeking to "+MistUtil.format.time(e)+" ("+Math.round(i*-10)/10+"s from live)");t.video.currentTime=e};MistUtil.event.addListener(r,"progress",function(){t.player.api.lastProgress=new Date});t.player.api.lastProgress=new Date;t.player.api.liveOffset=0}}else{i.api=r}if(t.options.autoplay){r.setAttribute("autoplay","")}if(t.options.loop&&t.info.type!="live"){r.setAttribute("loop","")}if(t.options.poster){r.setAttribute("poster",t.options.poster)}if(t.options.controls=="stock"){r.setAttribute("controls","")}var s=dashjs.MediaPlayer().create();s.initialize(r,t.source.url,t.options.autoplay);i.dash=s;var o=["METRIC_ADDED","METRIC_CHANGED","METRICS_CHANGED","FRAGMENT_LOADING_STARTED","FRAGMENT_LOADING_COMPLETED","LOG","PLAYBACK_TIME_UPDATED","PLAYBACK_PROGRESS"];for(var n in dashjs.MediaPlayer.events){if(o.indexOf(n)<0){i.dash.on(dashjs.MediaPlayer.events[n],function(e){t.log("Player event fired: "+e.type)})}}t.player.setSize=function(t){this.api.style.width=t.width+"px";this.api.style.height=t.height+"px"};t.player.api.setSource=function(e){t.player.dash.attachSource(e)};t.player.api.setTrack=function(e,r){var a=MistUtil.tracks.parse(t.info.meta.tracks);if(!(e in a)||!(r in a[e])&&r!=0){t.log("Skipping trackselection of "+e+" track "+r+" because it does not exist");return}var s=i.dash.getBitrateInfoListFor("video").length-1;for(var o in t.info.meta.tracks){var n=t.info.meta.tracks[o];if(n.type==e){if(n.trackid==r){break}s--}}i.dash.setAutoSwitchQualityFor(e,false);i.dash.setFastSwitchEnabled(true);i.dash.setQualityFor(e,s)};i.dash.on("qualityChangeRendered",function(e){var r=i.dash.getBitrateInfoListFor("video").length-1;var a;for(var s in t.info.meta.tracks){var o=t.info.meta.tracks[s];if(o.type==e.mediaType){if(e.newQuality==r){a=o.trackid;break}r--}}MistUtil.event.send("playerUpdate_trackChanged",{type:e.mediaType,trackid:a},t.video)});MistUtil.event.addListener(r,"progress",function(e){if(t.container.getAttribute("data-loading")=="stalled"){t.container.removeAttribute("data-loading")}});i.api.unload=function(){i.dash.reset()};t.log("Built html");e(r)};if("dashjs"in window){this.onDashLoad()}else{var r=MistUtil.scripts.insert(t.urlappend(mistplayers.dashjs.scriptsrc(t.options.host)),{onerror:function(e){var i="Failed to load dashjs.js";if(e.message){i+=": "+e.message}t.showError(i)},onload:i.onDashLoad},t)}}; \ No newline at end of file diff --git a/embed/min/wrappers/flash_strobe.js b/embed/min/wrappers/flash_strobe.js new file mode 100644 index 00000000..78fbc56b --- /dev/null +++ b/embed/min/wrappers/flash_strobe.js @@ -0,0 +1 @@ +mistplayers.flash_strobe={name:"Strobe Flash media playback",mimes:["flash/10","flash/11","flash/7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(t){return this.mimes.indexOf(t)==-1?false:true},isBrowserSupported:function(t,e,i){if(MistUtil.http.url.split(e.url).protocol.slice(0,4)=="http"&&location.protocol!=MistUtil.http.url.split(e.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}var r=0;try{var a=navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;if(a.version){r=a.version.split(".")[0]}else{r=a.description.replace(/([^0-9\.])/g,"").split(".")[0]}}catch(t){}try{r=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/([^0-9\,])/g,"").split(",")[0]}catch(t){}if(!r){return false}var l=t.split("/");return Number(r)>=Number(l[l.length-1])},player:function(){this.onreadylist=[]}};var p=mistplayers.flash_strobe.player;p.prototype=new MistPlayer;p.prototype.build=function(t,e){var i=document.createElement("object");var r=document.createElement("embed");i.appendChild(r);function a(e){var a=t.options;function l(t,e){var i=document.createElement("param");i.setAttribute("name",t);i.setAttribute("value",e);return i}MistUtil.empty(i);i.appendChild(l("movie",t.urlappend(a.host+t.source.player_url)));var s="src="+encodeURIComponent(e)+"&controlBarMode="+(a.controls?"floating":"none")+"&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3"+(a.live?"&streamType=live":"")+(a.autoplay?"&autoPlay=true":"");i.appendChild(l("flashvars",s));i.appendChild(l("allowFullScreen","true"));i.appendChild(l("wmode","direct"));if(a.autoplay){i.appendChild(l("autoPlay","true"))}r.setAttribute("src",t.urlappend(t.source.player_url));r.setAttribute("type","application/x-shockwave-flash");r.setAttribute("allowfullscreen","true");r.setAttribute("flashvars",s)}a(t.source.url);this.api={};this.setSize=function(t){i.setAttribute("width",t.width);i.setAttribute("height",t.height);r.setAttribute("width",t.width);r.setAttribute("height",t.height)};this.setSize(t.calcSize());this.onready(function(){if(t.container){t.container.removeAttribute("data-loading")}});this.api.setSource=function(t){a(t)};t.log("Built html");e(i)}; \ No newline at end of file diff --git a/embed/min/wrappers/html5.js b/embed/min/wrappers/html5.js new file mode 100644 index 00000000..98728494 --- /dev/null +++ b/embed/min/wrappers/html5.js @@ -0,0 +1 @@ +mistplayers.html5={name:"HTML5 video player",mimes:["html5/application/vnd.apple.mpegurl","html5/video/mp4","html5/video/ogg","html5/video/webm","html5/audio/mp3","html5/audio/webm","html5/audio/ogg","html5/audio/wav"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return MistUtil.array.indexOf(this.mimes,e)==-1?false:true},isBrowserSupported:function(e,t,i){if(location.protocol!=MistUtil.http.url.split(t.url).protocol){if(location.protocol=="file:"&&MistUtil.http.url.split(t.url).protocol=="http:"){i.log("This page was loaded over file://, the player might not behave as intended.")}else{i.log("HTTP/HTTPS mismatch for this source");return false}}var r=false;var a=e.split("/");a.shift();try{a=a.join("/");function n(e){var t=document.createElement("video");if(t&&t.canPlayType(e)!=""){r=t.canPlayType(e)}return r}if(a=="video/mp4"){function o(e){function t(t){return("0"+e.init.charCodeAt(t).toString(16)).slice(-2)}switch(e.codec){case"AAC":return"mp4a.40.2";case"MP3":return"mp3";case"AC3":return"ec-3";case"H264":return"avc1."+t(1)+t(2)+t(3);case"HEVC":return"hev1."+t(1)+t(6)+t(7)+t(8)+t(9)+t(10)+t(11)+t(12);default:return e.codec.toLowerCase()}}var s={};for(var l in i.info.meta.tracks){if(i.info.meta.tracks[l].type!="meta"){s[o(i.info.meta.tracks[l])]=1}}s=MistUtil.object.keys(s);if(s.length){if(s.length>t.simul_tracks){var p=0;for(var l in s){var u=n(a+';codecs="'+s[l]+'"');if(u){p++}}return p>=t.simul_tracks}a+=';codecs="'+s.join(",")+'"'}}r=n(a)}catch(e){}return r},player:function(){this.onreadylist=[]},mistControls:true};var p=mistplayers.html5.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){var i=e.source.type.split("/");i.shift();var r=document.createElement("video");r.setAttribute("crossorigin","anonymous");var a=document.createElement("source");a.setAttribute("src",e.source.url);r.source=a;r.appendChild(a);a.type=i.join("/");var n=["autoplay","loop","poster"];for(var o in n){var s=n[o];if(e.options[s]){r.setAttribute(s,e.options[s]===true?"":e.options[s])}}if(e.options.controls=="stock"){r.setAttribute("controls","")}if(e.info.type=="live"){r.loop=false}if("Proxy"in window&&"Reflect"in window){var l={get:{},set:{}};e.player.api=new Proxy(r,{get:function(e,t,i){if(t in l.get){return l.get[t].apply(e,arguments)}var r=e[t];if(typeof r==="function"){return function(){return r.apply(e,arguments)}}return r},set:function(e,t,i){if(t in l.set){return l.set[t].call(e,i)}return e[t]=i}});if(e.source.type=="html5/audio/mp3"){l.set.currentTime=function(){e.log("Seek attempted, but MistServer does not currently support seeking in MP3.");return false}}if(e.info.type=="live"){l.get.duration=function(){var t=0;if(this.buffered.length){t=this.buffered.end(this.buffered.length-1)}var i=((new Date).getTime()-e.player.api.lastProgress.getTime())*.001;return t+i-e.player.api.liveOffset};l.set.currentTime=function(t){var i=t-e.player.api.duration;e.player.api.liveOffset=i;e.log("Seeking to "+MistUtil.format.time(t)+" ("+Math.round(i*-10)/10+"s from live)");e.player.api.setSource(MistUtil.http.url.addParam(e.source.url,{startunix:i}))};MistUtil.event.addListener(r,"progress",function(){e.player.api.lastProgress=new Date});e.player.api.lastProgress=new Date;e.player.api.liveOffset=0;MistUtil.event.addListener(r,"pause",function(){e.player.api.pausedAt=new Date});l.get.play=function(){return function(){if(e.player.api.paused&&e.player.api.pausedAt&&new Date-e.player.api.pausedAt>5e3){r.load();e.log("Reloading source..")}return r.play.apply(r,arguments)}};if(e.source.type=="html5/video/mp4"){l.get.currentTime=function(){return this.currentTime-e.player.api.liveOffset+e.info.lastms*.001}}}else{if(!isFinite(r.duration)){var p=0;for(var o in e.info.meta.tracks){p=Math.max(p,e.info.meta.tracks[o].lastms)}l.get.duration=function(){if(isFinite(this.duration)){return this.duration}return p*.001}}}}else{e.player.api=r}e.player.api.setSource=function(e){if(e!=this.source.src){this.source.src=e;this.load()}};e.player.api.setSubtitle=function(e){var t=r.getElementsByTagName("track");for(var i=t.length-1;i>=0;i--){r.removeChild(t[i])}if(e){var a=document.createElement("track");r.appendChild(a);a.kind="subtitles";a.label=e.label;a.srclang=e.lang;a.src=e.src;a.setAttribute("default","")}};e.player.setSize=function(e){this.api.style.width=e.width+"px";this.api.style.height=e.height+"px"};t(r)}; \ No newline at end of file diff --git a/embed/min/wrappers/videojs.js b/embed/min/wrappers/videojs.js new file mode 100644 index 00000000..6ef64769 --- /dev/null +++ b/embed/min/wrappers/videojs.js @@ -0,0 +1 @@ +mistplayers.videojs={name:"VideoJS player",mimes:["html5/application/vnd.apple.mpegurl"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return this.mimes.indexOf(e)==-1?false:true},isBrowserSupported:function(e,t,i){if(location.protocol!=MistUtil.http.url.split(t.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}if(location.protocol=="file:"&&e=="html5/application/vnd.apple"){i.log("This source ("+e+") won't load if the page is run via file://");return false}return"MediaSource"in window},player:function(){},scriptsrc:function(e){return e+"/videojs.js"}};var p=mistplayers.videojs.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){var i=this;function r(){if(e.destroyed){return}e.log("Building VideoJS player..");var r=document.createElement("video");if(e.source.type!="html5/video/ogg"){r.crossOrigin="anonymous"}var o=e.source.type.split("/");o.shift();var n=document.createElement("source");n.setAttribute("src",e.source.url);i.source=n;r.appendChild(n);n.type=o.join("/");e.log("Adding "+n.type+" source @ "+e.source.url);if(n.type=="application/vnd.apple.mpegurl"){n.type="application/x-mpegURL"}MistUtil.class.add(r,"video-js");var s={};if(e.options.autoplay){s.autoplay=true}if(e.options.loop&&e.info.type!="live"){s.loop=true;r.loop=true}if(e.options.poster){s.poster=e.options.poster}if(e.options.controls=="stock"){r.setAttribute("controls","");if(!document.getElementById("videojs-css")){var l=document.createElement("link");l.rel="stylesheet";l.href=e.options.host+"/skins/videojs.css";l.id="videojs-css";document.head.appendChild(l)}}i.onready(function(){i.videojs=videojs(r,s,function(){e.log("Videojs initialized")});i.api.unload=function(){videojs(r).dispose()}});e.log("Built html");if("Proxy"in window&&"Reflect"in window){var a={get:{},set:{}};e.player.api=new Proxy(r,{get:function(e,t,i){if(t in a.get){return a.get[t].apply(e,arguments)}var r=e[t];if(typeof r==="function"){return function(){return r.apply(e,arguments)}}return r},set:function(e,t,i){if(t in a.set){return a.set[t].call(e,i)}return e[t]=i}});if(e.info.type=="live"){function p(e){var t=0;if(e.buffered.length){t=e.buffered.end(e.buffered.length-1)}return t}var u=90;a.get.duration=function(){return(e.info.lastms+(new Date).getTime()-e.info.updated.getTime())*.001};e.player.api.lastProgress=new Date;e.player.api.liveOffset=0;MistUtil.event.addListener(r,"progress",function(){e.player.api.lastProgress=new Date});a.set.currentTime=function(t){var i=e.player.api.currentTime-t;var r=t-e.player.api.duration;e.log("Seeking to "+MistUtil.format.time(t)+" ("+Math.round(r*-10)/10+"s from live)");e.video.currentTime-=i};a.get.currentTime=function(){return this.currentTime+e.info.lastms*.001-e.player.api.liveOffset-u}}}else{i.api=r}e.player.setSize=function(t){if("videojs"in e.player){e.player.videojs.dimensions(t.width,t.height);r.parentNode.style.width=t.width+"px";r.parentNode.style.height=t.height+"px"}this.api.style.width=t.width+"px";this.api.style.height=t.height+"px"};e.player.api.setSource=function(t){if(!e.player.videojs){return}if(e.player.videojs.src()!=t){e.player.videojs.src({type:e.player.videojs.currentSource().type,src:t})}};e.player.api.setSubtitle=function(e){var t=r.getElementsByTagName("track");for(var i=t.length-1;i>=0;i--){r.removeChild(t[i])}if(e){var o=document.createElement("track");r.appendChild(o);o.kind="subtitles";o.label=e.label;o.srclang=e.lang;o.src=e.src;o.setAttribute("default","")}};t(r)}if("videojs"in window){r()}else{var o=MistUtil.scripts.insert(e.urlappend(mistplayers.videojs.scriptsrc(e.options.host)),{onerror:function(t){var i="Failed to load videojs.js";if(t.message){i+=": "+t.message}e.showError(i)},onload:r},e)}}; \ No newline at end of file diff --git a/embed/min/wrappers/webrtc.js b/embed/min/wrappers/webrtc.js new file mode 100644 index 00000000..63389543 --- /dev/null +++ b/embed/min/wrappers/webrtc.js @@ -0,0 +1 @@ +mistplayers.webrtc={name:"WebRTC player",mimes:["webrtc"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return this.mimes.indexOf(e)==-1?false:true},isBrowserSupported:function(e,t,n){if(!("WebSocket"in window)||!("RTCPeerConnection"in window)){return false}if(location.protocol.replace(/^http/,"ws")!=MistUtil.http.url.split(t.url.replace(/^http/,"ws")).protocol){n.log("HTTP/HTTPS mismatch for this source");return false}return true},player:function(){}};var p=mistplayers.webrtc.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){var n=this;if(typeof WebRTCBrowserEqualizerLoaded=="undefined"||!WebRTCBrowserEqualizerLoaded){var i=document.createElement("script");i.src=e.urlappend(e.options.host+"/webrtc.js");e.log("Retrieving webRTC browser equalizer code from "+i.src);document.head.appendChild(i);i.onerror=function(){e.showError("Failed to load webrtc browser equalizer",{nextCombo:5})};i.onload=function(){n.build(e,t)};return}var r=document.createElement("video");var o=["autoplay","loop","poster"];for(var s in o){var c=o[s];if(e.options[c]){r.setAttribute(c,e.options[c]===true?"":e.options[c])}}if(e.info.type=="live"){r.loop=false}if(e.options.controls=="stock"){r.setAttribute("controls","")}r.setAttribute("crossorigin","anonymous");this.setSize=function(e){r.style.width=e.width+"px";r.style.height=e.height+"px"};MistUtil.event.addListener(r,"loadeddata",v);MistUtil.event.addListener(r,"seeked",v);var a=0;var u=false;this.listeners={on_connected:function(){a=0;u=false;this.webrtc.play()},on_disconnected:function(){e.log("Websocket sent on_disconnect");if(u){e.showError("Connection to media server ended unexpectedly.")}r.pause()},on_answer_sdp:function(t){if(!t.result){e.showError("Failed to open stream.");this.on_disconnected();return}e.log("SDP answer received")},on_time:function(e){var t=a;a=e.current*.001-r.currentTime;if(Math.abs(t-a)>1){v()}var n=e.end==0?Infinity:e.end*.001;if(n!=d){d=n;MistUtil.event.send("durationchange",n,r)}},on_seek:function(){MistUtil.event.send("seeked",a,r);r.play()},on_stop:function(){e.log("Websocket sent on_stop");MistUtil.event.send("ended",null,r);u=true}};function f(){this.peerConn=null;this.localOffer=null;this.isConnected=false;var t=this;this.on_event=function(i){switch(i.type){case"on_connected":{t.isConnected=true;break}case"on_answer_sdp":{t.peerConn.setRemoteDescription({type:"answer",sdp:i.answer_sdp}).then(function(){},function(e){console.error(e)});break}case"on_disconnected":{t.isConnected=false;break}}if(i.type in n.listeners){return n.listeners[i.type].call(n,i)}e.log("Unhandled WebRTC event "+i.type+": "+JSON.stringify(i));return false};this.connect=function(e){t.signaling=new p(t.on_event);t.peerConn=new RTCPeerConnection;t.peerConn.ontrack=function(t){r.srcObject=t.streams[0];if(e){e()}}};this.play=function(){if(!this.isConnected){throw"Not connected, cannot play"}this.peerConn.createOffer({offerToReceiveAudio:true,offerToReceiveVideo:true}).then(function(e){t.localOffer=e;t.peerConn.setLocalDescription(e).then(function(){t.signaling.sendOfferSDP(t.localOffer.sdp)},function(e){console.error(e)})},function(e){throw e})};this.stop=function(){if(!this.isConnected){throw"Not connected, cannot stop."}this.signaling.send({type:"stop"})};this.seek=function(e){if(!this.isConnected){return}this.signaling.send({type:"seek",seek_time:e*1e3})};this.pause=function(){if(!this.isConnected){throw"Not connected, cannot pause."}this.signaling.send({type:"pause"})};this.setTrack=function(e){if(!this.isConnected){throw"Not connected, cannot set track."}e.type="tracks";this.signaling.send(e)};this.getStats=function(e){this.peerConn.getStats().then(function(t){var n={};var i=Array.from(t.entries());for(var r in i){var o=i[r];if(o[1].type=="inbound-rtp"){n[o[0]]=o[1]}}e(n)})};this.connect()}function p(t){this.ws=null;this.ws=new WebSocket(e.source.url.replace(/^http/,"ws"));this.ws.onopen=function(){t({type:"on_connected"})};this.ws.onmessage=function(e){try{var n=JSON.parse(e.data);t(n)}catch(t){console.error("Failed to parse a response from MistServer",t,e.data)}};this.ws.onclose=function(e){switch(e.code){default:{t({type:"on_disconnected"});break}}};this.sendOfferSDP=function(e){this.send({type:"offer_sdp",offer_sdp:e})};this.send=function(e){if(!this.ws){throw"Not initialized, cannot send "+JSON.stringify(e)}this.ws.send(JSON.stringify(e))}}this.webrtc=new f;this.api={};var d;Object.defineProperty(this.api,"duration",{get:function(){return d}});Object.defineProperty(this.api,"currentTime",{get:function(){return a+r.currentTime},set:function(e){a=e-r.currentTime;r.pause();n.webrtc.seek(e);MistUtil.event.send("seeking",e,r)}});function l(e){Object.defineProperty(n.api,e,{get:function(){return r[e]},set:function(t){return r[e]=t}})}var h=["volume","muted","loop","paused",,"error","textTracks","webkitDroppedFrameCount","webkitDecodedFrameCount"];for(var s in h){l(h[s])}function w(e){if(e in r){n.api[e]=function(){return r[e].call(r,arguments)}}}var h=["load","getVideoPlaybackQuality"];for(var s in h){w(h[s])}n.api.play=function(){if(n.api.currentTime){if(!n.webrtc.isConnected||n.webrtc.peerConn.iceConnectionState!="completed"){n.webrtc.connect(function(){n.webrtc.seek(n.api.currentTime)})}else{n.webrtc.seek(n.api.currentTime)}}else{r.play()}};n.api.pause=function(){r.pause();try{n.webrtc.pause()}catch(e){}MistUtil.event.send("paused",null,r)};n.api.setTracks=function(e){n.webrtc.setTrack(e)};function v(){if(!n.api.textTracks[0]){return}var e=n.api.textTracks[0].currentOffset||0;if(Math.abs(a-e)<1){return}var t=[];for(var i=n.api.textTracks[0].cues.length-1;i>=0;i--){var r=n.api.textTracks[0].cues[i];n.api.textTracks[0].removeCue(r);if(!("orig"in r)){r.orig={start:r.startTime,end:r.endTime}}r.startTime=r.orig.start-a;r.endTime=r.orig.end-a;t.push(r)}for(var i in t){n.api.textTracks[0].addCue(t[i])}n.api.textTracks[0].currentOffset=a}n.api.setSubtitle=function(e){var t=r.getElementsByTagName("track");for(var n=t.length-1;n>=0;n--){r.removeChild(t[n])}if(e){var i=document.createElement("track");r.appendChild(i);i.kind="subtitles";i.label=e.label;i.srclang=e.lang;i.src=e.src;i.setAttribute("default","");i.onload=v}};MistUtil.event.addListener(r,"ended",function(){if(n.api.loop){n.webrtc.connect()}});if("decodingIssues"in e.skin.blueprints){var b=["nackCount","pliCount","packetsLost","packetsReceived","bytesReceived"];for(var y in b){n.api[b[y]]=0}var m=function(){e.timers.start(function(){n.webrtc.getStats(function(e){for(var t in e){for(var i in b){if(b[i]in e[t]){n.api[b[i]]=e[t][b[i]]}}break}});m()},1e3)};m()}n.api.unload=function(){try{n.webrtc.stop()}catch(e){}};t(r)}; \ No newline at end of file diff --git a/embed/minimize.sh b/embed/minimize.sh new file mode 100755 index 00000000..ddddacad --- /dev/null +++ b/embed/minimize.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +echo "Minimizing player code.."; + +echo " Minimizing JS.."; + +if [ "min/player.js" -ot "util.js" ] || [ "min/player.js" -ot "skins.js" ] || [ "min/player.js" -ot "controls.js" ] || [ "min/player.js" -ot "player.js" ]; then + echo " Minimizing 'util.js skins.js controls.js player.js' into 'min/player.js'.."; + terser -mc -o min/player.js -- util.js skins.js controls.js player.js +fi +echo " Done."; + +echo " Minimizing wrappers.." + +if [ "min/wrappers/dashjs.js" -ot "wrappers/dashjs.js" ]; then + echo " Minimizing dashjs"; + terser -mn -o min/wrappers/dashjs.js -- wrappers/dashjs.js +fi +if [ "min/wrappers/flash_strobe.js" -ot "wrappers/flash_strobe.js" ]; then + echo " Minimizing flash_strobe"; + terser -mn -o min/wrappers/flash_strobe.js -- wrappers/flash_strobe.js +fi +if [ "min/wrappers/html5.js" -ot "wrappers/html5.js" ]; then + echo " Minimizing html5"; + terser -mn -o min/wrappers/html5.js -- wrappers/html5.js +fi +if [ "min/wrappers/videojs.js" -ot "wrappers/videojs.js" ]; then + echo " Minimizing videojs"; + terser -mn -o min/wrappers/videojs.js -- wrappers/videojs.js +fi +if [ "min/wrappers/webrtc.js" -ot "wrappers/webrtc.js" ]; then + echo " Minimizing webrtc"; + terser -mn -o min/wrappers/webrtc.js -- wrappers/webrtc.js +fi +echo " Done."; + +echo " Minimizing CSS.."; + +if [ "min/skins/default.css" -ot "skins/default.css" ] || [ "min/skins/default.css" -ot "skins/general.css" ]; then + echo " Minimizing default"; + cleancss --format keep-breaks -o min/skins/default.css skins/general.css skins/default.css +fi +if [ "min/skins/dev.css" -ot "skins/default.css" ] || [ "min/skins/dev.css" -ot "skins/general.css" ] || [ "min/skins/dev.css" -ot "skins/dev.css" ]; then + echo " Minimizing dev"; + cleancss --format keep-breaks -o min/skins/dev.css skins/general.css skins/default.css skins/dev.css +fi +echo " Done."; +echo "Done."; diff --git a/embed/mist.css b/embed/mist.css deleted file mode 100644 index dc912f77..00000000 --- a/embed/mist.css +++ /dev/null @@ -1,1633 +0,0 @@ - -.mistvideo { - background: black center none no-repeat; - display: inline-block; - color: white; - font-family: sans-serif; - text-align: center; - position: relative; - text-shadow: 0 0 1px black, 0 0 1px black; - max-width: 100%; - max-height: 100%; - overflow: hidden; -} -.mistvideo[data-loading] { - background-image: none; - position: relative; - min-width: 70px; - min-height: 70px; -} -.mistvideo[data-loading]:before { - content: ''; - display: block; - width: 25px; - height: 25px; - border: 5px solid transparent; - border-radius: 25px; - border-top-color: white; - border-left: 0px; - opacity: 0.8; - animation: spin 1.5s infinite linear; - margin: -15px 0 0 -12.5px; - position: absolute; - top: 50%; - left: 50%; - z-index: 5; -} -.mistvideo .error { - margin: 2em 0.5em; - z-index: 69; - bottom: 40%; -} -.mistvideo .error button { - background: black; - color: rgba(255,255,255,0.8); - border: 1px solid rgba(255,255,255,0.2); - font-family: inherit; - padding: 0.5em; - margin: 5px auto; - display: block; -} -.mistvideo .error button:hover { - color: white; - border-color: white; -} -.mistvideo .vjs-error-display:before { - content: '' !important; -} -.mistplayer { - position: relative; - overflow: hidden; -} -.mistplayer[data-hide] { - cursor: none; -} -.mistplayer .html5_player { - display: block; - margin: 0 auto; -} -.mistplayer .controls { - height: 75px; - background-color: black; - opacity: 0.6; - position: absolute; - left: 0px; - right: 0px; - bottom: -75px; - display: flex; - align-items: center; - text-shadow: none; -} -.mistplayer .controls.smaller { - height: 30px; - bottom: -30px; -} -.mistplayer:hover:not([data-hide]) .controls { - bottom: 0; -} -.mistplayer.audio { - width: 500px; -} -.mistplayer.audio .controls { - position: static; -} -.mistplayer:not(:hover) .controls, -.mistplayer[data-hide] .controls { - transition: bottom 0.5s ease-in 1s; -} -.mistplayer video { - display: block; -} -.mistplayer .controls .row { - display: flex; - flex-flow: row nowrap; - flex-shrink: 1; -} -.mistplayer .controls .column { - display: flex; - flex-flow: column nowrap; - align-items: center; - flex-shrink: 1; -} -.mistplayer .controls .row .button:not(:first-child) { - margin-left: 0; -} -.mistplayer .controls .button { - cursor: pointer; - width: 45px; - margin: 5px; - line-height: 45px; - font-size: 16px; - position: relative; - background: transparent center none no-repeat; - background-size: contain; -} -.mistplayer .controls.smaller .button { - width: 15px; - margin: 0; - line-height: 15px; - font-size: 8px; -} -.mistplayer .controls .button.play { - height: 30px; - width: 30px; - margin-left: 15px; -} -.mistplayer .controls.minimal .button.play, -.mistplayer .controls.minimal .button.fullscreen, -.mistplayer .controls.minimal .button.tracks, -.mistplayer .controls.minimal .button.loop, -.mistplayer .controls.minimal .button.timestamp, -.mistplayer .controls.minimal .button.sound { - display: none; -} -.mistplayer .controls.smaller .button.play { - height: 15px; - margin-left: 5px; -} -.mistplayer .controls .button.play[data-state=playing] { - background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIGlkPSJzdmcyIiBoZWlnaHQ9IjQ1IiB3aWR0aD0iNDUiPjxkZWZzIGlkPSJkZWZzNCIgLz48bWV0YWRhdGEgaWQ9Im1ldGFkYXRhNyI+PHJkZjpSREY+PGNjOldvcmsgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+PGRjOnRpdGxlPjwvZGM6dGl0bGU+PC9jYzpXb3JrPjwvcmRmOlJERj48L21ldGFkYXRhPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsLTEwMDcuMzYyMikiIGlkPSJsYXllcjEiPjxnIHN0eWxlPSJmaWxsOiNmZmYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMuMDMwNDU3NSw0Ny43Mjk3MDUpIiBpZD0iZzM3NzkiPjxwYXRoIGlkPSJwYXRoMzgyMy03IiBkPSJtIDQuNDY5NTQyOSw5OTguMTYzNzcgYSA0LjAwMTE5MTYsNC4wMDExOTE2IDAgMCAwIDMuNzQ5OTk5LDMuOTY4NzMgbCAyLjI4MTI1MDEsMCBhIDQuMDAxMTkxNiw0LjAwMTE5MTYgMCAwIDAgMy45Njg3NSwtMy43NTAwMyBsIDAsLTMyLjI4MTIzIGEgNC4wMDExOTE2LDQuMDAxMTkxNiAwIDAgMCAtMy43NSwtMy45Njg3NSBsIC0yLjI4MTI1MDEsMCBhIDQuMDAxMTkxNiw0LjAwMTE5MTYgMCAwIDAgLTMuOTY4NzQ5LDMuNzUgbCAwLDMyLjI4MTI4IHoiIHN0eWxlPSJmaWxsOiNmZmY7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOm5vbmUiIC8+PHBhdGggaWQ9InBhdGgzODIzLTctNCIgZD0ibSAyNC40Njk1NDIsOTk4LjE2MzggYSA0LjAwMTE5MTYsNC4wMDExOTE2IDAgMCAwIDMuNzUsMy45Njg3IGwgMi4yODEyNSwwIGEgNC4wMDExOTE2LDQuMDAxMTkxNiAwIDAgMCAzLjk2ODc1LC0zLjc1IGwgMCwtMzIuMjgxMjYgYSA0LjAwMTE5MTYsNC4wMDExOTE2IDAgMCAwIC0zLjc1LC0zLjk2ODc1IGwgLTIuMjgxMjUsMCBhIDQuMDAxMTkxNiw0LjAwMTE5MTYgMCAwIDAgLTMuOTY4NzUsMy43NSBsIDAsMzIuMjgxMzEgeiIgc3R5bGU9ImZpbGw6I2ZmZjtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZSIgLz48L2c+PC9nPjwvc3ZnPg=="); -} -.mistplayer .controls .button.play[data-state=paused] { - background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIGlkPSJzdmcyIiBoZWlnaHQ9IjQ1IiB3aWR0aD0iNDUiPjxkZWZzIGlkPSJkZWZzNCIgLz48bWV0YWRhdGEgaWQ9Im1ldGFkYXRhNyI+PHJkZjpSREY+PGNjOldvcmsgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+PGRjOnRpdGxlPjwvZGM6dGl0bGU+PC9jYzpXb3JrPjwvcmRmOlJERj48L21ldGFkYXRhPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsLTEwMDcuMzYyMikiIGlkPSJsYXllcjEiPjxwYXRoIHRyYW5zZm9ybT0ibWF0cml4KDEuMDE0MTgyNywtMC41ODU1Mzg2NywwLjU4NTUzODY3LDEuMDE0MTgyNywtMC40ODQxOTgzMSwxMDIyLjg4OTMpIiBkPSJNIDEwLjMxMjUsLTYuMzQzNzUgQSAyLjk0MTYxODYsMi45NDE2MTg2IDAgMCAwIDcuOTA2MjUsLTQuODc1IGwgLTE0LjEyNSwyNC41IGEgMi45NDE2MTg2LDIuOTQxNjE4NiAwIDAgMCAyLjU2MjUsNC40MDYyNSBsIDI4LjI4MTI1LDAgQSAyLjk0MTYxODYsMi45NDE2MTg2IDAgMCAwIDI3LjE1NjI1LDE5LjYyNSBMIDEzLC00Ljg3NSBhIDIuOTQxNjE4NiwyLjk0MTYxODYgMCAwIDAgLTIuNjg3NSwtMS40Njg3NSB6IiBpZD0icGF0aDM4MDkiIHN0eWxlPSJmaWxsOiNmZmY7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlOm5vbmUiIC8+PC9nPjwvc3ZnPg=="); -} -.mistplayer .controls .progress_container { - flex-grow: 1; - position: relative; - margin: 5px; -} -.mistplayer .controls.smaller .progress_container { - margin: 5px; - min-width: 20px; -} -.mistplayer .controls .button.progress { - height: 15px; - border: 1px solid white; - overflow: hidden; - width: auto; - margin: 0; -} -.mistplayer .controls.smaller .button.progress { - height: 10px; -} -.mistplayer .controls .button.progress .bar { - background-color: white; - position: absolute; - width: 0; - top: 0; - bottom: 0; - left: 0; - min-width: 5px; -} -.mistplayer .controls .button.progress .buffer { - background-color: white; - opacity: 0.5; - position: absolute; - top: 0; - bottom: 0; -} -.mistplayer .controls .progress_container .hint { - position: absolute; - background: white; - border-radius: 5px; - bottom: 22px; - padding: 3px 5px; - color: black; - opacity: 0.6; - display: none; - font-size: 12px; -} -.mistplayer .controls.smaller .progress_container .hint { - bottom: 17px; - font-size: 6px; - border-radius: 3px; -} -.mistplayer .controls .progress_container .hint:after { - content: ''; - display: block; - position: absolute; - left: 0; - border: 5px solid transparent; - border-left-color: white; - bottom: -5px; -} -.mistplayer .controls.smaller .progress_container .hint:after { - border-width: 3px; - bottom: -3px; -} -.mistplayer .controls .button.timestamp { - width: auto; - cursor: default; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.mistplayer .controls .button.sound { - height: 65px; - width: 43px; - position: relative; - background: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIGlkPSJzdmczOTM3IiBoZWlnaHQ9IjY1IiB3aWR0aD0iMzAiPjxkZWZzIGlkPSJkZWZzMzkzOSIgLz48bWV0YWRhdGEgaWQ9Im1ldGFkYXRhMzk0MiI+PHJkZjpSREY+PGNjOldvcmsgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+PGRjOnRpdGxlPjwvZGM6dGl0bGU+PC9jYzpXb3JrPjwvcmRmOlJERj48L21ldGFkYXRhPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsLTk4Ny4zNjIyKSIgaWQ9ImxheWVyMSI+PHBhdGggaWQ9InJlY3Q0Njc0IiBkPSJtIDAsMTA1Mi4zNjIyIDAsLTY1IDUsMCBjIC0wLjE3MjU4OCwwIC0wLjMzNzI1NiwwLjAyOTUgLTAuNSwwLjA2MjUgLTAuNDg5MTExLDAuMSAtMC45NDIzNDUsMC4zMTcyNSAtMS4yODEyNSwwLjY1NjI1IC0wLjIyNjIwNiwwLjIyNjIgLTAuNDA0NzQzLDAuNTEzNSAtMC41MzEyNSwwLjgxMjUgLTAuMTI2NTA3LDAuMjk5MSAtMC4xODc1LDAuNjIzNjUgLTAuMTg3NSwwLjk2ODc1IDAsMCAwLjA3NTk3OCwwLjQ0NzA1IDAuMTg3NSwwLjc4MTI1IGwgMTkuODQzNzUsNTkuNDk5OTUgYyAwLjE0Mjc3NywxLjI0NTEgMS4xODU0MTQsMi4yMTg4IDIuNDY4NzUsMi4yMTg4IGwgLTI1LDAgeiBtIDI1LDAgYyAwLjg3NzU0OSwwIDEuNjQ3NjYzLC0wLjQ0MSAyLjA5Mzc1LC0xLjEyNSAwLjA2MzgxLC0wLjA5OCAwLjEwNjIsLTAuMjA0NiAwLjE1NjI1LC0wLjMxMjUgMC4wMjk2MiwtMC4wNjIgMC4wNjkyNiwtMC4xMjI1IDAuMDkzNzUsLTAuMTg3NSAwLjA0NTAxLC0wLjEyMTIgMC4wNjc0MSwtMC4yNDU5IDAuMDkzNzUsLTAuMzc1IDAuMDA5LC0wLjA0NCAwLjAyNDU3LC0wLjA4IDAuMDMxMjUsLTAuMTI1IDAuMDE4NzgsLTAuMTIzNSAwLjAzMTI1LC0wLjI0NjIgMC4wMzEyNSwtMC4zNzUgbCAwLC02MCBjIDAsLTEuMzg1IC0xLjExNDk5OSwtMi41IC0yLjUsLTIuNSBsIDUsMCAwLDY1IC01LDAgeiIgc3R5bGU9ImNvbG9yOiMwMDAwMDA7ZGlzcGxheTppbmxpbmU7b3ZlcmZsb3c6dmlzaWJsZTt2aXNpYmlsaXR5OnZpc2libGU7ZmlsbDojMDAwMDAwO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lO21hcmtlcjpub25lO2VuYWJsZS1iYWNrZ3JvdW5kOmFjY3VtdWxhdGUiIC8+PHBhdGggaWQ9InBhdGg0Njk3LTYiIGQ9Im0gMjUsMTA1Mi4zNjE3IGMgLTEuMjgzMzM2LDAgLTIuMzI1OTczLC0wLjk3MzcgLTIuNDY4NzUsLTIuMjE4NyBMIDIuNjg3NSw5OTAuNjQyOSBDIDIuNTc1OTc4LDk5MC4zMDg3IDIuNSw5ODkuODYxNyAyLjUsOTg5Ljg2MTcgYyAwLC0wLjM0NTEgMC4wNjA5OTMsLTAuNjY5NyAwLjE4NzUsLTAuOTY4OCAwLjEyNjUwNywtMC4yOTkgMC4zMDUwNDQsLTAuNTg2MyAwLjUzMTI1LC0wLjgxMjUgMC4zMzg5MDUsLTAuMzM5IDAuNzkyMTM5LC0wLjU1NjIgMS4yODEyNSwtMC42NTYyIDAuMTYyNzQ0LC0wLjAzMyAwLjMyNzQxMiwtMC4wNjIgMC41LC0wLjA2MiBsIDIwLDAgYyAxLjM4NTAwMSwwIDIuNSwxLjExNSAyLjUsMi41IGwgMCw2MCBjIDAsMC4xMjg4IC0wLjAxMjQ3LDAuMjUxNSAtMC4wMzEyNSwwLjM3NSAtMC4wMDY3LDAuMDQ1IC0wLjAyMjI1LDAuMDgxIC0wLjAzMTI1LDAuMTI1IC0wLjAyNjM0LDAuMTI5MiAtMC4wNDg3NCwwLjI1MzggLTAuMDkzNzUsMC4zNzUgLTAuMDI0NDksMC4wNjUgLTAuMDY0MTMsMC4xMjUyIC0wLjA5Mzc1LDAuMTg3NSAtMC4wNTAwNSwwLjEwNzkgLTAuMDkyNDQsMC4yMTQ1IC0wLjE1NjI1LDAuMzEyNSAtMC40NDYwODcsMC42ODQgLTEuMjE2MjAxLDEuMTI1IC0yLjA5Mzc1LDEuMTI1IHogbSAwLC0xLjIxODcgYyAwLjQ3NDEwNiwwIDAuODY0NzM0LC0wLjIxMTQgMS4wOTM3NSwtMC41NjI1IC0wLjAyMTEyLDAuMDMyIC0wLjAwNTksLTAuMDEgMC4wNjI1LC0wLjE1NjMgYSAxLjIwNDQ1MiwxLjIwNDQ1MiAwIDAgMSAwLC0wLjAzMSBjIDAuMDIzNSwtMC4wNDkgMC4wNTE5OCwtMC4wNTIgMC4wNjI1LC0wLjA2MiAwLjAwNTUsLTAuMDE2IDAuMDA5NCwtMC4wMzUgMCwtMC4wMzEgMC4wMDE3LC0wLjAxIDAuMDA1NSwtMC4wNjEgMC4wMzEyNSwtMC4xODc1IDAuMDA4LC0wLjAzOSAwLjAyNTU1LC0wLjAzOSAwLjAzMTI1LC0wLjA2MiAwLjAwOTgsLTAuMDY2IDAuMDA1NSwtMC4xMDI3IDAsLTAuMDk0IC0wLjAwMTYsLTAuMDMgMCwtMC4wNjggMCwtMC4wOTQgbCAwLC02MCBjIDAsLTAuNzM4NiAtMC41NDI2MTcsLTEuMjgxMyAtMS4yODEyNSwtMS4yODEzIGwgLTIwLDAgYyAtMC4wMzUzNTMsMCAtMC4xMDUzMjIsMCAtMC4yNSwwLjAzMSAtMC4yOTY4NjMsMC4wNjEgLTAuNTQ2MzQzLDAuMTcxMyAtMC42ODc1LDAuMzEyNSAtMC4wODkzOTQsMC4wODkgLTAuMjA1MjYzLDAuMjU4IC0wLjI4MTI1LDAuNDM3NSAtMC4wNTUzMTUsMC4xMzA4IC0wLjA1ODY2MSwwLjI4MzIgLTAuMDYyNSwwLjQ2ODcgLTIuNTJlLTQsMC4wMTIgMCwwLjAxOSAwLDAuMDMxIDAuMDI3OTgyLDAuMTM1MyAwLjA4MjQ5OSwwLjI3ODkgMC4xMjUsMC40MDYyIGwgMTkuODQzNzUsNTkuNTAwNSBhIDEuMjA0NDUyLDEuMjA0NDUyIDAgMCAxIDAuMDMxMjUsMC4yNSBjIDAuMDc1MjcsMC42NTY0IDAuNjA3MDU0LDEuMTI1IDEuMjgxMjUsMS4xMjUgeiIgc3R5bGU9ImZpbGw6I2ZmZmZmZjtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZSIgLz48L2c+PC9zdmc+") no-repeat; - background-position: center right; - border: 1px solid black; /*helps with white border*/ - flex-shrink: 0; -} -.mistplayer .controls.smaller .button.sound { - height: 19.5px; - width: 14px; - background-size: contain; -} -.mistplayer .controls .button.sound .speaker { - width: 25px; - height: 25px; - margin: 0; - background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIGlkPSJzdmc0NjU5IiBoZWlnaHQ9IjI1IiB3aWR0aD0iMjUiPiA8ZGVmcyBpZD0iZGVmczQ2NjEiIC8+IDxtZXRhZGF0YSBpZD0ibWV0YWRhdGE0NjY0Ij4gPHJkZjpSREY+IDxjYzpXb3JrIHJkZjphYm91dD0iIj4gPGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+IDxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+IDxkYzp0aXRsZT48L2RjOnRpdGxlPiA8L2NjOldvcms+IDwvcmRmOlJERj4gPC9tZXRhZGF0YT4gPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwtMTAyNy4zNjIyKSIgaWQ9ImxheWVyMSI+IDxwYXRoIGlkPSJyZWN0NDEzOSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwxMDI3LjM2MjIpIiBkPSJNIDAgMCBMIDAgMjUgTCAyNSAyNSBMIDI1IDAgTCAwIDAgeiBNIDE2Ljk1NTA3OCAyLjUxNzU3ODEgQyAxNy4zODE1MDcgMi41MzYwMDIzIDE3LjgwNTc0IDIuNjYxMiAxOC4xODc1IDIuODkwNjI1IEwgMTguMTg3NSAyMi4xMDkzNzUgQyAxNy4xNjkyMDYgMjIuNzIyNjc1IDE1Ljg1Mzg2IDIyLjU4NzQ4NyAxNC45ODA0NjkgMjEuNjc5Njg4IEwgMTAuNjgxNjQxIDE3LjIxMDkzOCBMIDguNzgzMjAzMSAxNy4yMTA5MzggQyA3LjY5NzgzMzEgMTcuMjEwOTM4IDYuODEyNSAxNi4yOTA0MDkgNi44MTI1IDE1LjE2MjEwOSBMIDYuODEyNSA5LjgzNTkzNzUgQyA2LjgxMjUgOC43MDc3Mzc1IDcuNjk3ODMzMSA3Ljc4OTA2MjUgOC43ODMyMDMxIDcuNzg5MDYyNSBMIDEwLjY4MTY0MSA3Ljc4OTA2MjUgTCAxNC45ODA0NjkgMy4zMTgzNTk0IEMgMTUuNTI2MDE5IDIuNzUxMjM0NCAxNi4yNDQzNjMgMi40ODY4NzExIDE2Ljk1NTA3OCAyLjUxNzU3ODEgeiAiIHN0eWxlPSJjb2xvcjojMDAwMDAwO2NsaXAtcnVsZTpub256ZXJvO2Rpc3BsYXk6aW5saW5lO292ZXJmbG93OnZpc2libGU7dmlzaWJpbGl0eTp2aXNpYmxlO29wYWNpdHk6MTtpc29sYXRpb246YXV0bzttaXgtYmxlbmQtbW9kZTpub3JtYWw7Y29sb3ItaW50ZXJwb2xhdGlvbjpzUkdCO2NvbG9yLWludGVycG9sYXRpb24tZmlsdGVyczpsaW5lYXJSR0I7c29saWQtY29sb3I6IzAwMDAwMDtzb2xpZC1vcGFjaXR5OjE7ZmlsbDojMDAwMDAwO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpldmVub2RkO3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDowO3N0cm9rZS1saW5lY2FwOmJ1dHQ7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLW9wYWNpdHk6MTtjb2xvci1yZW5kZXJpbmc6YXV0bztpbWFnZS1yZW5kZXJpbmc6YXV0bztzaGFwZS1yZW5kZXJpbmc6YXV0bzt0ZXh0LXJlbmRlcmluZzphdXRvO2VuYWJsZS1iYWNrZ3JvdW5kOmFjY3VtdWxhdGUiIC8+IDxwYXRoIGlkPSJyZWN0NDU3NCIgZD0ibSAxOC4xODc2NzQsMTAzMC4yNTMxIGMgLTEuMDE4MDI2LC0wLjYxMTggLTIuMzMzNzE1LC0wLjQ3OSAtMy4yMDY1OTUsMC40Mjg0IGwgLTQuMjk5MzQ0LDQuNDY5MSAtMS44OTg4NzU3LDAgYyAtMS4wODUzNzA4LDAgLTEuOTcwNTMzMSwwLjkyMDEgLTEuOTcwNTMzMSwyLjA0ODMgbCAwLDUuMzI1OCBjIDAsMS4xMjgzIDAuODg1MTYyMywyLjA0ODQgMS45NzA1MzMxLDIuMDQ4NCBsIDEuODk4ODc1NywwIDQuMjk5MzQ0LDQuNDY5MyBjIDAuODczMzkxLDAuOTA3OCAyLjE4ODMwMSwxLjA0MTUgMy4yMDY1OTUsMC40MjgyIGwgMCwtMTkuMjE3NSB6IiBzdHlsZT0iZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTojZmZmZmZmO3N0cm9rZS13aWR0aDoxLjU7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgLz4gPC9nPjwvc3ZnPg=="); - position: absolute; - top: 30px; - background-color: white; - box-shadow: inset 1px 1px black, inset -1px -1px black; /* helps with white shadow*/ -} -.mistplayer .controls .button.sound .speaker[data-muted] { - background-color: transparent; -} -.mistplayer .controls.smaller .button.sound .speaker { - width: 8px; - height: 8px; - top: 10px; - box-shadow: none; -} -.mistplayer .controls .button.sound .volume { - position: absolute; - bottom: 0.5px; - right: 1px; - width: 23.5px; - background-color: white; - opacity: 0.6; - height: 100%; - z-index: -1; - border-left: 1px solid transparent; /* these help with white showing through */ - border-right: 1px solid transparent; -} -.mistplayer .controls.smaller .button.sound .volume { - width: 6px; -} -.mistplayer .controls .button.loop { - min-height: 45px; - background-color: transparent; - background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iNDUiIGhlaWdodD0iNDUiIGlkPSJzdmczOTM3IiB2ZXJzaW9uPSIxLjEiPiA8ZGVmcyBpZD0iZGVmczM5MzkiIC8+IDxtZXRhZGF0YSBpZD0ibWV0YWRhdGEzOTQyIj4gPHJkZjpSREY+IDxjYzpXb3JrIHJkZjphYm91dD0iIj4gPGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+IDxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+IDxkYzp0aXRsZT48L2RjOnRpdGxlPiA8L2NjOldvcms+IDwvcmRmOlJERj4gPC9tZXRhZGF0YT4gPHBhdGggaWQ9InJlY3Q0NTExIiBkPSJNIDAgMCBMIDAgNDUgTCA0NSA0NSBMIDQ1IDAgTCAwIDAgeiBNIDIyLjUgMTEuMjUgQSAxMS4yNSAxMS4yNSAwIDAgMSAzMy43NSAyMi41IEEgMTEuMjUgMTEuMjUgMCAwIDEgMjIuNSAzMy43NSBBIDExLjI1IDExLjI1IDAgMCAxIDE0LjU1MDc4MSAzMC40NDkyMTkgTCAxMi43MTQ4NDQgMzIuMjg1MTU2IEwgMTIuNzE0ODQ0IDI1Ljc4NTE1NiBMIDE5LjIxNDg0NCAyNS43ODUxNTYgTCAxNy4zNzY5NTMgMjcuNjIzMDQ3IEEgNy4yNSA3LjI1IDAgMCAwIDIyLjUgMjkuNzUgQSA3LjI1IDcuMjUgMCAwIDAgMjkuNzUgMjIuNSBBIDcuMjUgNy4yNSAwIDAgMCAyMi41IDE1LjI1IEEgNy4yNSA3LjI1IDAgMCAwIDE3LjM3Njk1MyAxNy4zNzY5NTMgTCAxNC41NTA3ODEgMTQuNTUwNzgxIEEgMTEuMjUgMTEuMjUgMCAwIDEgMjIuNSAxMS4yNSB6ICIgc3R5bGU9Im9wYWNpdHk6MTtmaWxsOiMwMDAwMDA7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlOm5vbmU7c3Ryb2tlLXdpZHRoOjEuNTtzdHJva2UtbWl0ZXJsaW1pdDo0O3N0cm9rZS1kYXNoYXJyYXk6bm9uZTtzdHJva2UtZGFzaG9mZnNldDowO3N0cm9rZS1vcGFjaXR5OjEiIC8+IDxwYXRoIGlkPSJwYXRoNDQ5NSIgZD0iTSAyMi41IDExLjI1IEEgMTEuMjUgMTEuMjUgMCAwIDAgMTQuNTUwNzgxIDE0LjU1MDc4MSBMIDE3LjM3Njk1MyAxNy4zNzY5NTMgQSA3LjI1IDcuMjUgMCAwIDEgMjIuNSAxNS4yNSBBIDcuMjUgNy4yNSAwIDAgMSAyOS43NSAyMi41IEEgNy4yNSA3LjI1IDAgMCAxIDIyLjUgMjkuNzUgQSA3LjI1IDcuMjUgMCAwIDEgMTcuMzc2OTUzIDI3LjYyMzA0NyBMIDE5LjIxNDg0NCAyNS43ODUxNTYgTCAxMi43MTQ4NDQgMjUuNzg1MTU2IEwgMTIuNzE0ODQ0IDMyLjI4NTE1NiBMIDE0LjU1MDc4MSAzMC40NDkyMTkgQSAxMS4yNSAxMS4yNSAwIDAgMCAyMi41IDMzLjc1IEEgMTEuMjUgMTEuMjUgMCAwIDAgMzMuNzUgMjIuNSBBIDExLjI1IDExLjI1IDAgMCAwIDIyLjUgMTEuMjUgeiAiIHN0eWxlPSJvcGFjaXR5OjE7ZmlsbDpub25lO2ZpbGwtb3BhY2l0eTowLjg1ODQ0NzU7ZmlsbC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlOiNmZmZmZmY7c3Ryb2tlLXdpZHRoOjEuNTtzdHJva2UtbWl0ZXJsaW1pdDo0O3N0cm9rZS1kYXNoYXJyYXk6bm9uZTtzdHJva2UtZGFzaG9mZnNldDowO3N0cm9rZS1vcGFjaXR5OjEiIC8+PC9zdmc+"); - box-shadow: inset 1px 1px black, inset -1px -1px black; /* helps with white shadow*/ -} -.mistplayer .controls.smaller .button.loop { - min-height: 15px; -} -.mistplayer .controls .button.loop[data-on] { - background-color: rgba(255,255,255,0.6); -} -.mistplayer .controls .button.fullscreen { - background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIGlkPSJzdmczOTM3IiBoZWlnaHQ9IjQ1IiB3aWR0aD0iNDUiPjxkZWZzIGlkPSJkZWZzMzkzOSIgLz48bWV0YWRhdGEgaWQ9Im1ldGFkYXRhMzk0MiI+PHJkZjpSREY+PGNjOldvcmsgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+PGRjOnRpdGxlPjwvZGM6dGl0bGU+PC9jYzpXb3JrPjwvcmRmOlJERj48L21ldGFkYXRhPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsLTEwMDcuMzYyMikiIGlkPSJsYXllcjEiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsLTEuMTA5Mzc1KSIgaWQ9Imc0NTYzIj48ZyBpZD0iZzQ1NTgiPjxwYXRoIGlkPSJyZWN0Mzk0NSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwxMDA3LjM2MjIpIiBkPSJNIDUuMTU2MjUsMTAgQyAzLjY5MTM0NjEsMTAgMi41LDExLjE5MTM0NiAyLjUsMTIuNjU2MjUgbCAwLDE5LjY4NzUgQyAyLjUsMzMuODA4NjU0IDMuNjkxMzQ2MSwzNSA1LjE1NjI1LDM1IGwgMzQuNjg3NSwwIEMgNDEuMzA4NjU0LDM1IDQyLjUsMzMuODA4NjU0IDQyLjUsMzIuMzQzNzUgbCAwLC0xOS42ODc1IEMgNDIuNSwxMS4xOTEzNDYgNDEuMzA4NjU0LDEwIDM5Ljg0Mzc1LDEwIEwgNS4xNTYyNSwxMCB6IE0gNSwxMi41MzEyNSBsIDM1LDAgMCwyMCAtMzUsMCAwLC0yMCB6IiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPjxyZWN0IHJ5PSIwIiB5PSIxMDE5Ljg2MjIiIHg9IjUiIGhlaWdodD0iMjAiIHdpZHRoPSIzNSIgaWQ9InJlY3QzOTQ3IiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtb3BhY2l0eTowLjM5MjE1Njg2O3N0cm9rZTpub25lIiAvPjxwYXRoIGlkPSJwYXRoMzk0OSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwxMDA3LjM2MjIpIiBkPSJtIDE4Ljc4MTI1LDM1LjQwNjI1IGMgLTEuNTM2NjEsMC4zNzk4MDkgLTIuOTcxNDY1LDAuOTkxNTU3IC00LjI4MTI1LDEuODEyNSBsIDE1LjY1NjI1LDAgYyAtMS4zMTMwMDUsLTAuODIyOTYxIC0yLjc2MjgyNSwtMS40MzI5NTMgLTQuMzEyNSwtMS44MTI1IGwgLTcuMDYyNSwwIHoiIHN0eWxlPSJmaWxsOiNmZmY7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOm5vbmUiIC8+PC9nPjxnIGlkPSJnNDAwNyIgdHJhbnNmb3JtPSJtYXRyaXgoMi4wMzUzOTg1LDAsMCwxLjE2MzA4MjgsLTk5LjMyMTczNCwtMTQxLjU0NTgxKSIgc3R5bGU9ImZpbGw6IzAwMCI+PHBhdGggaWQ9InJlY3QzOTU4IiBkPSJtIDY1LjUzMzY0NiwxMDAxLjQ3NTggLTIuMDMyOTMyLDAgMC42NjI5MTMsMC42NjI5IC0yLjI1MzkwMywyLjI1MzkgMC43MDcxMDcsMC43MDcxIDIuMjUzOTAzLC0yLjI1MzkgMC42NjI5MTIsMC42NjI5IDAsLTIuMDMyOSB6IiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPjxwYXRoIGlkPSJyZWN0Mzk1OC01IiBkPSJtIDY1LjUzMzY0NiwxMDEyLjg0IDAsLTIuMDMzIC0wLjY2MjgzNiwwLjY2MjkgLTIuMjUzOTAxLC0yLjI1MzkgLTAuNzA3MTA0LDAuNzA3MSAyLjI1MzkwMiwyLjI1MzkgLTAuNjYyOTA2LDAuNjYyOSAyLjAzMjg0NSwxZS00IHoiIHN0eWxlPSJmaWxsOiNmZmY7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOm5vbmUiIC8+PHBhdGggaWQ9InJlY3QzOTU4LTUxIiBkPSJtIDU0LjE2OTQzLDEwMDEuNDc1OCAyLjAzMjkzMiwwIC0wLjY2MjkxMywwLjY2MjkgMi4yNTM5MDMsMi4yNTM5IC0wLjcwNzEwNywwLjcwNzEgLTIuMjUzOTAzLC0yLjI1MzkgLTAuNjYyOTEyLDAuNjYyOSAwLC0yLjAzMjkgeiIgc3R5bGU9ImZpbGw6I2ZmZjtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZSIgLz48cGF0aCBpZD0icmVjdDM5NTgtNS03IiBkPSJtIDU0LjE2OTQzLDEwMTIuODQgMCwtMi4wMzMgMC42NjI4MzYsMC42NjI5IDIuMjUzOTAxLC0yLjI1MzkgMC43MDcxMDQsMC43MDcxIC0yLjI1MzkwMiwyLjI1MzkgMC42NjI5MDYsMC42NjI5IC0yLjAzMjg0NSwxZS00IHoiIHN0eWxlPSJmaWxsOiNmZmY7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOm5vbmUiIC8+PC9nPjwvZz48L2c+PC9zdmc+"); - height: 45px; -} -.mistplayer .controls.smaller .button.fullscreen { - height: 15px; -} -.mistplayer .controls .button.tracks { - line-height: 25px; - width: 100%; - margin: 0; - height: 25px; - box-sizing: border-box; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.mistplayer .controls.smaller .button.tracks { - height: 10px; - line-height: 10px; -} -.mistplayer .controls .tracks .settings { - position: absolute; - background-color: black; - padding: 5px 10px; - right: -1000px; - bottom: 23px; -} -.mistplayer .controls.smaller .tracks .settings { - padding: 2px 3px; - bottom: 12.5px; -} -.mistplayer .controls .tracks:hover .settings { - right: 0; -} -.mistplayer .controls .tracks:not(:hover) .settings { - transition: right 0.5s ease-in 1s; -} -.mistplayer .controls .tracks .settings label { - text-align: left; - display: flex; - flex-flow: row nowrap; -} -.mistplayer .controls .tracks .settings label > *:not(:first-child) { - margin-left: 1em; - flex-grow: 1; -} -.mistplayer .controls .tracks .settings label span { - text-transform: capitalize; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.mistplayer .controls .tracks .settings label select { - background: none; - color: white; - border: none; - outline: none; - font-size: inherit; -} -.mistplayer .controls .tracks .settings label option { - color: black; - background-color: white; - font-size: inherit; -} - -@keyframes spin { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} - -.countdown { - height: 1em; - width: 1em; - display: inline-block; - vertical-align: bottom; - border-radius: 50%; - background-image: linear-gradient(to right,#bbb 50%,#333 0); - margin: 0 0.2em; - opacity: 0; - animation: appear 20s step-start 1; -} -.countdown:before { - content: ''; - display: block; - margin-left: 50%; - height: 100%; - border-radius: 0 100% 100% 0 / 50%; - background-color: #bbb; - transform-origin: 0 50%; - animation: rotate 10s linear 2, bg 20s step-end 1; -} -.countdown[data-delay=60] { - animation-duration: 60s; -} -.countdown[data-delay=60]:before { - animation-duration: 30s, 60s; -} -@keyframes rotate { - to { transform: rotate(.5turn); } -} -@keyframes bg { - 50% { background: #333; } -} -@keyframes appear { - to { opacity: 1; } -} - -.video-js .vjs-big-play-button:before, .video-js .vjs-control:before, .video-js .vjs-modal-dialog, .vjs-modal-dialog .vjs-modal-dialog-content { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; } - -.video-js .vjs-big-play-button:before, .video-js .vjs-control:before { - text-align: center; } - -@font-face { - font-family: VideoJS; - src: url("../font/1.5.1/VideoJS.eot?#iefix") format("eot"); } - -@font-face { - font-family: VideoJS; - src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAA4wAAoAAAAAFfAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAAA9AAAAD4AAABWUZFeBGNtYXAAAAE0AAAAOgAAAUriLxC2Z2x5ZgAAAXAAAAnnAAAO5OV/F/5oZWFkAAALWAAAACsAAAA2C4eUa2hoZWEAAAuEAAAAGAAAACQOogcfaG10eAAAC5wAAAAPAAAAeNIAAABsb2NhAAALrAAAAD4AAAA+MMgtQm1heHAAAAvsAAAAHwAAACABLwB5bmFtZQAADAwAAAElAAACCtXH9aBwb3N0AAANNAAAAPkAAAF5vawAenicY2BkZ2CcwMDKwMFSyPKMgYHhF4RmjmEIZzzHwMDEwMrMgBUEpLmmMDh8ZPwoyw7iLmSHCDOCCADu/Qo9AAB4nGNgYGBmgGAZBkYGEHAB8hjBfBYGDSDNBqQZGZgYGD7K/v8PUvCREUTzM0DVAwEjG8OIBwCOWgbUAAB4nI1XfVBU1xV/574vlsUlj/14grDs48FuAgaR3X2LEnY3UZSgEkTwAySAgkIwI8bRfFDjTszYCWRMW9lNa4y2meokmq+2k5ia0dpkmknbkWgSSW3GyaaNf0RTx0wxX7A3Pe/tQmIgHXf3vXvvueeee+45v3POXQYY/PCD/CBDGAYkIE2sxg+OXSJmhmH1OaFX6MU5C5PDMCZi5Rg2i+ELGSthwM14NCbgYGSBIZfhFA1H6Zu0OS0NDkMVfg+npdFm+maCvigI0JBIQIMg0BdJGdTj9ylj7nr+b97+Hl8C1+H2xNAvjPqxjIgaKtItICkSnIISeo40QQls4xxjlzgHsnGGvi7BxQiMlSlkPMhfCh67rAUEUQ6CHxW2O7JARCkKnlUQ7UEIyAEQZe4MdDW9xr5OPFuKbubpRxcPDY8da4MOelDfAYJLW+sGKn/Vlmjfv5+NdB4oOfTazJn3tGxZtL9xFNZX7PPRUbjcRg/SMB2EL+gblXn7shbO/WUbF9u/H5XQ9eKO8iMMr9tY35qYoRi20wGuXV/CHaGDk2fdgHwCk5HUXQpCcgHfBV2NjV3jkq4PHTSUSBwuOQALvxPAps6fiftk6P6yJpcm5bB4dFkgoh195mbiSTnkL3jupq7jh4ZZdvjQRVB4PPx3SsVTu5D/6kd85RU66ttXAeuuXYN1E/Y2sMMzZkZiZNRZlRS/ynr9Xr8Cql2RVNbutXslYo7B9ngsFqcDbCQO22PxeIxcpgMxkh6PjUdwkvw6hvRpZeoCFKshDQzJVr++DWyLx+hAXJcGp3TJMV1ME45xCNvHLsWRrpOZSduOoG0zERuIIwuIkhNkBREglQKLiODD45FQE0BTiE214xE2wp8zOt9NjH3GRtDMk7Ehoq2tzCzGxdyMEQJuD0qGIrQ58ApoWQE3D2h1h6zwuB14wYFIDAA5CZ11jT+92gFZ7B7/p7+hV8jFxBl4aG03wLiVXtBbCylLfIJzkPUAvWAw0yvsVdKdBbC6nnruP/RFkHqWJLZ2Auxdtgy+6qTf7l1WswTJcJ6mGVxwXj92UtfU2WXUNX+qBUCxK6D4FR4f/cufG1sZbiSkMcwdMdoxBxTTEXIp4SCXMNhHoFjvTTFP4vkoPReNRmPRCTwa+3qY0DR7qn7Vjh612wRRTaI04HWCnZ+gIzvS/ZJP0+mynphCui4hzmG0id6+aLSv2BV3FQMYDTHrlGQ/SZ+q4ZdF8aLa5Ar8GW3tVNKEj13cF0buMaesx1i9CL/Uo1tM0h+74o9HjQ+UcPaxy8mH9ccwK8KpKA3rHdIUjTKpfIBxuokpxUGBIILm84ATvHh8tAIe2iZj8KvYwUOXawHMVNgxZvlwSa0z8Zkokkxn3ey2nYTsbMO3mPh8cji7zklsPLD9a9f2s2w/uSt/FgSytWzw5bmS3PielU1P56aGrlz6NzlnbT8h/Wtb+1OxIqxBbC9g7kINUbtAEDxsKWSCe46eltCPmaiUxy2IrODIB8EmixaQrU4IAQ6THg6BFpAdWsCquT16DkL9ccIC/FGeP5AuiDExe8bx+QtzWVsmHcm0kdzqecdn5IhRkTc/zfNPm3ns5sw4Pq86l9gyofh6jkTF5iFChjYbbzZQWFvYb8qZAWyGiV9ya+5bFgnzpuWt3FuX8KYMmsiYZepPseBgGhZcOMt0+4Q8fDOTftJjHIuhdaLsFXFM9AclTi9jbGRq8ZvIOykZei77kfo53eoppVPovbGiyV63p/p/dkWETTjmhjTIm8RP284b04bcNYlRsvO6Gp2JeaiIueVHsgJGF2aASlCQLuG8EsBomzb++/AXmwhaOoLhL7iQ4/uc449gWJ56/XWDARn74v/PL1bRBB4TBEyYrqezSkUPHaWjPWCm13ogAzJ66LVpbTEuXccDZlyXxBQ/IrzKOPS7gAkkIyZ0N6joE6M246aDsO1kgucTJ/EdFWA5pbAcTfoSP4hJeBCni7nEn5IclL4kpDgmMMuH8Kpk0+WrBUIeKCyWS0nPVz7NW86Hnl55GxR5KB3+9tszL+wVRulXNTUn6D8SJvIl3PzP46eZST/tQTllTDXTzmxCaTYna7eJAqcWuD1ulBXQsMz5fQEBCfowCF5FVDF/2yysB9OW5veVEtRAFOy41FoeJEiAOZhDiFstsKAwJ8Hijs72q1jWvWx+uKU5XFZDLx189OK8ojW1u0By5dtLHUN/rwkte68PnhnYVbt0bvWiub9w1+f4C0L3hIuXZ8+xlVSt0eb3tgQsmVZnem5R3U0uf/fmFdqiLTvY3nPnet5/v4f9pLB6QX2krnnFQ1tXtN+2ePlAaUNWcfiWwrncn4ca9ml3hFeHHm+u2bq4MhxUZs3bMH/3jgaPUtlVunFjg2/8yRzf3cHsssKZqlnOqyCWworWykW9lXnspk0ffrjpfCreIpjPWbwnFxt3PAkcQgkUuH1auUMf+txJQ0hK1k1zsNaqQdaLMxfoq9AGGxtJQ+fGw53cE/TY8pWhJruZHiMAcCexFS/eGDp6hntiXGE/gvI7163b29ExfiHxNsnqub/a6/QmPoAn4GpZ2c9cZRX5/57IWUNYuubiQBAddhuxAKe6PA5vuV5dkk0VXkMM3zk42W3Awrgka8LQgjZY+tQIffd5+vnHasnHL/cczldyS4r79i6su6Nu9oPQ8lbaid2Pt9/bXtTTynevq7bkPkITV47d+3NugOzo4M3y77Zxbnb2nhWrl0T/kO4u3H1ig33e1lD6JDYjiKkCHOioF0pZv6T6gxxipxLNhFc8xERA48vq5ZfXdL/QV6c8W3PfwjIsZyI3Csvo72e4FpTVwTv/UYNAKtY+8MB84vogZ1Xr5lW38iJdPZ74xunzO4Gk7BARIkytjlyCoPVoIb3IluMfAYRhEoAO2aGXKc2TNAJaSwdzQEeq7jC7TWYF2Y2jrEIXlyVEhunBs5t7K62a7Z6qB0923/+vPT2v7mwpqV/mTEsTiCB5zz735HOP9VbVWtKKZK08uDJ7vcQN02HogGegY5iNnKUHh12ti9/zzHvsauy+tx+e375j94LuA64MV/5MQbZVNT95/re7jlxZVaVuW5Nffsd9TXfOpXcv6m2Bn3x6FgXg/oz+P0h/ce8g2mTEWxVTzzQzrTruNCcRdbu6VY87gLVXc4uSjXfosak7XxWM4oyl+ockmzCFhJXaGwK8e6sCW2T3sLmPnh5qSZtx9JHFL6QBHGnsTjdtWQ8PFygWtQTIkrI84NILfQSC65FUMFsnOYFHEoSmUCD49a4rt3985PTsd8GzB/5KEnzmhhORgVOZPM+yb5KmpRu38jQqviH6826Lrdrxx6DZdFPo2fVbTiy9AUpDJ3SxGYvpK7u+Rhz8D4BCxssAeJxjYGRgYABi/vcdWfH8Nl8ZuNkZQODSliXbkWl2BrA4BwMTiAIAKDsJfgB4nGNgZGBgZwCChWASxGZkQAVyABOTANd4nGNnYGBgHwAMADNUANMAAAAAAAAOAFAAZgCyAMYA5gEeAUgBdAGcAfICLgKOAroDCgOOA7AD6gQ4BHwEuAToBQwFogXoBjYGbAbaB3IAAHicY2BkYGCQY8hlYGcAASYg5gJCBob/YD4DABa6AakAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2P2XLCMAxFfYE4CWlZSveFP8hHOY4gHhw79VLav68hMNOH6kG60mg5YhM22pr9b1vGMMEUM2TgyFGgxBwVbnCLBZZYYY07bHCPBzziCc94wSve8I4PbGeDFj/VydVSOakpG0T0VH1ZHXuq+xhoftHaHq+yV+21o1P7brWLWnvpiExNJpBb/i18q8D9ZxSOcj8oY8iVPjZBBU2+kGIIypokuqTI+cx3qXMq7Z6PQIsx1DYGrQxtLul50YV50rVcCiNJc0enX4qdkNRYe8j2g46+SIMHapXJw1GFdIWH2DfalQknZeTDWsRW2bqlBK3ORIz9AqJUapQAAAA=) format("woff"), url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMlGRXgQAAAEoAAAAVmNtYXDiLxC2AAAB+AAAAUpnbHlm5X8X/gAAA4QAAA7kaGVhZAuHlGsAAADQAAAANmhoZWEOogcfAAAArAAAACRobXR40gAAAAAAAYAAAAB4bG9jYTDILUIAAANEAAAAPm1heHABLwB5AAABCAAAACBuYW1l1cf1oAAAEmgAAAIKcG9zdL2sAHoAABR0AAABeQABAAAHAAAAAKEHAAAAAAAHAAABAAAAAAAAAAAAAAAAAAAAHgABAAAAAQAAD+/W/l8PPPUACwcAAAAAANK0pLcAAAAA0rSktwAAAAAHAAcAAAAACAACAAAAAAAAAAEAAAAeAG0ABwAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQcAAZAABQAIBHEE5gAAAPoEcQTmAAADXABXAc4AAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA8QHxHQcAAAAAoQcAAAAAAAABAAAAAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAAAAAAAwAAAAMAAAAcAAEAAAAAAEQAAwABAAAAHAAEACgAAAAGAAQAAQACAADxHf//AAAAAPEB//8AAA8AAAEAAAAAAAAAAAEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AUABmALIAxgDmAR4BSAF0AZwB8gIuAo4CugMKA44DsAPqBDgEfAS4BOgFDAWiBegGNgZsBtoHcgAAAAEAAAAABYsFiwACAAABEQECVQM2BYv76gILAAADAAAAAAZrBmsAAgAOABoAAAkCEwQAAxIABSQAEwIAASYAJzYANxYAFwYAAusBwP5Alf7D/loICAGmAT0BPQGmCAj+Wv7D/f6uBgYBUv39AVIGBv6uAjABUAFQAZsI/lr+w/7D/loICAGmAT0BPQGm+sgGAVL9/QFSBgb+rv39/q4AAAACAAAAAAVABYsAAwAHAAABIREpAREhEQHAASv+1QJVASsBdQQW++oEFgAAAAQAAAAABiAGIAAGABMAJAAnAAABLgEnFRc2NwYHFz4BNSYAJxUWEgEHASERIQERAQYHFT4BNxc3AQcXBNABZVW4A7sCJ3ElKAX+3+Wlzvu3XwFh/p8BKwF1AT5MXU6KO5lf/WCcnAOAZJ4rpbgYGGpbcUacVPQBYziaNP70Aetf/p/+QP6LAfb+wjsdmhJEMZhfBJacnAAAAQAAAAAEqwXWAAUAAAERIQERAQILASoBdv6KBGD+QP6LBKr+iwAAAAIAAAAABWYF1gAGAAwAAAEuAScRPgEBESEBEQEFZQFlVFRl/BEBKwF1/osDgGSeK/2mK54BRP5A/osEqv6LAAADAAAAAAYgBg8ABQAMABoAABMRIQERAQUuAScRPgEDFRYSFwYCBxU2ADcmAOABKwF1/osCxQFlVVVluqXOAwPOpeUBIQUF/t8EYP5A/osEqv6L4GSeK/2mK54C85o0/vS1tf70NJo4AWL19QFiAAAABAAAAAAFiwWLAAUACwARABcAAAEjESE1IwMzNTM1IQEjFSERIwMVMxUzEQILlgF24JaW4P6KA4DgAXaW4OCWAuv+ipYCCuCW/ICWAXYCoJbgAXYABAAAAAAFiwWLAAUACwARABcAAAEzFTMRIRMjFSERIwEzNTM1IRM1IxEhNQF14Jb+iuDgAXaWAcCW4P6KlpYBdgJV4AF2AcCWAXb76uCWAcDg/oqWAAAAAAIAAAAABdYF1gAPABMAAAEhDgEHER4BFyE+ATcRLgEDIREhBUD8gD9VAQFVPwOAP1UBAVU//IADgAXVAVU//IA/VQEBVT8DgD9V++wDgAAABgAAAAAGawZrAAcADAATABsAIAAoAAAJASYnDgEHASUuAScBBSEBNhI3JgUBBgIHFhchBR4BFwEzARYXPgE3AQK+AWROVIfwYQESA4416aH+7gLl/dABelxoAQH8E/7dXGgBAQ4CMP3kNemhARJ4/t1OVIfwYf7uA/ACaBIBAVhQ/id3pfY+/idL/XNkAQGTTU0B+GT+/5NNSEul9j4B2f4IEgEBWFAB2QAAAAUAAAAABmsF1gAPABMAFwAbAB8AAAEhDgEHER4BFyE+ATcRLgEBIRUhASE1IQUhNSE1ITUhBdX7VkBUAgJUQASqQFQCAlT7FgEq/tYC6v0WAuoBwP7WASr9FgLqBdUBVT/8gD9VAQFVPwOAP1X9rJX+1ZWVlZaVAAMAAAAABiAF1gAPACcAPwAAASEOAQcRHgEXIT4BNxEuAQEjNSMVMzUzFRQGByMuAScRPgE3Mx4BFQUjNSMVMzUzFQ4BByMuATURNDY3Mx4BFwWL++o/VAICVD8EFj9UAgJU/WtwlZVwKiDgICoBASog4CAqAgtwlZVwASog4CAqKiDgICoBBdUBVT/8gD9VAQFVPwOAP1X99yXgJUogKgEBKiABKiAqAQEqIEol4CVKICoBASogASogKgEBKiAAAAYAAAAABiAE9gADAAcACwAPABMAFwAAEzM1IxEzNSMRMzUjASE1IREhNSERFSE14JWVlZWVlQErBBX76wQV++sEFQM1lv5AlQHAlf5Alv5AlQJVlZUAAAABAAAAAAYgBmwALgAAASIGBwE2NCcBHgEzPgE3LgEnDgEHFBcBLgEjDgEHHgEXMjY3AQYHHgEXPgE3LgEFQCtKHv3sBwcCDx5OLF9/AgJ/X19/Agf98R5OLF9/AgJ/XyxOHgIUBQEDe1xcewMDewJPHxsBNxk2GQE0HSACf19ffwICf18bGf7NHCACf19ffwIgHP7KFxpcewICe1xdewAAAgAAAAAGWQZrAEMATwAAATY0Jzc+AScDLgEPASYvAS4BJyEOAQ8BBgcnJgYHAwYWHwEGFBcHDgEXEx4BPwEWHwEeARchPgE/ATY3FxY2NxM2JicFLgEnPgE3HgEXDgEFqwUFngoGB5YHGQ26OkQcAxQP/tYPFAIcRTm6DRoHlQcFC50FBZ0LBQeVBxoNujlFHAIUDwEqDxQCHEU5ug0aB5UHBQv9OG+UAgKUb2+UAgKUAzckSiR7CRoNAQMMCQVLLRzGDhEBAREOxhwtSwUJDP79DBsJeyRKJHsJGg3+/QwJBUstHMYOEQEBEQ7GHC1LBQkMAQMMGwlBApRvb5QCApRvb5QAAAAAAQAAAAAGawZrAAsAABMSAAUkABMCACUEAJUIAaYBPQE9AaYICP5a/sP+w/5aA4D+w/5aCAgBpgE9AT0BpggI/loAAAACAAAAAAZrBmsACwAXAAABBAADEgAFJAATAgABJgAnNgA3FgAXBgADgP7D/loICAGmAT0BPQGmCAj+Wv7D/f6uBgYBUv39AVIGBv6uBmsI/lr+w/7D/loICAGmAT0BPQGm+sgGAVL9/QFSBgb+rv39/q4AAAMAAAAABmsGawALABcAIwAAAQQAAxIABSQAEwIAASYAJzYANxYAFwYAAw4BBy4BJz4BNx4BA4D+w/5aCAgBpgE9AT0BpggI/lr+w/3+rgYGAVL9/QFSBgb+rh0Cf19ffwICf19ffwZrCP5a/sP+w/5aCAgBpgE9AT0BpvrIBgFS/f0BUgYG/q79/f6uAk9ffwICf19ffwICfwAAAAQAAAAABiAGIAAPABsAJQApAAABIQ4BBxEeARchPgE3ES4BASM1IxUjETMVMzU7ASEeARcRDgEHITczNSMFi/vqP1QCAlQ/BBY/VAICVP1rcJVwcJVwlgEqICoBASog/tZwlZUGIAJUP/vqP1QCAlQ/BBY/VPyClZUBwLu7ASog/tYgKgFw4AACAAAAAAZrBmsACwAXAAABBAADEgAFJAATAgATBwkBJwkBNwkBFwEDgP7D/loICAGmAT0BPQGmCAj+Wjhp/vT+9GkBC/71aQEMAQxp/vUGawj+Wv7D/sP+WggIAaYBPQE9Aab8EWkBC/71aQEMAQxp/vUBC2n+9AABAAAAAAXWBrYAFgAAAREJAREeARcOAQcuAScjFgAXNgA3JgADgP6LAXW+/QUF/b6+/QWVBgFR/v4BUQYG/q8FiwEq/ov+iwEqBP2/vv0FBf2+/v6vBgYBUf7+AVEAAAABAAAAAAU/BwAAFAAAAREjIgYdASEDIxEhESMRMzU0NjMyBT+dVjwBJSf+/s7//9Ctkwb0/vhISL3+2P0JAvcBKNq6zQAAAAAEAAAAAAaOBwAAMABFAGAAbAAAARQeAxUUBwYEIyImJyY1NDY3NiUuATU0NwYjIiY1NDY3PgEzIQcjHgEVFA4DJzI2NzY1NC4CIyIGBwYVFB4DEzI+AjU0LgEvASYvAiYjIg4DFRQeAgEzFSMVIzUjNTM1MwMfQFtaQDBI/uqfhOU5JVlKgwERIB8VLhaUy0g/TdNwAaKKg0pMMUVGMZImUBo1Ij9qQCpRGS8UKz1ZNjprWzcODxMeChwlThAgNWhvUzZGcX0Da9XVadTUaQPkJEVDUIBOWlN6c1NgPEdRii5SEipAKSQxBMGUUpo2QkBYP4xaSHNHO0A+IRs5ZjqGfVInITtlLmdnUjT8lxo0Xj4ZMCQYIwsXHTgCDiQ4XTtGazsdA2xs29ts2QADAAAAAAaABmwAAwAOACoAAAERIREBFgYrASImNDYyFgERIRE0JiMiBgcGFREhEhAvASEVIz4DMzIWAd3+tgFfAWdUAlJkZ6ZkBI/+t1FWP1UVC/63AgEBAUkCFCpHZz+r0ASP/CED3wEySWJik2Fh/N39yAISaXdFMx4z/dcBjwHwMDCQIDA4H+MAAAEAAAAABpQGAAAxAAABBgcWFRQCDgEEIyAnFjMyNy4BJxYzMjcuAT0BFhcuATU0NxYEFyY1NDYzMhc2NwYHNgaUQ18BTJvW/tKs/vHhIyvhsGmmHyEcKypwk0ROQk4seQFbxgi9hoxgbWAlaV0FaGJFDhyC/v3ut22RBIoCfWEFCxexdQQmAyyOU1hLlbMKJiSGvWYVOXM/CgAAAAEAAAAABYAHAAAiAAABFw4BBwYuAzURIzU+BDc+ATsBESEVIREUHgI3NgUwUBewWWitcE4hqEhyRDAUBQEHBPQBTf6yDSBDME4Bz+0jPgECOFx4eDoCINcaV11vVy0FB/5Y/P36HjQ1HgECAAEAAAAABoAGgABKAAABFAIEIyInNj8BHgEzMj4BNTQuASMiDgMVFBYXFj8BNjc2JyY1NDYzMhYVFAYjIiY3PgI1NCYjIgYVFBcDBhcmAjU0EiQgBBIGgM7+n9FvazsTNhRqPXm+aHfijmm2f1srUE0eCAgGAgYRM9Gpl6mJaz1KDgglFzYyPlYZYxEEzv7OAWEBogFhzgOA0f6fziBdR9MnOYnwlnLIfjpgfYZDaJ4gDCAfGAYXFD1al9mkg6ruVz0jdVkfMkJyVUkx/l5Ga1sBfOnRAWHOzv6fAAAHAAAAAAcABM8ADgAXACoAPQBQAFoAXQAAARE2HgIHDgEHBiYjJyY3FjY3NiYHERQFFjY3PgE3LgEnIwYfAR4BFw4BFxY2Nz4BNy4BJyMGHwEeARcUBhcWNjc+ATcuAScjBh8BHgEXDgEFMz8BFTMRIwYDJRUnAxyEzZRbCA2rgketCAEBqlRoCglxYwF+IiEOIysBAkswHQEECiQ0AgE+YyIhDiIsAQJLMB4BBQokNAE/YyIhDiIsAQJLMB4BBQokNAEBPvmD7kHhqs0s0gEnjgHJAv0FD2a9gIrADwUFAwPDAlVMZ3MF/pUHwgc1HTyWV325PgsJED+oY3G9TAc1HTyWV325PgsJED+oY3G9TAc1HTyWV325PgsJED+oY3G9UmQBZQMMR/61g/kBAAAAAAAQAMYAAQAAAAAAAQAHAAAAAQAAAAAAAgAHAAcAAQAAAAAAAwAHAA4AAQAAAAAABAAHABUAAQAAAAAABQALABwAAQAAAAAABgAHACcAAQAAAAAACgArAC4AAQAAAAAACwATAFkAAwABBAkAAQAOAGwAAwABBAkAAgAOAHoAAwABBAkAAwAOAIgAAwABBAkABAAOAJYAAwABBAkABQAWAKQAAwABBAkABgAOALoAAwABBAkACgBWAMgAAwABBAkACwAmAR5WaWRlb0pTUmVndWxhclZpZGVvSlNWaWRlb0pTVmVyc2lvbiAxLjBWaWRlb0pTR2VuZXJhdGVkIGJ5IHN2ZzJ0dGYgZnJvbSBGb250ZWxsbyBwcm9qZWN0Lmh0dHA6Ly9mb250ZWxsby5jb20AVgBpAGQAZQBvAEoAUwBSAGUAZwB1AGwAYQByAFYAaQBkAGUAbwBKAFMAVgBpAGQAZQBvAEoAUwBWAGUAcgBzAGkAbwBuACAAMQAuADAAVgBpAGQAZQBvAEoAUwBHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAACAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AAAECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQEOAQ8BEAERARIBEwEUARUBFgEXARgBGQEaARsBHAEdAR4EcGxheQtwbGF5LWNpcmNsZQVwYXVzZQt2b2x1bWUtbXV0ZQp2b2x1bWUtbG93CnZvbHVtZS1taWQLdm9sdW1lLWhpZ2gQZnVsbHNjcmVlbi1lbnRlcg9mdWxsc2NyZWVuLWV4aXQGc3F1YXJlB3NwaW5uZXIJc3VidGl0bGVzCGNhcHRpb25zCGNoYXB0ZXJzBXNoYXJlA2NvZwZjaXJjbGUOY2lyY2xlLW91dGxpbmUTY2lyY2xlLWlubmVyLWNpcmNsZQJoZAZjYW5jZWwGcmVwbGF5CGZhY2Vib29rBWdwbHVzCGxpbmtlZGluB3R3aXR0ZXIGdHVtYmxyCXBpbnRlcmVzdBFhdWRpby1kZXNjcmlwdGlvbgAAAAAA) format("truetype"); - font-weight: normal; - font-style: normal; } - -.vjs-icon-play, .video-js .vjs-big-play-button, .video-js .vjs-play-control { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-play:before, .video-js .vjs-big-play-button:before, .video-js .vjs-play-control:before { - content: '\f101'; } - -.vjs-icon-play-circle { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-play-circle:before { - content: '\f102'; } - -.vjs-icon-pause, .video-js .vjs-play-control.vjs-playing { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-pause:before, .video-js .vjs-play-control.vjs-playing:before { - content: '\f103'; } - -.vjs-icon-volume-mute, .video-js .vjs-mute-control.vjs-vol-0, -.video-js .vjs-volume-menu-button.vjs-vol-0 { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-volume-mute:before, .video-js .vjs-mute-control.vjs-vol-0:before, - .video-js .vjs-volume-menu-button.vjs-vol-0:before { - content: '\f104'; } - -.vjs-icon-volume-low, .video-js .vjs-mute-control.vjs-vol-1, -.video-js .vjs-volume-menu-button.vjs-vol-1 { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-volume-low:before, .video-js .vjs-mute-control.vjs-vol-1:before, - .video-js .vjs-volume-menu-button.vjs-vol-1:before { - content: '\f105'; } - -.vjs-icon-volume-mid, .video-js .vjs-mute-control.vjs-vol-2, -.video-js .vjs-volume-menu-button.vjs-vol-2 { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-volume-mid:before, .video-js .vjs-mute-control.vjs-vol-2:before, - .video-js .vjs-volume-menu-button.vjs-vol-2:before { - content: '\f106'; } - -.vjs-icon-volume-high, .video-js .vjs-mute-control, -.video-js .vjs-volume-menu-button { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-volume-high:before, .video-js .vjs-mute-control:before, - .video-js .vjs-volume-menu-button:before { - content: '\f107'; } - -.vjs-icon-fullscreen-enter, .video-js .vjs-fullscreen-control { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-fullscreen-enter:before, .video-js .vjs-fullscreen-control:before { - content: '\f108'; } - -.vjs-icon-fullscreen-exit, .video-js.vjs-fullscreen .vjs-fullscreen-control { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-fullscreen-exit:before, .video-js.vjs-fullscreen .vjs-fullscreen-control:before { - content: '\f109'; } - -.vjs-icon-square { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-square:before { - content: '\f10a'; } - -.vjs-icon-spinner { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-spinner:before { - content: '\f10b'; } - -.vjs-icon-subtitles, .video-js .vjs-subtitles-button { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-subtitles:before, .video-js .vjs-subtitles-button:before { - content: '\f10c'; } - -.vjs-icon-captions, .video-js .vjs-captions-button { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-captions:before, .video-js .vjs-captions-button:before { - content: '\f10d'; } - -.vjs-icon-chapters, .video-js .vjs-chapters-button { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-chapters:before, .video-js .vjs-chapters-button:before { - content: '\f10e'; } - -.vjs-icon-share { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-share:before { - content: '\f10f'; } - -.vjs-icon-cog { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-cog:before { - content: '\f110'; } - -.vjs-icon-circle, .video-js .vjs-mouse-display, .video-js .vjs-play-progress, .video-js .vjs-volume-level { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-circle:before, .video-js .vjs-mouse-display:before, .video-js .vjs-play-progress:before, .video-js .vjs-volume-level:before { - content: '\f111'; } - -.vjs-icon-circle-outline { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-circle-outline:before { - content: '\f112'; } - -.vjs-icon-circle-inner-circle { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-circle-inner-circle:before { - content: '\f113'; } - -.vjs-icon-hd { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-hd:before { - content: '\f114'; } - -.vjs-icon-cancel, .video-js .vjs-control.vjs-close-button { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-cancel:before, .video-js .vjs-control.vjs-close-button:before { - content: '\f115'; } - -.vjs-icon-replay { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-replay:before { - content: '\f116'; } - -.vjs-icon-facebook { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-facebook:before { - content: '\f117'; } - -.vjs-icon-gplus { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-gplus:before { - content: '\f118'; } - -.vjs-icon-linkedin { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-linkedin:before { - content: '\f119'; } - -.vjs-icon-twitter { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-twitter:before { - content: '\f11a'; } - -.vjs-icon-tumblr { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-tumblr:before { - content: '\f11b'; } - -.vjs-icon-pinterest { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-pinterest:before { - content: '\f11c'; } - -.vjs-icon-audio-description { - font-family: VideoJS; - font-weight: normal; - font-style: normal; } - .vjs-icon-audio-description:before { - content: '\f11d'; } - -.video-js { - display: block; - vertical-align: top; - box-sizing: border-box; - color: #fff; - background-color: #000; - position: relative; - padding: 0; - font-size: 10px; - line-height: 1; - font-weight: normal; - font-style: normal; - font-family: Arial, Helvetica, sans-serif; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } - .video-js:-moz-full-screen { - position: absolute; } - .video-js:-webkit-full-screen { - width: 100% !important; - height: 100% !important; } - -.video-js *, -.video-js *:before, -.video-js *:after { - box-sizing: inherit; } - -.video-js ul { - font-family: inherit; - font-size: inherit; - line-height: inherit; - list-style-position: outside; - margin-left: 0; - margin-right: 0; - margin-top: 0; - margin-bottom: 0; } - -.video-js.vjs-fluid, -.video-js.vjs-16-9, -.video-js.vjs-4-3 { - width: 100%; - max-width: 100%; - height: 0; } - -.video-js.vjs-16-9 { - padding-top: 56.25%; } - -.video-js.vjs-4-3 { - padding-top: 75%; } - -.video-js.vjs-fill { - width: 100%; - height: 100%; } - -.video-js .vjs-tech { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; } - -body.vjs-full-window { - padding: 0; - margin: 0; - height: 100%; - overflow-y: auto; } - -.vjs-full-window .video-js.vjs-fullscreen { - position: fixed; - overflow: hidden; - z-index: 1000; - left: 0; - top: 0; - bottom: 0; - right: 0; } - -.video-js.vjs-fullscreen { - width: 100% !important; - height: 100% !important; - padding-top: 0 !important; } - -.video-js.vjs-fullscreen.vjs-user-inactive { - cursor: none; } - -.vjs-hidden { - display: none !important; } - -.video-js .vjs-offscreen { - height: 1px; - left: -9999px; - position: absolute; - top: 0; - width: 1px; } - -.vjs-lock-showing { - display: block !important; - opacity: 1; - visibility: visible; } - -.vjs-no-js { - padding: 20px; - color: #fff; - background-color: #000; - font-size: 18px; - font-family: Arial, Helvetica, sans-serif; - text-align: center; - width: 300px; - height: 150px; - margin: 0px auto; } - -.vjs-no-js a, -.vjs-no-js a:visited { - color: #66A8CC; } - -.video-js .vjs-big-play-button { - font-size: 3em; - line-height: 1.5em; - height: 1.5em; - width: 3em; - display: block; - position: absolute; - top: 10px; - left: 10px; - padding: 0; - cursor: pointer; - opacity: 1; - border: 0.06666em solid #fff; - background-color: #2B333F; - background-color: rgba(43, 51, 63, 0.7); - -webkit-border-radius: 0.3em; - -moz-border-radius: 0.3em; - border-radius: 0.3em; - -webkit-transition: all 0.4s; - -moz-transition: all 0.4s; - -o-transition: all 0.4s; - transition: all 0.4s; } - -.vjs-big-play-centered .vjs-big-play-button { - top: 50%; - left: 50%; - margin-top: -0.75em; - margin-left: -1.5em; } - -.video-js:hover .vjs-big-play-button, -.video-js .vjs-big-play-button:focus { - outline: 0; - border-color: #fff; - background-color: #73859f; - background-color: rgba(115, 133, 159, 0.5); - -webkit-transition: all 0s; - -moz-transition: all 0s; - -o-transition: all 0s; - transition: all 0s; } - -.vjs-controls-disabled .vjs-big-play-button, -.vjs-has-started .vjs-big-play-button, -.vjs-using-native-controls .vjs-big-play-button, -.vjs-error .vjs-big-play-button { - display: none; } - -.video-js button { - background: none; - border: none; - color: inherit; - display: inline-block; - overflow: visible; - font-size: inherit; - line-height: inherit; - text-transform: none; - text-decoration: none; - transition: none; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; } - -.video-js .vjs-control.vjs-close-button { - cursor: pointer; - height: 3em; - position: absolute; - right: 0; - top: 0.5em; - z-index: 2; } - -.vjs-menu-button { - cursor: pointer; } - -.vjs-menu .vjs-menu-content { - display: block; - padding: 0; - margin: 0; - overflow: auto; } - -.vjs-scrubbing .vjs-menu-button:hover .vjs-menu { - display: none; } - -.vjs-menu li { - list-style: none; - margin: 0; - padding: 0.2em 0; - line-height: 1.4em; - font-size: 1.2em; - text-align: center; - text-transform: lowercase; } - -.vjs-menu li:focus, -.vjs-menu li:hover { - outline: 0; - background-color: #73859f; - background-color: rgba(115, 133, 159, 0.5); } - -.vjs-menu li.vjs-selected, -.vjs-menu li.vjs-selected:focus, -.vjs-menu li.vjs-selected:hover { - background-color: #fff; - color: #2B333F; } - -.vjs-menu li.vjs-menu-title { - text-align: center; - text-transform: uppercase; - font-size: 1em; - line-height: 2em; - padding: 0; - margin: 0 0 0.3em 0; - font-weight: bold; - cursor: default; } - -.vjs-menu-button-popup .vjs-menu { - display: none; - position: absolute; - bottom: 0; - width: 10em; - left: -3em; - height: 0em; - margin-bottom: 1.5em; - border-top-color: rgba(43, 51, 63, 0.7); } - -.vjs-menu-button-popup .vjs-menu .vjs-menu-content { - background-color: #2B333F; - background-color: rgba(43, 51, 63, 0.7); - position: absolute; - width: 100%; - bottom: 1.5em; - max-height: 15em; } - -.vjs-workinghover .vjs-menu-button-popup:hover .vjs-menu, -.vjs-menu-button-popup .vjs-menu.vjs-lock-showing { - display: block; } - -.video-js .vjs-menu-button-inline { - -webkit-transition: all 0.4s; - -moz-transition: all 0.4s; - -o-transition: all 0.4s; - transition: all 0.4s; - overflow: hidden; } - -.video-js .vjs-menu-button-inline:before { - width: 2.222222222em; } - -.video-js .vjs-menu-button-inline:hover, -.video-js .vjs-menu-button-inline:focus, -.video-js .vjs-menu-button-inline.vjs-slider-active, -.video-js.vjs-no-flex .vjs-menu-button-inline { - width: 12em; } - -.video-js .vjs-menu-button-inline.vjs-slider-active { - -webkit-transition: none; - -moz-transition: none; - -o-transition: none; - transition: none; } - -.vjs-menu-button-inline .vjs-menu { - opacity: 0; - height: 100%; - width: auto; - position: absolute; - left: 4em; - top: 0; - padding: 0; - margin: 0; - -webkit-transition: all 0.4s; - -moz-transition: all 0.4s; - -o-transition: all 0.4s; - transition: all 0.4s; } - -.vjs-menu-button-inline:hover .vjs-menu, -.vjs-menu-button-inline:focus .vjs-menu, -.vjs-menu-button-inline.vjs-slider-active .vjs-menu { - display: block; - opacity: 1; } - -.vjs-no-flex .vjs-menu-button-inline .vjs-menu { - display: block; - opacity: 1; - position: relative; - width: auto; } - -.vjs-no-flex .vjs-menu-button-inline:hover .vjs-menu, -.vjs-no-flex .vjs-menu-button-inline:focus .vjs-menu, -.vjs-no-flex .vjs-menu-button-inline.vjs-slider-active .vjs-menu { - width: auto; } - -.vjs-menu-button-inline .vjs-menu-content { - width: auto; - height: 100%; - margin: 0; - overflow: hidden; } - -.video-js .vjs-control-bar { - display: none; - width: 100%; - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 3.0em; - background-color: #2B333F; - background-color: rgba(43, 51, 63, 0.7); } - -.vjs-has-started .vjs-control-bar { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - visibility: visible; - opacity: 1; - -webkit-transition: visibility 0.1s, opacity 0.1s; - -moz-transition: visibility 0.1s, opacity 0.1s; - -o-transition: visibility 0.1s, opacity 0.1s; - transition: visibility 0.1s, opacity 0.1s; } - -.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar { - visibility: hidden; - opacity: 0; - -webkit-transition: visibility 1s, opacity 1s; - -moz-transition: visibility 1s, opacity 1s; - -o-transition: visibility 1s, opacity 1s; - transition: visibility 1s, opacity 1s; } - -.vjs-controls-disabled .vjs-control-bar, -.vjs-using-native-controls .vjs-control-bar, -.vjs-error .vjs-control-bar { - display: none !important; } - -.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar { - opacity: 1; - visibility: visible; } - -@media \0screen { - .vjs-user-inactive.vjs-playing .vjs-control-bar :before { - content: ""; } } - -.vjs-has-started.vjs-no-flex .vjs-control-bar { - display: table; } - -.video-js .vjs-control { - outline: none; - position: relative; - text-align: center; - margin: 0; - padding: 0; - height: 100%; - width: 4em; - -webkit-box-flex: none; - -moz-box-flex: none; - -webkit-flex: none; - -ms-flex: none; - flex: none; } - .video-js .vjs-control:before { - font-size: 1.8em; - line-height: 1.67; } - -.video-js .vjs-control:focus:before, -.video-js .vjs-control:hover:before, -.video-js .vjs-control:focus { - text-shadow: 0em 0em 1em white; } - -.video-js .vjs-control-text { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; } - -.vjs-no-flex .vjs-control { - display: table-cell; - vertical-align: middle; } - -.video-js .vjs-custom-control-spacer { - display: none; } - -.video-js .vjs-progress-control { - -webkit-box-flex: auto; - -moz-box-flex: auto; - -webkit-flex: auto; - -ms-flex: auto; - flex: auto; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -webkit-align-items: center; - -ms-flex-align: center; - align-items: center; - min-width: 4em; } - -.vjs-live .vjs-progress-control { - display: none; } - -.video-js .vjs-progress-holder { - -webkit-box-flex: auto; - -moz-box-flex: auto; - -webkit-flex: auto; - -ms-flex: auto; - flex: auto; - -webkit-transition: all 0.2s; - -moz-transition: all 0.2s; - -o-transition: all 0.2s; - transition: all 0.2s; - height: 0.3em; } - -.video-js .vjs-progress-control:hover .vjs-progress-holder { - font-size: 1.666666666666666666em; } - -/* If we let the font size grow as much as everything else, the current time tooltip ends up - ginormous. If you'd like to enable the current time tooltip all the time, this should be disabled - to avoid a weird hitch when you roll off the hover. */ -.video-js .vjs-progress-control:hover .vjs-mouse-display:after, -.video-js .vjs-progress-control:hover .vjs-play-progress:after { - display: block; - font-size: 0.6em; } - -.video-js .vjs-progress-holder .vjs-play-progress, -.video-js .vjs-progress-holder .vjs-load-progress, -.video-js .vjs-progress-holder .vjs-load-progress div { - position: absolute; - display: block; - height: 0.3em; - margin: 0; - padding: 0; - width: 0; - left: 0; - top: 0; } - -.video-js .vjs-mouse-display:before { - display: none; } - -.video-js .vjs-play-progress { - background-color: #fff; } - .video-js .vjs-play-progress:before { - position: absolute; - top: -0.333333333333333em; - right: -0.5em; - font-size: 0.9em; } - -.video-js .vjs-mouse-display:after, -.video-js .vjs-play-progress:after { - display: none; - position: absolute; - top: -3.4em; - right: -1.5em; - font-size: 0.9em; - color: #000; - content: attr(data-current-time); - padding: 6px 8px 8px 8px; - background-color: #fff; - background-color: rgba(255, 255, 255, 0.8); - -webkit-border-radius: 0.3em; - -moz-border-radius: 0.3em; - border-radius: 0.3em; } - -.video-js .vjs-play-progress:before, -.video-js .vjs-play-progress:after { - z-index: 1; } - -.video-js .vjs-load-progress { - background: #bfc7d3; - background: rgba(115, 133, 159, 0.5); } - -.video-js .vjs-load-progress div { - background: white; - background: rgba(115, 133, 159, 0.75); } - -.video-js.vjs-no-flex .vjs-progress-control { - width: auto; } - -.video-js .vjs-progress-control .vjs-mouse-display { - display: none; - position: absolute; - width: 1px; - height: 100%; - background-color: #000; - z-index: 1; } - -.vjs-no-flex .vjs-progress-control .vjs-mouse-display { - z-index: 0; } - -.video-js .vjs-progress-control:hover .vjs-mouse-display { - display: block; } - -.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display, -.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display:after { - visibility: hidden; - opacity: 0; - -webkit-transition: visibility 1s, opacity 1s; - -moz-transition: visibility 1s, opacity 1s; - -o-transition: visibility 1s, opacity 1s; - transition: visibility 1s, opacity 1s; } - -.video-js.vjs-user-inactive.vjs-no-flex .vjs-progress-control .vjs-mouse-display, -.video-js.vjs-user-inactive.vjs-no-flex .vjs-progress-control .vjs-mouse-display:after { - display: none; } - -.video-js .vjs-progress-control .vjs-mouse-display:after { - color: #fff; - background-color: #000; - background-color: rgba(0, 0, 0, 0.8); } - -.video-js .vjs-slider { - outline: 0; - position: relative; - cursor: pointer; - padding: 0; - margin: 0 0.45em 0 0.45em; - background-color: #73859f; - background-color: rgba(115, 133, 159, 0.5); } - -.video-js .vjs-slider:focus { - text-shadow: 0em 0em 1em white; - -webkit-box-shadow: 0 0 1em #fff; - -moz-box-shadow: 0 0 1em #fff; - box-shadow: 0 0 1em #fff; } - -.video-js .vjs-mute-control, -.video-js .vjs-volume-menu-button { - cursor: pointer; - -webkit-box-flex: none; - -moz-box-flex: none; - -webkit-flex: none; - -ms-flex: none; - flex: none; } - -.video-js .vjs-volume-control { - width: 5em; - -webkit-box-flex: none; - -moz-box-flex: none; - -webkit-flex: none; - -ms-flex: none; - flex: none; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -webkit-align-items: center; - -ms-flex-align: center; - align-items: center; } - -.video-js .vjs-volume-bar { - margin: 1.35em 0.45em; } - -.vjs-volume-bar.vjs-slider-horizontal { - width: 5em; - height: 0.3em; } - -.vjs-volume-bar.vjs-slider-vertical { - width: 0.3em; - height: 5em; - margin: 1.35em auto; } - -.video-js .vjs-volume-level { - position: absolute; - bottom: 0; - left: 0; - background-color: #fff; } - .video-js .vjs-volume-level:before { - position: absolute; - font-size: 0.9em; } - -.vjs-slider-vertical .vjs-volume-level { - width: 0.3em; } - .vjs-slider-vertical .vjs-volume-level:before { - top: -0.5em; - left: -0.3em; } - -.vjs-slider-horizontal .vjs-volume-level { - height: 0.3em; } - .vjs-slider-horizontal .vjs-volume-level:before { - top: -0.3em; - right: -0.5em; } - -.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level { - height: 100%; } - -.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level { - width: 100%; } - -.vjs-menu-button-popup.vjs-volume-menu-button .vjs-menu { - display: block; - width: 0; - height: 0; - border-top-color: transparent; } - -.vjs-menu-button-popup.vjs-volume-menu-button-vertical .vjs-menu { - left: 0.5em; - height: 8em; } - -.vjs-menu-button-popup.vjs-volume-menu-button-horizontal .vjs-menu { - left: -2em; } - -.vjs-menu-button-popup.vjs-volume-menu-button .vjs-menu-content { - height: 0; - width: 0; - overflow-x: hidden; - overflow-y: hidden; } - -.vjs-volume-menu-button-vertical:hover .vjs-menu-content, -.vjs-volume-menu-button-vertical:focus .vjs-menu-content, -.vjs-volume-menu-button-vertical.vjs-slider-active .vjs-menu-content, -.vjs-volume-menu-button-vertical .vjs-lock-showing .vjs-menu-content { - height: 8em; - width: 2.9em; } - -.vjs-volume-menu-button-horizontal:hover .vjs-menu-content, -.vjs-volume-menu-button-horizontal:focus .vjs-menu-content, -.vjs-volume-menu-button-horizontal .vjs-slider-active .vjs-menu-content, -.vjs-volume-menu-button-horizontal .vjs-lock-showing .vjs-menu-content { - height: 2.9em; - width: 8em; } - -.vjs-volume-menu-button.vjs-menu-button-inline .vjs-menu-content { - background-color: transparent !important; } - -.vjs-poster { - display: inline-block; - vertical-align: middle; - background-repeat: no-repeat; - background-position: 50% 50%; - background-size: contain; - cursor: pointer; - margin: 0; - padding: 0; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - height: 100%; } - -.vjs-poster img { - display: block; - vertical-align: middle; - margin: 0 auto; - max-height: 100%; - padding: 0; - width: 100%; } - -.vjs-has-started .vjs-poster { - display: none; } - -.vjs-audio.vjs-has-started .vjs-poster { - display: block; } - -.vjs-controls-disabled .vjs-poster { - display: none; } - -.vjs-using-native-controls .vjs-poster { - display: none; } - -.video-js .vjs-live-control { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-align: flex-start; - -webkit-align-items: flex-start; - -ms-flex-align: flex-start; - align-items: flex-start; - -webkit-box-flex: auto; - -moz-box-flex: auto; - -webkit-flex: auto; - -ms-flex: auto; - flex: auto; - font-size: 1em; - line-height: 3em; } - -.vjs-no-flex .vjs-live-control { - display: table-cell; - width: auto; - text-align: left; } - -.video-js .vjs-time-control { - -webkit-box-flex: none; - -moz-box-flex: none; - -webkit-flex: none; - -ms-flex: none; - flex: none; - font-size: 1em; - line-height: 3em; - min-width: 2em; - width: auto; - padding-left: 1em; - padding-right: 1em; } - -.vjs-live .vjs-time-control { - display: none; } - -.video-js .vjs-current-time, -.vjs-no-flex .vjs-current-time { - display: none; } - -.video-js .vjs-duration, -.vjs-no-flex .vjs-duration { - display: none; } - -.vjs-time-divider { - display: none; - line-height: 3em; } - -.vjs-live .vjs-time-divider { - display: none; } - -.video-js .vjs-play-control { - cursor: pointer; - -webkit-box-flex: none; - -moz-box-flex: none; - -webkit-flex: none; - -ms-flex: none; - flex: none; } - -.vjs-text-track-display { - position: absolute; - bottom: 3em; - left: 0; - right: 0; - top: 0; - pointer-events: none; } - -.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display { - bottom: 1em; } - -.video-js .vjs-text-track { - font-size: 1.4em; - text-align: center; - margin-bottom: 0.1em; - background-color: #000; - background-color: rgba(0, 0, 0, 0.5); } - -.vjs-subtitles { - color: #fff; } - -.vjs-captions { - color: #fc6; } - -.vjs-tt-cue { - display: block; } - -video::-webkit-media-text-track-display { - -moz-transform: translateY(-3em); - -ms-transform: translateY(-3em); - -o-transform: translateY(-3em); - -webkit-transform: translateY(-3em); - transform: translateY(-3em); } - -.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display { - -moz-transform: translateY(-1.5em); - -ms-transform: translateY(-1.5em); - -o-transform: translateY(-1.5em); - -webkit-transform: translateY(-1.5em); - transform: translateY(-1.5em); } - -.video-js .vjs-fullscreen-control { - cursor: pointer; - -webkit-box-flex: none; - -moz-box-flex: none; - -webkit-flex: none; - -ms-flex: none; - flex: none; } - -.vjs-playback-rate .vjs-playback-rate-value { - font-size: 1.5em; - line-height: 2; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - text-align: center; } - -.vjs-playback-rate .vjs-menu { - width: 4em; - left: 0em; } - -.vjs-error .vjs-error-display .vjs-modal-dialog-content { - font-size: 1.4em; - text-align: center; } - -.vjs-error .vjs-error-display:before { - color: #fff; - content: 'X'; - font-family: Arial, Helvetica, sans-serif; - font-size: 4em; - left: 0; - line-height: 1; - margin-top: -0.5em; - position: absolute; - text-shadow: 0.05em 0.05em 0.1em #000; - text-align: center; - top: 50%; - vertical-align: middle; - width: 100%; } - -.vjs-loading-spinner { - display: none; - position: absolute; - top: 50%; - left: 50%; - margin: -25px 0 0 -25px; - opacity: 0.85; - text-align: left; - border: 6px solid rgba(43, 51, 63, 0.7); - box-sizing: border-box; - background-clip: padding-box; - width: 50px; - height: 50px; - border-radius: 25px; } - -.vjs-seeking .vjs-loading-spinner, -.vjs-waiting .vjs-loading-spinner { - display: block; } - -.vjs-loading-spinner:before, -.vjs-loading-spinner:after { - content: ""; - position: absolute; - margin: -6px; - box-sizing: inherit; - width: inherit; - height: inherit; - border-radius: inherit; - opacity: 1; - border: inherit; - border-color: transparent; - border-top-color: white; } - -.vjs-seeking .vjs-loading-spinner:before, -.vjs-seeking .vjs-loading-spinner:after, -.vjs-waiting .vjs-loading-spinner:before, -.vjs-waiting .vjs-loading-spinner:after { - -webkit-animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite; - animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite; } - -.vjs-seeking .vjs-loading-spinner:before, -.vjs-waiting .vjs-loading-spinner:before { - border-top-color: white; } - -.vjs-seeking .vjs-loading-spinner:after, -.vjs-waiting .vjs-loading-spinner:after { - border-top-color: white; - -webkit-animation-delay: 0.44s; - animation-delay: 0.44s; } - -@keyframes vjs-spinner-spin { - 100% { - transform: rotate(360deg); } } - -@-webkit-keyframes vjs-spinner-spin { - 100% { - -webkit-transform: rotate(360deg); } } - -@keyframes vjs-spinner-fade { - 0% { - border-top-color: #73859f; } - 20% { - border-top-color: #73859f; } - 35% { - border-top-color: white; } - 60% { - border-top-color: #73859f; } - 100% { - border-top-color: #73859f; } } - -@-webkit-keyframes vjs-spinner-fade { - 0% { - border-top-color: #73859f; } - 20% { - border-top-color: #73859f; } - 35% { - border-top-color: white; } - 60% { - border-top-color: #73859f; } - 100% { - border-top-color: #73859f; } } - -.vjs-chapters-button .vjs-menu ul { - width: 24em; } - -.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-custom-control-spacer { - -webkit-box-flex: auto; - -moz-box-flex: auto; - -webkit-flex: auto; - -ms-flex: auto; - flex: auto; } - -.video-js.vjs-layout-tiny:not(.vjs-fullscreen).vjs-no-flex .vjs-custom-control-spacer { - width: auto; } - -.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-current-time, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-time-divider, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-duration, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-remaining-time, -.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-playback-rate, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-progress-control, -.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-mute-control, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-volume-control, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-volume-menu-button, -.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-chapters-button, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-captions-button, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-subtitles-button { - display: none; } - -.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-current-time, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-time-divider, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-duration, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-remaining-time, -.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-playback-rate, -.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-mute-control, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-volume-control, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-volume-menu-button, -.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-chapters-button, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-captions-button, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-subtitles-button { - display: none; } - -.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-current-time, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-time-divider, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-duration, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-remaining-time, -.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-playback-rate, -.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-mute-control, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-volume-control, -.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-chapters-button, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-captions-button, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-subtitles-button { - display: none; } - -.vjs-caption-settings { - position: relative; - top: 1em; - background-color: #2B333F; - background-color: rgba(43, 51, 63, 0.75); - color: #fff; - margin: 0 auto; - padding: 0.5em; - height: 15em; - font-size: 12px; - width: 40em; } - -.vjs-caption-settings .vjs-tracksettings { - top: 0; - bottom: 2em; - left: 0; - right: 0; - position: absolute; - overflow: auto; } - -.vjs-caption-settings .vjs-tracksettings-colors, -.vjs-caption-settings .vjs-tracksettings-font { - float: left; } - -.vjs-caption-settings .vjs-tracksettings-colors:after, -.vjs-caption-settings .vjs-tracksettings-font:after, -.vjs-caption-settings .vjs-tracksettings-controls:after { - clear: both; } - -.vjs-caption-settings .vjs-tracksettings-controls { - position: absolute; - bottom: 1em; - right: 1em; } - -.vjs-caption-settings .vjs-tracksetting { - margin: 5px; - padding: 3px; - min-height: 40px; } - -.vjs-caption-settings .vjs-tracksetting label { - display: block; - width: 100px; - margin-bottom: 5px; } - -.vjs-caption-settings .vjs-tracksetting span { - display: inline; - margin-left: 5px; } - -.vjs-caption-settings .vjs-tracksetting > div { - margin-bottom: 5px; - min-height: 20px; } - -.vjs-caption-settings .vjs-tracksetting > div:last-child { - margin-bottom: 0; - padding-bottom: 0; - min-height: 0; } - -.vjs-caption-settings label > input { - margin-right: 10px; } - -.vjs-caption-settings input[type="button"] { - width: 40px; - height: 40px; } - -.video-js .vjs-modal-dialog { - background: rgba(0, 0, 0, 0.8); - background: -webkit-linear-gradient(-90deg, rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0)); - background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0)); } - -.vjs-modal-dialog .vjs-modal-dialog-content { - font-size: 1.2em; - line-height: 1.5; - padding: 20px 24px; - z-index: 1; } diff --git a/embed/player.js b/embed/player.js new file mode 100644 index 00000000..a643ebb1 --- /dev/null +++ b/embed/player.js @@ -0,0 +1,1127 @@ +var mistplayers = {}; /*TODO move this*/ +function MistPlayer() {}; +function mistPlay(streamName,options) { + return new MistVideo(streamName,options); +} +function MistVideo(streamName,options) { + var MistVideo = this; + + if (!options) { options = {}; } + if (typeof mistoptions != "undefined") { + options = MistUtil.object.extend(MistUtil.object.extend({},mistoptions),options); + } + options = MistUtil.object.extend({ + host: null, //override mistserver host (default is the host that player.js is loaded from) + autoplay: true, //start playing when loaded + controls: true, //show controls (MistControls when available) + loop: false, //don't loop when the stream has finished + poster: null, //don't show an image before the stream has started + callback: false, //don't call a function when the player has finished building + streaminfo: false, //don't use this streaminfo but collect it from the mistserverhost + startCombo: false, //start looking for a player/source match at the start + forceType: false, //don't force a mimetype + forcePlayer: false, //don't force a player + forceSource: false, //don't force a source + forcePriority: false, //no custom priority sorting + monitor: false, //no custom monitoring + reloadDelay: false, //don't override default reload delay + urlappend: false, //don't add this to urls + setTracks: false, //don't set tracks + fillSpace: false, //don't fill parent container + width: false, //no set width + height: false, //no set height + maxwidth: false, //no max width (apart from targets dimensions) + maxheight: false, //no max height (apart from targets dimensions) + MistVideoObject: false//no reference object is passed + },options); + if (options.host) { options.host = MistUtil.http.url.sanitizeHost(options.host); } + + this.options = options; + this.stream = streamName; + this.info = false; + this.logs = []; + this.log = function(message,type){ + if (!type) { type = "log"; } + MistUtil.event.send(type,message,options.target); + var data = { + type: type + }; + this.logs.push({ + time: new Date(), + message: message, + data: data + }); + if (this.options.skin == "dev") { + try { + var msg = "["+(type ? type :"log")+"] "+(MistVideo.destroyed ? "[DESTROYED] " : "")+(this.player && this.player.api ? MistUtil.format.time(this.player.api.currentTime,{ms:true})+" " : "")+message; + if (type && (type != "log")) { console.warn(msg); } + else { console.log(msg); } + } catch(e){} + } + }; + this.log("Initializing.."); + + this.timers = { + list: {}, //will contain the timeouts, format timeOutIndex: endTime + start: function(callback,delay){ + var i = setTimeout(function(){ + delete MistVideo.timers.list[i]; + callback(); + },delay); + this.list[i] = new Date(new Date().getTime() + delay); + return i; + }, + stop: function(which){ + var list; + if (which == "all") { + list = this.list; + } + else { + list = {}; + list[which] = 1; + } + + for (var i in list) { + //MistVideo.log("Stopping timer "+i); + clearTimeout(i); + delete this.list[i]; + } + } + } + this.errorListeners = []; + + this.urlappend = function(url){ + if (this.options.urlappend) { + url += this.options.urlappend; + } + return url; + } + + new MistSkin(this); + + this.checkPlayer = function(options,quiet) { + if (!options) { + options = {}; + } + options = MistUtil.object.extend(MistUtil.object.extend({},this.options),options) + + var source = false; + var mistPlayer = false; + + if (options.startCombo) { + options.startCombo.started = { + player: false, + source: false + }; + } + + //retrieve the sources we can loop over + var sources; + if (options.forceSource) { + sources = [MistVideo.info.source[options.forceSource]]; + MistVideo.log("Forcing source "+options.forceSource+": "+sources[0].type+" @ "+sources[0].url); + } + else if (options.forceType) { + sources = MistVideo.info.source.filter(function(d){ return (d.type == options.forceType); }); + MistVideo.log("Forcing type "+options.forceType); + } + else { + sources = MistVideo.info.source; + } + + //retrieve and sort the players we can loop over + var players; + if (options.forcePlayer) { + players = [options.forcePlayer]; + MistVideo.log("Forcing player "+options.forcePlayer); + } + else { + players = MistUtil.object.keys(mistplayers); + } + + + //create a copy to not mess with the sorting of the original sourced array + sources = [].concat(sources); + + var sortoptions = { + first: "source", + source: [function(a){ + if ("origIndex" in a) { return a.origIndex; } + + //use original sorting -> retrieve index in original array + a.origIndex = MistVideo.info.source.indexOf(a) + return a.origIndex; + }], + player: [{priority:-1}] + }; + var map = { + inner: "player", + outer: "source" + }; + if (options.forcePriority) { + if ("source" in options.forcePriority) { + if (!(options.forcePriority.source instanceof Array)) { throw "forcePriority.source is not an array."; } + sortoptions.source = options.forcePriority.source.concat(sortoptions.source); //prepend + MistUtil.array.multiSort(sources,sortoptions.source); + } + if ("player" in options.forcePriority) { + if (!(options.forcePriority.player instanceof Array)) { throw "forcePriority.player is not an array."; } + sortoptions.player = options.forcePriority.player.concat(sortoptions.player); //prepend + MistUtil.array.multiSort(players,sortoptions.players); + } + if ("first" in options.forcePriority) { + sortopions.first = options.forcePriority.first; //overwrite + } + + + //define inner and outer loops + if (sortoptions.first == "player") { + map.outer = "player"; + map.inner = "source"; + } + } + + var variables = { + player: { + list: players, + current: false + }, + source: { + list: sources, + current: false + } + }; + + function checkStartCombo(which) { + if ((options.startCombo) && (!options.startCombo.started[which])) { + //if we have a starting point for the loops, skip testing until we are at the correct point + if ((options.startCombo[which] == variables[which].current) || (options.startCombo[which] == variables[which].list[variables[which].current])) { + //we're here! + options.startCombo.started[which] = true; + return 1; //issue continue statement in inner loop + } + return 2; //always issue continue statement + } + return 0; //carry on! + } + + outerloop: + for (var n in variables[map.outer].list) { + variables[map.outer].current = n; + + //loop over the sources (prioritized by MistServer) + + if (checkStartCombo(map.outer) >= 2) { continue; } + + innerloop: + for (var m in variables[map.inner].list) { + variables[map.inner].current = m; + + if (checkStartCombo(map.inner) >= 1) { continue; } + + var source = variables.source.list[variables.source.current]; + var p_shortname = variables.player.list[variables.player.current]; + var player = mistplayers[p_shortname]; + + if (player.isMimeSupported(source.type)) { + //this player supports this mime + if (player.isBrowserSupported(source.type,source,MistVideo)) { + //this browser is supported + return { + player: p_shortname, + source: source, + source_index: variables.source.current + }; + } + } + if (!quiet) { MistVideo.log("Checking "+player.name+" with "+source.type+".. Nope."); } + } + } + + return false; + } + + this.choosePlayer = function() { + MistVideo.log("Checking available players.."); + + var result = this.checkPlayer(); + if (!result) { return false; } + + var player = mistplayers[result.player]; + var source = result.source; + + MistVideo.log("Found a working combo: "+player.name+" with "+source.type+" @ "+source.url); + MistVideo.playerName = result.player; + source = MistUtil.object.extend({},source); + source.index = result.source_index; + source.url = MistVideo.urlappend(source.url); + MistVideo.source = source; + + MistUtil.event.send("playerChosen","Player/source combination selected",MistVideo.options.target); + + return true; + } + + function hasVideo(d){ + if (("meta" in d) && ("tracks" in d.meta)) { + //check if this stream has video + var tracks = d.meta.tracks; + var hasVideo = false; + for (var i in tracks) { + if (tracks[i].type == "video") { + return true; + } + } + } + return false; + } + + function onStreamInfo(d) { + + MistVideo.info = d; + MistVideo.info.updated = new Date(); + MistUtil.event.send("haveStreamInfo",d,MistVideo.options.target); + MistVideo.log("Stream info was loaded succesfully."); + + if ("error" in d) { + var e = data.error; + if ("on_error" in d) { + MistVideo.log(e); + e = data.on_error; + } + MistVideo.showError(e,{reload:true}); + return; + } + + //pre-show poster or other loading image + MistVideo.calcSize = function(size) { + if (!size) { size = { width:false, height:false }; } + + var fw = size.width || ('width' in options && options.width ? options.width : false ); //force this width + var fh = size.height || ('height' in options && options.height ? options.height : false ); //force this height + + if (!("source" in this.info)) { + fw = 640; + fh = 480; + } + else if ((!this.info.hasVideo) || (this.source.type.split("/")[1] == "audio")){ + if (!fw) { fw = 480; } + if (!fh) { fh = 42; } + } + else { + //calculate desired width and height + if (!(fw && fh)) { + var ratio = MistVideo.info.width / MistVideo.info.height; + if (fw || fh) { + if (fw) { + fh = fw/ratio; + } + else { + fw = fh*ratio; + } + } + else { + + //neither width or height are being forced. Set them to the minimum of video and target size + var cw = ('maxwidth' in options && options.maxwidth ? options.maxwidth : window.innerWidth); + var ch = ('maxheight' in options && options.maxheight ? options.maxheight : window.innerHeight); + var fw = MistVideo.info.width; + var fh = MistVideo.info.height; + + function rescale(factor){ + fw /= factor; + fh /= factor; + }; + + if (fw < 426) { //rescale if video width is smaller than 240p + rescale(fw / 426); + } + if (fh < 240) { //rescale if video height is smaller than 240p + rescale(fh / 240); + } + + if (cw) { + if (fw > cw) { //rescale if video width is larger than the target + rescale(fw / cw); + } + } + if (ch) { + if (fh > ch) { //rescale if video height is (still?) larger than the target + rescale(fh / ch); + } + } + } + } + } + this.size = { + width: Math.round(fw), + height: Math.round(fh) + }; + return this.size; + }; + + d.hasVideo = hasVideo(d); + + + if (d.type == "live") { + //calculate duration so far + var maxms = 0; + for (var i in MistVideo.info.meta.tracks) { + maxms = Math.max(maxms,MistVideo.info.meta.tracks[i].lastms); + } + d.lastms = maxms; + } + + + + if (MistVideo.choosePlayer()) { + + //build player + MistVideo.player = new mistplayers[MistVideo.playerName].player(); + + MistVideo.player.onreadylist = []; + MistVideo.player.onready = function(dothis){ + this.onreadylist.push(dothis); + }; + + + MistVideo.player.build(MistVideo,function(video){ + + MistVideo.container.removeAttribute("data-loading"); + MistVideo.video = video; + + if ("api" in MistVideo.player) { + + //add monitoring + MistVideo.monitor = { + MistVideo: MistVideo, //added here so that the other functions can use it. Do not override it. + delay: 1, //the amount of seconds between measurements. + averagingSteps: 20, //the amount of measurements that are saved. + threshold: function(){ //returns the score threshold below which the "action" should be taken + if (this.MistVideo.source.type == "webrtc") { + return 0.97; + } + return 0.75; + }, + init: function(){ //starts the monitor and defines the basic shape of the procedure it follows. This is called when the stream should begin playback. + + if ((this.vars) && (this.vars.active)) { return; } //it's already running, don't bother + this.MistVideo.log("Enabling monitor"); + + this.vars = { + values: [], + score: false, + active: true + }; + + var monitor = this; + //the procedure to follow + function repeat(){ + if ((monitor.vars) && (monitor.vars.active)) { + monitor.vars.timer = monitor.MistVideo.timers.start(function(){ + + var score = monitor.calcScore(); + if (score !== false) { + if (monitor.check(score)) { + monitor.action(); + } + } + repeat(); + },monitor.delay*1e3); + } + } + repeat(); + + }, + destroy: function(){ //stops the monitor. This is called when the stream has ended or has been paused by the viewer. + + if ((!this.vars) || (!this.vars.active)) { return; } //it's not running, don't bother] + + this.MistVideo.log("Disabling monitor"); + this.MistVideo.timers.stop(this.vars.timer); + delete this.vars; + }, + reset: function(){ //clears the monitor’s history. This is called when the history becomes invalid because of a seek or change in the playback rate. + + if ((!this.vars) || (!this.vars.active)) { + //it's not running, start it up + this.init(); + return; + } + + this.MistVideo.log("Resetting monitor"); + this.vars.values = []; + }, + calcScore: function(){ //calculate and save the current score + + var list = this.vars.values; + list.push(this.getValue()); //add the current value to the history + + if (list.length <= 1) { return false; } //no history yet, can't calculate a score + + var score = this.valueToScore(list[0],list[list.length-1]); //should be 1, decreases if bad + + //kick the oldest value from the array + if (list.length > this.averagingSteps) { list.shift(); } + + //the final score is the maximum of the averaged and the current value + score = Math.max(score,list[list.length-1].score); + + this.vars.score = score; + return score; + }, + valueToScore: function(a,b){ //calculate the moving average + //if this returns > 1, the video played faster than the clock + //if this returns < 0, the video time went backwards + var rate = 1; + if (("player" in this.MistVideo) && ("api" in this.MistVideo.player) && ("playbackRate" in this.MistVideo.player.api)) { + rate = this.MistVideo.player.api.playbackRate; + } + return (b.video - a.video) / (b.clock - a.clock) / rate; + }, + getValue: function(){ //save the current testing value and time + // If the video plays, this should keep a constant value. If the video is stalled, it will go up with 1sec/sec. If the video is playing faster, it will go down. + // current clock time - current playback time + var result = { + clock: (new Date()).getTime()*1e-3, + video: this.MistVideo.player.api.currentTime, + }; + if (this.vars.values.length) { + result.score = this.valueToScore(this.vars.values[this.vars.values.length-1],result); + } + + return result; + }, + check: function(score){ //determine if the current score is good enough. It must return true if the score fails. + + if (this.vars.values.length < this.averagingSteps * 0.5) { return false; } //gather enough values first + + if (score < this.threshold()) { + return true; + } + }, + action: function(){ //what to do when the check is failed + var score = this.vars.score; + + //passive: only if nothing is already showing + this.MistVideo.showError("Poor playback: "+Math.max(0,Math.round(score*100))+"%",{ + passive: true, + reload: true, + nextCombo: true, + ignore: true, + type: "poor_playback" + }); + } + }; + + //overwrite (some?) monitoring functions/values with custom ones if specified + if ("monitor" in MistVideo.options) { + MistVideo.monitor.default = MistUtil.object.extend({},MistVideo.monitor); + MistUtil.object.extend(MistVideo.monitor,MistVideo.options.monitor); + } + + //enable + var events = ["loadstart","play","playing"]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(){MistVideo.monitor.init()}); + } + + //disable + var events = ["loadeddata","pause","abort","emptied","ended"]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(){ + if (MistVideo.monitor) { MistVideo.monitor.destroy(); } + }); + } + + //reset + var events = ["seeking","seeked",/*"canplay","playing",*/"ratechange"]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(){ + if (MistVideo.monitor) { MistVideo.monitor.reset(); } + }); + } + + } + + //remove placeholder and add UI structure + + MistUtil.empty(MistVideo.options.target); + new MistSkin(MistVideo); + MistVideo.container = new MistUI(MistVideo); + MistVideo.options.target.appendChild(MistVideo.container); + MistVideo.container.setAttribute("data-loading",""); //will be removed automatically when video loads + + MistVideo.video.p = MistVideo.player; + + //add event logging + var events = [ + "abort","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","loadstart","pause","play","playing","ratechange","seeked","seeking","stalled","volumechange","waiting","metaUpdate_tracks","resizing" + //,"timeupdate" + ]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(e){ + MistVideo.log("Player event fired: "+e.type); + }); + } + MistUtil.event.addListener(MistVideo.video,"error",function(e){ + var msg; + if ( + ("player" in MistVideo) && ("api" in MistVideo.player) + && ("error" in MistVideo.player.api) && (MistVideo.player.api.error) + ) { + if ("message" in MistVideo.player.api.error) { + msg = MistVideo.player.api.error.message; + } + else if (("code" in MistVideo.player.api.error) && (MistVideo.player.api.error instanceof MediaError)) { + var human = { + 1: "MEDIA_ERR_ABORTED: The fetching of the associated resource was aborted by the user's request.", + 2: "MEDIA_ERR_NETWORK: Some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available.", + 3: "MEDIA_ERR_DECODE: Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error.", + 4: "MEDIA_ERR_SRC_NOT_SUPPORTED: The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable." + }; + if (MistVideo.player.api.error.code in human) { + msg = human[MistVideo.player.api.error.code]; + } + else { + msg = "MediaError code "+MistVideo.player.api.error.code; + } + } + else { + msg = MistVideo.player.api.error; + if (typeof msg != "string") { + msg = JSON.stringify(msg); + } + } + } + else { + msg = "An error was encountered."; + //console.log("Err:",e); + } + MistVideo.showError(msg); + }); + + //add general resize function + if ("setSize" in MistVideo.player) { + MistVideo.player.videocontainer = MistVideo.video.parentNode; + MistVideo.video.currentTarget = MistVideo.options.target; + if (!MistUtil.class.has(MistVideo.options.target,"secondaryVideo")) { + //this is the main MistVideo + MistVideo.player.resizeAll = function(){ + function findVideo(startAt,matchTarget) { + if (startAt.video.currentTarget == matchTarget) { + return startAt.video; + } + if (startAt.secondary) { + for (var i = 0; i < startAt.secondary.length; i++) { + var result = findVideo(startAt.secondary[i].MistVideo,matchTarget); + if (result) { return result; } + } + } + return false; + } + + //find the video that is in the main container, and resize that one + findVideo(MistVideo,MistVideo.options.target).p.resize(); + + //then, resize the secondaries + if ("secondary" in MistVideo) { + function tryResize(mv){ + if (mv.MistVideo) { + if ("player" in mv.MistVideo) { + findVideo(MistVideo,mv.MistVideo.options.target).p.resize(); + } + } + else { + //player is not loaded yet, try again later + MistVideo.timers.start(function(){ + tryResize(mv); + },0.1e3); + } + } + for (var i in MistVideo.secondary) { + tryResize(MistVideo.secondary[i]); + } + } + }; + + } + MistVideo.player.resize = function(options){ + if (!MistVideo.container.hasAttribute("data-fullscreen")) { + //if ((!document.fullscreenElement) || (document.fullscreenElement.parentElement != MistVideo.video.currentTarget)) { + //first, base the size on the video dimensions + size = MistVideo.calcSize(options); + this.setSize(size); + MistVideo.container.style.width = size.width+"px"; + MistVideo.container.style.height = size.height+"px"; + + if ((MistVideo.options.fillSpace) && (!options || !options.reiterating)) { + //if this container is set to fill the available space + //start by fitting the video to the window size, then iterate until the container is not smaller than the video + return this.resize({ + width:window.innerWidth, + height: false, + reiterating: true + }); + } + + //check if the container is smaller than the video, if so, set the max size to the current container dimensions and reiterate + if ((MistVideo.video.currentTarget.clientHeight) && (MistVideo.video.currentTarget.clientHeight < size.height)) { + //console.log("current h:",size.height,"target h:",MistVideo.video.currentTarget.clientHeight); + return this.resize({ + width: false, + height: MistVideo.video.currentTarget.clientHeight, + reiterating: true + }); + } + if ((MistVideo.video.currentTarget.clientWidth) && (MistVideo.video.currentTarget.clientWidth < size.width)) { + //console.log("current w:",size.width,"target w:",MistVideo.video.currentTarget.clientWidth); + return this.resize({ + width: MistVideo.video.currentTarget.clientWidth, + height: false, + reiterating: true + }); + } + MistVideo.log("Player size calculated: "+size.width+" x "+size.height+" px"); + return true; + } + else { + function findVideo(parent) { + for (var i = 0; i < parent.children.length; i++) { + if (MistUtil.class.has(parent.children[i],"video")) { + return parent.children[i]; + } + } + } + + //this is the video that is in the main container, and resize this one to the screen dimensions + this.setSize({ + height: window.innerHeight, + width: window.innerWidth + }); + return true; + } + }; + + //if this is the main video + if (!MistUtil.class.has(MistVideo.options.target,"secondaryVideo")) { + MistUtil.event.addListener(window,"resize",function(){ + if (MistVideo.destroyed) { return; } + MistVideo.player.resizeAll(); + },MistVideo.video); + MistUtil.event.addListener(MistVideo.options.target,"resize",function(){ + MistVideo.player.resizeAll(); + },MistVideo.video); + MistVideo.player.resizeAll(); + } + } + + if (MistVideo.player.api) { + //add general setSource function + if ("setSource" in MistVideo.player.api) { + MistVideo.sourceParams = {}; + MistVideo.player.api.setSourceParams = function(url,params){ + //append these params to the current source, overwrite if they already exist + MistUtil.object.extend(MistVideo.sourceParams,params); + + MistVideo.player.api.setSource(MistUtil.http.url.addParam(url,params)); + }; + + //add track selection function + if (!("setTrack" in MistVideo.player.api)) { + MistVideo.player.api.setTracks = function(usetracks){ + + //check tracks exist + var meta = MistUtil.tracks.parse(MistVideo.info.meta.tracks); + for (var i in usetracks) { + if ((i in meta) && ((usetracks[i] in meta[i]) || (usetracks[i] == 0))) { continue; } + MistVideo.log("Skipping trackselection of "+i+" track "+usetracks[i]+" because it does not exist"); + delete usetracks[i]; + } + if (!MistUtil.object.keys(usetracks).length) { return; } + + //create source url + var newurl; + if (MistVideo.source.type == "html5/application/vnd.apple.mpegurl") { //for HLS, use a different format for track selection + newurl = MistVideo.source.url.split("/"); + var m3u8 = newurl.pop(); //take this off now, it will be added back later + var hlstracks = []; + for (var i in usetracks) { + //for audio or video tracks, just add the tracknumber between slashes + switch (i) { + case "audio": + case "video": + if (usetracks[i] == 0) { continue; } + hlstracks.push(usetracks[i]); + break; + } + } + if (hlstracks.length) { newurl.push(hlstracks.join("_")); } + newurl.push(m3u8); //put back index.m3u8 + newurl = newurl.join("/"); + usetracks = {}; + } + else { + newurl = MistVideo.source.url; + } + + var time = MistVideo.player.api.currentTime; + + //actually switch to the new source url + this.setSourceParams(newurl,usetracks); + + //restore video position + var f = function(){ + this.currentTime = time; + this.removeEventListener("loadedmetadata",f); + }; + MistUtil.event.addListener(MistVideo.video,"loadedmetadata",f); + + } + + } + + if (options.setTracks) { + if ("setTrack" in MistVideo.player.api) { + MistVideo.player.onready(function(){ + for (var i in options.setTracks) { + MistVideo.player.api.setTrack(i,options.setTracks[i]); + } + }); + } + else if ("setTracks" in MistVideo.player.api) { + MistVideo.player.onready(function(){ + MistVideo.player.api.setTracks(options.setTracks); + }); + } + } + + } + + } + + for (var i in MistVideo.player.onreadylist) { + MistVideo.player.onreadylist[i](); + } + + MistUtil.event.send("initialized",null,options.target); + MistVideo.log("Initialized"); + if (MistVideo.options.callback) { options.callback(MistVideo); } + + }); + } + else if (MistVideo.options.startCombo) { + //try again without a startCombo + delete MistVideo.options.startCombo; + MistVideo.unload(); + MistVideo = mistPlay(MistVideo.stream,MistVideo.options); + } + else { + MistVideo.showError("No compatible player/source combo found.",{reload:true}); + MistUtil.event.send("initializeFailed",null,options.target); + MistVideo.log("Initialization failed"); + } + } + + MistVideo.calcSize = function(){ + return { + width: 640, + height: 480 + }; + }; + + //load placeholder + MistUtil.empty(MistVideo.options.target); + new MistSkin(MistVideo); + MistVideo.container = new MistUI(MistVideo,MistVideo.skin.structure.placeholder); + MistVideo.options.target.appendChild(MistVideo.container); + MistVideo.container.setAttribute("data-loading",""); + + //listen for changes to the srteam status + //TODO switch to polling-mode if websockets are not supported + if ("WebSocket" in window) { + function openSocket() { + MistVideo.log("Opening stream status stream.."); + var url = MistVideo.options.host.replace(/^http/i,"ws"); + var socket = new WebSocket(MistVideo.urlappend(url+"/json_"+encodeURIComponent(MistVideo.stream)+".js")); + MistVideo.socket = socket; + socket.die = false; + socket.destroy = function(){ + this.die = true; + this.close(); + }; + socket.onopen = function(e){ + this.wasConnected = true; + }; + socket.onclose = function(e){ + if (this.die) { + //it's supposed to go down + return; + } + if (this.wasConnected) { + MistVideo.log("Reopening websocket.."); + openSocket(); + return; + } + var msg = "Connection failed: the media server may be offline."; + MistVideo.showError(msg,{reload:30}); + + if (!MistVideo.info) { + MistUtil.event.send("initializeFailed",null,options.target); + MistVideo.log("Initialization failed"); + } + }; + socket.addEventListener("message",function(e){ + var data = JSON.parse(e.data); + if (!data) { MistVideo.showError("Error while parsing stream status stream. Obtained: "+e.data.toString(),{reload:true}); } + + + if ("error" in data) { + var e = data.error; + if ("on_error" in data) { + MistVideo.log(e); + e = data.on_error; + } + var buttons; + switch (data.error) { + case "Stream is offline": + MistVideo.info = false; + case "Stream is initializing": + case "Stream is booting": + case "Stream is waiting for data": + case "Stream is shutting down": + buttons = {polling:true}; + break; + default: + buttons = {reload:true}; + } + MistVideo.showError(e,buttons); + } + else { + //new metadata object! + //console.log("stream status stream said",data); + + if (!MistVideo.info) { + onStreamInfo(data); + return; + } + + //figure out what changed + + //calculate the changes. note: ignores missing keys in the new data + function difference(a,b) { + if (a == b) { return false; } + if ((typeof a == "object") && (typeof b != "undefined")) { + var results = {}; + for (var i in a) { + + //ignore certain keys for which we don't care about changes + if (MistUtil.array.indexOf(["lastms","hasVideo"],i) >= 0) { continue; } + + var d = difference(a[i],b[i]); + //console.log(i,a[i],b[i],d); + if (d) { + if (d === true) { + results[i] = [a[i],b[i]]; + } + else { + results[i] = d; + } + } + } + //also show keys in b that are not in a + for (var i in b) { + + //ignore certain keys for which we don't care about changes + if (MistUtil.array.indexOf(["lastms","hasVideo"],i) >= 0) { continue; } + + if (!(i in a)) { + results[i] = [a[i],b[i]]; + } + } + + //add this check: [1,2] == [1,2] -> false + if (MistUtil.object.keys(results).length) { return results; } + return false; + } + return true; + } + var diff = difference(data,MistVideo.info); + if (diff) { + //console.log("Difference",diff,data,MistVideo.info); + + if ("source" in diff) { + if ("error" in MistVideo.info) { + MistVideo.reload(); + } + return; + } + + MistVideo.info = MistUtil.object.extend(MistVideo.info,data); + MistVideo.info.updated = new Date(); + + var resized = false; + + for (var i in diff) { + switch (i) { + case "meta": { + for (var j in diff[i]) { + switch (j) { + case "tracks": + //if difference in tracks, recalculate info.hasVideo + MistVideo.info.hasVideo = hasVideo(MistVideo.info); + + //signal track selector to refresh + MistUtil.event.send("metaUpdate_tracks",data,MistVideo.video); + + break; + } + } + break; + } + case "width": + case "height": { + resized = true; + break; + } + } + } + + if (resized) { + //call resize function + MistVideo.player.resize(); + } + + } + else { + MistVideo.log("Metachange: no differences detected"); + } + + } + + }); + } + openSocket(); + } + else { + + //get info + var url = this.urlappend(options.host+"/json_"+encodeURIComponent(this.stream)+".js"); + this.log("Requesting stream info from "+url); + MistUtil.http.get(url,function(d){ + if (MistVideo.destroyed) { return; } + onStreamInfo(JSON.parse(d)); + },function(xhr){ + var msg = "Connection failed (failed to load "+url+")"; + MistVideo.showError(msg,{reload:true}); + MistUtil.event.send("initializeFailed",null,options.target); + MistVideo.log("Initialization failed"); + }); + } + + this.unload = function(){ + if (this.destroyed) { return; } + + this.log("Unloading.."); + this.destroyed = true; + + this.timers.stop("all"); + for (var i in this.errorListeners) { + var listener = this.errorListeners[i]; + if (listener.src in MistUtil.scripts.list) { + var index = MistUtil.array.indexOf(MistUtil.scripts.list[listener.src].subscribers); + if (index >= 0) { + MistUtil.scripts.list[listener.src].subscribers.splice(index,1); + } + } + } + if (("monitor" in MistVideo) && ("destroy" in MistVideo.monitor)) { + MistVideo.monitor.destroy(); + } + if (this.socket) { + this.socket.destroy(); + } + if ((this.player) && (this.player.api)) { + if ("pause" in this.player.api) { this.player.api.pause(); } + if ("setSource" in this.player.api) { + this.player.api.setSource(""); + //this.element.load(); //don't use this.load() to avoid interrupting play/pause + } + if ("unload" in this.player.api) { try { this.player.api.unload(); } catch (e) {} } + } + if ((this.UI) && (this.UI.elements)) { + for (var i in this.UI.elements) { + var e = this.UI.elements[i]; + if (e.parentNode) { + e.parentNode.removeChild(e); + } + } + } + if (this.video) { MistUtil.empty(this.video); } + if ("container" in this) { MistUtil.empty(this.container); delete this.container; } + MistUtil.empty(this.options.target); + delete this.video; + + }; + this.reload = function(){ + var time = ("player" in this && "api" in this.player ? this.player.api.currentTime : false); + + this.unload(); + MistVideo = mistPlay(this.stream,this.options); + + if ((time) && (this.info.type != "live")) { + //after load, try to restore the video position + var f = function(){ + if (MistVideo.player && MistVideo.player.api) { + MistVideo.player.api.currentTime = time; + } + this.removeEventListener("initialized",f); + }; + MistUtil.event.addListener(this.options.target,"initialized",f); + } + + return MistVideo; + }; + this.nextCombo = function(){ + + var time = false; + if (("player" in this) && ("api" in this.player)) { time = this.player.api.currentTime; } + + var startCombo = { + source: this.source.index, + player: this.playerName + }; + if (!this.checkPlayer({startCombo:startCombo},true)) { + //the nextCombo won't yield a result + if (this.checkPlayer({startCombo: false},true)) { + //..but resetting the startcombo would + startCombo = false; + } + else { + return; + } + } + + this.unload(); + var opts = this.options; + opts.startCombo = startCombo; + MistVideo = mistPlay(this.stream,opts); + + if ((time) && (isFinite(time))) { + //after load, try to restore the video position + var f = function(){ + if (("player" in MistVideo) && ("api" in MistVideo.player)) { MistVideo.player.api.currentTime = time; } + this.removeEventListener("initialized",f); + }; + MistUtil.event.addListener(opts.target,"initialized",f); + } + + }; + this.onPlayerBuilt = function(){}; + + if (options.MistVideoObject) { + options.MistVideoObject.reference = this; + } + + return this; +} diff --git a/embed/players/dash.all.min.js b/embed/players/dash.all.min.js index 7346345b..ba3c0665 100644 --- a/embed/players/dash.all.min.js +++ b/embed/players/dash.all.min.js @@ -1,14 +1,32 @@ -/*! v2.4.1-9de5764, 2017-02-01T21:55:06Z */ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c,d){"use strict";var e={};e.encode=function(a){for(var b=[],c=0;c<a.length;++c){var d=a.charCodeAt(c);d<128?b.push(d):d<2048?(b.push(192|d>>6),b.push(128|63&d)):d<65536?(b.push(224|d>>12),b.push(128|63&d>>6),b.push(128|63&d)):(b.push(240|d>>18),b.push(128|63&d>>12),b.push(128|63&d>>6),b.push(128|63&d))}return b},e.decode=function(a){for(var b=[],c=0;c<a.length;){var d=a[c++];d<128||(d<224?(d=(31&d)<<6,d|=63&a[c++]):d<240?(d=(15&d)<<12,d|=(63&a[c++])<<6,d|=63&a[c++]):(d=(7&d)<<18,d|=(63&a[c++])<<12,d|=(63&a[c++])<<6,d|=63&a[c++])),b.push(String.fromCharCode(d))}return b.join("")};var f={};!function(b){var c=function(a){for(var c=0,d=[],e=0|a.length/3;0<e--;){var f=(a[c]<<16)+(a[c+1]<<8)+a[c+2];c+=3,d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push(b.charAt(63&f>>6)),d.push(b.charAt(63&f))}if(2==a.length-c){var f=(a[c]<<16)+(a[c+1]<<8);d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push(b.charAt(63&f>>6)),d.push("=")}else if(1==a.length-c){var f=a[c]<<16;d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push("==")}return d.join("")},d=function(){for(var a=[],c=0;c<b.length;++c)a[b.charCodeAt(c)]=c;return a["=".charCodeAt(0)]=0,a}(),g=function(a){for(var b=0,c=[],e=0|a.length/4;0<e--;){var f=(d[a.charCodeAt(b)]<<18)+(d[a.charCodeAt(b+1)]<<12)+(d[a.charCodeAt(b+2)]<<6)+d[a.charCodeAt(b+3)];c.push(255&f>>16),c.push(255&f>>8),c.push(255&f),b+=4}return c&&("="==a.charAt(b-2)?(c.pop(),c.pop()):"="==a.charAt(b-1)&&c.pop()),c},h={};h.encode=function(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b},h.decode=function(b){for(var c=0;c<s.length;++c)a[c]=String.fromCharCode(a[c]);return a.join("")},f.decodeArray=function(a){var b=g(a);return new Uint8Array(b)},f.encodeASCII=function(a){var b=h.encode(a);return c(b)},f.decodeASCII=function(a){var b=g(a);return h.decode(b)},f.encode=function(a){var b=e.encode(a);return c(b)},f.decode=function(a){var b=g(a);return e.decode(b)}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),"undefined"!=typeof d&&(d.decode=f.decode,d.decodeArray=f.decodeArray)},{}],2:[function(a,b,c){"use strict";!function(a){var b={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},c=function(a){var c=a;return b.hasOwnProperty(a)&&(c=b[a]),String.fromCharCode(c)},d=15,e=32,f={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},g={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},i={25:2,26:4,29:6,30:8,31:10,27:13,28:15},j=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],k={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(a){this.time=a},log:function(a,b){var c=this.verboseFilter[a];this.verboseLevel>=c&&console.log(this.time+" ["+a+"] "+b)}},l=function(a){for(var b=[],c=0;c<a.length;c++)b.push(a[c].toString(16));return b},m=function(a,b,c,d,e){this.foreground=a||"white",this.underline=b||!1,this.italics=c||!1,this.background=d||"black",this.flash=e||!1};m.prototype={reset:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},setStyles:function(a){for(var b=["foreground","underline","italics","background","flash"],c=0;c<b.length;c++){var d=b[c];a.hasOwnProperty(d)&&(this[d]=a[d])}},isDefault:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},equals:function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},copy:function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},toString:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}};var n=function(a,b,c,d,e,f){this.uchar=a||" ",this.penState=new m(b,c,d,e,f)};n.prototype={reset:function(){this.uchar=" ",this.penState.reset()},setChar:function(a,b){this.uchar=a,this.penState.copy(b)},setPenState:function(a){this.penState.copy(a)},equals:function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},copy:function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},isEmpty:function(){return" "===this.uchar&&this.penState.isDefault()}};var o=function(){this.chars=[];for(var a=0;a<e;a++)this.chars.push(new n);this.pos=0,this.currPenState=new m};o.prototype={equals:function(a){for(var b=!0,c=0;c<e;c++)if(!this.chars[c].equals(a.chars[c])){b=!1;break}return b},copy:function(a){for(var b=0;b<e;b++)this.chars[b].copy(a.chars[b])},isEmpty:function(){for(var a=!0,b=0;b<e;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},setCursor:function(a){this.pos!==a&&(this.pos=a),this.pos<0?(k.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>e&&(k.log("ERROR","Too large cursor position "+this.pos),this.pos=e)},moveCursor:function(a){var b=this.pos+a;if(a>1)for(var c=this.pos+1;c<b+1;c++)this.chars[c].setPenState(this.currPenState);this.setCursor(b)},backSpace:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},insertChar:function(a){a>=144&&this.backSpace();var b=c(a);return this.pos>=e?void k.log("ERROR","Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(b,this.currPenState),void this.moveCursor(1))},clearFromPos:function(a){var b;for(b=a;b<e;b++)this.chars[b].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var a=[],b=!0,c=0;c<e;c++){var d=this.chars[c].uchar;" "!==d&&(b=!1),a.push(d)}return b?"":a.join("")},setPenStyles:function(a){this.currPenState.setStyles(a);var b=this.chars[this.pos];b.setPenState(this.currPenState)}};var p=function(){this.rows=[];for(var a=0;a<d;a++)this.rows.push(new o);this.currRow=d-1,this.nrRollUpRows=null,this.reset()};p.prototype={reset:function(){for(var a=0;a<d;a++)this.rows[a].clear();this.currRow=d-1},equals:function(a){for(var b=!0,c=0;c<d;c++)if(!this.rows[c].equals(a.rows[c])){b=!1;break}return b},copy:function(a){for(var b=0;b<d;b++)this.rows[b].copy(a.rows[b])},isEmpty:function(){for(var a=!0,b=0;b<d;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},backSpace:function(){var a=this.rows[this.currRow];a.backSpace()},clearToEndOfRow:function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},insertChar:function(a){var b=this.rows[this.currRow];b.insertChar(a)},setPen:function(a){var b=this.rows[this.currRow];b.setPenStyles(a)},moveCursor:function(a){var b=this.rows[this.currRow];b.moveCursor(a)},setCursor:function(a){k.log("INFO","setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},setPAC:function(a){k.log("INFO","pacData = "+JSON.stringify(a));var b=a.row-1;this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.currRow=b;var c=this.rows[this.currRow];if(null!==a.indent){var d=a.indent,e=Math.max(d-1,0);c.setCursor(a.indent),a.color=c.chars[e].penState.foreground}var f={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(f)},setBkgData:function(a){k.log("INFO","bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},setRollUpRows:function(a){this.nrRollUpRows=a},rollUp:function(){if(null===this.nrRollUpRows)return void k.log("DEBUG","roll_up but nrRollUpRows not set yet");k.log("TEXT",this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),k.log("INFO","Rolling up")},getDisplayText:function(a){a=a||!1;for(var b=[],c="",e=-1,f=0;f<d;f++){var g=this.rows[f].getTextString();g&&(e=f+1,a?b.push("Row "+e+': "'+g+'"'):b.push(g.trim()))}return b.length>0&&(c=a?"["+b.join(" | ")+"]":b.join("\n")),c},getTextAndFormat:function(){return this.rows}};var q=function(a,b){this.chNr=a,this.outputFilter=b,this.mode=null,this.verbose=0,this.displayedMemory=new p,this.nonDisplayedMemory=new p,this.lastOutputScreen=new p,this.currRollUpRow=this.displayedMemory.rows[d-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};q.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[d-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(a){this.outputFilter=a},setPAC:function(a){this.writeScreen.setPAC(a)},setBkgData:function(a){this.writeScreen.setBkgData(a)},setMode:function(a){a!==this.mode&&(this.mode=a,k.log("INFO","MODE="+a),"MODE_POP-ON"==this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a)},insertChars:function(a){for(var b=0;b<a.length;b++)this.writeScreen.insertChar(a[b]);var c=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";k.log("INFO",c+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(k.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},cc_RCL:function(){k.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},cc_BS:function(){k.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},cc_AOF:function(){},cc_AON:function(){},cc_DER:function(){k.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},cc_RU:function(a){k.log("INFO","RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},cc_FON:function(){k.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},cc_RDC:function(){k.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},cc_TR:function(){k.log("INFO","TR"),this.setMode("MODE_TEXT")},cc_RTD:function(){k.log("INFO","RTD"),this.setMode("MODE_TEXT")},cc_EDM:function(){k.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},cc_CR:function(){k.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},cc_ENM:function(){k.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},cc_EOC:function(){if(k.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,k.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()},cc_TO:function(a){k.log("INFO","TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},cc_MIDROW:function(a){var b={flash:!1};if(b.underline=a%2===1,b.italics=a>=46,b.italics)b.foreground="white";else{var c=Math.floor(a/2)-16,d=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=d[c]}k.log("INFO","MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},outputDataUpdate:function(){var a=k.time;null!==a&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(a,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:a):this.cueStartTime=a,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))}};var r=function(a,b,c){this.field=a||1,this.outputs=[b,c],this.channels=[new q(1,b),new q(2,c)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};r.prototype={getHandler:function(a){return this.channels[a].getHandler()},setHandler:function(a,b){this.channels[a].setHandler(b)},addData:function(a,b){var c,d,e,f=!1;this.lastTime=a,k.setTime(a);for(var g=0;g<b.length;g+=2)if(d=127&b[g],e=127&b[g+1],0!==d||0!==e){if(k.log("DATA","["+l([b[g],b[g+1]])+"] -> ("+l([d,e])+")"),c=this.parseCmd(d,e),c||(c=this.parseMidrow(d,e)),c||(c=this.parsePAC(d,e)),c||(c=this.parseBackgroundAttributes(d,e)),!c&&(f=this.parseChars(d,e)))if(this.currChNr&&this.currChNr>=0){var h=this.channels[this.currChNr-1];h.insertChars(f)}else k.log("WARNING","No channel found yet. TEXT-MODE?");c?this.dataCounters.cmd+=2:f?this.dataCounters.char+=2:(this.dataCounters.other+=2,k.log("WARNING","Couldn't parse cleaned data "+l([d,e])+" orig: "+l([b[g],b[g+1]])))}else this.dataCounters.padding+=2},parseCmd:function(a,b){var c=null,d=(20===a||28===a)&&32<=b&&b<=47,e=(23===a||31===a)&&33<=b&&b<=35;if(!d&&!e)return!1;if(a===this.lastCmdA&&b===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,k.log("DEBUG","Repeated command ("+l([a,b])+") is dropped"),!0;c=20===a||23===a?1:2;var f=this.channels[c-1];return 20===a||28===a?32===b?f.cc_RCL():33===b?f.cc_BS():34===b?f.cc_AOF():35===b?f.cc_AON():36===b?f.cc_DER():37===b?f.cc_RU(2):38===b?f.cc_RU(3):39===b?f.cc_RU(4):40===b?f.cc_FON():41===b?f.cc_RDC():42===b?f.cc_TR():43===b?f.cc_RTD():44===b?f.cc_EDM():45===b?f.cc_CR():46===b?f.cc_ENM():47===b&&f.cc_EOC():f.cc_TO(b-32),this.lastCmdA=a,this.lastCmdB=b,this.currChNr=c,!0},parseMidrow:function(a,b){var c=null;if((17===a||25===a)&&32<=b&&b<=47){if(c=17===a?1:2,c!==this.currChNr)return k.log("ERROR","Mismatch channel in midrow parsing"),!1;var d=this.channels[c-1];return d.cc_MIDROW(b),k.log("DEBUG","MIDROW ("+l([a,b])+")"),!0}return!1},parsePAC:function(a,b){var c=null,d=null,e=(17<=a&&a<=23||25<=a&&a<=31)&&64<=b&&b<=127,j=(16===a||24===a)&&64<=b&&b<=95;if(!e&&!j)return!1;if(a===this.lastCmdA&&b===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;c=a<=23?1:2,d=64<=b&&b<=95?1===c?f[a]:h[a]:1===c?g[a]:i[a];var k=this.interpretPAC(d,b),l=this.channels[c-1];return l.setPAC(k),this.lastCmdA=a,this.lastCmdB=b,this.currChNr=c,!0},interpretPAC:function(a,b){var c=b,d={color:null,italics:!1,indent:null,underline:!1,row:a};return c=b>95?b-96:b-64,d.underline=1===(1&c),c<=13?d.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(c/2)]:c<=15?(d.italics=!0,d.color="white"):d.indent=4*Math.floor((c-16)/2),d},parseChars:function(a,b){var d=null,e=null,f=null;if(a>=25?(d=2,f=a-8):(d=1,f=a),17<=f&&f<=19){var g=b;g=17===f?b+80:18===f?b+112:b+144,k.log("INFO","Special char '"+c(g)+"' in channel "+d),e=[g]}else 32<=a&&a<=127&&(e=0===b?[a]:[a,b]);if(e){var h=l(e);k.log("DEBUG","Char codes = "+h.join(",")),this.lastCmdA=null,this.lastCmdB=null}return e},parseBackgroundAttributes:function(a,b){var c,d,e,f,g=(16===a||24===a)&&32<=b&&b<=47,h=(23===a||31===a)&&45<=b&&b<=47;return!(!g&&!h)&&(c={},16===a||24===a?(d=Math.floor((b-32)/2),c.background=j[d],b%2===1&&(c.background=c.background+"_semi")):45===b?c.background="transparent":(c.foreground="black",47===b&&(c.underline=!0)),e=a<24?1:2,f=this.channels[e-1],f.setBkgData(c),this.lastCmdA=null,this.lastCmdB=null,!0)},reset:function(){for(var a=0;a<this.channels.length;a++)this.channels[a]&&this.channels[a].reset();this.lastCmdA=null,this.lastCmdB=null},cueSplitAtTime:function(a){for(var b=0;b<this.channels.length;b++)this.channels[b]&&this.channels[b].cueSplitAtTime(a)}};var s=function(a,b,c){for(var d=0,e=b,f=0,g=[],h=function(a,b,c,d){if(4!==a||b<8)return null;var e=c.getUint8(d),f=c.getUint16(d+1),g=c.getUint32(d+3),h=c.getUint8(d+7);return 181==e&&49==f&&1195456820==g&&3==h};e<b+c;){if(d=a.getUint32(e),f=31&a.getUint8(e+4),6===f)for(var i=e+5,j=-1;i<e+4+d-1;){j=0;for(var k=255;255===k;)k=a.getUint8(i),j+=k,i++;var l=0;for(k=255;255===k;)k=a.getUint8(i),l+=k,i++;h(j,l,a,i)&&g.push([i,l]),i+=l}e+=d+4}return g},t=function(a,b){var c=b[0],d=[[],[]];c+=8;var e=31&a.getUint8(c);c+=2;for(var f=0;f<e;f++){var g=a.getUint8(c),h=4&g,i=3&g;c++;var j=a.getUint8(c);c++;var k=a.getUint8(c);c++,h&&(127&j)+(127&k)!==0&&(0===i?(d[0].push(j),d[0].push(k)):1===i&&(d[1].push(j),d[1].push(k)))}return d};a.logger=k,a.PenState=m,a.CaptionScreen=p,a.Cea608Parser=r,a.findCea608Nalus=s,a.extractCea608DataFromRange=t}("undefined"==typeof c?(void 0).cea608parser={}:c)},{}],3:[function(a,b,c){"use strict";function d(a){var b,c,d;for(b=[],d=0,c=a.length;d<c;d+=1)a[d].isRoot?b.push("root"):b.push(a[d].name);var e=function(a,b){var c;if(null!==a&&null!==b)for(c in a)a.hasOwnProperty(c)&&(b.hasOwnProperty(c)||(b[c]=a[c]))},f=function(a,b,c){var d,f,g,h,i;if(null!==a&&0!==a.length)for(d=0,f=a.length;d<f;d+=1)g=a[d],b.hasOwnProperty(g.name)&&(c.hasOwnProperty(g.name)?g.merge&&(h=b[g.name],i=c[g.name],"object"==typeof h&&"object"==typeof i?e(h,i):null!=g.mergeFunction?c[g.name]=g.mergeFunction(h,i):c[g.name]=h+i):c[g.name]=b[g.name])},g=function a(b,c){var d,e,g,h,i,j,k,l=b;if(null!==l.children&&0!==l.children.length)for(d=0,e=l.children.length;d<e;d+=1)if(j=l.children[d],c.hasOwnProperty(j.name))if(j.isArray)for(i=c[j.name+"_asArray"],g=0,h=i.length;g<h;g+=1)k=i[g],f(l.properties,c,k),a(j,k);else k=c[j.name],f(l.properties,c,k),a(j,k)},h=function c(d){var e,f,h,i,j,k,l;if(null===d)return d;if("object"!=typeof d)return d;for(e=0,f=b.length;e<f;e+=1)"root"===b[e]&&(j=a[e],k=d,g(j,k));for(i in d)if(d.hasOwnProperty(i)&&"__children"!=i){if(h=b.indexOf(i),h!==-1)if(j=a[h],j.isArray)for(l=d[i+"_asArray"],e=0,f=l.length;e<f;e+=1)k=l[e],g(j,k);else k=d[i],g(j,k);c(d[i])}return d};return{run:h}}Object.defineProperty(c,"__esModule",{value:!0}),c.default=d,b.exports=c.default},{}],4:[function(a,b,c){"use strict";function d(a){function b(){void 0===a.escapeMode&&(a.escapeMode=!0),void 0===a.attributePrefix&&(a.attributePrefix="_"),a.arrayAccessForm=a.arrayAccessForm||"none",a.emptyNodeForm=a.emptyNodeForm||"text",void 0===a.enableToStringFunc&&(a.enableToStringFunc=!0),a.arrayAccessFormPaths=a.arrayAccessFormPaths||[],void 0===a.skipEmptyTextNodesForObj&&(a.skipEmptyTextNodesForObj=!0),void 0===a.stripWhitespaces&&(a.stripWhitespaces=!0),a.datetimeAccessFormPaths=a.datetimeAccessFormPaths||[],void 0===a.useDoubleQuotes&&(a.useDoubleQuotes=!1),a.xmlElementsFilter=a.xmlElementsFilter||[],a.jsonPropertiesFilter=a.jsonPropertiesFilter||[],void 0===a.keepCData&&(a.keepCData=!1),void 0===a.ignoreRoot&&(a.ignoreRoot=!1)}function c(){}function d(a){var b=a.localName;return null==b&&(b=a.baseName),null!=b&&""!=b||(b=a.nodeName),b}function e(a){return a.prefix}function f(a){return"string"==typeof a?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):a}function g(a,b,c,d){for(var e=0;e<a.length;e++){var f=a[e];if("string"==typeof f){if(f==d)break}else if(f instanceof RegExp){if(f.test(d))break}else if("function"==typeof f&&f(b,c,d))break}return e!=a.length}function h(b,c,d){switch(a.arrayAccessForm){case"property":b[c]instanceof Array?b[c+"_asArray"]=b[c]:b[c+"_asArray"]=[b[c]]}!(b[c]instanceof Array)&&a.arrayAccessFormPaths.length>0&&g(a.arrayAccessFormPaths,b,c,d)&&(b[c]=[b[c]])}function i(a){var b=a.split(/[-T:+Z]/g),c=new Date(b[0],b[1]-1,b[2]),d=b[5].split(".");if(c.setHours(b[3],b[4],d[0]),d.length>1&&c.setMilliseconds(d[1]),b[6]&&b[7]){var e=60*b[6]+Number(b[7]),f=/\d\d-\d\d:\d\d$/.test(a)?"-":"+";e=0+("-"==f?-1*e:e),c.setMinutes(c.getMinutes()-e-c.getTimezoneOffset())}else a.indexOf("Z",a.length-1)!==-1&&(c=new Date(Date.UTC(c.getFullYear(),c.getMonth(),c.getDate(),c.getHours(),c.getMinutes(),c.getSeconds(),c.getMilliseconds())));return c}function j(b,c,d){if(a.datetimeAccessFormPaths.length>0){var e=d.split(".#")[0];return g(a.datetimeAccessFormPaths,b,c,e)?i(b):b}return b}function k(b,c,d,e){return!(c==z.ELEMENT_NODE&&a.xmlElementsFilter.length>0)||g(a.xmlElementsFilter,b,d,e)}function l(b,c){if(b.nodeType==z.DOCUMENT_NODE){for(var f=new Object,g=b.childNodes,i=0;i<g.length;i++){var m=g.item(i);if(m.nodeType==z.ELEMENT_NODE)if(a.ignoreRoot)f=l(m);else{f={};var n=d(m);f[n]=l(m)}}return f}if(b.nodeType==z.ELEMENT_NODE){var f=new Object;f.__cnt=0;for(var o=[],g=b.childNodes,i=0;i<g.length;i++){var m=g.item(i),n=d(m);if(m.nodeType!=z.COMMENT_NODE){var p=c+"."+n;if(k(f,m.nodeType,n,p))if(f.__cnt++,null==f[n]){var q=l(m,p);if("#text"!=n||/[^\s]/.test(q)){var r={};r[n]=q,o.push(r)}f[n]=q,h(f,n,p)}else{null!=f[n]&&(f[n]instanceof Array||(f[n]=[f[n]],h(f,n,p)));var q=l(m,p);if("#text"!=n||/[^\s]/.test(q)){var r={};r[n]=q,o.push(r)}f[n][f[n].length]=q}}}f.__children=o;for(var s=d(b),t=0;t<b.attributes.length;t++){var u=b.attributes.item(t);f.__cnt++;for(var v=u.value,w=0,x=a.matchers.length;w<x;w++){var y=a.matchers[w];y.test(u,s)&&(v=y.converter(u.value))}f[a.attributePrefix+u.name]=v}var A=e(b);return null!=A&&""!=A&&(f.__cnt++,f.__prefix=A),null!=f["#text"]&&(f.__text=f["#text"],f.__text instanceof Array&&(f.__text=f.__text.join("\n")),a.stripWhitespaces&&(f.__text=f.__text.trim()),delete f["#text"],"property"==a.arrayAccessForm&&delete f["#text_asArray"],f.__text=j(f.__text,n,c+"."+n)),null!=f["#cdata-section"]&&(f.__cdata=f["#cdata-section"],delete f["#cdata-section"],"property"==a.arrayAccessForm&&delete f["#cdata-section_asArray"]),0==f.__cnt&&"text"==a.emptyNodeForm?f="":1==f.__cnt&&null!=f.__text?f=f.__text:1!=f.__cnt||null==f.__cdata||a.keepCData?f.__cnt>1&&null!=f.__text&&a.skipEmptyTextNodesForObj&&(a.stripWhitespaces&&""==f.__text||""==f.__text.trim())&&delete f.__text:f=f.__cdata,delete f.__cnt,!a.enableToStringFunc||null==f.__text&&null==f.__cdata||(f.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),f}if(b.nodeType==z.TEXT_NODE||b.nodeType==z.CDATA_SECTION_NODE)return b.nodeValue}function m(b,c,d,e){var g="<"+(null!=b&&null!=b.__prefix?b.__prefix+":":"")+c;if(null!=d)for(var h=0;h<d.length;h++){var i=d[h],j=b[i];a.escapeMode&&(j=f(j)),g+=" "+i.substr(a.attributePrefix.length)+"=",g+=a.useDoubleQuotes?'"'+j+'"':"'"+j+"'"}return g+=e?"/>":">"}function n(a,b){return"</"+(null!=a.__prefix?a.__prefix+":":"")+b+">"}function o(a,b){return a.indexOf(b,a.length-b.length)!==-1}function p(b,c){return!!("property"==a.arrayAccessForm&&o(c.toString(),"_asArray")||0==c.toString().indexOf(a.attributePrefix)||0==c.toString().indexOf("__")||b[c]instanceof Function)}function q(a){var b=0;if(a instanceof Object)for(var c in a)p(a,c)||b++;return b}function r(b,c,d){return 0==a.jsonPropertiesFilter.length||""==d||g(a.jsonPropertiesFilter,b,c,d)}function s(b){var c=[];if(b instanceof Object)for(var d in b)d.toString().indexOf("__")==-1&&0==d.toString().indexOf(a.attributePrefix)&&c.push(d);return c}function t(b){var c="";return null!=b.__cdata&&(c+="<![CDATA["+b.__cdata+"]]>"),null!=b.__text&&(c+=a.escapeMode?f(b.__text):b.__text),c}function u(b){var c="";return b instanceof Object?c+=t(b):null!=b&&(c+=a.escapeMode?f(b):b),c}function v(a,b){return""===a?b:a+"."+b}function w(a,b,c,d){var e="";if(0==a.length)e+=m(a,b,c,!0);else for(var f=0;f<a.length;f++)e+=m(a[f],b,s(a[f]),!1),e+=x(a[f],v(d,b)),e+=n(a[f],b);return e}function x(a,b){var c="",d=q(a);if(d>0)for(var e in a)if(!p(a,e)&&(""==b||r(a,e,v(b,e)))){var f=a[e],g=s(f);if(null==f||void 0==f)c+=m(f,e,g,!0);else if(f instanceof Object)if(f instanceof Array)c+=w(f,e,g,b);else if(f instanceof Date)c+=m(f,e,g,!1),c+=f.toISOString(),c+=n(f,e);else{var h=q(f);h>0||null!=f.__text||null!=f.__cdata?(c+=m(f,e,g,!1),c+=x(f,v(b,e)),c+=n(f,e)):c+=m(f,e,g,!0)}else c+=m(f,e,g,!1),c+=u(f),c+=n(f,e)}return c+=u(a)}var y="1.2.0";a=a||{},b(),c();var z={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};this.parseXmlString=function(a){var b=window.ActiveXObject||"ActiveXObject"in window;if(void 0===a)return null;var c;if(window.DOMParser){var d=new window.DOMParser,e=null;if(!b)try{e=d.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(f){e=null}try{c=d.parseFromString(a,"text/xml"),null!=e&&c.getElementsByTagNameNS(e,"parsererror").length>0&&(c=null)}catch(f){c=null}}else 0==a.indexOf("<?")&&(a=a.substr(a.indexOf("?>")+2)),c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(a);return c},this.asArray=function(a){return void 0===a||null==a?[]:a instanceof Array?a:[a]},this.toXmlDateTime=function(a){return a instanceof Date?a.toISOString():"number"==typeof a?new Date(a).toISOString():null},this.asDateTime=function(a){return"string"==typeof a?i(a):a},this.xml2json=function(a){return l(a)},this.xml_str2json=function(a){var b=this.parseXmlString(a);return null!=b?this.xml2json(b):null},this.json2xml_str=function(a){return x(a,"")},this.json2xml=function(a){var b=this.json2xml_str(a);return this.parseXmlString(b)},this.getVersion=function(){return y}}Object.defineProperty(c,"__esModule",{value:!0}),c.default=d,b.exports=c.default},{}],5:[function(a,b,c){(function(b){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}Object.defineProperty(c,"__esModule",{value:!0});var e=a(52),f=d(e),g=a(107),h=d(g),i=a(76),j=d(i),k=a(54),l=d(k),m=a(11),n="undefined"!=typeof window&&window||b,o=n.dashjs;o||(o=n.dashjs={}),o.MediaPlayer=f.default,o.Protection=h.default,o.MetricsReporting=j.default,o.MediaPlayerFactory=l.default,o.Version=(0,m.getVersionString)(),c.default=o,c.MediaPlayer=f.default,c.Protection=h.default,c.MetricsReporting=j.default,c.MediaPlayerFactory=l.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{107:107,11:11,52:52,54:54,76:76}],6:[function(a,b,c){/*! codem-isoboxer v0.2.7 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */ -var d={};d.parseBuffer=function(a){return new e(a).parse()},d.addBoxParser=function(a,b){"string"==typeof a&&"function"==typeof b&&(f.prototype._boxParsers[a]=b)},d.Utils={},d.Utils.dataViewToString=function(a,b){var c=b||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(c).decode(a);var d=[],e=0;if("utf-8"===c)for(;e<a.byteLength;){var f=a.getUint8(e++);f<128||(f<224?(f=(31&f)<<6,f|=63&a.getUint8(e++)):f<240?(f=(15&f)<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++)):(f=(7&f)<<18,f|=(63&a.getUint8(e++))<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++))),d.push(String.fromCharCode(f))}else for(;e<a.byteLength;)d.push(String.fromCharCode(a.getUint8(e++)));return d.join("")},"undefined"!=typeof c&&(c.parseBuffer=d.parseBuffer,c.addBoxParser=d.addBoxParser,c.Utils=d.Utils),d.Cursor=function(a){this.offset="undefined"==typeof a?0:a};var e=function(a){this._raw=new DataView(a),this._cursor=new d.Cursor,this.boxes=[]};e.prototype.fetch=function(a){var b=this.fetchAll(a,!0);return b.length?b[0]:null},e.prototype.fetchAll=function(a,b){var c=[];return e._sweep.call(this,a,c,b),c},e.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var a=f.parse(this);if("undefined"==typeof a.type)break;this.boxes.push(a)}return this},e._sweep=function(a,b,c){this.type&&this.type==a&&b.push(this);for(var d in this.boxes){if(b.length&&c)return;e._sweep.call(this.boxes[d],a,b,c)}};var f=function(){this._cursor=new d.Cursor};f.parse=function(a){var b=new f;return b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,b._parseBox(),a._cursor.offset=b._raw.byteOffset+b._raw.byteLength,b},f.prototype._readInt=function(a){var b=null;switch(a){case 8:b=this._raw.getInt8(this._cursor.offset-this._raw.byteOffset);break;case 16:b=this._raw.getInt16(this._cursor.offset-this._raw.byteOffset);break;case 32:b=this._raw.getInt32(this._cursor.offset-this._raw.byteOffset);break;case 64:var c=this._raw.getInt32(this._cursor.offset-this._raw.byteOffset),d=this._raw.getInt32(this._cursor.offset-this._raw.byteOffset+4);b=c*Math.pow(2,32)+d}return this._cursor.offset+=a>>3,b},f.prototype._readUint=function(a){var b=null;switch(a){case 8:b=this._raw.getUint8(this._cursor.offset-this._raw.byteOffset);break;case 16:b=this._raw.getUint16(this._cursor.offset-this._raw.byteOffset);break;case 24:var c=this._raw.getUint16(this._cursor.offset-this._raw.byteOffset),d=this._raw.getUint8(this._cursor.offset-this._raw.byteOffset+2);b=(c<<8)+d;break;case 32:b=this._raw.getUint32(this._cursor.offset-this._raw.byteOffset);break;case 64:var c=this._raw.getUint32(this._cursor.offset-this._raw.byteOffset),d=this._raw.getUint32(this._cursor.offset-this._raw.byteOffset+4);b=c*Math.pow(2,32)+d}return this._cursor.offset+=a>>3,b},f.prototype._readString=function(a){for(var b="",c=0;c<a;c++){var d=this._readUint(8);b+=String.fromCharCode(d)}return b},f.prototype._readTerminatedString=function(){for(var a="";this._cursor.offset-this._offset<this._raw.byteLength;){var b=this._readUint(8);if(0==b)break;a+=String.fromCharCode(b)}return a},f.prototype._readTemplate=function(a){var b=this._readUint(a/2),c=this._readUint(a/2);return b+c/Math.pow(2,a/2)},f.prototype._parseBox=function(){if(this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)return void(this._root._incomplete=!0);switch(this.size=this._readUint(32),this.type=this._readString(4),1==this.size&&(this.largesize=this._readUint(64)),"uuid"==this.type&&(this.usertype=this._readString(16)),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}!this._incomplete&&this._boxParsers[this.type]&&this._boxParsers[this.type].call(this)},f.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},f.prototype._boxParsers={},f.prototype._boxParsers.avc1=function(){this.version=this._readUint(16),this.revision_level=this._readUint(16),this.vendor=this._readUint(32),this.temporal_quality=this._readUint(32),this.spatial_quality=this._readUint(32),this.width=this._readUint(16),this.height=this._readUint(16),this.horizontal_resolution=this._readUint(32),this.vertical_resolution=this._readUint(32),this.data_size=this._readUint(32),this.frame_count=this._readUint(16),this.compressor_name=this._readUint(32),this.depth=this._readUint(16),this.color_table_id=this._readUint(16)},["moov","trak","tref","mdia","minf","stbl","edts","dinf","mvex","moof","traf","mfra","udta","meco","strk","vttc"].forEach(function(a){f.prototype._boxParsers[a]=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(f.parse(this))}}),f.prototype._boxParsers.elst=function(){this._parseFullBox(),this.entry_count=this._readUint(32),this.entries=[];for(var a=1;a<=this.entry_count;a++){var b={};1==this.version?(b.segment_duration=this._readUint(64),b.media_time=this._readInt(64)):(b.segment_duration=this._readUint(32),b.media_time=this._readInt(32)),b.media_rate_integer=this._readInt(16),b.media_rate_fraction=this._readInt(16),this.entries.push(b)}},f.prototype._boxParsers.emsg=function(){this._parseFullBox(),this.scheme_id_uri=this._readTerminatedString(),this.value=this._readTerminatedString(),this.timescale=this._readUint(32),this.presentation_time_delta=this._readUint(32),this.event_duration=this._readUint(32),this.id=this._readUint(32),this.message_data=new DataView(this._raw.buffer,this._cursor.offset,this._raw.byteLength-(this._cursor.offset-this._offset))},f.prototype._boxParsers.free=f.prototype._boxParsers.skip=function(){this.data=new DataView(this._raw.buffer,this._cursor.offset,this._raw.byteLength-(this._cursor.offset-this._offset))},f.prototype._boxParsers.ftyp=f.prototype._boxParsers.styp=function(){for(this.major_brand=this._readString(4),this.minor_versions=this._readUint(32),this.compatible_brands=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.compatible_brands.push(this._readString(4))},f.prototype._boxParsers.hdlr=function(){this._parseFullBox(),this.pre_defined=this._readUint(32),this.handler_type=this._readString(4),this.reserved=[this._readUint(32),this._readUint(32),this._readUint(32)],this.name=this._readTerminatedString()},f.prototype._boxParsers.mdat=function(){this.data=new DataView(this._raw.buffer,this._cursor.offset,this._raw.byteLength-(this._cursor.offset-this._offset))},f.prototype._boxParsers.mdhd=function(){this._parseFullBox(),1==this.version?(this.creation_time=this._readUint(64),this.modification_time=this._readUint(64),this.timescale=this._readUint(32),this.duration=this._readUint(64)):(this.creation_time=this._readUint(32),this.modification_time=this._readUint(32),this.timescale=this._readUint(32),this.duration=this._readUint(32));var a=this._readUint(16);this.pad=a>>15,this.language=String.fromCharCode((a>>10&31)+96,(a>>5&31)+96,(31&a)+96),this.pre_defined=this._readUint(16)},f.prototype._boxParsers.mehd=function(){this._parseFullBox(),1==this.version?this.fragment_duration=this._readUint(64):this.fragment_duration=this._readUint(32)},f.prototype._boxParsers.mfhd=function(){this._parseFullBox(),this.sequence_number=this._readUint(32)},f.prototype._boxParsers.mfro=function(){this._parseFullBox(),this.mfra_size=this._readUint(32)},f.prototype._boxParsers.mp4a=function(){this.reserved1=[this._readUint(32),this._readUint(32)],this.channelcount=this._readUint(16),this.samplesize=this._readUint(16),this.pre_defined=this._readUint(16),this.reserved2=this._readUint(16),this.sample_rate=this._readUint(32)},f.prototype._boxParsers.mvhd=function(){this._parseFullBox(),1==this.version?(this.creation_time=this._readUint(64),this.modification_time=this._readUint(64),this.timescale=this._readUint(32),this.duration=this._readUint(64)):(this.creation_time=this._readUint(32),this.modification_time=this._readUint(32),this.timescale=this._readUint(32),this.duration=this._readUint(32)),this.rate=this._readTemplate(32),this.volume=this._readTemplate(16),this.reserved1=this._readUint(16),this.reserved2=[this._readUint(32),this._readUint(32)],this.matrix=[];for(var a=0;a<9;a++)this.matrix.push(this._readTemplate(32));this.pre_defined=[];for(var a=0;a<6;a++)this.pre_defined.push(this._readUint(32));this.next_track_ID=this._readUint(32)},f.prototype._boxParsers.payl=function(){var a=new DataView(this._raw.buffer,this._cursor.offset,this._raw.byteLength-(this._cursor.offset-this._offset));this.cue_text=d.Utils.dataViewToString(a)},f.prototype._boxParsers.sidx=function(){this._parseFullBox(),this.reference_ID=this._readUint(32),this.timescale=this._readUint(32),0==this.version?(this.earliest_presentation_time=this._readUint(32),this.first_offset=this._readUint(32)):(this.earliest_presentation_time=this._readUint(64),this.first_offset=this._readUint(64)),this.reserved=this._readUint(16),this.reference_count=this._readUint(16),this.references=[];for(var a=0;a<this.reference_count;a++){var b={},c=this._readUint(32);b.reference_type=c>>31&1,b.referenced_size=2147483647&c,b.subsegment_duration=this._readUint(32);var d=this._readUint(32);b.starts_with_SAP=d>>31&1,b.SAP_type=d>>28&7,b.SAP_delta_time=268435455&d,this.references.push(b)}},f.prototype._boxParsers.ssix=function(){this._parseFullBox(),this.subsegment_count=this._readUint(32),this.subsegments=[];for(var a=0;a<this.subsegment_count;a++){var b={};b.ranges_count=this._readUint(32),b.ranges=[];for(var c=0;c<b.ranges_count;c++){var d={};d.level=this._readUint(8),d.range_size=this._readUint(24),b.ranges.push(d)}this.subsegments.push(b)}},f.prototype._boxParsers.stsd=function(){this._parseFullBox(),this.entry_count=this._readUint(32),this.entries=[];for(var a=0;a<this.entry_count;a++)this.entries.push(f.parse(this))},f.prototype._boxParsers.subs=function(){this._parseFullBox(),this.entry_count=this._readUint(32),this.samples_with_subsamples=[];for(var a=0,b=0;b<this.entry_count;b++){var c=this._readUint(32);a+=c;var d=this._readUint(16);if(d>0){for(var e={nr:a,subsamples:[]},f=0;f<d;f++){var g={};1&this.version?g.size=this._readUint(32):g.size=this._readUint(16),g.priority=this._readUint(8),g.discardable=this._readUint(8),g.codec_specific_parameters=this._readUint(32),e.subsamples.push(g)}this.samples_with_subsamples.push(e)}}},f.prototype._boxParsers.tfdt=function(){this._parseFullBox(),1==this.version?this.baseMediaDecodeTime=this._readUint(64):this.baseMediaDecodeTime=this._readUint(32)},f.prototype._boxParsers.tfhd=function(){this._parseFullBox(),this.track_ID=this._readUint(32),1&this.flags&&(this.base_data_offset=this._readUint(64)),2&this.flags&&(this.sample_description_offset=this._readUint(32)),8&this.flags&&(this.default_sample_duration=this._readUint(32)),16&this.flags&&(this.default_sample_size=this._readUint(32)),32&this.flags&&(this.default_sample_flags=this._readUint(32))},f.prototype._boxParsers.tfra=function(){this._parseFullBox(),this.track_ID=this._readUint(32),this._packed=this._readUint(32),this.reserved=this._packed>>>6,this.length_size_of_traf_num=(this._packed&&0xffff00000000)>>>4,this.length_size_of_trun_num=(this._packed&&4294901760)>>>2,this.length_size_of_sample_num=this._packed&&255,this.number_of_entry=this._readUint(32),this.entries=[];for(var a=0;a<this.number_of_entry;a++){var b={};1==this.version?(b.time=this._readUint(64),b.moof_offset=this._readUint(64)):(b.time=this._readUint(32),b.moof_offset=this._readUint(32)),b.traf_number=this._readUint(8*(this.length_size_of_traf_num+1)),b.trun_number=this._readUint(8*(this.length_size_of_trun_num+1)),b.sample_number=this._readUint(8*(this.length_size_of_sample_num+1)),this.entries.push(b)}},f.prototype._boxParsers.tkhd=function(){this._parseFullBox(),1==this.version?(this.creation_time=this._readUint(64),this.modification_time=this._readUint(64),this.track_ID=this._readUint(32),this.reserved1=this._readUint(32),this.duration=this._readUint(64)):(this.creation_time=this._readUint(32),this.modification_time=this._readUint(32),this.track_ID=this._readUint(32),this.reserved1=this._readUint(32),this.duration=this._readUint(32)),this.reserved2=[this._readUint(32),this._readUint(32)],this.layer=this._readUint(16),this.alternate_group=this._readUint(16),this.volume=this._readTemplate(16),this.reserved3=this._readUint(16),this.matrix=[];for(var a=0;a<9;a++)this.matrix.push(this._readTemplate(32));this.width=this._readUint(32),this.height=this._readUint(32)},f.prototype._boxParsers.trex=function(){this._parseFullBox(),this.track_ID=this._readUint(32),this.default_sample_description_index=this._readUint(32),this.default_sample_duration=this._readUint(32),this.default_sample_size=this._readUint(32),this.default_sample_flags=this._readUint(32)},f.prototype._boxParsers.trun=function(){this._parseFullBox(),this.sample_count=this._readUint(32),1&this.flags&&(this.data_offset=this._readInt(32)),4&this.flags&&(this.first_sample_flags=this._readUint(32)),this.samples=[];for(var a=0;a<this.sample_count;a++){var b={};256&this.flags&&(b.sample_duration=this._readUint(32)),512&this.flags&&(b.sample_size=this._readUint(32)),1024&this.flags&&(b.sample_flags=this._readUint(32)),2048&this.flags&&(0==this.version?b.sample_composition_time_offset=this._readUint(32):b.sample_composition_time_offset=this._readInt(32)),this.samples.push(b)}},f.prototype._boxParsers.vlab=function(){var a=new DataView(this._raw.buffer,this._cursor.offset,this._raw.byteLength-(this._cursor.offset-this._offset));this.source_label=d.Utils.dataViewToString(a)},f.prototype._boxParsers.vttC=function(){var a=new DataView(this._raw.buffer,this._cursor.offset,this._raw.byteLength-(this._cursor.offset-this._offset));this.config=d.Utils.dataViewToString(a)},f.prototype._boxParsers.vtte=function(){}},{}],7:[function(a,b,c){var d=c.decimalAdjust=function(a,b,c){return"undefined"==typeof c||0===+c?Math[a](b):(b=+b,c=+c,isNaN(b)||"number"!=typeof c||c%1!==0?NaN:(b=b.toString().split("e"),b=Math[a](+(b[0]+"e"+(b[1]?+b[1]-c:-c))),b=b.toString().split("e"),+(b[0]+"e"+(b[1]?+b[1]+c:c))))};b.exports={round10:function(a,b){return d("round",a,b)},floor10:function(a,b){return d("floor",a,b)},ceil10:function(a,b){return d("ceil",a,b)}},b.exports.polyfill=function(){Math.round10||(Math.round10=b.exports.round10),Math.floor10||(Math.floor10=b.exports.floor10),Math.ceil10||(Math.ceil10=b.exports.ceil10)}},{}],8:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){k=!0,l=!0,m=(new Date).getTime()}function b(a){l=a}function c(a){k=a}function d(){return k}function e(){var a="",b=null;l&&(b=(new Date).getTime(),a+="["+(b-m)+"]"),a.length>0&&(a+=" "),Array.apply(null,arguments).forEach(function(b){a+=b+" "}),k&&console.log(a),h.trigger(i.default.LOG,{message:a})}var f=this.context,h=(0,g.default)(f).getInstance(),j=void 0,k=void 0,l=void 0,m=void 0;return j={log:e,setLogTimestampVisible:b,setLogToBrowserConsole:c,getLogToBrowserConsole:d},a(),j}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j);e.__dashjs_factory_name="Debug",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,9:9}],9:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b,c){var e=arguments.length<=3||void 0===arguments[3]?h:arguments[3];if(!a)throw new Error("event type cannot be null or undefined");if(!b||"function"!=typeof b)throw new Error("listener must be a function: "+b);if(!(d(a,b,c)>=0)){f[a]=f[a]||[];var g={callback:b,scope:c,priority:e},i=f[a].some(function(b,c){if(e>b.priority)return f[a].splice(c,0,g),!0});i||f[a].push(g)}}function b(a,b,c){if(a&&b&&f[a]){var e=d(a,b,c);e<0||f[a].splice(e,1)}}function c(a,b){if(a&&f[a]){if(b=b||{},b.hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");b.type=a,f[a].forEach(function(a){return a.callback.call(a.scope,b)})}}function d(a,b,c){var d=-1;return f[a]?(f[a].some(function(a,e){if(a.callback===b&&(!c||c===a.scope))return d=e,!0}),d):d}function e(){f={}}var f={},g={on:a,off:b,trigger:c,reset:e};return g}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=0,i=5e3;e.__dashjs_factory_name="EventBus";var j=g.default.getSingletonFactory(e);j.EVENT_PRIORITY_LOW=h,j.EVENT_PRIORITY_HIGH=i,c.default=j,b.exports=c.default},{10:10}],10:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d=function(){function a(a,b,c,d){var e=g(d);!e[a]&&b&&(e[a]={instance:b,override:c})}function b(a,b){for(var c in j){var d=j[c];if(d.context===a&&d.name===b)return d.instance}return null}function c(a,b,c){for(var d in j){var e=j[d];if(e.context===a&&e.name===b)return void(j[d].instance=c)}j.push({name:b,context:a,instance:c})}function d(a){return function(b){return void 0===b&&(b={}),{create:function(){return f(a.__dashjs_factory_name,a.apply({context:b},arguments),b,arguments)}}}}function e(a){return function(c){var d=void 0;return void 0===c&&(c={}),{getInstance:function(){return d||(d=b(c,a.__dashjs_factory_name)),d||(d=f(a.__dashjs_factory_name,a.apply({context:c},arguments),c,arguments),j.push({name:a.__dashjs_factory_name,context:c,instance:d})),d}}}}function f(a,b,c,d){var e=g(c),f=e[a];if(f){var i=f.instance;if(!f.override)return i.apply({context:c,factory:h},d);i=i.apply({context:c,factory:h,parent:b},d);for(var j in i)b.hasOwnProperty(j)&&(b[j]=i[j])}return b}function g(a){var b=void 0;return i.forEach(function(c){c===a&&(b=c)}),b||(b=i.push(a)),b}var h=void 0,i=[],j=[];return h={extend:a,getSingletonInstance:b,setSingletonInstance:c,getSingletonFactory:e,getClassFactory:d}}();c.default=d,b.exports=c.default},{}],11:[function(a,b,c){"use strict";function d(){return e}Object.defineProperty(c,"__esModule",{value:!0}),c.getVersionString=d;var e="2.4.1"},{}],12:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(14),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.BUFFERING_COMPLETED="bufferingCompleted",this.BUFFER_CLEARED="bufferCleared",this.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",this.BYTES_APPENDED="bytesAppended",this.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",this.CURRENT_TRACK_CHANGED="currentTrackChanged",this.DATA_UPDATE_COMPLETED="dataUpdateCompleted",this.DATA_UPDATE_STARTED="dataUpdateStarted",this.INITIALIZATION_LOADED="initializationLoaded",this.INIT_FRAGMENT_LOADED="initFragmentLoaded",this.INIT_REQUESTED="initRequested",this.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",this.LIVE_EDGE_SEARCH_COMPLETED="liveEdgeSearchCompleted",this.LOADING_COMPLETED="loadingCompleted",this.LOADING_PROGRESS="loadingProgress",this.MANIFEST_UPDATED="manifestUpdated",this.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",this.QUOTA_EXCEEDED="quotaExceeded",this.REPRESENTATION_UPDATED="representationUpdated",this.SEGMENTS_LOADED="segmentsLoaded",this.SERVICE_LOCATION_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",this.SOURCEBUFFER_APPEND_COMPLETED="sourceBufferAppendCompleted",this.SOURCEBUFFER_REMOVE_COMPLETED="sourceBufferRemoveCompleted",this.STREAMS_COMPOSED="streamsComposed",this.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",this.STREAM_COMPLETED="streamCompleted",this.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",this.TIMED_TEXT_REQUESTED="timedTextRequested",this.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",this.URL_RESOLUTION_FAILED="urlResolutionFailed",this.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",this.XLINK_ELEMENT_LOADED="xlinkElementLoaded",this.XLINK_READY="xlinkReady"}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{14:14}],13:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(12),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).apply(this,arguments)}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{12:12}],14:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a)}return e(a,[{key:"extend",value:function(a,b){if(a){var c=!!b&&b.override,d=!!b&&b.publicOnly;for(var e in a)!a.hasOwnProperty(e)||this[e]&&!c||d&&a[e].indexOf("public_")===-1||(this[e]=a[e])}}}]),a}();c.default=f,b.exports=c.default},{}],15:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function e(a){return a&&a.__esModule?a:{default:a}}function f(){function a(a){a&&a.dashManifestModel&&(I=a.dashManifestModel)}function b(){J=[],K={}}function c(a,b){return b.getRepresentationForQuality(a.quality)}function d(a){return K?K[a.streamInfo.id][a.index]:null}function e(a){for(var b=J.length,c=0;c<b;c++){var d=J[c];if(a.id===d.id)return d}return null}function f(a,b){var c=new h.default,d=b.adaptation.period.mpd.manifest.Period_asArray[b.adaptation.period.index].AdaptationSet_asArray[b.adaptation.index],e=I.getRepresentationFor(b.index,d);return c.id=b.id,c.quality=b.index,c.bandwidth=I.getBandwidth(e),c.DVRWindow=b.segmentAvailabilityRange,c.fragmentDuration=b.segmentDuration||(b.segments&&b.segments.length>0?b.segments[0].duration:NaN),c.MSETimeOffset=b.MSETimeOffset,c.useCalculatedLiveEdgeTime=b.useCalculatedLiveEdgeTime,c.mediaInfo=g(a,b.adaptation),c}function g(a,b){var c,d=new j.default,e=b.period.mpd.manifest.Period_asArray[b.period.index].AdaptationSet_asArray[b.index];return d.id=b.id,d.index=b.index,d.type=b.type,d.streamInfo=k(a,b.period),d.representationCount=I.getRepresentationCount(e),d.lang=I.getLanguageForAdaptation(e),c=I.getViewpointForAdaptation(e),d.viewpoint=c?c.value:void 0,d.accessibility=I.getAccessibilityForAdaptation(e).map(function(a){var b=a.value,c=b;return a.schemeIdUri&&a.schemeIdUri.search("cea-608")>=0&&"undefined"!=typeof t.default&&(c=b?"cea-608:"+b:"cea-608",d.embeddedCaptions=!0),c}),d.audioChannelConfiguration=I.getAudioChannelConfigurationForAdaptation(e).map(function(a){return a.value}),d.roles=I.getRolesForAdaptation(e).map(function(a){return a.value}),d.codec=I.getCodec(e),d.mimeType=I.getMimeType(e),d.contentProtection=I.getContentProtectionData(e),d.bitrateList=I.getBitrateListForAdaptation(e),d.contentProtection&&d.contentProtection.forEach(function(a){a.KID=I.getKID(a)}),d.isText=I.getIsTextTrack(d.mimeType),d}function i(a,b,c){a.id=b,a.index=100+parseInt(b.substring(2,3)),a.type="embeddedText",a.codec="cea-608-in-SEI",a.isText=!0,a.isEmbedded=!0,a.lang=b+" "+c,a.roles=["caption"]}function k(a,b){var c=new l.default,d=1;return c.id=b.id,c.index=b.index,c.start=b.start,c.duration=b.duration,c.manifestInfo=m(a,b.mpd),c.isLast=1===a.Period_asArray.length||Math.abs(c.start+c.duration-c.manifestInfo.duration)<d,c.isFirst=1===a.Period_asArray.length||I.getRegularPeriods(a,I.getMpd(a))[0].id===b.id,c}function m(a,b){var c=new n.default;return c.DVRWindowSize=b.timeShiftBufferDepth,c.loadedTime=b.manifest.loadedTime,c.availableFrom=b.availabilityStartTime,c.minBufferTime=b.manifest.minBufferTime,c.maxFragmentDuration=b.maxSegmentDuration,c.duration=I.getDuration(a),c.isDynamic=I.getIsDynamic(a),c}function o(a,b,c){var d=I.getAdaptationForType(a,b.index,c,b);if(!d)return null;var f=e(b),h=f.id,i=I.getIndexForAdaptation(d,a,b.index);return K[h]=K[h]||I.getAdaptationsForPeriod(a,f),g(a,K[h][i])}function q(a,b,c){var d,f,h,j,k,l,m=e(b),n=m.id,o=I.getAdaptationsForType(a,b.index,"embeddedText"!==c?c:"video"),p=[];if(!o)return p;for(K[n]=K[n]||I.getAdaptationsForPeriod(a,m),j=0,l=o.length;j<l;j++){if(d=o[j],h=I.getIndexForAdaptation(d,a,b.index),f=g(a,K[n][h]),"embeddedText"===c){var q=f.accessibility.length;for(k=0;k<q;k++)if(f){var r=f.accessibility[k];if(0===r.indexOf("cea-608:")){var s=r.substring(8),t=s.split(";");if("CC"===t[0].substring(0,2))for(k=0;k<t.length;k++)f||(f=g.call(this,a,K[n][h])),i(f,t[k].substring(0,3),t[k].substring(4)),p.push(f),f=null;else for(k=0;k<t.length;k++)f||(f=g.call(this,a,K[n][h])),i(f,"CC"+(k+1),t[k]),p.push(f),f=null}else 0===r.indexOf("cea-608")&&(i(f,"CC1","eng"),p.push(f),f=null)}}f&&"embeddedText"!==c&&p.push(f)}return p}function r(a){if(!a)return null;var b=[],c=I.getMpd(a);J=I.getRegularPeriods(a,c),K={};for(var d=0,e=J.length;d<e;d++)b.push(k(a,J[d]));return b}function s(a){var b=I.getMpd(a);return m(a,b)}function u(a,b){var c=a.getRepresentationController().getRepresentationForQuality(b);return a.getIndexHandler().getInitRequest(c)}function w(a,b){var d=c(b,a.getRepresentationController());return a.getIndexHandler().getNextSegmentRequest(d)}function x(a,b,d,e){var f=c(b,a.getRepresentationController());return a.getIndexHandler().getSegmentRequestForTime(f,d,e)}function y(a,b,d){var e=c(b,a.getRepresentationController());return a.getIndexHandler().generateSegmentRequestForTime(e,d)}function z(a){return a.getIndexHandler().getCurrentTime()}function A(a,b){return a.getIndexHandler().setCurrentTime(b)}function B(a,b){var c,f,g=e(b.getStreamInfo()),h=b.getMediaInfo(),i=d(h),j=b.getType();c=h.id,f=c?I.getAdaptationForId(c,a,g.index):I.getAdaptationForIndex(h.index,a,g.index),b.getRepresentationController().updateData(f,i,j)}function C(a,b,c){var d=b.getRepresentationForQuality(c);return d?f(a,d):null}function D(a,b){var c=b.getCurrentRepresentation();return c?f(a,c):null}function E(a,b,c){var d=new p.default,e=a.scheme_id_uri,f=a.value,g=a.timescale,h=a.presentation_time_delta,i=a.event_duration,j=a.id,k=a.message_data,l=c*g+h;return b[e]?(d.eventStream=b[e],d.eventStream.value=f,d.eventStream.timescale=g,d.duration=i,d.id=j,d.presentationTime=l,d.messageData=k,d.presentationTimeDelta=h,d):null}function F(a,b,f){var g=[];return b instanceof l.default?g=I.getEventsForPeriod(a,e(b)):b instanceof j.default?g=I.getEventStreamForAdaptationSet(a,d(b)):b instanceof h.default&&(g=I.getEventStreamForRepresentation(a,c(b,f.getRepresentationController()))),g}function G(){J=[],K={}}var H=void 0,I=void 0,J=void 0,K=void 0;return H={initialize:b,convertDataToTrack:f,convertDataToMedia:g,convertDataToStream:k,getDataForTrack:c,getDataForMedia:d,getDataForStream:e,getStreamsInfo:r,getManifestInfo:s,getMediaInfoForType:o,getAllMediaInfoForType:q,getCurrentRepresentationInfo:D,getRepresentationInfoForQuality:C,updateData:B,getInitRequest:u,getNextFragmentRequest:w,getFragmentRequestForTime:x,generateFragmentRequestForTime:y,getIndexHandlerTime:z,setIndexHandlerTime:A,getEventsFor:F,getEvent:E,setConfig:a,reset:G,metricsList:v}}Object.defineProperty(c,"__esModule",{value:!0});var g=a(173),h=e(g),i=a(168),j=e(i),k=a(170),l=e(k),m=a(167),n=e(m),o=a(42),p=e(o),q=a(10),r=e(q),s=a(2),t=e(s),u=a(20),v=d(u);f.__dashjs_factory_name="DashAdapter",c.default=r.default.getSingletonFactory(f),b.exports=c.default},{10:10,167:167,168:168,170:170,173:173,2:2,20:20,42:42}],16:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){V=-1,Z=0,$=NaN,N.on(l.default.INITIALIZATION_LOADED,J,U),N.on(l.default.SEGMENTS_LOADED,K,U)}function c(b){_=b,Y=_.getType(),X=_.isDynamic(),aa=(0,y.default)(L).create(a,X)}function d(){return _}function e(a){Z=a}function f(){return Z}function h(){return V}function k(){return $}function m(){aa=null,Z=0,$=NaN,W=NaN,V=-1,X=null,Y=null,_=null,N.off(l.default.INITIALIZATION_LOADED,J,U),N.off(l.default.SEGMENTS_LOADED,K,U)}function o(a){return a?a.split("$$").join("$"):a}function p(a,b){if(null===b||null===a||a.indexOf("$RepresentationID$")===-1)return a;var c=b.toString();return a.split("$RepresentationID$").join(c)}function q(a,b,c){var d,e,f=T.resolve(c.path);return f&&b!==f.url&&O.isRelative(b)?(d=f.url,e=f.serviceLocation,b&&(d=O.resolve(b,d))):d=b,!O.isRelative(d)&&(a.url=d,a.serviceLocation=e,!0)}function s(a,b){var c=new g.default,d=a.adaptation.period,e=d.start;if(c.mediaType=b,c.type=j.HTTPRequest.INIT_SEGMENT_TYPE,c.range=a.range,c.availabilityStartTime=Q.calcAvailabilityStartTimeFromPresentationTime(e,d.mpd,X),c.availabilityEndTime=Q.calcAvailabilityEndTimeFromPresentationTime(e+d.duration,d.mpd,X),c.quality=a.index,c.mediaInfo=_.getMediaInfo(),q(c,a.initialization,a))return c}function u(a){if(!a)return null;var b=s(a,Y);return b}function x(a){var b=!1;if(X||V!==a.availableSegmentsNumber){var c=(0,w.getSegmentByIndex)(V,a);if(c){var d=c.presentationStartTime-a.adaptation.period.start,e=a.adaptation.period.duration;M(a.segmentInfoType+": "+d+" / "+e),b=("SegmentTimeline"!==a.segmentInfoType||!X)&&d>=e}}else b=!0;return b}function A(a){return aa.getSegments(a,W,V,B)}function B(a,b){if(a.segments=b,b&&b.length>0&&($=isNaN($)?b[0].presentationStartTime:Math.min(b[0].presentationStartTime,$)),X&&isNaN(Q.getExpectedLiveEdge())){var c=b[b.length-1],d=c.presentationStartTime,e=S.getMetricsFor("stream");Q.setExpectedLiveEdge(d),S.updateManifestUpdateInfo(R.getCurrentManifestUpdate(e),{presentationStartTime:d})}}function C(a){if(!a)throw new i.default("no representation");return a.segments=null,A(a),a}function D(a,b){var c,d=v.default.hasInitialization(a),e=v.default.hasSegments(a);return a.segmentDuration||a.segments||C(a),a.segmentAvailabilityRange=null,a.segmentAvailabilityRange=Q.calcSegmentAvailabilityRange(a,X),a.segmentAvailabilityRange.end<a.segmentAvailabilityRange.start&&!a.useCalculatedLiveEdgeTime?(c=new i.default(z,"no segments are available yet",{availabilityDelay:a.segmentAvailabilityRange.start-a.segmentAvailabilityRange.end}),void N.trigger(l.default.REPRESENTATION_UPDATED,{sender:this,representation:a,error:c})):(b||(V=-1),a.segmentDuration&&C(a),d||P.loadInitialization(a),e||P.loadSegments(a,Y,a.indexRange),void(d&&e&&N.trigger(l.default.REPRESENTATION_UPDATED,{sender:this,representation:a})))}function E(a,b,c){ -var d,e,f,g,h,i=b.segments,j=i?i.length:null,k=-1;if(i&&j>0)for(h=0;h<j;h++)if(e=i[h],f=e.presentationStartTime,g=e.duration,d=void 0===c||null===c?g/2:c,a+d>=f&&a-d<f+g){k=e.availabilityIdx;break}return k}function F(a){if(null===a||void 0===a)return null;var b=new g.default,c=a.representation,d=c.adaptation.period.mpd.manifest.Period_asArray[c.adaptation.period.index].AdaptationSet_asArray[c.adaptation.index].Representation_asArray[c.index].bandwidth,e=a.media;return e=(0,w.replaceTokenForTemplate)(e,"Number",a.replacementNumber),e=(0,w.replaceTokenForTemplate)(e,"Time",a.replacementTime),e=(0,w.replaceTokenForTemplate)(e,"Bandwidth",d),e=p(e,c.id),e=o(e),b.mediaType=Y,b.type=j.HTTPRequest.MEDIA_SEGMENT_TYPE,b.range=a.mediaRange,b.startTime=a.presentationStartTime,b.duration=a.duration,b.timescale=c.timescale,b.availabilityStartTime=a.availabilityStartTime,b.availabilityEndTime=a.availabilityEndTime,b.wallStartTime=a.wallStartTime,b.quality=c.index,b.index=a.availabilityIdx,b.mediaInfo=_.getMediaInfo(),b.adaptationIndex=c.adaptation.index,q(b,e,c)?b:void 0}function G(a,b,c){var d,e,f,h=V,i=!!c&&c.keepIdx,j=c?c.timeThreshold:null,k=!(!c||!c.ignoreIsFinished);return a?(W!==b&&(W=b,M("Getting the request for "+Y+" time : "+b)),A(a),V=E(b,a,j),V<0&&(A(a),V=E(b,a,j)),V>0&&M("Index for "+Y+" time "+b+" is "+V),f=!k&&x(a),f?(d=new g.default,d.action=g.default.ACTION_COMPLETE,d.index=V,d.mediaType=Y,d.mediaInfo=_.getMediaInfo(),M("Signal complete.",d)):(e=(0,w.getSegmentByIndex)(V,a),d=F(e)),i&&h>=0&&(V="SegmentTimeline"===a.segmentInfoType&&X?V:h),d):null}function H(a,b){var c=(a.segmentAvailabilityRange.end-a.segmentAvailabilityRange.start)/2;return a.segments=null,a.segmentAvailabilityRange={start:b-c,end:b+c},G(a,b,{keepIdx:!1,ignoreIsFinished:!0})}function I(a){var b,c,d;return a&&V!==-1?(W=null,V++,M("Getting the next request at index: "+V),d=x(a),d?(b=new g.default,b.action=g.default.ACTION_COMPLETE,b.index=V,b.mediaType=Y,b.mediaInfo=_.getMediaInfo(),M("Signal complete.")):(A(a),c=(0,w.getSegmentByIndex)(V,a),b=F(c),!c&&X&&V--),b):null}function J(a){var b=a.representation;b.segments&&N.trigger(l.default.REPRESENTATION_UPDATED,{sender:this,representation:b})}function K(a){if(!a.error&&Y===a.mediaType){var b,c,d,e,f=a.segments,g=a.representation,h=[],i=0;for(b=0,c=f.length;b<c;b++)d=f[b],e=(0,w.getTimeBasedSegment)(Q,X,g,d.startTime,d.duration,d.timescale,d.media,d.mediaRange,i),h.push(e),e=null,i++;g.segmentAvailabilityRange={start:h[0].presentationStartTime,end:h[c-1].presentationStartTime},g.availableSegmentsNumber=c,B(g,h),v.default.hasInitialization(g)&&N.trigger(l.default.REPRESENTATION_UPDATED,{sender:this,representation:g})}}var L=this.context,M=(0,r.default)(L).getInstance().log,N=(0,n.default)(L).getInstance(),O=(0,t.default)(L).getInstance(),P=a.segmentBaseLoader,Q=a.timelineConverter,R=a.dashMetrics,S=a.metricsModel,T=a.baseURLController,U=void 0,V=void 0,W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa=void 0;return U={initialize:c,getStreamProcessor:d,getInitRequest:u,getSegmentRequestForTime:G,getNextSegmentRequest:I,generateSegmentRequestForTime:H,updateRepresentation:D,setCurrentTime:e,getCurrentTime:f,getCurrentIndex:h,getEarliestTime:k,reset:m},b(),U}Object.defineProperty(c,"__esModule",{value:!0});var f=a(164),g=d(f),h=a(163),i=d(h),j=a(180),k=a(13),l=d(k),m=a(9),n=d(m),o=a(10),p=d(o),q=a(8),r=d(q),s=a(159),t=d(s),u=a(46),v=d(u),w=a(36),x=a(35),y=d(x),z=1;e.__dashjs_factory_name="DashHandler";var A=p.default.getClassFactory(e);A.SEGMENTS_UNAVAILABLE_ERROR_CODE=z,c.default=A,b.exports=c.default},{10:10,13:13,159:159,163:163,164:164,180:180,35:35,36:36,46:46,8:8,9:9}],17:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function e(a){return a&&a.__esModule?a:{default:a}}function f(){function a(a,b){var c,d=C.getValue(),e=d.Period_asArray[b];return c=x(e,a),null===c?null:c.bandwidth}function b(a,b){var c,d=C.getValue(),e=d.Period_asArray[b];return c=w(e,a)}function c(a,b){var c,d=C.getValue(),e=d.Period_asArray[b];return c=z(e,a)}function d(a){return m(a,o.TRACK_SWITCH)}function e(a){return m(a,o.BUFFER_LEVEL)}function f(a){var b=e(a);return b?(0,p.round10)(b.level/1e3,-3):0}function h(a){return a.RequestsQueue}function j(a){if(null===a)return null;var b,c,d=a.HttpList,e=null;if(null===d||d.length<=0)return null;for(b=d.length,c=b-1;c>=0;){if(d[c].responsecode){e=d[c];break}c--}return e}function l(a){return null===a?[]:a.HttpList?a.HttpList:[]}function m(a,b){if(null===a)return null;var c=a[b];if(null===c)return null;var d=c.length;return d<=0?null:c[d-1]}function n(a){return m(a,o.DROPPED_FRAMES)}function q(a){return m(a,o.SCHEDULING_INFO)}function r(a){return m(a,o.MANIFEST_UPDATE)}function s(a){return m(a,o.DVR_INFO)}function t(a,b){var c,d,e,f={};if(null===a)return null;for(c=l(a),e=c.length-1;e>=0;e--)if(d=c[e],d.type===g.HTTPRequest.MPD_TYPE){f=v(d._responseHeaders);break}return void 0===f[b]?null:f[b]}function u(a,b){if(null===a)return null;var c,d=j(a);return null===d||null===d._responseHeaders?null:(c=v(d._responseHeaders),void 0===c[b]?null:c[b])}function v(a){var b={};if(!a)return b;for(var c=a.trim().split("\r\n"),d=0,e=c.length;d<e;d++){var f=c[d],g=f.indexOf(": ");g>0&&(b[f.substring(0,g)]=f.substring(g+2))}return b}function w(a,b){var c=x(a,b,!0);return null!==c?c:-1}function x(a,b,c){var d,e,f,g,h,i;for(e=a.AdaptationSet_asArray,h=0;h<e.length;h+=1)for(d=e[h],g=d.Representation_asArray,i=0;i<g.length;i+=1)if(f=g[i],b===f.id)return c?i:f;return null}function y(a,b){return(0,k.default)(B).getInstance().getIsTypeOf(a,b)}function z(a,b){var c,d,e,f;if(!a||!b)return-1;for(d=a.AdaptationSet_asArray,f=0;f<d.length;f+=1)if(c=d[f],e=c.Representation_asArray,y(c,b))return e.length;return-1}var A=void 0,B=this.context,C=(0,i.default)(B).getInstance();return A={getBandwidthForRepresentation:a,getIndexForRepresentation:b,getMaxIndexForBufferType:c,getCurrentRepresentationSwitch:d,getLatestBufferLevelVO:e,getCurrentBufferLevel:f,getCurrentHttpRequest:j,getHttpRequests:l,getCurrentDroppedFrames:n,getCurrentSchedulingInfo:q,getCurrentDVRInfo:s,getCurrentManifestUpdate:r,getLatestFragmentRequestHeaderValueByID:u,getLatestMPDRequestHeaderValueByID:t,getRequestsQueue:h}}Object.defineProperty(c,"__esModule",{value:!0});var g=a(180),h=a(101),i=e(h),j=a(22),k=e(j),l=a(10),m=e(l),n=a(20),o=d(n),p=a(7);f.__dashjs_factory_name="DashMetrics",c.default=m.default.getSingletonFactory(f),b.exports=c.default},{10:10,101:101,180:180,20:20,22:22,7:7}],18:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){u=(0,m.default)(n).getInstance(),v=(0,s.default)(n).getInstance(),y=(0,g.default)(n).getInstance(),C=(0,B.default)(n).create({errHandler:u,metricsModel:A,requestModifier:y})}function b(a){a.baseURLController&&(D=a.baseURLController),a.metricsModel&&(A=a.metricsModel)}function c(a,b){var d=null,e=null,f=D.resolve(a.path),g=b||{init:!0,url:f?f.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500};p("Start searching for initialization.");var i=j(g),k=function(b){g.bytesLoaded=g.range.end,e=v.parse(b),d=h(e),d?(a.range=d,r.trigger(o.default.INITIALIZATION_LOADED,{representation:a})):(g.range.end=g.bytesLoaded+g.bytesToLoad,c(a,g))},l=function(){r.trigger(o.default.INITIALIZATION_LOADED,{representation:a})};C.load({request:i,success:k,error:l}),p("Perform init search: "+g.url)}function d(a,b,c,e,g){if(c&&(void 0===c.start||void 0===c.end)){var h=c?c.toString().split("-"):null;c=h?{start:parseFloat(h[0]),end:parseFloat(h[1])}:null}g=g?g:l;var i=null,k=null,m=!!c,n=D.resolve(a.path),o={init:!1,url:n?n.url:void 0,range:m?c:{start:0,end:1500},searching:!m,bytesLoaded:e?e.bytesLoaded:0,bytesToLoad:1500},q=j(o),r=function(c){var e=o.bytesToLoad,h=c.byteLength;if(o.bytesLoaded=o.range.end-o.range.start,i=v.parse(c),k=i.getBox("sidx"),k&&k.isComplete){var j,l,m=k.references;if(null!==m&&void 0!==m&&m.length>0&&(j=1===m[0].reference_type),j){p("Initiate multiple SIDX load."),o.range.end=o.range.start+k.size;var n,q,r,s,t,u=[],w=0,x=(k.offset||o.range.start)+k.size,y=function(c){c?(u=u.concat(c),w++,w>=q&&g(u,a,b)):g(null,a,b)};for(n=0,q=m.length;n<q;n++)r=x,s=x+m[n].referenced_size-1,x+=m[n].referenced_size,t={start:r,end:s},d(a,null,t,o,y)}else p("Parsing segments from SIDX."),l=f(k,o),g(l,a,b)}else{if(k)o.range.start=k.offset||o.range.start,o.range.end=o.range.start+(k.size||e);else{if(h<o.bytesLoaded)return void g(null,a,b);var z=i.getLastBox();z&&z.size?(o.range.start=z.offset+z.size,o.range.end=o.range.start+e):o.range.end+=e}d(a,b,o.range,o,g)}},s=function(){g(null,a,b)};C.load({request:q,success:r,error:s}),p("Perform SIDX load: "+o.url)}function e(){C.abort(),C=null,u=null,v=null,y=null}function f(a,b){for(var c,d,e,f,g=a.references,h=g.length,j=a.timescale,k=a.earliest_presentation_time,l=b.range.start+a.offset+a.first_offset+a.size,m=[],n=0;n<h;n++)e=g[n].subsegment_duration,f=g[n].referenced_size,c=new i.default,c.duration=e,c.startTime=k,c.timescale=j,d=l+f-1,c.mediaRange=l+"-"+d,m.push(c),k+=e,l+=f;return m}function h(a){var b,c,d=a.getBox("ftyp"),e=a.getBox("moov"),f=null;return p("Searching for initialization."),e&&e.isComplete&&(b=d?d.offset:e.offset,c=e.offset+e.size-1,f=b+"-"+c,p("Found the initialization. Range: "+f)),f}function j(a){if(a.url){var b=new z.default;return b.type=a.init?x.HTTPRequest.INIT_SEGMENT_TYPE:x.HTTPRequest.MEDIA_SEGMENT_TYPE,b.url=a.url,b.range=a.range.start+"-"+a.range.end,b}}function l(a,b,c){a?r.trigger(o.default.SEGMENTS_LOADED,{segments:a,representation:b,mediaType:c}):r.trigger(o.default.SEGMENTS_LOADED,{segments:null,representation:b,mediaType:c,error:new k.default(null,"error loading segments",null)})}var n=this.context,p=(0,w.default)(n).getInstance().log,r=(0,q.default)(n).getInstance(),t=void 0,u=void 0,v=void 0,y=void 0,A=void 0,C=void 0,D=void 0;return t={setConfig:b,initialize:a,loadInitialization:c,loadSegments:d,reset:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(157),g=d(f),h=a(47),i=d(h),j=a(163),k=d(j),l=a(152),m=d(l),n=a(13),o=d(n),p=a(9),q=d(p),r=a(147),s=d(r),t=a(10),u=d(t),v=a(8),w=d(v),x=a(180),y=a(164),z=d(y),A=a(59),B=d(A);e.__dashjs_factory_name="SegmentBaseLoader",c.default=u.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,147:147,152:152,157:157,163:163,164:164,180:180,47:47,59:59,8:8,9:9}],19:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){y={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"},CueBlockNumber:{tag:21368}}}}},Void:{tag:236,required:!0}}}function b(){A=(0,q.default)(p).getInstance(),B=(0,s.default)(p).getInstance(),D=(0,z.default)(p).create({errHandler:A,metricsModel:C,requestModifier:B})}function c(a){if(!a.baseURLController||!a.metricsModel)throw new Error("Missing config parameter(s)");E=a.baseURLController,C=a.metricsModel}function d(a){var b=[],c=void 0,d=void 0,e=void 0,f=(0,k.default)(p).create({data:a}),g=void 0;for(f.consumeTag(y.Segment.Cues),d=f.getMatroskaCodedNum();f.moreData()&&f.consumeTagAndSize(y.Segment.Cues.CuePoint,!0);){for(c={},c.CueTime=f.parseTag(y.Segment.Cues.CuePoint.CueTime),c.CueTracks=[];f.moreData()&&f.consumeTagAndSize(y.Segment.Cues.CuePoint.CueTrackPositions,!0);){if(e={},e.Track=f.parseTag(y.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),0===e.Track)throw new Error("Cue track cannot be 0");e.ClusterPosition=f.parseTag(y.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),f.getPos()+4>d||!f.consumeTag(y.Segment.Cues.CuePoint.CueTrackPositions.CueBlockNumber,!0)?c.CueTracks.push(e):(g=f.getMatroskaCodedNum(),e.BlockNumber=f.getMatroskaUint(g),c.CueTracks.push(e))}if(0===c.CueTracks.length)throw new Error("Mandatory cuetrack not found");b.push(c)}if(0===b.length)throw new Error("mandatory cuepoint not found");return b}function e(a,b,c,e){var f=void 0,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=void 0,m=void 0;for(g=d(a),h=[],j=0,k=g.length;j<k;j+=1)i=new u.default,f=0,f=j<g.length-1?g[j+1].CueTime-g[j].CueTime:e-g[j].CueTime,i.duration=f,i.startTime=g[j].CueTime,i.timescale=1e3,l=g[j].CueTracks[0].ClusterPosition+b,m=j<g.length-1?g[j+1].CueTracks[0].ClusterPosition+b-1:c-1,i.mediaRange=l+"-"+m,h.push(i);return r("Parsed cues: "+h.length+" cues."),h}function f(a,b,c,d){var f=(0,k.default)(p).create({data:a}),g=void 0,h=void 0,i=c.split("-"),j=null,l={url:b,range:{start:parseFloat(i[0]),end:parseFloat(i[1])},request:j},n=void 0,o=void 0;for(r("Parse EBML header: "+l.url),f.skipOverElement(y.EBML),f.consumeTag(y.Segment),n=f.getMatroskaCodedNum(),n+=f.getPos(),o=f.getPos();f.moreData()&&!f.consumeTagAndSize(y.Segment.Info,!0);)if(!(f.skipOverElement(y.Segment.SeekHead,!0)||f.skipOverElement(y.Segment.Tracks,!0)||f.skipOverElement(y.Segment.Cues,!0)||f.skipOverElement(y.Void,!0)))throw new Error("no valid top level element found");for(;void 0===g;){var q=f.getMatroskaCodedNum(!0),s=f.getMatroskaCodedNum();switch(q){case y.Segment.Info.Duration.tag:g=f[y.Segment.Info.Duration.parse](s);break;default:f.setPos(f.getPos()+s)}}j=m(l);var t=function(a){h=e(a,o,n,g),d(h)},u=function(){r("Download Error: Cues "+l.url),d(null)};D.load({request:j,success:t,error:u}),r("Perform cues load: "+l.url+" bytes="+l.range.start+"-"+l.range.end)}function h(a,b){var c=null,d=E.resolve(a.path),e=d?d.url:void 0,f=a.range.split("-"),h=b||{range:{start:parseFloat(f[0]),end:parseFloat(f[1])},request:c,url:e,init:!0};r("Start loading initialization."),c=m(h);var i=function(){t.trigger(g.default.INITIALIZATION_LOADED,{representation:a})},j=function(){t.trigger(g.default.INITIALIZATION_LOADED,{representation:a})};D.load({request:c,success:i,error:j}),r("Perform init load: "+h.url)}function j(a,b,c,d){var e=null,g=E.resolve(a.path),h=g?g.url:void 0,i=8192,j={bytesLoaded:0,bytesToLoad:i,range:{start:0,end:i},request:e,url:h,init:!1};d=d?d:l,e=m(j),r("Parsing ebml header");var k=function(e){f(e,h,c,function(c){d(c,a,b)})},n=function(){d(null,a,b)};D.load({request:e,success:k,error:n})}function l(a,b,c){a?t.trigger(g.default.SEGMENTS_LOADED,{segments:a,representation:b,mediaType:c}):t.trigger(g.default.SEGMENTS_LOADED,{segments:null,representation:b,mediaType:c,error:new Error(null,"error loading segments",null)})}function m(a){var b=new x.default;return b.type=a.init?v.HTTPRequest.INIT_SEGMENT_TYPE:v.HTTPRequest.MEDIA_SEGMENT_TYPE,b.url=a.url,b.range=a.range.start+"-"+a.range.end,b}function n(){A=null,B=null,r=null}var p=this.context,r=(0,o.default)(p).getInstance().log,t=(0,i.default)(p).getInstance(),w=void 0,y=void 0,A=void 0,B=void 0,C=void 0,D=void 0,E=void 0;return w={setConfig:c,initialize:b,loadInitialization:h,loadSegments:j,reset:n},a(),w}Object.defineProperty(c,"__esModule",{value:!0});var f=a(13),g=d(f),h=a(9),i=d(h),j=a(151),k=d(j),l=a(10),m=d(l),n=a(8),o=d(n),p=a(152),q=d(p),r=a(157),s=d(r),t=a(47),u=d(t),v=a(180),w=a(164),x=d(w),y=a(59),z=d(y);e.__dashjs_factory_name="WebmSegmentBaseLoader",c.default=m.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,151:151,152:152,157:157,164:164,180:180,47:47,59:59,8:8,9:9}],20:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d="TcpList";c.TCP_CONNECTION=d;var e="HttpList";c.HTTP_REQUEST=e;var f="RepSwitchList";c.TRACK_SWITCH=f;var g="BufferLevel";c.BUFFER_LEVEL=g;var h="BufferState";c.BUFFER_STATE=h;var i="DVRInfo";c.DVR_INFO=i;var j="DroppedFrames";c.DROPPED_FRAMES=j;var k="SchedulingInfo";c.SCHEDULING_INFO=k;var l="RequestsQueue";c.REQUESTS_QUEUE=l;var m="ManifestUpdate";c.MANIFEST_UPDATE=m;var n="ManifestUpdatePeriodInfo";c.MANIFEST_UPDATE_STREAM_INFO=n;var o="ManifestUpdateRepresentationInfo";c.MANIFEST_UPDATE_TRACK_INFO=o;var p="PlayList";c.PLAY_LIST=p;var q="DVBErrors";c.DVB_ERRORS=q},{}],21:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){Q=null,R=-1,S=!0,T=[],W=(0,m.default)(N).getInstance(),Y=(0,q.default)(N).getInstance(),Z=(0,o.default)(N).getInstance(),$=(0,s.default)(N).getInstance(),_=(0,u.default)(N).getInstance(),aa=(0,y.default)(N).getInstance(),ba=(0,k.default)(N).getInstance(),ca=(0,g.default)(N).getInstance(),da=(0,i.default)(N).getInstance(),ea=(0,w.default)(N).getInstance(),O.on(E.default.QUALITY_CHANGE_REQUESTED,L,P),O.on(E.default.REPRESENTATION_UPDATED,H,P),O.on(E.default.WALLCLOCK_TIME_UPDATED,I,P),O.on(E.default.BUFFER_LEVEL_UPDATED,J,P)}function b(a){a.abrController&&(W=a.abrController)}function c(a){V=a,X=V.getIndexHandler()}function d(){return V}function e(){return Q}function f(){return R}function h(){return S}function j(){return U}function l(){O.off(E.default.QUALITY_CHANGE_REQUESTED,L,P),O.off(E.default.REPRESENTATION_UPDATED,H,P),O.off(E.default.WALLCLOCK_TIME_UPDATED,I,P),O.off(E.default.BUFFER_LEVEL_UPDATED,J,P),Q=null,R=-1,S=!0,T=[],W=null,Y=null,Z=null,$=null,_=null,aa=null,ba=null,ca=null,da=null,ea=null}function n(a,b,c){var d,e,f=null,g=V.getStreamInfo(),h=W.getTopQualityIndexFor(c,g.id);if(S=!0,O.trigger(E.default.DATA_UPDATE_STARTED,{sender:this}),T=z(b),null===Q&&"fragmentedText"!==c?(e=W.getAverageThroughput(c),f=e||W.getInitialBitrateFor(c,g),d=W.getQualityForBitrate(V.getMediaInfo(),f)):d=W.getQualityFor(c,g),d>h&&(d=h),U=t(d),Q=a,"video"!==c&&"audio"!==c&&"fragmentedText"!==c)return S=!1,void O.trigger(E.default.DATA_UPDATE_COMPLETED,{sender:this,data:Q,currentRepresentation:U});for(var i=0;i<T.length;i++)X.updateRepresentation(T[i],!0)}function p(){var a=new Date,b=j(),c=1e3*Z.getTime();_.addRepresentationSwitch(b.adaptation.type,a,c,b.id)}function r(){var a=ba.calcSegmentAvailabilityRange(U,V.isDynamic());_.addDVRInfo(V.getType(),Z.getTime(),V.getStreamInfo().manifestInfo,a)}function t(a){return T[a]}function v(a){return T.indexOf(a)}function x(){for(var a=0,b=T.length;a<b;a++){var c=T[a].segmentInfoType;if(null===T[a].segmentAvailabilityRange||!K.default.hasInitialization(T[a])||("SegmentBase"===c||"BaseURL"===c)&&!T[a].segments)return!1}return!0}function z(a){var b,c=$.getValue();return R=ca.getIndexForAdaptation(Q,c,a.period.index),b=ca.getRepresentationsForAdaptation(c,a)}function B(a){for(var b,c=0,d=T.length;c<d;c++)b=T[c],b.segmentAvailabilityRange=ba.calcSegmentAvailabilityRange(b,a)}function D(){T.forEach(function(a){a.segmentAvailabilityRange=null})}function F(a){var b=a,c=function(){if(!h()){S=!0,O.trigger(E.default.DATA_UPDATE_STARTED,{sender:P}),D();for(var a=0;a<T.length;a++)X.updateRepresentation(T[a],!0)}};S=!1,O.trigger(G.default.AST_IN_FUTURE,{delay:b}),setTimeout(c,b)}function H(a){if(a.sender.getStreamProcessor()===V&&h()){var b,c,d,e=a.representation,f=_.getMetricsFor("stream"),g=_.getMetricsFor(j().adaptation.type),i=da.getCurrentManifestUpdate(f),k=!1,l=0;if("dynamic"===e.adaptation.period.mpd.manifest.type){var m=e.segmentAvailabilityRange.end-e.segmentAvailabilityRange.start,n=Z.computeLiveDelay(U.segmentDuration,V.getStreamInfo().manifestInfo.DVRWindowSize);l=1e3*(n-m)}if(l>0)return r(),F(l),c=new A.default(M,"Segments update failed",null),void O.trigger(E.default.DATA_UPDATE_COMPLETED,{sender:this,data:Q,currentRepresentation:U,error:c});if(i){for(var o=0;o<i.trackInfo.length;o++)if(b=i.trackInfo[o],b.index===e.index&&b.mediaType===V.getType()){k=!0;break}k||_.addManifestUpdateRepresentationInfo(i,e.id,e.index,e.adaptation.period.index,V.getType(),e.presentationTimeOffset,e.startNumber,e.segmentInfoType)}x()&&(S=!1,W.setPlaybackQuality(V.getType(),V.getStreamInfo(),v(U)),_.updateManifestUpdateInfo(i,{latency:U.segmentAvailabilityRange.end-Z.getTime()}),d=da.getCurrentRepresentationSwitch(g),d||p(),O.trigger(E.default.DATA_UPDATE_COMPLETED,{sender:this,data:Q,currentRepresentation:U}))}}function I(a){a.isDynamic&&B(a.isDynamic)}function J(a){a.sender.getStreamProcessor()===V&&r()}function L(a){a.mediaType===V.getType()&&V.getStreamInfo().id===a.streamInfo.id&&a.oldQuality!==a.newQuality&&(U=t(a.newQuality),aa.setSavedBitrateSettings(a.mediaType,U.bandwidth),p())}var M=1,N=this.context,O=(0,C.default)(N).getInstance(),P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0,V=void 0,W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0;return P={initialize:c,setConfig:b,getData:e,getDataIndex:f,isUpdating:h,updateData:n,getStreamProcessor:d,getCurrentRepresentation:j,getRepresentationForQuality:t,reset:l},a(),P}Object.defineProperty(c,"__esModule",{value:!0});var f=a(22),g=d(f),h=a(17),i=d(h),j=a(38),k=d(j),l=a(61),m=d(l),n=a(69),o=d(n),p=a(72),q=d(p),r=a(101),s=d(r),t=a(103),u=d(t),v=a(102),w=d(v),x=a(150),y=d(x),z=a(163),A=d(z),B=a(9),C=d(B),D=a(13),E=d(D),F=a(53),G=d(F),H=a(10),I=d(H),J=a(46),K=d(J);e.__dashjs_factory_name="RepresentationController",c.default=I.default.getClassFactory(e),b.exports=c.default},{10:10,101:101,102:102,103:103,13:13,150:150,163:163,17:17,22:22,38:38,46:46,53:53,61:61,69:69,72:72,9:9}],22:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c,d,e,f=!1,g=!1,h=a.ContentComponent_asArray,i="text"!==b?new RegExp(b):new RegExp("(vtt|ttml)");if(a.Representation_asArray.length>0&&a.Representation_asArray[0].hasOwnProperty("codecs")){var j=a.Representation_asArray[0].codecs;if(0===j.search("stpp")||0===j.search("wvtt"))return"fragmentedText"===b}if(h){if(h.length>1)return"muxed"===b;h[0]&&h[0].contentType===b&&(f=!0,g=!0)}if(a.hasOwnProperty("mimeType")&&(f=i.test(a.mimeType),g=!0),!g)for(c=0,d=a.Representation_asArray.length;!g&&c<d;)e=a.Representation_asArray[c],e.hasOwnProperty("mimeType")&&(f=i.test(e.mimeType),g=!0),c++;return f}function b(b){return a(b,"audio")}function c(b){return a(b,"video")}function d(b){return a(b,"fragmentedText")}function e(b){return a(b,"text")}function f(b){return a(b,"muxed")}function h(a){return"text/vtt"===a||"application/ttml+xml"===a}function j(a){var b="";return a.hasOwnProperty("lang")&&(b=a.lang.replace(/[^A-Za-z0-9-]/g,"")),b}function l(a){return a.hasOwnProperty("Viewpoint")?a.Viewpoint:null}function n(a){return a.hasOwnProperty("Role_asArray")?a.Role_asArray:[]}function p(a){return a.hasOwnProperty("Accessibility_asArray")?a.Accessibility_asArray:[]}function r(a){return a.hasOwnProperty("AudioChannelConfiguration_asArray")?a.AudioChannelConfiguration_asArray:[]}function t(a){return n(a).filter(function(a){return"main"===a.value})[0]}function v(){return function(a,b){return a.bandwidth-b.bandwidth}}function x(a){return void 0!==a.Representation_asArray&&null!==a.Representation_asArray&&a.Representation_asArray.sort(v()),a}function z(a,b,c){var d,e,f=b.Period_asArray[c].AdaptationSet_asArray;for(d=0,e=f.length;d<e;d++)if(f[d].hasOwnProperty("id")&&f[d].id===a)return f[d];return null}function B(a,b,c){var d=b.Period_asArray[c].AdaptationSet_asArray;return d[a]}function D(a,b,c){var d,e,f=b.Period_asArray[c].AdaptationSet_asArray;for(d=0,e=f.length;d<e;d++)if(f[d]===a)return d;return-1}function E(b,c,d){var e,f,g=b.Period_asArray[c].AdaptationSet_asArray,h=[];for(e=0,f=g.length;e<f;e++)a(g[e],d)&&h.push(x(g[e]));return h}function F(a,b,c,d){var e=E(a,b,c);if(!e||0===e.length)return null;if(e.length>1&&d)for(var f=ja.getCurrentTrackFor(c,d),g=ka.getAllMediaInfoForType(a,d,c),h=0,i=e.length;h<i;h++){if(f&&ja.isTracksEqual(f,g[h]))return e[h];if(t(e[h]))return e[h]}return e[0]}function G(a){var b=a.Representation_asArray[0];return b.mimeType+';codecs="'+b.codecs+'"'}function H(a){return a.Representation_asArray[0].mimeType}function I(a){return a&&a.hasOwnProperty("cenc:default_KID")?a["cenc:default_KID"]:null}function J(a){return a&&a.hasOwnProperty("ContentProtection_asArray")&&0!==a.ContentProtection_asArray.length?a.ContentProtection_asArray:null}function K(a){var b=!1;return a.hasOwnProperty("type")&&(b="dynamic"===a.type),b}function L(a){var b,c,d=K(a);return b=!isNaN(a.timeShiftBufferDepth),c=d&&b}function M(a,b){var c=!1;return a.profiles&&a.profiles.length>0&&(c=a.profiles.indexOf(b)!==-1),c}function N(a){return M(a,"urn:mpeg:dash:profile:isoff-on-demand:2011")}function O(a){return M(a,"urn:dvb:dash:profile:dvb-dash:2014")}function P(a){var b;return b=a.hasOwnProperty("mediaPresentationDuration")?a.mediaPresentationDuration:Number.MAX_VALUE}function Q(a){return a.bandwidth}function R(a){var b=arguments.length<=1||void 0===arguments[1]?0:arguments[1],c=NaN;return a.hasOwnProperty("minimumUpdatePeriod")&&(c=a.minimumUpdatePeriod),isNaN(c)?c:Math.max(c-b,1)}function S(a){return a.Representation_asArray.length}function T(a){if(!a||!a.Representation_asArray||!a.Representation_asArray.length)return null;for(var b=x(a),c=b.Representation_asArray,d=c.length,e=[],f=0;f<d;f++)e.push({bandwidth:c[f].bandwidth,width:c[f].width||0,height:c[f].height||0});return e}function U(a,b){return b.Representation_asArray[a]}function V(a,b){for(var c,d,e,f,i,j=x(a.Period_asArray[b.period.index].AdaptationSet_asArray[b.index]),k=[],l=0;l<j.Representation_asArray.length;l++)f=j.Representation_asArray[l],c=new g.default,c.index=l,c.adaptation=b,f.hasOwnProperty("id")&&(c.id=f.id),f.hasOwnProperty("bandwidth")&&(c.bandwidth=f.bandwidth),f.hasOwnProperty("maxPlayoutRate")&&(c.maxPlayoutRate=f.maxPlayoutRate),f.hasOwnProperty("SegmentBase")?(e=f.SegmentBase,c.segmentInfoType="SegmentBase"):f.hasOwnProperty("SegmentList")?(e=f.SegmentList,e.hasOwnProperty("SegmentTimeline")?(c.segmentInfoType="SegmentTimeline",i=e.SegmentTimeline.S_asArray[e.SegmentTimeline.S_asArray.length-1],(!i.hasOwnProperty("r")||i.r>=0)&&(c.useCalculatedLiveEdgeTime=!0)):(c.segmentInfoType="SegmentList",c.useCalculatedLiveEdgeTime=!0)):f.hasOwnProperty("SegmentTemplate")?(e=f.SegmentTemplate,e.hasOwnProperty("SegmentTimeline")?(c.segmentInfoType="SegmentTimeline",i=e.SegmentTimeline.S_asArray[e.SegmentTimeline.S_asArray.length-1],(!i.hasOwnProperty("r")||i.r>=0)&&(c.useCalculatedLiveEdgeTime=!0)):c.segmentInfoType="SegmentTemplate",e.hasOwnProperty("initialization")&&(c.initialization=e.initialization.split("$Bandwidth$").join(f.bandwidth).split("$RepresentationID$").join(f.id))):c.segmentInfoType="BaseURL",e&&(e.hasOwnProperty("Initialization")?(d=e.Initialization,d.hasOwnProperty("sourceURL")?c.initialization=d.sourceURL:d.hasOwnProperty("range")&&(c.range=d.range)):f.hasOwnProperty("mimeType")&&h(f.mimeType)&&(c.range=0),e.hasOwnProperty("timescale")&&(c.timescale=e.timescale),e.hasOwnProperty("duration")&&(c.segmentDuration=e.duration/c.timescale),e.hasOwnProperty("startNumber")&&(c.startNumber=e.startNumber),e.hasOwnProperty("indexRange")&&(c.indexRange=e.indexRange),e.hasOwnProperty("presentationTimeOffset")&&(c.presentationTimeOffset=e.presentationTimeOffset/c.timescale)),c.MSETimeOffset=ia.calcMSETimeOffset(c),c.path=[b.period.index,b.index,l],k.push(c);return k}function W(a,e){for(var g,h,j=a.Period_asArray[e.index],k=[],l=0;l<j.AdaptationSet_asArray.length;l++)h=j.AdaptationSet_asArray[l],g=new i.default,h.hasOwnProperty("id")&&(g.id=h.id),g.index=l,g.period=e,f(h)?g.type="muxed":b(h)?g.type="audio":c(h)?g.type="video":d(h)?g.type="fragmentedText":g.type="text",k.push(g);return k}function X(a,b){var c,d,e=K(a),f=[],g=null,h=null,i=null,j=null;for(d=0,c=a.Period_asArray.length;d<c;d++)h=a.Period_asArray[d],h.hasOwnProperty("start")?(j=new k.default,j.start=h.start):null!==g&&h.hasOwnProperty("duration")&&null!==i?(j=new k.default,j.start=i.start+i.duration,j.duration=h.duration):0!==d||e||(j=new k.default,j.start=0),null!==i&&isNaN(i.duration)&&(i.duration=j.start-i.start),null!==j&&(j.id=Y(h,d)),null!==j&&h.hasOwnProperty("duration")&&(j.duration=h.duration),null!==j&&(j.index=d,j.mpd=b,f.push(j),g=h,i=j),h=null,j=null;return 0===f.length?f:(null!==i&&isNaN(i.duration)&&(i.duration=$(a,i)-i.start),f)}function Y(a,b){if(!a)throw new Error("Period cannot be null or undefined");var c=k.default.DEFAULT_ID+"_"+b;return a.hasOwnProperty("id")&&"__proto__"!==a.id&&(c=a.id),c}function Z(a){var b=new m.default;return b.manifest=a,a.hasOwnProperty("availabilityStartTime")?b.availabilityStartTime=new Date(a.availabilityStartTime.getTime()):b.availabilityStartTime=new Date(a.loadedTime.getTime()),a.hasOwnProperty("availabilityEndTime")&&(b.availabilityEndTime=new Date(a.availabilityEndTime.getTime())),a.hasOwnProperty("minimumUpdatePeriod")&&(b.minimumUpdatePeriod=a.minimumUpdatePeriod),a.hasOwnProperty("mediaPresentationDuration")&&(b.mediaPresentationDuration=a.mediaPresentationDuration),a.hasOwnProperty("suggestedPresentationDelay")&&(b.suggestedPresentationDelay=a.suggestedPresentationDelay),a.hasOwnProperty("timeShiftBufferDepth")&&(b.timeShiftBufferDepth=a.timeShiftBufferDepth),a.hasOwnProperty("maxSegmentDuration")&&(b.maxSegmentDuration=a.maxSegmentDuration),b}function $(a,b){var c=K(a),d=void 0;if(a.mediaPresentationDuration)d=a.mediaPresentationDuration;else if(b.duration)d=b.duration;else{if(!c)throw new Error("Must have @mediaPresentationDuratio on MPD or an explicit @duration on the last period.");d=Number.POSITIVE_INFINITY}return d}function _(a,b){var c=a.Period_asArray,d=c[b.index].EventStream_asArray,e=[];if(d)for(var f=0;f<d.length;f++){var g=new A.default;if(g.period=b,g.timescale=1,!d[f].hasOwnProperty("schemeIdUri"))throw new Error("Invalid EventStream. SchemeIdUri has to be set");g.schemeIdUri=d[f].schemeIdUri,d[f].hasOwnProperty("timescale")&&(g.timescale=d[f].timescale),d[f].hasOwnProperty("value")&&(g.value=d[f].value);for(var h=0;h<d[f].Event_asArray.length;h++){var i=new w.default;i.presentationTime=0,i.eventStream=g,d[f].Event_asArray[h].hasOwnProperty("presentationTime")&&(i.presentationTime=d[f].Event_asArray[h].presentationTime),d[f].Event_asArray[h].hasOwnProperty("duration")&&(i.duration=d[f].Event_asArray[h].duration),d[f].Event_asArray[h].hasOwnProperty("id")&&(i.id=d[f].Event_asArray[h].id),e.push(i)}}return e}function aa(a,b){var c=[];if(!a)return c;for(var d=0;d<a.length;d++){var e=new A.default;if(e.timescale=1,e.representation=b,!a[d].hasOwnProperty("schemeIdUri"))throw new Error("Invalid EventStream. SchemeIdUri has to be set");e.schemeIdUri=a[d].schemeIdUri,a[d].hasOwnProperty("timescale")&&(e.timescale=a[d].timescale),a[d].hasOwnProperty("value")&&(e.value=a[d].value),c.push(e)}return c}function ba(a,b){var c=a.Period_asArray[b.period.index].AdaptationSet_asArray[b.index].InbandEventStream_asArray;return aa(c,null)}function ca(a,b){var c=a.Period_asArray[b.adaptation.period.index].AdaptationSet_asArray[b.adaptation.index].Representation_asArray[b.index].InbandEventStream_asArray;return aa(c,b)}function da(a){var b=K(a),c=a.hasOwnProperty("availabilityStartTime"),d=a.UTCTiming_asArray,e=[];return(b||c)&&d&&d.forEach(function(a){var b=new o.default;a.hasOwnProperty("schemeIdUri")&&(b.schemeIdUri=a.schemeIdUri,a.hasOwnProperty("value")&&(b.value=a.value.toString(),e.push(b)))}),e}function ea(a){var b=[],c=a.BaseURL_asArray||[a.baseUri],d=!1;return c.some(function(c){if(c){var e=new y.default,f=c.__text||c;return la.isRelative(f)&&(d=!0,a.baseUri&&(f=a.baseUri+f)),e.url=f,c.hasOwnProperty("serviceLocation")&&c.serviceLocation.length?e.serviceLocation=c.serviceLocation:e.serviceLocation=f,c.hasOwnProperty("dvb:priority")&&(e.dvb_priority=c["dvb:priority"]),c.hasOwnProperty("dvb:weight")&&(e.dvb_weight=c["dvb:weight"]),b.push(e),d}}),b}function fa(a){return a.hasOwnProperty("Location")&&(a.Location=a.Location_asArray[0]),a.Location}var ga=void 0,ha=this.context,ia=(0,q.default)(ha).getInstance(),ja=(0,s.default)(ha).getInstance(),ka=(0, -u.default)(ha).getInstance(),la=(0,C.default)(ha).getInstance();return ga={getIsTypeOf:a,getIsAudio:b,getIsVideo:c,getIsText:e,getIsMuxed:f,getIsTextTrack:h,getIsFragmentedText:d,getIsMain:t,getLanguageForAdaptation:j,getViewpointForAdaptation:l,getRolesForAdaptation:n,getAccessibilityForAdaptation:p,getAudioChannelConfigurationForAdaptation:r,processAdaptation:x,getAdaptationForIndex:B,getIndexForAdaptation:D,getAdaptationForId:z,getAdaptationsForType:E,getAdaptationForType:F,getCodec:G,getMimeType:H,getKID:I,getContentProtectionData:J,getIsDynamic:K,getIsDVR:L,getIsOnDemand:N,getIsDVB:O,getDuration:P,getBandwidth:Q,getManifestUpdatePeriod:R,getRepresentationCount:S,getBitrateListForAdaptation:T,getRepresentationFor:U,getRepresentationsForAdaptation:V,getAdaptationsForPeriod:W,getRegularPeriods:X,getMpd:Z,getEventsForPeriod:_,getEventStreams:aa,getEventStreamForAdaptationSet:ba,getEventStreamForRepresentation:ca,getUTCTimingSources:da,getBaseURLsFromElement:ea,getRepresentationSortFunction:v,getLocation:fa}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(46),g=d(f),h=a(40),i=d(h),j=a(45),k=d(j),l=a(44),m=d(l),n=a(48),o=d(n),p=a(38),q=d(p),r=a(67),s=d(r),t=a(15),u=d(t),v=a(42),w=d(v),x=a(41),y=d(x),z=a(43),A=d(z),B=a(159),C=d(B),D=a(10),E=d(D);e.__dashjs_factory_name="DashManifestModel",c.default=E.default.getSingletonFactory(e),b.exports=c.default},{10:10,15:15,159:159,38:38,40:40,41:41,42:42,43:43,44:44,45:45,46:46,48:48,67:67}],23:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){h=[new s.default,new u.default,new w.default,new q.default],i=new o.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:h}),j=new m.default([new y.default,new A.default])}function b(a,b){var c;try{var f=window.performance.now();if(c=i.xml_str2json(a),!c)throw new Error("parser error");var g=window.performance.now();j.run(c);var k=window.performance.now();b.setMatchers(h),b.setIron(j),d("Parsing complete: ( xml2json: "+(g-f).toPrecision(3)+"ms, objectiron: "+(k-g).toPrecision(3)+"ms, total: "+((k-f)/1e3).toPrecision(3)+"s)")}catch(l){return e.manifestError("parsing the manifest failed","parse",a,l),null}return c}var c=this.context,d=(0,k.default)(c).getInstance().log,e=(0,g.default)(c).getInstance(),f=void 0,h=void 0,i=void 0,j=void 0;return f={parse:b},a(),f}Object.defineProperty(c,"__esModule",{value:!0});var f=a(152),g=d(f),h=a(10),i=d(h),j=a(8),k=d(j),l=a(3),m=d(l),n=a(4),o=d(n),p=a(32),q=d(p),r=a(30),s=d(r),t=a(29),u=d(t),v=a(31),w=d(v),x=a(26),y=d(x),z=a(27),A=d(z);e.__dashjs_factory_name="DashParser",c.default=i.default.getClassFactory(e),b.exports=c.default},{10:10,152:152,26:26,27:27,29:29,3:3,30:30,31:31,32:32,4:4,8:8}],24:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b,c){d(this,a);var e=function(a){return a&&a.length&&a.charAt(0)===a.charAt(0).toUpperCase()};this._name=b,this._merge=void 0!==c?c:e(b)}return e(a,[{key:"name",get:function(){return this._name}},{key:"merge",get:function(){return this._merge}}]),a}();c.default=f,b.exports=c.default},{}],25:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a(24),h=d(g),i=function(){function a(b,c,d,f,g){var i=this;e(this,a),this._name=b||"",this._properties=[],this._children=d||[],this._isRoot=f||!1,this._isArray=g||!0,Array.isArray(c)&&c.forEach(function(a){i._properties.push(new h.default(a))})}return f(a,[{key:"name",get:function(){return this._name}},{key:"isRoot",get:function(){return this._isRoot}},{key:"isArray",get:function(){return this._isArray}},{key:"children",get:function(){return this._children}},{key:"properties",get:function(){return this._properties}}]),a}();c.default=i,b.exports=c.default},{24:24}],26:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(25),i=d(h),j=function(a){function b(){e(this,b);var a=["profiles","width","height","sar","frameRate","audioSamplingRate","mimeType","segmentProfiles","codecs","maximumSAPPeriod","startWithSAP","maxPlayoutRate","codingDependency","scanType","FramePacking","AudioChannelConfiguration","ContentProtection","EssentialProperty","SupplementalProperty","InbandEventStream"];g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"AdaptationSet",a,[new i.default("Representation",a,[new i.default("SubRepresentation",a)])])}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{25:25}],27:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(25),i=d(h),j=function(a){function b(){e(this,b);var a=["SegmentBase","SegmentTemplate","SegmentList"];g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Period",a,[new i.default("AdaptationSet",a,[new i.default("Representation",a)])])}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{25:25}],28:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b,c){d(this,a),this._test=b,this._converter=c}return e(a,[{key:"test",get:function(){return this._test}},{key:"converter",get:function(){return this._converter}}]),a}();c.default=f,b.exports=c.default},{}],29:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(28),i=d(h),j=60,k=60,l=1e3,m=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/,n=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a){return m.test(a.value)},function(a){var b=m.exec(a),c=void 0;if(c=Date.UTC(parseInt(b[1],10),parseInt(b[2],10)-1,parseInt(b[3],10),parseInt(b[4],10),parseInt(b[5],10),b[6]&&parseInt(b[6],10)||0,b[7]&&parseFloat(b[7])*l||0),b[9]&&b[10]){var d=parseInt(b[9],10)*k+parseInt(b[10],10);c+=("+"===b[8]?-1:1)*d*j*l}return new Date(c)})}return f(b,a),b}(i.default);c.default=n,b.exports=c.default},{28:28}],30:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(28),i=d(h),j=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,k=31536e3,l=2592e3,m=86400,n=3600,o=60,p=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a){for(var b=["minBufferTime","mediaPresentationDuration","minimumUpdatePeriod","timeShiftBufferDepth","maxSegmentDuration","maxSubsegmentDuration","suggestedPresentationDelay","start","starttime","duration"],c=b.length,d=0;d<c;d++)if(a.nodeName===b[d])return j.test(a.value);return!1},function(a){var b=j.exec(a),c=parseFloat(b[2]||0)*k+parseFloat(b[4]||0)*l+parseFloat(b[6]||0)*m+parseFloat(b[8]||0)*n+parseFloat(b[10]||0)*o+parseFloat(b[12]||0);return void 0!==b[1]&&(c=-c),c})}return f(b,a),b}(i.default);c.default=p,b.exports=c.default},{28:28}],31:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(28),i=d(h),j=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,k=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a){return j.test(a.value)},function(a){return parseFloat(a)})}return f(b,a),b}(i.default);c.default=k,b.exports=c.default},{28:28}],32:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(28),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a,b){var c={MPD:["id","profiles"],Period:["id"],BaseURL:["serviceLocation","byteRange"],SegmentBase:["indexRange"],Initialization:["range"],RepresentationIndex:["range"],SegmentList:["indexRange"],BitstreamSwitching:["range"],SegmentURL:["mediaRange","indexRange"],SegmentTemplate:["indexRange","media","index","initialization","bitstreamSwitching"],AssetIdentifier:["value","id"],EventStream:["value"],AdaptationSet:["profiles","mimeType","segmentProfiles","codecs","contentType"],FramePacking:["value","id"],AudioChannelConfiguration:["value","id"],ContentProtection:["value","id"],EssentialProperty:["value","id"],SupplementalProperty:["value","id"],InbandEventStream:["value","id"],Accessibility:["value","id"],Role:["value","id"],Rating:["value","id"],Viewpoint:["value","id"],ContentComponent:["contentType"],Representation:["id","dependencyId","mediaStreamStructureId"],Subset:["id"],Metrics:["metrics"],Reporting:["value","id"]};if(c.hasOwnProperty(b)){var d=c[b];return void 0!==d&&d.indexOf(a.name)>=0}return!1},function(a){return String(a)})}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{28:28}],33:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){a&&a.boxParser&&(e=a.boxParser)}function b(a){var b,c,d,f,g,h,i,j,k,l,m,n,o,p=e.parse(a),q=p.getBox("tfhd"),r=p.getBox("tfdt"),s=p.getBox("trun"),t=p.getBox("moof"),u=p.getBox("mfhd"),v=p.getBox("subs");for(m=u.sequence_number,d=s.sample_count,g=r.baseMediaDecodeTime,l=(q.base_data_offset||0)+(s.data_offset||0),h=[],o=0,j=0;j<d;j++){i=s.samples[j],b=void 0!==i.sample_duration?i.sample_duration:q.default_sample_duration,f=void 0!==i.sample_size?i.sample_size:q.default_sample_size,c=void 0!==i.sample_composition_time_offset?i.sample_composition_time_offset:0;var w={dts:g,cts:g+c,duration:b,offset:t.offset+l,size:f,subSizes:[f]};if(v&&o<v.samples_with_subsamples.length&&v.samples_with_subsamples[o].nr==j+1){for(w.subSizes=[],k=0;k<v.samples_with_subsamples[o].subsamples.length;k++){var x=v.samples_with_subsamples[o].subsamples[k].size;w.subSizes.push(x)}o++}h.push(w),l+=f,g+=b}return n=g-r.baseMediaDecodeTime,{sampleList:h,sequenceNumber:m,totalDuration:n}}function c(a){var b=e.parse(a),c=b.getBox("mdhd");return c?c.timescale:NaN}var d=void 0,e=void 0;return d={getSamplesInfo:b,getMediaTimescaleFromMoov:c,setConfig:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="FragmentedTextBoxParser",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],34:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(a,c,e,f){var g,i,j,k,l,m,n,o=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentList,p=o.SegmentURL_asArray.length,q=[];for(n=a.startNumber,k=(0,h.decideSegmentListRangeForTemplate)(d,b,a,c,e,f),l=Math.max(k.start,0),m=Math.min(k.end,o.SegmentURL_asArray.length-1),g=l;g<=m;g++)j=o.SegmentURL_asArray[g],i=(0,h.getIndexBasedSegment)(d,b,a,g),i.replacementTime=(n+g-1)*a.segmentDuration,i.media=j.media?j.media:"",i.mediaRange=j.mediaRange,i.index=j.index,i.indexRange=j.indexRange,q.push(i),i=null;return a.availableSegmentsNumber=p,q}var d=a.timelineConverter,e=void 0;return e={getSegments:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(36);e.__dashjs_factory_name="ListSegmentsGetter";var i=g.default.getClassFactory(e);c.default=i,b.exports=c.default},{10:10,36:36}],35:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(){h=(0,i.default)(f).create(a,b),j=(0,k.default)(f).create(a,b),l=(0,m.default)(f).create(a,b)}function d(a,b,c,d,f){var g,i=a.segmentInfoType;return"SegmentBase"!==i&&"BaseURL"!==i&&e(a,c)?("SegmentTimeline"===i?g=h.getSegments(a,b,c,f):"SegmentTemplate"===i?g=j.getSegments(a,b,c,f):"SegmentList"===i&&(g=l.getSegments(a,b,c,f)),d&&d(a,g)):g=a.segments,g}function e(a,b){var c,d,e=a.segments,f=!1;return e&&0!==e.length?(d=e[0].availabilityIdx,c=e[e.length-1].availabilityIdx,f=b<d||b>c):f=!0,f}var f=this.context,g=void 0,h=void 0,j=void 0,l=void 0;return g={getSegments:d},c(),g}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(39),i=d(h),j=a(37),k=d(j),l=a(34),m=d(l);e.__dashjs_factory_name="SegmentsGetter";var n=g.default.getClassFactory(e);c.default=n,b.exports=c.default},{10:10,34:34,37:37,39:39}],36:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){for(;a.length<b;)a="0"+a;return a}function f(a,b){return a.representation.startNumber+b}function g(a,b,c){var d,f,g,h,i,j,k="%0",l=b.length,m=k.length;if(!a)return a;for(;;){if(d=a.indexOf("$"+b),d<0)return a;if(f=a.indexOf("$",d+l),f<0)return a;if(g=a.indexOf(k,d+l),g>d&&g<f)switch(h=a.charAt(f-1),i=parseInt(a.substring(g+m,f-1),10),h){case"d":case"i":case"u":j=e(c.toString(),i);break;case"x":j=e(c.toString(16),i);break;case"X":j=e(c.toString(16),i).toUpperCase();break;case"o":j=e(c.toString(8),i);break;default:return a}else j=c;a=a.substring(0,d)+j+a.substring(f+1)}}function h(a,b,c,d){var e,g,h,i;return g=c.segmentDuration,isNaN(g)&&(g=c.adaptation.period.duration),h=c.adaptation.period.start+d*g,i=h+g,e=new n.default,e.representation=c,e.duration=g,e.presentationStartTime=h,e.mediaStartTime=a.calcMediaTimeFromPresentationTime(e.presentationStartTime,c),e.availabilityStartTime=a.calcAvailabilityStartTimeFromPresentationTime(e.presentationStartTime,c.adaptation.period.mpd,b),e.availabilityEndTime=a.calcAvailabilityEndTimeFromPresentationTime(i,c.adaptation.period.mpd,b),e.wallStartTime=a.calcWallTimeForSegment(e,b),e.replacementNumber=f(e,d),e.availabilityIdx=d,e}function i(a,b,c,d,e,h,i,j,k){var l,m,o,p=d/h,q=Math.min(e/h,c.adaptation.period.mpd.maxSegmentDuration);return l=a.calcPresentationTimeFromMediaTime(p,c),m=l+q,o=new n.default,o.representation=c,o.duration=q,o.mediaStartTime=p,o.presentationStartTime=l,o.availabilityStartTime=c.adaptation.period.mpd.manifest.loadedTime,o.availabilityEndTime=a.calcAvailabilityEndTimeFromPresentationTime(m,c.adaptation.period.mpd,b),o.wallStartTime=a.calcWallTimeForSegment(o,b),o.replacementTime=d,o.replacementNumber=f(o,k),i=g(i,"Number",o.replacementNumber),i=g(i,"Time",o.replacementTime),o.media=i,o.mediaRange=j,o.availabilityIdx=k,o}function j(a,b){if(!b||!b.segments)return null;var c,d,e=b.segments.length;if(a<e&&(c=b.segments[a],c&&c.availabilityIdx===a))return c;for(d=0;d<e;d++)if(c=b.segments[d],c&&c.availabilityIdx===a)return c;return null}function k(a,b,c,d,e){var f,g,h,i=2,j=e||10,k=0,l=Number.POSITIVE_INFINITY;return b&&!a.isTimeSyncCompleted()?h={start:k,end:l}:!b&&c||d<0?null:(f=Math.max(d-i,k),g=Math.min(d+j,l),h={start:f,end:g})}function l(a,b,c,d,e,f){var g,h,i,k=c.segmentDuration,l=c.adaptation.period.mpd.manifest.minBufferTime,m=c.segmentAvailabilityRange,n={start:a.calcPeriodRelativeTimeFromMpdRelativeTime(c,m.start),end:a.calcPeriodRelativeTimeFromMpdRelativeTime(c,m.end)},o=c.segments,p=2*k,q=f||Math.max(2*l,10*k),r=NaN,s=null;return n.start=Math.max(n.start,0),b&&!a.isTimeSyncCompleted()?(g=Math.floor(n.start/k),h=Math.floor(n.end/k),i={start:g,end:h}):(o&&o.length>0?(s=j(e,c),r=s?a.calcPeriodRelativeTimeFromMpdRelativeTime(c,s.presentationStartTime):e>0?e*k:a.calcPeriodRelativeTimeFromMpdRelativeTime(c,d)):r=e>0?e*k:b?n.end:n.start,g=Math.floor(Math.max(r-p,n.start)/k),h=Math.floor(Math.min(g+q/k,n.end/k)),i={start:g,end:h})}Object.defineProperty(c,"__esModule",{value:!0}),c.replaceTokenForTemplate=g,c.getIndexBasedSegment=h,c.getTimeBasedSegment=i,c.getSegmentByIndex=j,c.decideSegmentListRangeForTimeline=k,c.decideSegmentListRangeForTemplate=l;var m=a(47),n=d(m)},{47:47}],37:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(a,c,e,f){var g,i,j,k,l,m=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentTemplate,n=a.segmentDuration,o=a.segmentAvailabilityRange,p=[],q=null,r=null;for(l=a.startNumber,g=isNaN(n)&&!b?{start:l,end:l}:(0,h.decideSegmentListRangeForTemplate)(d,b,a,c,e,f),j=g.start,k=g.end,i=j;i<=k;i++)r=(0,h.getIndexBasedSegment)(d,b,a,i),r.replacementTime=(l+i-1)*a.segmentDuration,q=m.media,q=(0,h.replaceTokenForTemplate)(q,"Number",r.replacementNumber),q=(0,h.replaceTokenForTemplate)(q,"Time",r.replacementTime),r.media=q,p.push(r),r=null;return isNaN(n)?a.availableSegmentsNumber=1:a.availableSegmentsNumber=Math.ceil((o.end-o.start)/n),p}var d=a.timelineConverter,e=void 0;return e={getSegments:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(36);e.__dashjs_factory_name="TemplateSegmentsGetter";var i=g.default.getClassFactory(e);c.default=i,b.exports=c.default},{10:10,36:36}],38:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){z=0,A=!1,B=NaN,x.on(i.default.TIME_SYNCHRONIZATION_COMPLETED,t,this)}function b(){return A}function c(a){A=a}function d(){return z}function e(a){z=a}function f(){return B}function h(a){B=a}function j(a,b,c,d){var e=NaN;return e=d?c&&b.timeShiftBufferDepth!=Number.POSITIVE_INFINITY?new Date(b.availabilityStartTime.getTime()+1e3*(a+b.timeShiftBufferDepth)):b.availabilityEndTime:c?new Date(b.availabilityStartTime.getTime()+1e3*(a-z)):b.availabilityStartTime}function k(a,b,c){return j.call(this,a,b,c)}function l(a,b,c){return j.call(this,a,b,c,!0)}function m(a,b){return(a.getTime()-b.mpd.availabilityStartTime.getTime()+1e3*z)/1e3}function n(a,b){var c=b.adaptation.period.start,d=b.presentationTimeOffset;return a+(c-d)}function o(a,b){var c=b.adaptation.period.start,d=b.presentationTimeOffset;return a-c+d}function p(a,b){var c,d,e;return b&&(c=a.representation.adaptation.period.mpd.suggestedPresentationDelay,d=a.presentationStartTime+c,e=new Date(a.availabilityStartTime.getTime()+1e3*d)),e}function q(a,b){var c=a.adaptation.period,d={start:c.start,end:c.start+c.duration};if(!b)return d;if(!A&&a.segmentAvailabilityRange)return a.segmentAvailabilityRange;var e=a.segmentDuration||(a.segments&&a.segments.length?a.segments[a.segments.length-1].duration:0),f=m(new Date,c),g=c.start+c.duration;return d.start=Math.max(f-c.mpd.timeShiftBufferDepth,c.start),d.end=f>=g&&f-e<g?g-e:f-e,d}function r(a,b){var c=a.adaptation.period.start;return b-c}function s(a,b){var c=a.adaptation.period.start;return b+c}function t(a){A||void 0!==a.offset&&(e(a.offset/1e3),A=!0)}function u(a){var b=a.presentationTimeOffset,c=a.adaptation.period.start;return c-b}function v(){x.off(i.default.TIME_SYNCHRONIZATION_COMPLETED,t,this),z=0,A=!1,B=NaN}var w=this.context,x=(0,g.default)(w).getInstance(),y=void 0,z=void 0,A=void 0,B=void 0;return y={initialize:a,isTimeSyncCompleted:b,setTimeSyncCompleted:c,getClientTimeOffset:d,setClientTimeOffset:e,getExpectedLiveEdge:f,setExpectedLiveEdge:h,calcAvailabilityStartTimeFromPresentationTime:k,calcAvailabilityEndTimeFromPresentationTime:l,calcPresentationTimeFromWallTime:m,calcPresentationTimeFromMediaTime:n,calcPeriodRelativeTimeFromMpdRelativeTime:r,calcMpdRelativeTimeFromPeriodRelativeTime:s,calcMediaTimeFromPresentationTime:o,calcSegmentAvailabilityRange:q,calcWallTimeForSegment:p,calcMSETimeOffset:u,reset:v}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j);e.__dashjs_factory_name="TimelineConverter",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,9:9}],39:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(a,c,e,f){var g,i,j,k,l,m,n,o,p,q,r,s,t,u,v=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentTemplate||a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentList,w=v.SegmentTimeline,x=v.SegmentURL_asArray,y=a.availableSegmentsNumber>0,z=10,A=0,B=0,C=-1,D=[],E=!1,F=function(c,e){var f=v.media,g=c.mediaRange;return x&&(f=x[e].media||"",g=x[e].mediaRange),(0,h.getTimeBasedSegment)(d,b,a,A,c.d,u,f,g,C)};for(u=a.timescale,g=w.S_asArray,p=(0,h.decideSegmentListRangeForTimeline)(d,b,c,e,f),p?(s=p.start,t=p.end):r=d.calcMediaTimeFromPresentationTime(c||0,a),j=0,k=g.length;j<k;j++){if(i=g[j],m=0,i.hasOwnProperty("r")&&(m=i.r),i.hasOwnProperty("t")&&(A=i.t,B=A/u),m<0){if(o=g[j+1],o&&o.hasOwnProperty("t"))n=o.t/u;else{var G=a.segmentAvailabilityRange?a.segmentAvailabilityRange.end:d.calcSegmentAvailabilityRange(a,b).end;n=d.calcMediaTimeFromPresentationTime(G,a),a.segmentDuration=i.d/u}m=Math.ceil((n-B)/(i.d/u))-1}if(q){if(y)break;C+=m+1}else for(l=0;l<=m;l++){if(C++,p){if(C>t){if(q=!0,y)break;continue}C>=s&&D.push(F(i,C))}else{if(D.length>z){if(q=!0,y)break;continue}E?D.push(F(i,C)):B>=r-i.d/u*1.5&&(E=!0,D.push(F(i,C)))}A+=i.d,B=A/u}}return y||(a.availableSegmentsNumber=C+1),D}var d=a.timelineConverter,e=void 0;return e={getSegments:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(36);e.__dashjs_factory_name="TimelineSegmentsGetter";var i=g.default.getClassFactory(e);c.default=i,b.exports=c.default},{10:10,36:36}],40:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.period=null,this.index=-1,this.type=null};c.default=e,b.exports=c.default},{}],41:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=1,f=1,g=function a(b,c,g,h){d(this,a),this.url=b||"",this.serviceLocation=c||b||"",this.dvb_priority=g||e,this.dvb_weight=h||f};g.DEFAULT_DVB_PRIORITY=e,g.DEFAULT_DVB_WEIGHT=f,c.default=g,b.exports=c.default},{}],42:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN};c.default=e,b.exports=c.default},{}],43:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri=""};c.default=e,b.exports=c.default},{}],44:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.minimumUpdatePeriod=NaN,this.mediaPresentationDuration=NaN};c.default=e,b.exports=c.default},{}],45:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null};e.DEFAULT_ID="defaultId",c.default=e,b.exports=c.default},{}],46:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a),this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.segmentDuration=NaN,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=NaN,this.segmentAvailabilityRange=null,this.availableSegmentsNumber=0,this.bandwidth=NaN,this.maxPlayoutRate=NaN}return e(a,null,[{key:"hasInitialization",value:function(a){return null!==a.initialization||("BaseURL"!==a.segmentInfoType||"SegmentBase"!==a.segmentInfoType)&&null!==a.range}},{key:"hasSegments",value:function(a){return"BaseURL"!==a.segmentInfoType&&"SegmentBase"!==a.segmentInfoType&&!a.indexRange}}]),a}();c.default=f,b.exports=c.default},{}],47:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.replacementTime=null,this.replacementNumber=NaN,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.availabilityStartTime=NaN,this.availabilityEndTime=NaN,this.availabilityIdx=NaN,this.wallStartTime=NaN,this.representation=null};c.default=e,b.exports=c.default},{}],48:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.schemeIdUri="",this.value=""};c.default=e,b.exports=c.default},{}],49:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){n=(0,g.default)(h).create({errHandler:a.errHandler,metricsModel:a.metricsModel,requestModifier:a.requestModifier})}function c(a){var b=function(b){j.trigger(o.default.CHECK_FOR_EXISTENCE_COMPLETED,{request:a,exists:b})};if(a){var c=new i.default(a.url);n.load({request:c,success:function(){b(!0)},error:function(){b(!1)}})}else b(!1)}function d(a){var b=function(b,c){j.trigger(o.default.LOADING_COMPLETED,{request:a,response:b||null,error:c||null,sender:l})};a?n.load({request:a,progress:function(){j.trigger(o.default.LOADING_PROGRESS,{request:a})},success:function(a){b(a)},error:function(a,c,d){b(void 0,new k.default(r,d,c))}}):b(void 0,new k.default(s,t))}function e(){n&&n.abort()}function f(){n&&(n.abort(),n=null)}var h=this.context,j=(0,m.default)(h).getInstance(),l=void 0,n=void 0;return l={checkForExistence:c,load:d,abort:e,reset:f},b(),l}Object.defineProperty(c,"__esModule",{value:!0});var f=a(59),g=d(f),h=a(165),i=d(h),j=a(163),k=d(j),l=a(9),m=d(l),n=a(13),o=d(n),p=a(10),q=d(p),r=1,s=2,t="request is null"; -e.__dashjs_factory_name="FragmentLoader";var u=q.default.getClassFactory(e);u.FRAGMENT_LOADER_ERROR_LOADING_FAILURE=r,u.FRAGMENT_LOADER_ERROR_NULL_REQUEST=s,c.default=u,b.exports=c.default},{10:10,13:13,163:163,165:165,59:59,9:9}],50:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){h.on(t.default.XLINK_READY,c,n),q=(0,i.default)(f).create({errHandler:a.errHandler,metricsModel:a.metricsModel,requestModifier:a.requestModifier}),s=(0,g.default)(f).create({errHandler:a.errHandler,metricsModel:a.metricsModel,requestModifier:a.requestModifier})}function c(a){h.trigger(t.default.INTERNAL_MANIFEST_LOADED,{manifest:a.manifest})}function d(a){var b=new m.default(a,p.HTTPRequest.MPD_TYPE);q.load({request:b,success:function(b,c,d){var e,f;d.responseURL&&d.responseURL!==a?(f=j.parseBaseUrl(d.responseURL),e=d.responseURL):(j.isRelative(a)&&(a=j.resolve(a,window.location.href)),f=j.parseBaseUrl(a));var g=l.parse(b,s);g?(g.url=e||a,g.originalUrl||(g.originalUrl=g.url),g.baseUri=f,g.loadedTime=new Date,s.resolveManifestOnLoad(g)):h.trigger(t.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new o.default(w,y)})},error:function(b,c,d){h.trigger(t.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new o.default(x,"Failed loading manifest: "+a+", "+d)})}})}function e(){h.off(t.default.XLINK_READY,c,n),s&&(s.reset(),s=null),q&&(q.abort(),q=null)}var f=this.context,h=(0,r.default)(f).getInstance(),j=(0,k.default)(f).getInstance(),l=a.parser,n=void 0,q=void 0,s=void 0;return n={load:d,reset:e},b(),n}Object.defineProperty(c,"__esModule",{value:!0});var f=a(75),g=d(f),h=a(59),i=d(h),j=a(159),k=d(j),l=a(171),m=d(l),n=a(163),o=d(n),p=a(180),q=a(9),r=d(q),s=a(13),t=d(s),u=a(10),v=d(u),w=1,x=2,y="parsing failed";e.__dashjs_factory_name="ManifestLoader";var z=v.default.getClassFactory(e);z.MANIFEST_LOADER_ERROR_PARSING_FAILURE=w,z.MANIFEST_LOADER_ERROR_LOADING_FAILURE=x,c.default=z,b.exports=c.default},{10:10,13:13,159:159,163:163,171:171,180:180,59:59,75:75,9:9}],51:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){a&&(a.manifestModel&&(B=a.manifestModel),a.dashManifestModel&&(C=a.dashManifestModel))}function b(a){A=a,w=NaN,x=null,z=!1,y=!0,D=(0,m.default)(s).getInstance(),u.on(i.default.STREAMS_COMPOSED,r,this),u.on(i.default.PLAYBACK_STARTED,p,this),u.on(i.default.PLAYBACK_PAUSED,q,this),u.on(i.default.INTERNAL_MANIFEST_LOADED,n,this)}function c(a){k(a)}function d(){return A}function e(){u.off(i.default.PLAYBACK_STARTED,p,this),u.off(i.default.PLAYBACK_PAUSED,q,this),u.off(i.default.STREAMS_COMPOSED,r,this),u.off(i.default.INTERNAL_MANIFEST_LOADED,n,this),f(),y=!0,z=!1,w=NaN,D=null}function f(){null!==x&&(clearInterval(x),x=null)}function h(){f(),isNaN(w)||(t("Refresh manifest in "+w+" seconds."),x=setTimeout(l,1e3*w))}function j(){z=!0;var a=B.getValue(),b=a.url,c=C.getLocation(a);c&&(b=c),A.load(b)}function k(a){B.setValue(a);var b=new Date,c=(b.getTime()-a.loadedTime.getTime())/1e3;w=C.getManifestUpdatePeriod(a,c),u.trigger(i.default.MANIFEST_UPDATED,{manifest:a}),t("Manifest has been refreshed at "+b+"["+b.getTime()/1e3+"] "),y||h()}function l(){y&&!D.getScheduleWhilePaused()||z||j()}function n(a){a.error||k(a.manifest)}function p(){y=!1,h()}function q(){y=!0,f()}function r(){z=!1}var s=this.context,t=(0,o.default)(s).getInstance().log,u=(0,g.default)(s).getInstance(),v=void 0,w=void 0,x=void 0,y=void 0,z=void 0,A=void 0,B=void 0,C=void 0,D=void 0;return v={initialize:b,setManifest:c,getManifestLoader:d,refreshManifest:j,setConfig:a,reset:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j),l=a(102),m=d(l),n=a(8),o=d(n);e.__dashjs_factory_name="ManifestUpdater",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{10:10,102:102,13:13,8:8,9:9}],52:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){ec=!1,fc=!1,gc=!0,jc=null,dc=null,lc=null,ca.default.extend(ea.default),nc=(0,I.default)(Zb).getInstance()}function b(a,b,c){return pc=(0,u.default)(Zb).getInstance(),oc=(0,s.default)(Zb).getInstance(),pc.supportsMediaSource()?void(ec||(ec=!0,hc=(0,M.default)(Zb).getInstance(),sc=(0,i.default)(Zb).getInstance(),ic=(0,m.default)(Zb).getInstance(),ic.initialize(),uc=(0,na.default)(Zb).getInstance(),tc=(0,pa.default)(Zb).getInstance(),mc=(0,K.default)(Zb).getInstance(),mc.setConfig({adapter:Ob()}),gb(),sa(void 0===c||c),a&&Eb(a),b&&Ib(b),ac("[dash.js "+T()+"] MediaPlayer has been initialized"))):void oc.capabilityError("mediasource")}function c(){return!!vc&&!!cc}function d(){if(!fc)throw Vb;(!gc||f()&&fc)&&sc.play()}function e(){if(!fc)throw Vb;sc.pause()}function f(){if(!fc)throw Vb;return sc.isPaused()}function h(){if(!fc)throw Vb;return sc.isSeeking()}function j(){if(!fc)throw Vb;return sc.getIsDynamic()}function l(a){if(!vc)throw Wb;Db().muted=a}function n(){if(!vc)throw Wb;return Db().muted}function p(a){if(!vc)throw Wb;Db().volume=a}function r(){if(!vc)throw Wb;return Db().volume}function t(a){var b=["video","audio","fragmentedText"];if(a){if(b.indexOf(a)!==-1){var c=wa().getCurrentBufferLevel(xa(a));return c?c:NaN}return ac("Warning - getBufferLength requested for invalid type"),NaN}return b.map(function(a){return Na(a).length>0?wa().getCurrentBufferLevel(xa(a)):Number.MAX_VALUE}).reduce(function(a,b){return Math.min(a,b)})}function v(){var a=Rb();return a?a.manifestInfo.DVRWindowSize:0}function x(a){var b=Rb();if(!b)return 0;var c=b.range.start+a;return c>b.range.end&&(c=b.range.end),c}function z(a){if(!fc)throw Vb;var b=sc.getIsDynamic()?x(a):a;sc.seek(b)}function B(a){if(!fc)throw Vb;var b=Db().currentTime;if(void 0!==a)b=qc.getTimeRelativeToStreamId(b,a);else if(sc.getIsDynamic()){var c=Rb();b=null===c?0:D()-(c.range.end-c.time)}return b}function D(){if(!fc)throw Vb;var a=Db().duration;if(sc.getIsDynamic()){var b,c=Rb();if(!c)return 0;b=c.range.end-c.range.start,a=b<c.manifestInfo.DVRWindowSize?b:c.manifestInfo.DVRWindowSize}return a}function F(){if(!fc)throw Vb;return B()<0?NaN:Sb(B())}function H(){if(!fc)throw Vb;return Sb(D())}function J(a,b,c){var d=!(arguments.length<=3||void 0===arguments[3])&&arguments[3],e=new Date(1e3*a),f=e.toLocaleDateString(b),g=e.toLocaleTimeString(b,{hour12:c});return d?g+" "+f:g}function L(a){a=Math.max(a,0);var b=Math.floor(a/3600),c=Math.floor(a%3600/60),d=Math.floor(a%3600%60);return(0===b?"":b<10?"0"+b.toString()+":":b.toString()+":")+(c<10?"0"+c.toString():c.toString())+":"+(d<10?"0"+d.toString():d.toString())}function N(a,b,c){ga.default.extend(a,b,c,Zb)}function P(a,b,c){$b.on(a,b,c)}function R(a,b,c){$b.off(a,b,c)}function T(){return(0,ha.getVersionString)()}function V(){return _b}function X(){if(!vc)throw Wb;return vc}function Z(a){nc.setLiveDelayFragmentCount(a)}function _(a){nc.setLiveDelay(a)}function ba(){return nc.getLiveDelay()}function da(a){nc.setUseSuggestedPresentationDelay(a)}function fa(a,b){nc.setLastBitrateCachingInfo(a,b)}function ia(a,b){nc.setLastMediaSettingsCachingInfo(a,b)}function ka(a,b){hc.setMaxAllowedBitrateFor(a,b)}function ma(a){return hc.getMaxAllowedBitrateFor(a)}function oa(a,b){hc.setMaxAllowedRepresentationRatioFor(a,b)}function qa(a){return hc.getMaxAllowedRepresentationRatioFor(a)}function sa(a){gc=a}function ta(){return gc}function ua(a){nc.setScheduleWhilePaused(a)}function va(){return nc.getScheduleWhilePaused()}function wa(){return tc}function xa(a){return mc.getReadOnlyMetricsFor(a)}function ya(a){if(!fc)throw Vb;return hc.getQualityFor(a,qc.getActiveStreamInfo())}function za(a,b){if(!fc)throw Vb;hc.setPlaybackQuality(a,qc.getActiveStreamInfo(),b)}function Aa(){hc.setElementSize(),hc.setWindowResizeEventCalled(!0)}function Ba(){return hc.getLimitBitrateByPortal()}function Ca(a){hc.setLimitBitrateByPortal(a)}function Da(){return hc.getUsePixelRatioInLimitBitrateByPortal()}function Ea(a){hc.setUsePixelRatioInLimitBitrateByPortal(a)}function Fa(a){if(!fc)throw Vb;void 0===wc&&(wc=(0,C.default)(Zb).getInstance());for(var b=Db().textTracks,c=b.length,d=0;d<c;d++){var e=b[d],f=a===d?"showing":"hidden";e.mode!==f&&(e.mode=f)}wc.setTextTrack()}function Ga(){var a=NaN;return wc&&(a=wc.getCurrentTrackIdx()),a}function Ha(a){if(!fc)throw Vb;var b=Tb();return b?b.getBitrateListFor(a):[]}function Ia(a,b){hc.setInitialBitrateFor(a,b)}function Ja(a){if(!fc)throw Vb;return hc.getInitialBitrateFor(a)}function Ka(a,b){hc.setInitialRepresentationRatioFor(a,b)}function La(a){return hc.getInitialRepresentationRatioFor(a)}function Ma(a){if(!fc)throw Vb;return lc.getStreamsInfo(a)}function Na(a){if(!fc)throw Vb;var b=qc.getActiveStreamInfo();return b?ic.getTracksFor(a,b):[]}function Oa(a,b,c){if(!fc)throw Vb;return c=c||lc.getStreamsInfo(b)[0],c?lc.getAllMediaInfoForType(b,c,a):[]}function Pa(a){if(!fc)throw Vb;var b=qc.getActiveStreamInfo();return b?ic.getCurrentTrackFor(a,b):null}function Qa(a,b){ic.setInitialSettings(a,b)}function Ra(a){return ic.getInitialSettings(a)}function Sa(a){if(!fc)throw Vb;ic.setTrack(a)}function Ta(a){return ic.getSwitchMode(a)}function Ua(a,b){ic.setSwitchMode(a,b)}function Va(a){ic.setSelectionModeForInitialTrack(a)}function Wa(){return ic.getSelectionModeForInitialTrack()}function Xa(){return hc.getAutoSwitchBitrateFor("video")||hc.getAutoSwitchBitrateFor("audio")}function Ya(a){hc.setAutoSwitchBitrateFor("video",a),hc.setAutoSwitchBitrateFor("audio",a)}function Za(a){return hc.getAutoSwitchBitrateFor(a)}function $a(a,b){hc.setAutoSwitchBitrateFor(a,b)}function _a(a){nc.setFastSwitchEnabled(a)}function ab(){return nc.getFastSwitchEnabled()}function bb(a){nc.setBufferOccupancyABREnabled(a)}function cb(a,b){var c=Mb(),d=this,e=function a(e){e.error?b(null,e.error):b(e.manifest),$b.off(ca.default.INTERNAL_MANIFEST_LOADED,a,d),c.reset()};$b.on(ca.default.INTERNAL_MANIFEST_LOADED,e,d);var f=(0,E.default)(Zb).getInstance();f.initialize(),c.load(f.parseURI(a))}function db(a,b){eb(a,b);var c=new g.default;c.schemeIdUri=a,c.value=b,nc.getUTCTimingSources().push(c)}function eb(a,b){var c=nc.getUTCTimingSources();c.forEach(function(d,e){d.schemeIdUri===a&&d.value===b&&c.splice(e,1)})}function fb(){nc.setUTCTimingSources([])}function gb(){db(I.default.DEFAULT_UTC_TIMING_SOURCE.scheme,I.default.DEFAULT_UTC_TIMING_SOURCE.value)}function hb(a){nc.setUseManifestDateHeaderTimeSource(a)}function ib(a){nc.setBufferToKeep(a)}function jb(a){nc.setBufferPruningInterval(a)}function kb(a){nc.setStableBufferTime(a)}function lb(a){nc.setBufferTimeAtTopQuality(a)}function mb(a){nc.setBufferTimeAtTopQualityLongForm(a)}function nb(a){nc.setLongFormContentDurationThreshold(a)}function ob(a){nc.setRichBufferThreshold(a)}function pb(a){nc.setBandwidthSafetyFactor(a)}function qb(){return nc.getBandwidthSafetyFactor()}function rb(a){nc.setAbandonLoadTimeout(a)}function sb(a){nc.setFragmentRetryAttempts(a)}function tb(a){nc.setFragmentRetryInterval(a)}function ub(a){vb(void 0,a)}function vb(a,b){nc.setXHRWithCredentialsForType(a,b)}function wb(a){return nc.getXHRWithCredentialsForType(a)}function xb(){return Pb()}function yb(a){jc=a}function zb(a){dc=a}function Ab(a){var b=(0,w.default)(Zb).getInstance();b.setConfig({videoModel:vc}),b.initialize(),b.displayCConTop(a)}function Bb(){return vc?vc.getVideoContainer():null}function Cb(a){if(!vc)throw Wb;vc.setVideoContainer(a)}function Db(){if(!vc)throw Wb;return vc.getElement()}function Eb(a){if(!ec)throw Yb;vc=null,a&&(vc=(0,S.default)(Zb).getInstance(),vc.initialize(),vc.setElement(a),Pb(),Qb()),Kb()}function Fb(){return vc?vc.getTTMLRenderingDiv():null}function Gb(a){if(!vc)throw Wb;vc.setTTMLRenderingDiv(a)}function Hb(){if(!cc)throw Xb;return cc}function Ib(a){if(!ec)throw Yb;if("string"==typeof a){var b=(0,E.default)(Zb).getInstance();b.initialize(),cc=b.parseURI(a)}else cc=a;Kb()}function Jb(){Ib(null),Eb(null),dc=null,jc=null}function Kb(){fc?(fc=!1,lc.reset(),qc.reset(),sc.reset(),hc.reset(),rc.reset(),ic.reset(),qc=null,kc=null,c()&&Ub()):c()&&Ub()}function Lb(){var a=(0,Q.default)(Zb).getInstance();a.initialize();var b=(0,y.default)(Zb).getInstance();b.setConfig({dashManifestModel:uc}),ic.initialize(),ic.setConfig({errHandler:oc}),rc=(0,U.default)(Zb).getInstance(),rc.initialize(),rc.setConfig({abrRulesCollection:a}),qc=(0,k.default)(Zb).getInstance(),qc.setConfig({capabilities:pc,manifestLoader:Mb(),manifestModel:(0,G.default)(Zb).getInstance(),dashManifestModel:uc,protectionController:jc,adapter:lc,metricsModel:mc,dashMetrics:tc,liveEdgeFinder:(0,q.default)(Zb).getInstance(),mediaSourceController:(0,W.default)(Zb).getInstance(),timeSyncController:(0,O.default)(Zb).getInstance(),baseURLController:(0,Y.default)(Zb).getInstance(),errHandler:oc,timelineConverter:(0,ra.default)(Zb).getInstance()}),qc.initialize(gc,dc),hc.setConfig({abrRulesCollection:a,rulesController:rc,streamController:qc})}function Mb(){return(0,o.default)(Zb).create({errHandler:oc,parser:Nb(),metricsModel:mc,requestModifier:(0,A.default)(Zb).getInstance()})}function Nb(){return(0,la.default)(Zb).create()}function Ob(){return lc=(0,ja.default)(Zb).getInstance(),lc.initialize(),lc.setConfig({dashManifestModel:uc}),lc}function Pb(){if(jc)return jc;var a=dashjs.Protection;if("function"==typeof a){var b=a(Zb).create();return ca.default.extend(a.events),ea.default.extend(a.events,{publicOnly:!0}),jc=b.createProtectionSystem({log:ac,videoModel:vc,capabilities:pc,eventBus:$b,adapter:lc})}return null}function Qb(){if(kc)return kc;var a=dashjs.MetricsReporting;if("function"==typeof a){var b=a(Zb).create();return kc=b.createMetricsReporting({log:ac,eventBus:$b,mediaElement:Db(),dashManifestModel:uc,metricsModel:mc})}return null}function Rb(){var a=mc.getReadOnlyMetricsFor("video")||mc.getReadOnlyMetricsFor("audio");return tc.getCurrentDVRInfo(a)}function Sb(a){var b,c,d=Rb();return d?(b=d.manifestInfo.availableFrom.getTime()/1e3,c=a+(b+d.range.start)):0}function Tb(){if(!fc)throw Vb;var a=qc.getActiveStreamInfo();return a?qc.getStreamById(a.id):null}function Ub(){fc||(fc=!0,ac("Playback Initialized"),Lb(),"string"==typeof cc?qc.load(cc):qc.loadWithManifest(cc))}var Vb="You must first call play() to init playback before calling this method",Wb="You must first call attachView() to set the video element before calling this method",Xb="You must first call attachSource() with a valid source before calling this method",Yb="MediaPlayer not initialized!",Zb=this.context,$b=(0,aa.default)(Zb).getInstance(),_b=(0,$.default)(Zb).getInstance(),ac=_b.log,bc=void 0,cc=void 0,dc=void 0,ec=void 0,fc=void 0,gc=void 0,hc=void 0,ic=void 0,jc=void 0,kc=void 0,lc=void 0,mc=void 0,nc=void 0,oc=void 0,pc=void 0,qc=void 0,rc=void 0,sc=void 0,tc=void 0,uc=void 0,vc=void 0,wc=void 0;return bc={initialize:b,on:P,off:R,extend:N,attachView:Eb,attachSource:Ib,isReady:c,play:d,isPaused:f,pause:e,isSeeking:h,isDynamic:j,seek:z,setMute:l,isMuted:n,setVolume:p,getVolume:r,time:B,duration:D,timeAsUTC:F,durationAsUTC:H,getActiveStream:Tb,getDVRWindowSize:v,getDVRSeekOffset:x,convertToTimeCode:L,formatUTC:J,getVersion:T,getDebug:V,getBufferLength:t,getVideoModel:X,getVideoContainer:Bb,getTTMLRenderingDiv:Fb,getVideoElement:Db,getSource:Hb,setLiveDelayFragmentCount:Z,setLiveDelay:_,getLiveDelay:ba,useSuggestedPresentationDelay:da,enableLastBitrateCaching:fa,enableLastMediaSettingsCaching:ia,setMaxAllowedBitrateFor:ka,getMaxAllowedBitrateFor:ma,setMaxAllowedRepresentationRatioFor:oa,getMaxAllowedRepresentationRatioFor:qa,setAutoPlay:sa,getAutoPlay:ta,setScheduleWhilePaused:ua,getScheduleWhilePaused:va,getDashMetrics:wa,getMetricsFor:xa,getQualityFor:ya,setQualityFor:za,updatePortalSize:Aa,getLimitBitrateByPortal:Ba,setLimitBitrateByPortal:Ca,getUsePixelRatioInLimitBitrateByPortal:Da,setUsePixelRatioInLimitBitrateByPortal:Ea,setTextTrack:Fa,getBitrateInfoListFor:Ha,setInitialBitrateFor:Ia,getInitialBitrateFor:Ja,setInitialRepresentationRatioFor:Ka,getInitialRepresentationRatioFor:La,getStreamsFromManifest:Ma,getTracksFor:Na,getTracksForTypeFromManifest:Oa,getCurrentTrackFor:Pa,setInitialMediaSettingsFor:Qa,getInitialMediaSettingsFor:Ra,setCurrentTrack:Sa,getTrackSwitchModeFor:Ta,setTrackSwitchModeFor:Ua,setSelectionModeForInitialTrack:Va,getSelectionModeForInitialTrack:Wa,getAutoSwitchQuality:Xa,setAutoSwitchQuality:Ya,setFastSwitchEnabled:_a,getFastSwitchEnabled:ab,getAutoSwitchQualityFor:Za,setAutoSwitchQualityFor:$a,enableBufferOccupancyABR:bb,setBandwidthSafetyFactor:pb,getBandwidthSafetyFactor:qb,setAbandonLoadTimeout:rb,retrieveManifest:cb,addUTCTimingSource:db,removeUTCTimingSource:eb,clearDefaultUTCTimingSources:fb,restoreDefaultUTCTimingSources:gb,setBufferToKeep:ib,setBufferPruningInterval:jb,setStableBufferTime:kb,setBufferTimeAtTopQuality:lb,setFragmentLoaderRetryAttempts:sb,setFragmentLoaderRetryInterval:tb,setXHRWithCredentials:ub,setXHRWithCredentialsForType:vb,getXHRWithCredentialsForType:wb,setBufferTimeAtTopQualityLongForm:mb,setLongFormContentDurationThreshold:nb,setRichBufferThreshold:ob,getProtectionController:xb,attachProtectionController:yb,setProtectionData:zb,enableManifestDateHeaderTimeSource:hb,displayCaptionsOnTop:Ab,attachVideoContainer:Cb,attachTTMLRenderingDiv:Gb,getCurrentTextTrackIndex:Ga,reset:Jb},a(),bc}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(69),i=d(h),j=a(72),k=d(j),l=a(67),m=d(l),n=a(50),o=d(n),p=a(155),q=d(p),r=a(152),s=d(r),t=a(148),u=d(t),v=a(58),w=d(v),x=a(71),y=d(x),z=a(157),A=d(z),B=a(57),C=d(B),D=a(104),E=d(D),F=a(101),G=d(F),H=a(102),I=d(H),J=a(103),K=d(J),L=a(61),M=d(L),N=a(74),O=d(N),P=a(134),Q=d(P),R=a(105),S=d(R),T=a(131),U=d(T),V=a(68),W=d(V),X=a(62),Y=d(X),Z=a(8),$=d(Z),_=a(9),aa=d(_),ba=a(13),ca=d(ba),da=a(53),ea=d(da),fa=a(10),ga=d(fa),ha=a(11),ia=a(15),ja=d(ia),ka=a(23),la=d(ka),ma=a(22),na=d(ma),oa=a(17),pa=d(oa),qa=a(38),ra=d(qa);e.__dashjs_factory_name="MediaPlayer";var sa=ga.default.getClassFactory(e);sa.events=ea.default,c.default=sa,b.exports=c.default},{10:10,101:101,102:102,103:103,104:104,105:105,11:11,13:13,131:131,134:134,148:148,15:15,152:152,155:155,157:157,17:17,22:22,23:23,38:38,48:48,50:50,53:53,57:57,58:58,61:61,62:62,67:67,68:68,69:69,71:71,72:72,74:74,8:8,9:9}],53:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(14),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.AST_IN_FUTURE="astInFuture",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_LOADED="bufferLoaded",this.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",this.ERROR="error",this.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",this.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",this.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",this.LOG="log",this.MANIFEST_LOADED="manifestLoaded",this.METRICS_CHANGED="metricsChanged",this.METRIC_CHANGED="metricChanged",this.METRIC_ADDED="metricAdded",this.METRIC_UPDATED="metricUpdated",this.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",this.PERIOD_SWITCH_STARTED="periodSwitchStarted",this.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",this.QUALITY_CHANGE_RENDERED="qualityChangeRendered",this.STREAM_INITIALIZED="streamInitialized",this.TEXT_TRACKS_ADDED="allTextTracksAdded",this.TEXT_TRACK_ADDED="textTrackAdded",this.CAN_PLAY="canPlay",this.PLAYBACK_ENDED="playbackEnded",this.PLAYBACK_ERROR="playbackError",this.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",this.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",this.PLAYBACK_PAUSED="playbackPaused",this.PLAYBACK_PLAYING="playbackPlaying",this.PLAYBACK_PROGRESS="playbackProgress",this.PLAYBACK_RATE_CHANGED="playbackRateChanged",this.PLAYBACK_SEEKED="playbackSeeked",this.PLAYBACK_SEEKING="playbackSeeking",this.PLAYBACK_STARTED="playbackStarted",this.PLAYBACK_TIME_UPDATED="playbackTimeUpdated"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{14:14}],54:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b,c){if(!a||"VIDEO"!==a.nodeName)return null;if(a._dashjs_player)return a._dashjs_player;var e,f=a.id||a.name||"video element";if(b=b||[].slice.call(a.querySelectorAll("source")).filter(function(a){return a.type==d})[0],!b&&a.src)b=document.createElement("source"),b.src=a.src;else if(!b&&!a.src)return null;return c=c||{},e=(0,i.default)(c).create(),e.initialize(a,b.src,a.autoplay),e.getDebug().log("Converted "+f+" to dash.js player and added content: "+b.src),a._dashjs_player=e,e}function b(b,e){var f=[];b=b||"[data-dashjs-player]",e=e||document;for(var g=e.querySelectorAll(b),h=0;h<g.length;h++){var i=a(g[h],null);f.push(i)}for(var j=e.querySelectorAll('source[type="'+d+'"]'),h=0;h<j.length;h++){var k=c(j[h]),i=a(k,null);f.push(i)}return f}function c(a){for(var b=!0;b;){var c=a;if(b=!1,"video"===c.nodeName.toLowerCase())return c;a=c.parentNode,b=!0}}var d="application/dash+xml";return{create:a,createAll:b}}function f(){window.removeEventListener("load",f),j.createAll()}function g(){window.dashjs&&(window.clearInterval(k),j.createAll())}Object.defineProperty(c,"__esModule",{value:!0});var h=a(52),i=d(h),j=e(),k=void 0,l="undefined"!=typeof window&&window&&window.dashjs&&window.dashjs.skipAutoCreate;!l&&"undefined"!=typeof window&&window&&window.addEventListener&&("complete"===window.document.readyState?window.dashjs?j.createAll():k=window.setInterval(g,500):window.addEventListener("load",f)),c.default=j,b.exports=c.default},{52:52}],55:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){ja=[],ka=!1,la=!1,ma=null,na={},oa=!1,pa=!1,ra=(0,g.default)($).getInstance(),sa=(0,w.default)($).getInstance(),wa=(0,q.default)($).getInstance(),ta=(0,k.default)($).getInstance(),ua=(0,o.default)($).create(),xa=(0,O.default)($).getInstance(),aa.on(I.default.BUFFERING_COMPLETED,U,ia),aa.on(I.default.DATA_UPDATE_COMPLETED,V,ia)}function c(a,b){ma=a,qa=b,qa&&(aa.on(I.default.KEY_ERROR,D,ia),aa.on(I.default.SERVER_CERTIFICATE_UPDATED,D,ia),aa.on(I.default.LICENSE_REQUEST_COMPLETE,D,ia),aa.on(I.default.KEY_SYSTEM_SELECTED,D,ia),aa.on(I.default.KEY_SESSION_CREATED,D,ia))}function d(a){ka||(aa.on(I.default.CURRENT_TRACK_CHANGED,J,ia),Q(a),ka=!0)}function e(){for(var a=ja.length,b=0;b<a;b++)ja[b].reset();ja=[],ka=!1,la=!1,x(),aa.off(I.default.CURRENT_TRACK_CHANGED,J,ia)}function f(){sa&&(sa.pause(),sa=null),ua&&(ua.reset(),ua=null),e(),ta=null,wa=null,ca=null,ba=null,da=null,ea=null,_=null,fa=null,oa=!1,pa=!1,na={},aa.off(I.default.DATA_UPDATE_COMPLETED,V,ia),aa.off(I.default.BUFFERING_COMPLETED,U,ia),aa.off(I.default.KEY_ERROR,D,ia),aa.off(I.default.SERVER_CERTIFICATE_UPDATED,D,ia),aa.off(I.default.LICENSE_REQUEST_COMPLETE,D,ia),aa.off(I.default.KEY_SYSTEM_SELECTED,D,ia),aa.off(I.default.KEY_SESSION_CREATED,D,ia)}function h(){return ma.duration}function j(){return ma.start}function l(){return ma.index}function n(){return ma.id}function p(){return ma}function r(a){return null!==S(a)}function t(a){var b=S(a);return wa.getBitrateList(b)}function v(){va&&va.start()}function x(){va&&va.clear()}function z(){return ka}function B(){return pa}function D(a){a.error&&(fa.mediaKeySessionError(a.error),_(a.error),f())}function F(a){return"text"===a.type?a.mimeType:a.type}function H(a,b,c){var d,e,f=a.type;if("muxed"===f&&a)return e="Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines",_(e),fa.manifestError(e,"multiplexedrep",ba.getValue()),!1;if("text"===f||"fragmentedText"===f||"embeddedText"===f)return!0;if(d=a.codec,_(f+" codec: "+d),a.contentProtection&&!ea.supportsEncryptedMedia())fa.capabilityError("encryptedmedia");else if(!ea.supportsCodec((0,s.default)($).getInstance().getElement(),d))return e=f+"Codec ("+d+") is not supported.",fa.manifestError(e,"codec",c),_(e),!1;return!0}function J(a){if(a.newMediaInfo.streamInfo.id===ma.id){var b=W(a.oldMediaInfo);if(b){var c=sa.getTime(),d=b.getBuffer(),e=a.newMediaInfo,f=ba.getValue(),g=ja.indexOf(b),h=b.getMediaSource();"fragmentedText"!==e.type?(b.reset(!0),N(e,f,h,{buffer:d,replaceIdx:g,currentTime:c}),sa.seek(sa.getTime())):b.updateMediaInfo(f,e)}}}function L(a){var b=a.split("/")[1];return"webm"===b.toLowerCase()}function M(a){var b=L(a.mimeType)?(0,C.default)($).getInstance():(0,A.default)($).getInstance();b.setConfig({baseURLController:ha,metricsModel:(0,u.default)($).getInstance()}),b.initialize();var c=(0,y.default)($).create({segmentBaseLoader:b,timelineConverter:ga,dashMetrics:(0,E.default)($).getInstance(),metricsModel:(0,u.default)($).getInstance(),baseURLController:ha});return c}function N(a,b,c,d){var e=(0,i.default)($).create({indexHandler:M(a),timelineConverter:ga,adapter:da,manifestModel:ba}),f=da.getAllMediaInfoForType(b,ma,a.type);if(e.initialize(F(a),ua,c,ia,va),wa.updateTopQualityIndex(a),d?(e.setBuffer(d.buffer),e.getIndexHandler().setCurrentTime(d.currentTime),ja[d.replaceIdx]=e):ja.push(e),"text"===a.type||"fragmentedText"===a.type){for(var g,h=0;h<f.length;h++)f[h].index===a.index&&(g=h),e.updateMediaInfo(b,f[h]);"fragmentedText"===a.type&&e.updateMediaInfo(b,f[g])}else e.updateMediaInfo(b,a);return e}function P(a,b){var c,d=ba.getValue(),e=da.getAllMediaInfoForType(d,ma,a),f=null;if(!e||0===e.length)return void _("No "+a+" data.");for(var g=0,h=e.length;g<h;g++)if(f=e[g],"embeddedText"===a)xa.addEmbeddedTrack(f);else{if(!H(f,b,d))continue;ta.isMultiTrackSupportedByType(f.type)&&ta.addTrack(f,ma)}"embeddedText"!==a&&0!==ta.getTracksFor(a,ma).length&&(ta.checkInitialMediaSettingsForType(a,ma),c=ta.getCurrentTrackFor(a,ma),N(c,d,b))}function Q(a){var b,c=ba.getValue();if(va=(0,m.default)($).getInstance(),va.initialize(),va.setConfig({manifestModel:ba,manifestUpdater:ca}),b=da.getEventsFor(c,ma),va.addInlineEvents(b),oa=!0,P("video",a),P("audio",a),P("text",a),P("fragmentedText",a),P("embeddedText",a),P("muxed",a),T(),la=!0,oa=!1,0===ja.length){var d="No streams to play.";fa.manifestError(d,"nostreams",c),_(d)}else ra.initialize(ga,ja[0]),R()}function R(){var a=ja.length,b=!!na.audio||!!na.video,c=b?new Error(Z,"Data update failed",null):null,d=0;for(d;d<a;d++)if(ja[d].isUpdating()||oa)return;pa=!0,la&&(qa&&qa.initialize(ba.getValue(),S("audio"),S("video")),aa.trigger(I.default.STREAM_INITIALIZED,{streamInfo:ma,error:c}))}function S(a){for(var b=ja.length,c=null,d=0;d<b;d++)if(c=ja[d],c.getType()===a)return c.getMediaInfo();return null}function T(){for(var a=0,b=ja.length;a<b;a++)ja[a].createBuffer()}function U(a){if(a.streamInfo===ma){var b=X(),c=b.length,d=0;for(d;d<c;d++)if(!b[d].isBufferingCompleted())return;aa.trigger(I.default.STREAM_BUFFERING_COMPLETED,{streamInfo:ma})}}function V(a){var b=a.sender.getStreamProcessor();b.getStreamInfo()===ma&&(na[b.getType()]=a.error,R())}function W(a){if(!a)return!1;var b=X();return b.filter(function(b){return b.getType()===a.type})[0]}function X(){var a,b,c=ja.length,d=[],e=0;for(e;e<c;e++)b=ja[e],a=b.getType(),"audio"!==a&&"video"!==a&&"fragmentedText"!==a||d.push(b);return d}function Y(a){_("Manifest updated... updating data system wide.");var b=ba.getValue();if(ka=!1,oa=!0,pa=!1,ma=a,va){var c=da.getEventsFor(b,ma);va.addInlineEvents(c)}for(var d=0,e=ja.length;d<e;d++){var f=ja[d],g=da.getMediaInfoForType(b,ma,f.getType());wa.updateTopQualityIndex(g),f.updateMediaInfo(b,g)}oa=!1,R()}var Z=1,$=this.context,_=(0,K.default)($).getInstance().log,aa=(0,G.default)($).getInstance(),ba=a.manifestModel,ca=a.manifestUpdater,da=a.adapter,ea=a.capabilities,fa=a.errHandler,ga=a.timelineConverter,ha=a.baseURLController,ia=void 0,ja=void 0,ka=void 0,la=void 0,ma=void 0,na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0;return ia={initialize:c,activate:d,deactivate:e,getDuration:h,getStartTime:j,getStreamIndex:l,getId:n,getStreamInfo:p,hasMedia:r,getBitrateListFor:t,startEventController:v,isActivated:z,isInitialized:B,updateData:Y,reset:f,getProcessors:X},b(),ia}Object.defineProperty(c,"__esModule",{value:!0});var f=a(155),g=d(f),h=a(56),i=d(h),j=a(67),k=d(j),l=a(65),m=d(l),n=a(66),o=d(n),p=a(61),q=d(p),r=a(105),s=d(r),t=a(103),u=d(t),v=a(69),w=d(v),x=a(16),y=d(x),z=a(18),A=d(z),B=a(19),C=d(B),D=a(17),E=d(D),F=a(9),G=d(F),H=a(13),I=d(H),J=a(8),K=d(J),L=a(10),M=d(L),N=a(57),O=d(N);e.__dashjs_factory_name="Stream",c.default=M.default.getClassFactory(e),b.exports=c.default},{10:10,103:103,105:105,13:13,155:155,16:16,17:17,18:18,19:19,56:56,57:57,61:61,65:65,66:66,67:67,69:69,8:8,9:9}],56:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){ca=[]}function c(a,b,c,d,e){ba=a,da=d,ea=e,ja=b,_=da.getStreamInfo().manifestInfo.isDynamic,W.initialize(this),fa=(0,g.default)(V).getInstance(),fa.initialize(ba,this),ga=U(a),ha=(0,q.default)(V).create({metricsModel:(0,w.default)(V).getInstance(),manifestModel:Z,adapter:Y,dashMetrics:(0,I.default)(V).getInstance(),dashManifestModel:(0,G.default)(V).getInstance(),timelineConverter:X,rulesController:(0,s.default)(V).getInstance(),mediaPlayerModel:(0,u.default)(V).getInstance()}),ga.initialize(ba,c,this),ha.initialize(ba,this),ka=(0,y.default)(V).create({metricsModel:(0,w.default)(V).getInstance(),errHandler:(0,M.default)(V).getInstance(),requestModifier:(0,A.default)(V).getInstance()}),la=ha.getFragmentModel(),la.setLoader(ka),ia=(0,K.default)(V).create(),ia.initialize(this)}function d(a){W.reset(),ga&&(ga.reset(a),ga=null),ha&&(ha.reset(),ha=null),ia&&(ia.reset(),ia=null),ja=null,ka=null,ea=null,da=null,_=null,aa=null,ca=[],ba=null}function e(){return ia.isUpdating()}function f(){return ba}function h(){return fa}function j(){return ia}function l(){return ka}function n(){return W}function p(){return ja}function r(){return ga.getBuffer()}function t(a){ga.setBuffer(a)}function v(){return ga}function x(){return la}function z(){return da?da.getStreamInfo():null}function B(a,b){b===aa||b&&aa&&b.type!==aa.type||(aa=b),ca.indexOf(b)===-1&&ca.push(b),Y.updateData(a,this)}function D(){return ca}function F(){return aa}function H(){return ga.getMediaSource()}function J(){return ha}function L(){return ea}function N(){ha.start()}function O(){ha.stop()}function P(){return Y.getCurrentRepresentationInfo(Z.getValue(),ia)}function Q(a){return Y.getRepresentationInfoForQuality(Z.getValue(),ia,a)}function R(){return ga.getIsBufferingCompleted()}function S(){return ga.getBuffer()||ga.createBuffer(aa)}function T(){return _}function U(a){var b=null;return b="video"===a||"audio"===a||"fragmentedText"===a?(0,i.default)(V).create({metricsModel:(0,w.default)(V).getInstance(),manifestModel:Z,sourceBufferController:(0,C.default)(V).getInstance(),errHandler:(0,M.default)(V).getInstance(),streamController:(0,k.default)(V).getInstance(),mediaController:(0,m.default)(V).getInstance(),adapter:Y,textSourceBuffer:(0,E.default)(V).getInstance()}):(0,o.default)(V).create({errHandler:(0,M.default)(V).getInstance(),sourceBufferController:(0,C.default)(V).getInstance()})}var V=this.context,W=a.indexHandler,X=a.timelineConverter,Y=a.adapter,Z=a.manifestModel,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0,fa=void 0,ga=void 0,ha=void 0,ia=void 0,ja=void 0,ka=void 0,la=void 0;return $={initialize:c,isUpdating:e,getType:f,getBufferController:v,getABRController:h, -getFragmentLoader:l,getFragmentModel:x,getScheduleController:J,getEventController:L,getFragmentController:p,getRepresentationController:j,getIndexHandler:n,getCurrentRepresentationInfo:P,getRepresentationInfoForQuality:Q,isBufferingCompleted:R,createBuffer:S,getStreamInfo:z,updateMediaInfo:B,getMediaInfoArr:D,getMediaInfo:F,getMediaSource:H,getBuffer:r,setBuffer:t,start:N,stop:O,isDynamic:T,reset:d},b(),$}Object.defineProperty(c,"__esModule",{value:!0});var f=a(61),g=d(f),h=a(64),i=d(h),j=a(72),k=d(j),l=a(67),m=d(l),n=a(73),o=d(n),p=a(70),q=d(p),r=a(131),s=d(r),t=a(102),u=d(t),v=a(103),w=d(v),x=a(49),y=d(x),z=a(157),A=d(z),B=a(71),C=d(B),D=a(57),E=d(D),F=a(22),G=d(F),H=a(17),I=d(H),J=a(21),K=d(J),L=a(152),M=d(L),N=a(10),O=d(N);e.__dashjs_factory_name="StreamProcessor",c.default=O.default.getClassFactory(e),b.exports=c.default},{10:10,102:102,103:103,131:131,152:152,157:157,17:17,21:21,22:22,49:49,57:57,61:61,64:64,67:67,70:70,71:71,72:72,73:73}],57:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,c){M=!1,N=null,U=null,V=!1,W=NaN,X=[],$=null,F||b();var d=c.getStreamProcessor();if(R=d.getMediaInfoArr(),S.setConfig({videoModel:Y}),S.initialize(),T=!K.getIsTextTrack(a),I=(0,k.default)(D).getInstance(),Q=(0,i.default)(D).getInstance(),Q.setConfig({boxParser:I}),T){U=d.getFragmentModel(),this.buffered=(0,m.default)(D).create(),X=L.getTracksFor("fragmentedText",Z.getActiveStreamInfo());for(var e=L.getCurrentTrackFor("fragmentedText",Z.getActiveStreamInfo()),f=0;f<X.length;f++)if(X[f]===e){_=f;break}}}function b(){aa=[],R=[],Y=(0,s.default)(D).getInstance(),S=(0,u.default)(D).getInstance(),S.setConfig({videoModel:Y}),S.initialize(),I=(0,k.default)(D).getInstance(),Q=(0,i.default)(D).getInstance(),Q.setConfig({boxParser:I}),T=!1,_=null,ba=!1,ca=0,fa=[],ea=[],da=null,F=!0}function c(a,b){function c(a,b){var c=new g.default,d={subtitle:"subtitles",caption:"captions"},e=function(){var a=b.roles.length>0?d[b.roles[0]]:d.caption;return a=a===d.caption||a===d.subtitle?a:d.caption},f=function(){var a=!1;return b.codec&&b.codec.search("stpp")>=0&&(a=!0),b.mimeType&&b.mimeType.search("ttml")>=0&&(a=!0),a};c.captionData=a,c.lang=b.lang,c.label=b.id,c.index=b.index,c.isTTML=f(),c.video=Y.getElement(),c.defaultTrack=A(b),c.isFragmented=T,c.isEmbedded=!!b.isEmbedded,c.kind=e();var h=(R?R.length:0)+aa.length;S.addTextTrack(c,h)}var e,f,h,i,j,k,l,m=b.mediaInfo,n=m.type,p=m.mimeType,q=m.codec||p;if(!q)return void E("No text type defined");if("fragmentedText"===n)if(V)if(k=Q.getSamplesInfo(a),f=k.sampleList,!$&&f.length>0&&($=f[0].cts-b.start*W),q.search("stpp")>=0)for(N=null!==N?N:B(q),h=0;h<f.length;h++){var r=f[h],s=r.cts,t=s-$;this.buffered.add(t/W,(t+r.duration)/W);var u=new DataView(a,r.offset,r.subSizes[0]);l=w.default.Utils.dataViewToString(u,"utf-8");var v=[],x=r.offset+r.subSizes[0];for(i=1;i<r.subSizes.length;i++){var z=new Uint8Array(a,x,r.subSizes[i]),C=String.fromCharCode.apply(null,z);v.push(C),x+=r.subSizes[i]}try{e=N.parse(l,s/W,(s+r.duration)/W,v),S.addCaptions(_,$/W,e)}catch(D){E("TTML parser error: "+D.message)}}else{var F=[];for(h=0;h<f.length;h++){var G=f[h];G.cts-=$,this.buffered.add(G.cts/W,(G.cts+G.duration)/W);var H=a.slice(G.offset,G.offset+G.size),I=w.default.parseBuffer(H);for(i=0;i<I.boxes.length;i++){var K=I.boxes[i];if(E("VTT box1: "+K.type),"vtte"!==K.type&&"vttc"===K.type)for(E("VTT vttc boxes.length = "+K.boxes.length),j=0;j<K.boxes.length;j++){var L=K.boxes[j];if(E("VTT box2: "+L.type),"payl"===L.type){var M=L.cue_text;E("VTT cue_text = "+M);var O=G.cts/W,P=(G.cts+G.duration)/W;F.push({start:O,end:P,data:M,styles:{}}),E("VTT "+O+"-"+P+" : "+M)}}}}F.length>0&&S.addCaptions(_,0,F)}else{for(V=!0,h=0;h<R.length;h++)c(null,R[h]);W=Q.getMediaTimescaleFromMoov(a)}else if("text"===n){var u=new DataView(a,0,a.byteLength);l=w.default.Utils.dataViewToString(u,"utf-8");try{e=B(q).parse(l),c(e,m)}catch(D){J.timedTextError(D,"parse",l)}}else if("video"===n)if("InitializationSegment"===b.segmentType){if(0===ca)for(ca=Q.getMediaTimescaleFromMoov(a),h=0;h<aa.length;h++)c(null,aa[h])}else{if(0===ca)return void E("CEA-608: No timescale for embeddedTextTrack yet");var U=function(a,b){function c(a,c,d){var e=null;if(Y.getTTMLRenderingDiv())e=o(Y.getElement(),a,c,d);else{var f=d.getDisplayText();e=[{start:a,end:c,data:f,styles:{}}]}e&&S.addCaptions(b,0,e)}return c};k=Q.getSamplesInfo(a);var X=k.sequenceNumber;if(!fa[0]&&!fa[1]){var Z=void 0,ba=void 0,ga=void 0;for(h=0;h<aa.length;h++){if("CC1"===aa[h].id?(Z=0,ga=S.getTrackIdxForId("CC1")):"CC3"===aa[h].id&&(Z=1,ga=S.getTrackIdxForId("CC3")),ga===-1)return void E("CEA-608: data before track is ready.");ba=U(this,ga),fa[h]=new y.default.Cea608Parser(h,{newCue:ba},null)}}if(ca&&ea.indexOf(X)==-1){if(null!==da&&X!==da+1)for(h=0;h<fa.length;h++)fa[h]&&fa[h].reset();for(var ha=d(a),ia=0;ia<fa.length;ia++){var ja=ha.fields[ia],ka=fa[ia];if(ka){for(h=0;h<ja.length;h++)ka.addData(ja[h][0]/ca,ja[h][1]);ha.endTime&&ka.cueSplitAtTime(ha.endTime/ca)}}da=X,ea.push(X)}}}function d(a){var b=function(a,b,c){var d=a.length;if(d>0){if(b>=a[d-1][0])a.push([b,c]);else for(var e=d-1;e>=0;e--)if(b<a[e][0]){a.splice(e,0,[b,c]);break}}else a.push([b,c])},c=I.parse(a),d=c.getBox("moof"),e=c.getBox("tfdt"),f=c.getBox("tfhd"),g=c.getBoxes("trun"),h=null;if(0===g.length)return null;h=g[0],g.length>1&&E("Warning: Too many truns");for(var i=d.offset+h.data_offset,j=h.sample_count,k=i,l=e.baseMediaDecodeTime,m=new DataView(a),n={startTime:null,endTime:null,fields:[[],[]]},o=0,p=0;p<j;p++){var q=h.samples[p];void 0===q.sample_duration&&(q.sample_duration=f.default_sample_duration),void 0===q.sample_size&&(q.sample_size=f.default_sample_size),void 0===q.sample_composition_time_offset&&(q.sample_composition_time_offset=0);for(var r=l+o+q.sample_composition_time_offset,s=y.default.findCea608Nalus(m,k,q.sample_size),t=0;t<s.length;t++)for(var u=y.default.extractCea608DataFromRange(m,s[t]),v=0;v<2;v++)u[v].length>0&&b(n.fields[v],r,u[v]);o+=q.sample_duration,k+=q.sample_size}var w=l+o;return n.startTime=l,n.endTime=w,n}function e(a){for(var b="",c=0;c<a.length;++c){var d=a[c];b+=d.uchar}var e=b.length,f=b.replace(/^\s+/,"").length;return e-f}function f(a){return"left: "+3.125*a.x+"%; top: "+6.66*a.y1+"%; width: "+(100-3.125*a.x)+"%; height: "+6.66*Math.max(a.y2-1-a.y1,1)+"%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;"}function h(a){return"red"==a?"rgb(255, 0, 0)":"green"==a?"rgb(0, 255, 0)":"blue"==a?"rgb(0, 0, 255)":"cyan"==a?"rgb(0, 255, 255)":"magenta"==a?"rgb(255, 0, 255)":"yellow"==a?"rgb(255, 255, 0)":"white"==a?"rgb(255, 255, 255)":"black"==a?"rgb(0, 0, 0)":a}function j(a,b){var c=a.videoHeight/15;return b?"font-size: "+c+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; color: "+(b.foreground?h(b.foreground):"rgb(255, 255, 255)")+"; font-style: "+(b.italics?"italic":"normal")+"; text-decoration: "+(b.underline?"underline":"none")+"; white-space: pre; background-color: "+(b.background?h(b.background):"transparent")+";":"font-size: "+c+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;"}function l(a){var b=a.replace(/^\s+/g,"");return b}function n(a){var b=a.replace(/\s+$/g,"");return b}function o(a,b,c,d){var g=null,h=null,i=!1,k=-1,m={start:b,end:c,spans:[]},o="style_cea608_white_black",p={},q={},r=[],s=void 0,t=void 0;for(s=0;s<15;++s){var u=d.rows[s],v="",w=null;if(!1===u.isEmpty()){var x=e(u.chars);null===g&&(g={x:x,y1:s,y2:s+1,p:[]}),x!==k&&i&&(g.p.push(m),m={start:b,end:c,spans:[]},g.y2=s,g.name="region_"+g.x+"_"+g.y1+"_"+g.y2,!1===p.hasOwnProperty(g.name)?(r.push(g),p[g.name]=g):(h=p[g.name],h.p.contat(g.p)),g={x:x,y1:s,y2:s+1,p:[]});for(var y=0;y<u.chars.length;++y){var z=u.chars[y],A=z.penState;if(null===w||!A.equals(w)){v.trim().length>0&&(m.spans.push({name:o,line:v,row:s}),v="");var B="style_cea608_"+A.foreground+"_"+A.background;A.underline&&(B+="_underline"),A.italics&&(B+="_italics"),q.hasOwnProperty(B)||(q[B]=JSON.parse(JSON.stringify(A))),w=A,o=B}v+=z.uchar}v.trim().length>0&&m.spans.push({name:o,line:v,row:s}),i=!0,k=x}else i=!1,k=-1,g&&(g.p.push(m),m={start:b,end:c,spans:[]},g.y2=s,g.name="region_"+g.x+"_"+g.y1+"_"+g.y2,!1===p.hasOwnProperty(g.name)?(r.push(g),p[g.name]=g):(h=p[g.name],h.p.contat(g.p)),g=null)}g&&(g.p.push(m),g.y2=s+1,g.name="region_"+g.x+"_"+g.y1+"_"+g.y2,!1===p.hasOwnProperty(g.name)?(r.push(g),p[g.name]=g):(h=p[g.name],h.p.contat(g.p)),g=null);var C=[];for(s=0;s<r.length;++s){var D=r[s],E="sub_cea608_"+G++,F=document.createElement("div");F.id=E;var H=f(D);F.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+H;var I=document.createElement("div");I.className="paragraph bodyStyle",I.style.cssText=j(a);var J=document.createElement("div");J.className="cueUniWrapper",J.style.cssText="unicode-bidi: normal; direction: ltr;";for(var K=0;K<D.p.length;++K){var L=D.p[K],M=0;for(t=0;t<L.spans.length;++t){var N=L.spans[t];if(N.line.length>0){if(0!==t&&M!=N.row){var O=document.createElement("br");O.className="lineBreak",J.appendChild(O)}var P=!1;M===N.row&&(P=!0),M=N.row;var Q=q[N.name],R=document.createElement("span");R.className="spanPadding "+N.name+" customSpanColor",R.style.cssText=j(a,Q),0!==t&&P?t===L.spans.length-1?R.textContent=n(N.line):R.textContent=N.line:0===t&&L.spans.length>1&&N.row===L.spans[1].row?R.textContent=l(N.line):R.textContent=N.line.trim(),J.appendChild(R)}}}I.appendChild(J),F.appendChild(I);var S={bodyStyle:["%",90]};for(t in q)q.hasOwnProperty(t)&&(S[t]=["%",90]);C.push({type:"html",start:b,end:c,cueHTMLElement:F,cueID:E,cellResolution:[32,15],isFromCEA608:!0,regions:r,regionID:D.name,videoHeight:a.videoHeight,videoWidth:a.videoWidth,fontSize:S,lineHeight:{},linePadding:{}})}return C}function p(){S.deleteAllTextTracks(),M=!1,N=null,Q=null,R=null,S=null,T=!1,U=null,V=!1,W=NaN,X=[],Y=null,Z=null,F=!1,aa=null}function r(a){F||b(),"CC1"===a.id||"CC3"===a.id?aa.push(a):E("Warning: Embedded track "+a.id+" not supported!")}function t(){F=!1,aa=[],fa=[null,null],ea=[],da=null}function v(){return M}function x(a){a&&(a.errHandler&&(J=a.errHandler),a.dashManifestModel&&(K=a.dashManifestModel),a.mediaController&&(L=a.mediaController),a.videoModel&&(Y=a.videoModel),a.streamController&&(Z=a.streamController),a.textTracks&&(S=a.textTracks),a.VTTParser&&(O=a.VTTParser),a.TTMLParser&&(P=a.TTMLParser))}function z(){for(var a=Y.getElement(),b=a.textTracks,c=b.length,d=c-aa.length,e=S.getCurrentTrackIdx(),f=0;f<c;f++){var g=b[f];if(M="showing"!==g.mode,"showing"===g.mode){if(e!==f&&(S.setCurrentTrackIdx(f),S.addCaptions(f,0,null),T&&f<d)){var h=L.getCurrentTrackFor("fragmentedText",Z.getActiveStreamInfo()),i=X[f];i!==h&&(U.abortRequests(),S.deleteTrackCues(h),L.setTrack(i),_=f)}break}}M&&S.setCurrentTrackIdx(-1)}function A(a){var b=!1;return aa.length>1&&a.isEmbedded?b=a.id&&"CC1"===a.id:1===aa.length?a.id&&"CC"===a.id.substring(0,2)&&(b=!0):0===aa.length&&(b=a.index===R[0].index),b}function B(a){var b;return a.search("vtt")>=0?b=O:(a.search("ttml")>=0||a.search("stpp")>=0)&&(b=P,b.setConfig({videoModel:Y})),b}function C(){return S.getCurrentTrackIdx()}var D=this.context,E=(0,q.default)(D).getInstance().log,F=!1,G=0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0,V=void 0,W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0,fa=void 0;return H={initialize:a,append:c,abort:p,getCurrentTrackIdx:C,getAllTracksAreDisabled:v,setTextTrack:z,setConfig:x,addEmbeddedTrack:r,resetEmbedded:t}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(172),g=d(f),h=a(33),i=d(h),j=a(147),k=d(j),l=a(149),m=d(l),n=a(10),o=d(n),p=a(8),q=d(p),r=a(105),s=d(r),t=a(58),u=d(t),v=a(6),w=d(v),x=a(2),y=d(x);e.__dashjs_factory_name="TextSourceBuffer",c.default=o.default.getSingletonFactory(e),b.exports=c.default},{10:10,105:105,147:147,149:149,172:172,2:2,33:33,58:58,6:6,8:8}],58:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){D=window.VTTCue||window.TextTrackCue,G=[],H=[],I=-1,J=0,K=0,L=0,M=0,N=null,O=null,R=!1,S=2147483647,P=!!navigator.userAgent.match(/Chrome/)&&!navigator.userAgent.match(/Edge/),void 0!==document.fullscreenElement?Q="fullscreenElement":void 0!==document.webkitIsFullScreen?Q="webkitIsFullScreen":document.msFullscreenElement?Q="msFullscreenElement":document.mozFullScreen&&(Q="mozFullScreen")}function b(a){var b=G[a].kind,c=void 0!==G[a].label?G[a].label:G[a].lang,d=G[a].lang,e=P?document.createElement("track"):F.addTextTrack(b,c,d);return P&&(e.kind=b,e.label=c,e.srclang=d),e}function c(a){R=a,N&&!document[Q]&&(N.style.zIndex=a?S:null)}function d(a,c){if(G.length===c)return void B("Trying to add too many tracks.");if(G.push(a),void 0===F&&(F=a.video),G.length===c){G.sort(function(a,b){return a.index-b.index}),N=E.getTTMLRenderingDiv();for(var d=-1,e=0;e<G.length;e++){var f=b.call(this,e);H.push(f),G[e].defaultTrack&&(f.default=!0,d=e),P&&F.appendChild(f);var g=F.textTracks[e];g.nonAddedCues=[],N&&(G[e].isTTML||G[e].isEmbedded)?g.renderingType="html":g.renderingType="default",this.addCaptions(e,0,G[e].captionData),A.trigger(i.default.TEXT_TRACK_ADDED)}if(q.call(this,d),d>=0){for(var h=0;h<F.textTracks.length;h++)F.textTracks[h].mode=h===d?"showing":"hidden";this.addCaptions(d,0,null)}A.trigger(i.default.TEXT_TRACKS_ADDED,{index:I,tracks:G})}}function e(a,b,c,d,e,f){var g=a/b,h=c/d,i=0,j=0;g>h?(j=b,i=j/d*c):(i=a,j=i/c*d);var k=0,l=0,m=0,n=0,o=i/j;return o>e?(n=j,m=j/(1/e),k=(a-m)/2,l=0):(m=i,n=i/e,k=0,l=(b-n)/2),f?{x:k+.1*m,y:l+.1*n,w:.8*m,h:.8*n}:{x:k,y:l,w:m,h:n}}function f(){var a=this.getCurrentTextTrack();if(a&&"html"===a.renderingType){var b=F.clientWidth/F.clientHeight,c=!1;a.isFromCEA608&&(b=3.5/3,c=!0);var d=e.call(this,F.clientWidth,F.clientHeight,F.videoWidth,F.videoHeight,b,c),f=d.w,g=d.h;if(f!=L||g!=M){J=d.x,K=d.y,L=f,M=g,N.style.left=J+"px",N.style.top=K+"px",N.style.width=L+"px",N.style.height=M+"px";for(var h=0;a.activeCues&&h<a.activeCues.length;++h){var i=a.activeCues[h];i.scaleCue(i)}Q&&document[Q]||R?N.style.zIndex=S:N.style.zIndex=null}}}function h(a,b){var c=Math.round(.01*a*b).toString()+"px";return c}function j(a){var b=L,c=M;if(b*c!==0&&a.layout){var d=a.layout,e=h(d.left,b),f=h(d.top,c),g=h(d.width,b),i=h(d.height,c);N.style.left=e,N.style.top=f,N.style.width=g,N.style.height=i;var j=N.firstChild;j&&j.style&&(j.style.left="0px",j.style.top="0px",j.style.width=g,j.style.height=i)}}function k(a){var b,c,d,e,f,g=L,h=M,i=[g/a.cellResolution[0],h/a.cellResolution[1]];if(a.linePadding)for(b in a.linePadding)if(a.linePadding.hasOwnProperty(b)){var j=a.linePadding[b];c=(j*i[0]).toString();for(var k=document.getElementsByClassName("spanPadding"),l=0;l<k.length;l++)k[l].style.cssText=k[l].style.cssText.replace(/(padding-left\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+c),k[l].style.cssText=k[l].style.cssText.replace(/(padding-right\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+c)}if(a.fontSize)for(b in a.fontSize)if(a.fontSize.hasOwnProperty(b)){"%"===a.fontSize[b][0]?d=a.fontSize[b][1]/100:"c"===a.fontSize[b][0]&&(d=a.fontSize[b][1]),c=(d*i[1]).toString(),f="defaultFontSize"!==b?document.getElementsByClassName(b):document.getElementsByClassName("paragraph");for(var m=0;m<f.length;m++)f[m].style.cssText=f[m].style.cssText.replace(/(font-size\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+c)}if(a.lineHeight)for(b in a.lineHeight)if(a.lineHeight.hasOwnProperty(b)){"%"===a.lineHeight[b][0]?e=a.lineHeight[b][1]/100:"c"===a.fontSize[b][0]&&(e=a.lineHeight[b][1]),c=(e*i[1]).toString(),f=document.getElementsByClassName(b);for(var n=0;n<f.length;n++)f[n].style.cssText=f[n].style.cssText.replace(/(line-height\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+c)}}function l(a,b,c){var d=a>=0?F.textTracks[a]:null,e=this;if(d){if("showing"!==d.mode)return void(c&&c.length>0&&(d.nonAddedCues=d.nonAddedCues.concat(c)));if(c||(c=d.nonAddedCues,d.nonAddedCues=[]),c&&0!==c.length)for(var g in c){var h,i=c[g];d.cellResolution=i.cellResolution,d.isFromCEA608=i.isFromCEA608,O||"html"!==i.type&&"image"!==i.type||(O=setInterval(f.bind(this),500)),"image"===i.type?(h=new D(i.start-b,i.end-b,""),h.image=i.data,h.id=i.id,h.size=0,h.type="image",h.layout=i.layout,h.scaleCue=j.bind(e),h.onenter=function(){if(N&&"showing"===d.mode){var a=new Image;a.id="ttmlImage_"+this.id,a.src=this.image,a.style.cssText="z-index: 2147483648; pointer-events: none; display: block; visibility: visible !important; position: relative !important;",N.appendChild(a),j.call(e,this)}},h.onexit=function(){if(N)for(var a=N.childNodes,b=0;b<a.length;b++)a[b].id==="ttmlImage_"+this.id&&N.removeChild(a[b])}):"html"===i.type?(h=new D(i.start-b,i.end-b,""),h.cueHTMLElement=i.cueHTMLElement,h.regions=i.regions,h.regionID=i.regionID,h.cueID=i.cueID,h.videoWidth=i.videoWidth,h.videoHeight=i.videoHeight,h.cellResolution=i.cellResolution,h.fontSize=i.fontSize,h.lineHeight=i.lineHeight,h.linePadding=i.linePadding,h.scaleCue=k.bind(e),N.style.left=J+"px",N.style.top=K+"px",N.style.width=L+"px",N.style.height=M+"px",h.onenter=function(){"showing"===d.mode&&(B("Cue "+this.startTime+"-"+this.endTime+" : "+this.cueHTMLElement.id+" : "+this.cueHTMLElement.innerText),N.appendChild(this.cueHTMLElement),k.call(e,this))},h.onexit=function(){for(var a=N.childNodes,b=0;b<a.length;++b)a[b].id===this.cueID&&N.removeChild(a[b])}):(h=new D(i.start-b,i.end-b,i.data),i.styles&&(void 0!==i.styles.align&&h.hasOwnProperty("align")&&(h.align=i.styles.align),void 0!==i.styles.line&&h.hasOwnProperty("line")&&(h.line=i.styles.line),void 0!==i.styles.position&&h.hasOwnProperty("position")&&(h.position=i.styles.position),void 0!==i.styles.size&&h.hasOwnProperty("size")&&(h.size=i.styles.size))),d.addCue(h)}}}function n(){return I>=0?F.textTracks[I]:null}function o(){return I}function p(a){for(var b=-1,c=0;c<F.textTracks.length;c++)if(F.textTracks[c].label===a){b=c;break}return b}function q(a){if(I=a,x.call(this),a>=0){var b=F.textTracks[a];"html"===b.renderingType?v.call(this):w.call(this)}else w.call(this)}function r(a){return F.textTracks[a]}function s(a){if(a.cues){for(var b=a.cues,c=b.length-1,d=c;d>=0;d--)a.removeCue(b[d]);a.mode="disabled"}}function t(){for(var a=H.length,b=0;b<a;b++)if(P)F.removeChild(H[b]);else{var c=r.call(this,b);c.nonAddedCues=[],s.call(this,c)}H=[],G=[],O&&(clearInterval(O),O=null),x.call(this)}function u(a){F.removeChild(H[a]),H.splice(a,1)}function v(){if(P){var a=document.getElementById("native-cue-style");if(!a){a=document.createElement("style"),a.id="native-cue-style",document.head.appendChild(a);var b=a.sheet;F.id?b.insertRule("#"+F.id+"::cue {background: transparent}",0):0!==F.classList.length?b.insertRule("."+F.className+"::cue {background: transparent}",0):b.insertRule("video::cue {background: transparent}",0)}}}function w(){if(P){var a=document.getElementById("native-cue-style");a&&document.head.removeChild(a)}}function x(){if(N)for(;N.firstChild;)N.removeChild(N.firstChild)}function y(a){a&&a.videoModel&&(E=a.videoModel)}var z=this.context,A=(0,g.default)(z).getInstance(),B=(0,m.default)(z).getInstance().log,C=void 0,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0;return C={initialize:a,displayCConTop:c,addTextTrack:d,addCaptions:l,getTextTrack:r,getCurrentTextTrack:n,getCurrentTrackIdx:o,setCurrentTrackIdx:q,getTrackIdxForId:p,deleteTrackCues:s,deleteAllTextTracks:t,deleteTextTrack:u,setConfig:y}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j),l=a(8),m=d(l);e.__dashjs_factory_name="TextTracks",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,8:8,9:9}],59:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(a){function b(){var a;p=[],q=[],r=[],a={},e(a,g.HTTPRequest.MPD_TYPE,m.default.DOWNLOAD_ERROR_ID_MANIFEST),e(a,g.HTTPRequest.XLINK_EXPANSION_TYPE,m.default.DOWNLOAD_ERROR_ID_XLINK),e(a,g.HTTPRequest.INIT_SEGMENT_TYPE,m.default.DOWNLOAD_ERROR_ID_INITIALIZATION),e(a,g.HTTPRequest.MEDIA_SEGMENT_TYPE,m.default.DOWNLOAD_ERROR_ID_CONTENT),e(a,g.HTTPRequest.INDEX_SEGMENT_TYPE,m.default.DOWNLOAD_ERROR_ID_CONTENT),e(a,g.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,m.default.DOWNLOAD_ERROR_ID_CONTENT),e(a,g.HTTPRequest.OTHER_TYPE,m.default.DOWNLOAD_ERROR_ID_CONTENT),s=a}function c(a,b){var d=a.request,e=new XMLHttpRequest,f=[],g=!0,h=!0,k=new Date,m=k,o=0,t=function(a){h=!1,d.requestStartDate=k,d.requestEndDate=new Date,d.firstByteDate=d.firstByteDate||k,d.checkExistenceOnly||l.addHttpRequest(d.mediaType,null,d.type,d.url,e.responseURL||null,d.serviceLocation||null,d.range||null,d.requestStartDate,d.firstByteDate,d.requestEndDate,e.status,d.duration,e.getAllResponseHeaders(),a?f:null)},u=function(){p.indexOf(e)!==-1&&(p.splice(p.indexOf(e),1),h&&(t(!1),b>0?(b--,r.push(setTimeout(function(){c(a,b)},i.getRetryIntervalForType(d.type)))):(j.downloadError(s[d.type],d.url,d),a.error&&a.error(d,"error",e.statusText),a.complete&&a.complete(d,e.statusText))))},v=function(b){var c=new Date;g&&(g=!1,(!b.lengthComputable||b.lengthComputable&&b.total!==b.loaded)&&(d.firstByteDate=c)),b.lengthComputable&&(d.bytesLoaded=b.loaded,d.bytesTotal=b.total),f.push({s:m,d:c.getTime()-m.getTime(),b:[b.loaded?b.loaded-o:0]}),m=c,o=b.loaded,a.progress&&a.progress()},w=function(){e.status>=200&&e.status<=299&&(t(!0),a.success&&a.success(e.response,e.statusText,e),a.complete&&a.complete(d,e.statusText))};try{var x=n.modifyRequestURL(d.url),y=d.checkExistenceOnly?"HEAD":"GET";e.open(y,x,!0),d.responseType&&(e.responseType=d.responseType),d.range&&e.setRequestHeader("Range","bytes="+d.range),d.requestStartDate||(d.requestStartDate=k),e=n.modifyRequestHeader(e),e.withCredentials=i.getXHRWithCredentialsForType(d.type),e.onload=w,e.onloadend=u,e.onerror=u,e.onprogress=v;var z=(new Date).getTime();isNaN(d.delayLoadingTime)||z>=d.delayLoadingTime?(p.push(e),e.send()):!function(){var a={xhr:e};q.push(a),a.delayTimeout=setTimeout(function(){if(q.indexOf(a)!==-1){q.splice(q.indexOf(a),1);try{p.push(a.xhr),a.xhr.send()}catch(b){a.xhr.onerror()}}},d.delayLoadingTime-z)}()}catch(A){e.onerror()}}function d(a){a.request&&c(a,i.getRetryAttemptsForType(a.request.type))}function f(){r.forEach(function(a){return clearTimeout(a)}),r=[],q.forEach(function(a){return clearTimeout(a.delayTimeout)}),q=[],p.forEach(function(a){a.onloadend=a.onerror=a.onprogress=void 0,a.abort()}),p=[]}var h=this.context,i=(0,k.default)(h).getInstance(),j=a.errHandler,l=a.metricsModel,n=a.requestModifier,o=void 0,p=void 0,q=void 0,r=void 0,s=void 0;return o={load:d,abort:f},b(),o}Object.defineProperty(c,"__esModule",{value:!0});var g=a(180),h=a(10),i=d(h),j=a(102),k=d(j),l=a(152),m=d(l);f.__dashjs_factory_name="XHRLoader";var n=i.default.getClassFactory(f);c.default=n,b.exports=c.default},{10:10,102:102,152:152,180:180}],60:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b,c){var e=function(d,e){b.resolved=!0,b.resolvedContent=d?d:null,f.trigger(p.default.XLINK_ELEMENT_LOADED,{element:b,resolveObject:c,error:d||e?null:new g.default(s,"Failed loading Xlink element: "+a)})};if(a===d)e(null,!0);else{var i=new l.default(a,j.HTTPRequest.XLINK_TYPE);h.load({request:i,success:function(a){e(a)},error:function(){e(null)}})}}function c(){h&&(h.abort(),h=null)}var d="urn:mpeg:dash:resolve-to-zero:2013",e=this.context,f=(0,n.default)(e).getInstance(),h=(0,i.default)(e).create({errHandler:a.errHandler,metricsModel:a.metricsModel,requestModifier:a.requestModifier}),k=void 0;return k={load:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(163),g=d(f),h=a(59),i=d(h),j=a(180),k=a(171),l=d(k),m=a(9),n=d(m),o=a(13),p=d(o),q=a(10),r=d(q),s=1;e.__dashjs_factory_name="XlinkLoader";var t=r.default.getClassFactory(e);t.XLINK_LOADER_ERROR_LOADING_FAILURE=s,c.default=t,b.exports=c.default},{10:10,13:13,163:163,171:171,180:180,59:59,9:9}],61:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){qa={video:!0,audio:!0},ra={},sa={},ta={},ua={},va={},xa={},wa={},Ka={},za=!1,Aa=!1,void 0===Ba&&(Ba=!1),Ia=(0,i.default)(ja).getInstance(),Ha=(0,k.default)(ja).getInstance(),Ea=(0,w.default)(ja).getInstance(),Fa=(0,y.default)(ja).getInstance(),Ga=(0,A.default)(ja).getInstance(),Ma=(0,K.default)(ja).getInstance(),Na=(0,M.default)(ja).getInstance(),Oa=(new Date).getTime()/1e3}function b(a,b){Ka[a]=(0,G.default)(ja).create(),wa[a]=b,xa[a]=xa[a]||{},xa[a].state=Q,ma.on(q.default.LOADING_PROGRESS,ia,this),"video"==a&&(ma.on(s.default.QUALITY_CHANGE_RENDERED,e,this),La=(0,I.default)(ja).create(),ga())}function c(){ma.off(q.default.LOADING_PROGRESS,ia,this),ma.off(s.default.QUALITY_CHANGE_RENDERED,e,this),Ja=void 0,La=void 0,clearTimeout(ya),ya=null,a()}function d(a){a&&(a.abrRulesCollection&&(oa=a.abrRulesCollection),a.streamController&&(pa=a.streamController))}function e(a){"video"===a.mediaType&&(Ja=a.newQuality,La.push(Ja,Ga.getPlaybackQuality()))}function f(a,b){var c;return ra[b]=ra[b]||{},ra[b].hasOwnProperty(a)||(ra[b][a]=0),c=da(ra[b][a],a),c=ea(c,a,ra[b][a]),c=ha(c,a)}function h(a){var b=Ia.getSavedBitrateSettings(a);if(!ta.hasOwnProperty(a))if(ua.hasOwnProperty(a)){var c=Ea.getValue(),d=Fa.getAdaptationForType(c,0,a).Representation;if(Array.isArray(d)){var e=Math.max(Math.round(d.length*ua[a])-1,0);ta[a]=d[e].bandwidth}else ta[a]=0}else isNaN(b)?ta[a]="video"===a?R:S:ta[a]=b;return ta[a]}function j(a,b){ta[a]=b}function l(a){return ua.hasOwnProperty(a)?ua[a]:null}function n(a,b){ua[a]=b}function p(a){return ta.hasOwnProperty("max")&&ta.max.hasOwnProperty(a)?ta.max[a]:NaN}function r(a,b){ta.max=ta.max||{},ta.max[a]=b}function t(a){return ua.hasOwnProperty("max")&&ua.max.hasOwnProperty(a)?ua.max[a]:1}function u(a,b){ua.max=ua.max||{},ua.max[a]=b}function v(a){return qa[a]}function x(a,b){qa[a]=b}function z(){return za}function B(a){za=a}function D(){return Aa}function F(a){Aa=a}function H(a){var b=a.getType(),c=a.getStreamInfo(),d=c.id,e=aa(b,c),g=(0,C.default)(ja).create({streamProcessor:a,currentValue:e,playbackIndex:Ja,switchHistory:Ka[b],droppedFramesHistory:La,hasRichBuffer:X(b)});if(La&&La.push(Ja,Ga.getPlaybackQuality()),v(b)){var h=f(b,d),i=oa.getMaxQuality(g),j=i.value;if(j>h&&(j=h),Ka[b].push({oldValue:e,newValue:j}),j>E.default.NO_CHANGE&&j!=e)(xa[b].state===Q||j>e)&&L(b,c,e,j,h,i.reason);else if(ka.getLogToBrowserConsole()){var k=Na.getCurrentBufferLevel(Ma.getReadOnlyMetricsFor(b));la("AbrController ("+b+") stay on "+e+"/"+h+" (buffer: "+k+")")}}}function J(a,b,c,d){var e=b.id,g=aa(a,b),h=null!==c&&!isNaN(c)&&c%1===0;if(!h)throw new Error("argument is not an integer");var i=f(a,e);c!==g&&c>=0&&c<=i&&L(a,b,g,c,i,d)}function L(a,b,c,d,e,f){if(ka.getLogToBrowserConsole()){var g=Na.getCurrentBufferLevel(Ma.getReadOnlyMetricsFor(a));la("AbrController ("+a+") switch from "+c+" to "+d+"/"+e+" (buffer: "+g+")\n"+JSON.stringify(f))}ba(a,b.id,d),ma.trigger(q.default.QUALITY_CHANGE_REQUESTED,{mediaType:a,streamInfo:b,oldQuality:c,newQuality:d,reason:f})}function N(a,b){xa[a].state=b}function U(a){return xa[a].state}function V(a,b,c){if(c&&wa[a.type].getCurrentRepresentationInfo()&&wa[a.type].getCurrentRepresentationInfo().fragmentDuration){c/=1e3;var d=wa[a.type].getCurrentRepresentationInfo().fragmentDuration;if(c>d)return 0;var e=c/d;b*=1-e}var f=W(a);if(!f||0===f.length)return T;for(var g=f.length-1;g>=0;g--){var h=f[g];if(1e3*b>=h.bitrate)return g}return 0}function W(a){if(!a||!a.bitrateList)return null;for(var b,c=a.bitrateList,d=a.type,e=[],f=0,h=c.length;f<h;f++)b=new g.default,b.mediaType=d,b.qualityIndex=f,b.bitrate=c[f].bandwidth,b.width=c[f].width,b.height=c[f].height,e.push(b);return e}function X(a){var b=Ma.getReadOnlyMetricsFor(a),c=Na.getCurrentBufferLevel(b),d=b.BufferState.length>0?b.BufferState[b.BufferState.length-1]:null,e=!1;return d&&c>d.target&&(e=c>d.target+Ha.getRichBufferThreshold()),e}function Y(a,b){va[a]=b}function Z(a){return va[a]}function $(a){var b=a.type,c=a.streamInfo.id,d=a.representationCount-1;return ca(b,c,d),d}function _(a){var b,c=a.id,d=aa("audio",a),e=aa("video",a);return b=d===f("audio",c)&&e===f("video",c)}function aa(a,b){var c,d=b.id;return sa[d]=sa[d]||{},sa[d].hasOwnProperty(a)||(sa[d][a]=T),c=sa[d][a]}function ba(a,b,c){sa[b]=sa[b]||{},sa[b][a]=c}function ca(a,b,c){ra[b]=ra[b]||{},ra[b][a]=c}function da(a,b){var c=p(b);if(isNaN(c)||!wa[b])return a;var d=V(wa[b].getMediaInfo(),c);return Math.min(a,d)}function ea(a,b,c){var d=t(b);return isNaN(d)||d>=1||d<0?a:Math.min(a,Math.round(c*d))}function fa(a){Ba=a}function ga(){var a=Ga.getElement();if(void 0!==a){var b=Aa&&window.hasOwnProperty("devicePixelRatio"),c=b?window.devicePixelRatio:1;Ca=a.clientWidth*c,Da=a.clientHeight*c}}function ha(a,b){if("video"!==b||!za||!wa[b])return a;Ba||ga();var c=Ea.getValue(),d=Fa.getAdaptationForType(c,0,b).Representation,e=a;if(Ca>0&&Da>0){for(;e>0&&d[e]&&Ca<d[e].width&&Ca-d[e-1].width<d[e].width-Ca;)e-=1;d.length-2>=e&&d[e].width===d[e+1].width&&(e=Math.min(a,e+1))}return e}function ia(a){var b=a.request.mediaType;if(v(b)){var c=wa[b].getScheduleController();if(!c)return;var d=(0,C.default)(ja).create({streamProcessor:wa[b],currentRequest:a.request,currentValue:aa(b,pa.getActiveStreamInfo()),hasRichBuffer:X(b)}),e=oa.shouldAbandonFragment(d);if(e.value>E.default.NO_CHANGE){var f=c.getFragmentModel(),g=f.getRequests({state:m.default.FRAGMENT_MODEL_LOADING,index:a.request.index})[0];g&&(f.abortRequests(),N(b,P),Ka[b].reset(),Ka[b].push({oldValue:aa(b,pa.getActiveStreamInfo()),newValue:e.value,confidence:1,reason:e.reason}),J(b,pa.getActiveStreamInfo(),e.value,e.reason),ma.trigger(q.default.FRAGMENT_LOADING_ABANDONED,{streamProcessor:wa[b],request:g,mediaType:b}),clearTimeout(ya),ya=setTimeout(function(){N(b,Q),ya=null},Ha.getAbandonLoadTimeout()))}}}var ja=this.context,ka=(0,O.default)(ja).getInstance(),la=ka.log,ma=(0,o.default)(ja).getInstance(),na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0;return na={isPlayingAtTopQuality:_,updateTopQualityIndex:$,getAverageThroughput:Z,getBitrateList:W,getQualityForBitrate:V,getMaxAllowedBitrateFor:p,setMaxAllowedBitrateFor:r,getMaxAllowedRepresentationRatioFor:t,setMaxAllowedRepresentationRatioFor:u,getInitialBitrateFor:h,setInitialBitrateFor:j,getInitialRepresentationRatioFor:l,setInitialRepresentationRatioFor:n,setAutoSwitchBitrateFor:x,getAutoSwitchBitrateFor:v,setLimitBitrateByPortal:B,getLimitBitrateByPortal:z,getUsePixelRatioInLimitBitrateByPortal:D,setUsePixelRatioInLimitBitrateByPortal:F,getQualityFor:aa,getAbandonmentStateFor:U,setAbandonmentStateFor:N,setPlaybackQuality:J,getPlaybackQuality:H,setAverageThroughput:Y,getTopQualityIndexFor:f,setElementSize:ga,setWindowResizeEventCalled:fa,initialize:b,setConfig:d,reset:c},a(),na}Object.defineProperty(c,"__esModule",{value:!0});var f=a(161),g=d(f),h=a(150),i=d(h),j=a(102),k=d(j),l=a(100),m=d(l),n=a(9),o=d(n),p=a(13),q=d(p),r=a(53),s=d(r),t=a(10),u=d(t),v=a(101),w=d(v),x=a(22),y=d(x),z=a(105),A=d(z),B=a(130),C=d(B),D=a(132),E=d(D),F=a(133),G=d(F),H=a(129),I=d(H),J=a(103),K=d(J),L=a(17),M=d(L),N=a(8),O=d(N),P="abandonload",Q="allowload",R=1e3,S=100,T=0;e.__dashjs_factory_name="AbrController";var U=u.default.getSingletonFactory(e);U.ABANDON_LOAD=P,U.QUALITY_DEFAULT=T,c.default=U,b.exports=c.default; -},{10:10,100:100,101:101,102:102,103:103,105:105,129:129,13:13,130:130,132:132,133:133,150:150,161:161,17:17,22:22,53:53,8:8,9:9}],62:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){p.invalidateSelectedIndexes(a.entry)}function b(){p=(0,g.default)(l).create(),r=(0,i.default)(l).create(),n.on(s.default.SERVICE_LOCATION_BLACKLIST_CHANGED,a,j)}function c(a){a.baseURLTreeModel&&(p=a.baseURLTreeModel),a.baseURLSelector&&(r=a.baseURLSelector)}function d(a){p.update(a),r.chooseSelectorFromManifest(a)}function e(a){var b=p.getForPath(a),c=b.reduce(function(a,b){var c=r.select(b);return c?(o.isRelative(c.url)?a.url=o.resolve(c.url,a.url):(a.url=c.url,a.serviceLocation=c.serviceLocation),a):new m.default},new m.default);if(!o.isRelative(c.url))return c}function f(){p.reset(),r.reset()}function h(a){d(a)}var j=void 0,l=this.context,n=(0,q.default)(l).getInstance(),o=(0,k.default)(l).getInstance(),p=void 0,r=void 0;return j={reset:f,initialize:h,resolve:e,setConfig:c},b(),j}Object.defineProperty(c,"__esModule",{value:!0});var f=a(99),g=d(f),h=a(146),i=d(h),j=a(159),k=d(j),l=a(41),m=d(l),n=a(10),o=d(n),p=a(9),q=d(p),r=a(13),s=d(r);e.__dashjs_factory_name="BaseURLController",c.default=o.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,146:146,159:159,41:41,9:9,99:99}],63:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){return!!(g.length&&a&&a.length)&&g.indexOf(a)!==-1}function c(a){g.indexOf(a)===-1&&(g.push(a),h.trigger(j,{entry:a}))}function d(a){a.error&&c(a.request.serviceLocation)}function e(){k&&h.on(k,d,this)}function f(){g=[]}var g=[],h=(0,i.default)(this.context).getInstance(),j=a.updateEventName,k=a.loadFailedEventName;return e(),{add:c,contains:b,reset:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(9),i=d(h);e.__dashjs_factory_name="BlackListController",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,9:9}],64:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){oa=m.default.QUALITY_DEFAULT,pa=!1,qa=0,ra=Number.POSITIVE_INFINITY,ta=0,ua=Number.POSITIVE_INFINITY,wa=null,xa=E,za=0,Aa=!1,Ba=!1,Ca=!1,Da=!1}function c(a,b,c){va=a,$(b),Fa=c,Ia=(0,i.default)(ca).getInstance(),Ea=(0,o.default)(ca).getInstance(),Ga=(0,m.default)(ca).getInstance(),Ja=(0,C.default)(ca).getInstance(),Ha=Fa.getScheduleController(),oa=Ga.getQualityFor(va,Fa.getStreamInfo()),ea.on(u.default.DATA_UPDATE_COMPLETED,O,this),ea.on(u.default.INIT_FRAGMENT_LOADED,f,this),ea.on(u.default.MEDIA_FRAGMENT_LOADED,j,this),ea.on(u.default.QUALITY_CHANGE_REQUESTED,p,this),ea.on(u.default.STREAM_COMPLETED,P,this),ea.on(u.default.PLAYBACK_PROGRESS,t,this),ea.on(u.default.PLAYBACK_TIME_UPDATED,t,this),ea.on(u.default.PLAYBACK_RATE_CHANGED,S,this),ea.on(u.default.PLAYBACK_SEEKING,r,this),ea.on(u.default.WALLCLOCK_TIME_UPDATED,R,this),ea.on(u.default.CURRENT_TRACK_CHANGED,Q,this,s.default.EVENT_PRIORITY_HIGH),ea.on(u.default.SOURCEBUFFER_APPEND_COMPLETED,n,this),ea.on(u.default.SOURCEBUFFER_REMOVE_COMPLETED,M,this)}function d(a){if(!a||!sa||!Fa)return null;var b=null;try{b=ha.createSourceBuffer(sa,a),b&&b.hasOwnProperty("initialize")&&b.initialize(va,this)}catch(c){ia.mediaSourceError("Error creating "+va+" source buffer.")}return X(b),N(Fa.getRepresentationInfoForQuality(oa).MSETimeOffset),b}function e(){return Fa.getStreamInfo().id===ja.getActiveStreamInfo().id}function f(a){a.fragmentModel===Fa.getFragmentModel()&&(da("Init fragment finished loading saving to",va+"'s init cache"),Ja.save(a.chunk),l(a.chunk))}function h(a,b){var c=Ja.extract(a,va,b);c?l(c):ea.trigger(u.default.INIT_REQUESTED,{sender:na})}function j(a){if(a.fragmentModel===Fa.getFragmentModel()){var b=a.chunk,c=b.bytes,d=b.quality,e=Fa.getRepresentationInfoForQuality(d),f=ga.getValue(),h=la.getEventsFor(f,e.mediaInfo,Fa),i=la.getEventsFor(f,e,Fa);if(h&&h.length>0||i&&i.length>0){var j=Fa.getFragmentModel().getRequests({state:g.default.FRAGMENT_MODEL_EXECUTED,quality:d,index:b.index})[0],k=G(c,j,h,i);Fa.getEventController().addInbandEvents(k)}b.bytes=H(c),l(b)}}function l(a){Ba=!0,ya=a,ha.append(wa,a),"video"===a.mediaInfo.type&&a.mediaInfo.embeddedCaptions&&ma.append(a.bytes,a)}function n(a){if(wa===a.buffer){if(a.error||!I())return a.error.code===k.default.QUOTA_EXCEEDED_ERROR_CODE&&(ra=.8*ha.getTotalBufferedTime(wa)),void(a.error.code!==k.default.QUOTA_EXCEEDED_ERROR_CODE&&I()||(ea.trigger(u.default.QUOTA_EXCEEDED,{sender:na,criticalBufferLevel:ra}),L(K())));isNaN(ya.index)||(ta=Math.max(ya.index,ta),y());var b=ha.getAllRanges(wa);if(b&&b.length>0)for(var c=0,d=b.length;c<d;c++)da("Buffered Range for type:",va,":",b.start(c)," - ",b.end(c));t(),Ba=!1,ea.trigger(u.default.BYTES_APPENDED,{sender:na,quality:ya.quality,startTime:ya.start,index:ya.index,bufferedRanges:b})}}function p(a){oa!==a.newQuality&&va===a.mediaType&&Fa.getStreamInfo().id===a.streamInfo.id&&(N(Fa.getRepresentationInfoForQuality(a.newQuality).MSETimeOffset),oa=a.newQuality)}function r(){ua=Number.POSITIVE_INFINITY,pa=!1,t()}function t(){v(),x()}function v(){qa=ha.getBufferLength(wa,Ea.getTime()),ea.trigger(u.default.BUFFER_LEVEL_UPDATED,{sender:na,bufferLevel:qa}),z()}function x(){e()&&(fa.addBufferState(va,xa,Ha.getBufferTarget()),fa.addBufferLevel(va,new Date,1e3*qa))}function y(){var a=ta>=ua-1;a&&!pa&&(pa=!0,ea.trigger(u.default.BUFFERING_COMPLETED,{sender:na,streamInfo:Fa.getStreamInfo()}))}function z(){B(qa<F&&!pa?E:D)}function B(a){xa===a||"fragmentedText"===va&&ma.getAllTracksAreDisabled()||(xa=a,x(),ea.trigger(u.default.BUFFER_LEVEL_STATE_CHANGED,{sender:na,state:a,mediaType:va,streamInfo:Fa.getStreamInfo()}),ea.trigger(a===D?u.default.BUFFER_LOADED:u.default.BUFFER_EMPTY,{mediaType:va}),da(a===D?"Got enough buffer to start.":"Waiting for more buffer before starting playback."))}function G(a,b,c,d){var e=Math.max(isNaN(b.startTime)?0:b.startTime,0),f=[],g=[];Da=!1;for(var h=c.concat(d),i=0,j=h.length;i<j;i++)f[h[i].schemeIdUri]=h[i];for(var k=(0,w.default)(ca).getInstance().parse(a),l=k.getBoxes("emsg"),i=0,j=l.length;i<j;i++){var m=la.getEvent(l[i],f,e);m&&g.push(m)}return g}function H(a){if(!Da)return a;for(var b=a.length,c=Math.pow(256,2),d=Math.pow(256,3),e=new Uint8Array(a.length),f=0,g=0;f<b;){var h=String.fromCharCode(a[f+4],a[f+5],a[f+6],a[f+7]),i=a[f]*d+a[f+1]*c+256*a[f+2]+1*a[f+3];if("emsg"!=h)for(var j=f;j<f+i;j++)e[g]=a[j],g++;f+=i}return e.subarray(0,g)}function I(){var a=ha.getTotalBufferedTime(wa);return a<ra}function J(){if(wa&&"fragmentedText"!==va){var a=wa.buffered.length?wa.buffered.start(0):0,b=Ea.getTime()-a-Ia.getBufferToKeep();b>0&&(da("pruning buffer: "+b+" seconds."),Ca=!0,ha.remove(wa,0,Math.round(a+b),sa))}}function K(){if(!wa)return null;var a=Ea.getTime(),b=Fa.getFragmentModel().getRequests({state:g.default.FRAGMENT_MODEL_EXECUTED,time:a})[0],c=ha.getBufferRange(wa,a),d=b&&!isNaN(b.startTime)?b.startTime:Math.floor(a);return null===c&&wa.buffered.length>0&&(d=wa.buffered.end(wa.buffered.length-1)),{start:wa.buffered.start(0),end:d}}function L(a){a&&wa&&ha.remove(wa,a.start,a.end,sa)}function M(a){wa===a.buffer&&(Ca&&(Ca=!1),v(),ea.trigger(u.default.BUFFER_CLEARED,{sender:na,from:a.from,to:a.to,hasEnoughSpaceToAppend:I()}))}function N(a){wa&&wa.timestampOffset!==a&&!isNaN(a)&&(wa.timestampOffset=a)}function O(a){a.sender.getStreamProcessor()!==Fa||a.error||N(a.currentRepresentation.MSETimeOffset)}function P(a){a.fragmentModel===Fa.getFragmentModel()&&(ua=a.request.index,y())}function Q(a){wa&&a.newMediaInfo.type===va&&a.newMediaInfo.streamInfo.id===Fa.getStreamInfo().id&&ka.getSwitchMode(va)===q.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&L(K())}function R(){za++;var a=za*(Ia.getWallclockTimeUpdateInterval()/1e3);a>=Ia.getBufferPruningInterval()&&!Ba&&(za=0,J())}function S(){z()}function T(){return va}function U(){return Fa}function V(a){Fa=a}function W(){return wa}function X(a){wa=a}function Y(){return qa}function Z(){return ra}function $(a){sa=a}function _(){return sa}function aa(){return pa}function ba(a){ea.off(u.default.DATA_UPDATE_COMPLETED,O,this),ea.off(u.default.QUALITY_CHANGE_REQUESTED,p,this),ea.off(u.default.INIT_FRAGMENT_LOADED,f,this),ea.off(u.default.MEDIA_FRAGMENT_LOADED,j,this),ea.off(u.default.STREAM_COMPLETED,P,this),ea.off(u.default.CURRENT_TRACK_CHANGED,Q,this),ea.off(u.default.PLAYBACK_PROGRESS,t,this),ea.off(u.default.PLAYBACK_TIME_UPDATED,t,this),ea.off(u.default.PLAYBACK_RATE_CHANGED,S,this),ea.off(u.default.PLAYBACK_SEEKING,r,this),ea.off(u.default.WALLCLOCK_TIME_UPDATED,R,this),ea.off(u.default.SOURCEBUFFER_APPEND_COMPLETED,n,this),ea.off(u.default.SOURCEBUFFER_REMOVE_COMPLETED,M,this),ra=Number.POSITIVE_INFINITY,xa=E,oa=m.default.QUALITY_DEFAULT,ua=Number.POSITIVE_INFINITY,ta=0,ya=null,Aa=!1,pa=!1,Ba=!1,Ca=!1,Ea=null,Fa=null,Ga=null,Ha=null,a||(ha.abort(sa,wa),ha.removeSourceBuffer(sa,wa)),wa=null}var ca=this.context,da=(0,A.default)(ca).getInstance().log,ea=(0,s.default)(ca).getInstance(),fa=a.metricsModel,ga=a.manifestModel,ha=a.sourceBufferController,ia=a.errHandler,ja=a.streamController,ka=a.mediaController,la=a.adapter,ma=a.textSourceBuffer,na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0;return na={initialize:c,createBuffer:d,getType:T,getStreamProcessor:U,setStreamProcessor:V,getBuffer:W,setBuffer:X,getBufferLevel:Y,getCriticalBufferLevel:Z,setMediaSource:$,getMediaSource:_,getIsBufferingCompleted:aa,switchInitData:h,reset:ba},b(),na}Object.defineProperty(c,"__esModule",{value:!0});var f=a(100),g=d(f),h=a(102),i=d(h),j=a(71),k=d(j),l=a(61),m=d(l),n=a(69),o=d(n),p=a(67),q=d(p),r=a(9),s=d(r),t=a(13),u=d(t),v=a(147),w=d(v),x=a(10),y=d(x),z=a(8),A=d(z),B=a(153),C=d(B),D="bufferLoaded",E="bufferStalled",F=.5;e.__dashjs_factory_name="BufferController";var G=y.default.getClassFactory(e);G.BUFFER_LOADED=D,G.BUFFER_EMPTY=E,c.default=G,b.exports=c.default},{10:10,100:100,102:102,13:13,147:147,153:153,61:61,67:67,69:69,71:71,8:8,9:9}],65:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){D=!1,u={},v={},w={},x=null,y=100,z=y/1e3,C=(0,g.default)(q).getInstance()}function b(){null!==x&&D&&(clearInterval(x),x=null,D=!1)}function c(){r("Start Event Controller"),D||isNaN(y)||(D=!0,x=setInterval(h,y))}function d(a){if(u={},a)for(var b=0;b<a.length;b++){var c=a[b];u[c.id]=c,r("Add inline event with id "+c.id)}r("Added "+a.length+" inline events")}function e(a){for(var b=0;b<a.length;b++){var c=a[b];c.id in v?r("Repeated event with id "+c.id):(v[c.id]=c,r("Add inband event with id "+c.id))}}function f(){if(w)for(var a=C.getTime(),b=Object.keys(w),c=0;c<b.length;c++){var d=b[c],e=w[d];null!==e&&(e.duration+e.presentationTime)/e.eventStream.timescale<a&&(r("Remove Event "+d+" at time "+a),e=null,delete w[d])}}function h(){j(v),j(u),f()}function i(){var a=A.getValue(),b=a.url;a.hasOwnProperty("Location")&&(b=a.Location),r("Refresh manifest @ "+b),B.getManifestLoader().load(b)}function j(a){var b,c=C.getTime();if(a)for(var d=Object.keys(a),e=0;e<d.length;e++){var f=d[e],g=a[f];void 0!==g&&(b=g.presentationTime/g.eventStream.timescale,(0===b||b<=c&&b+z>c)&&(r("Start Event "+f+" at "+c),g.duration>0&&(w[f]=g),g.eventStream.schemeIdUri==o&&g.eventStream.value==p?i():s.trigger(g.eventStream.schemeIdUri,{event:g}),delete a[f]))}}function l(a){a&&(a.manifestModel&&(A=a.manifestModel),a.manifestUpdater&&(B=a.manifestUpdater))}function n(){b(),u=null,v=null,w=null,C=null}var o="urn:mpeg:dash:event:2012",p=1,q=this.context,r=(0,k.default)(q).getInstance().log,s=(0,m.default)(q).getInstance(),t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,y=void 0,z=void 0,A=void 0,B=void 0,C=void 0,D=void 0;return t={initialize:a,addInlineEvents:d,addInbandEvents:e,clear:b,start:c,setConfig:l,reset:n}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(69),g=d(f),h=a(10),i=d(h),j=a(8),k=d(j),l=a(9),m=d(l);e.__dashjs_factory_name="EventController",c.default=i.default.getSingletonFactory(e),b.exports=c.default},{10:10,69:69,8:8,9:9}],66:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){q={},m.on(p.default.FRAGMENT_LOADING_COMPLETED,g,o)}function b(a){var b=q[a];return b||(b=(0,j.default)(i).create({metricsModel:(0,l.default)(i).getInstance()}),q[a]=b),b}function c(a){return a&&a.type&&a.type===f.HTTPRequest.INIT_SEGMENT_TYPE}function d(){m.off(p.default.FRAGMENT_LOADING_COMPLETED,g,this);for(var a in q)q[a].reset();q={}}function e(a,b,c){var d=new h.default;return d.streamId=c,d.mediaInfo=b.mediaInfo,d.segmentType=b.type,d.start=b.startTime,d.duration=b.duration,d.end=d.start+d.duration,d.bytes=a,d.index=b.index,d.quality=b.quality,d}function g(a){if(q[a.request.mediaType]===a.sender){var b=a.sender.getScheduleController(),d=a.request,f=a.response,g=c(d),h=b.getStreamProcessor().getStreamInfo();if(!f||!h)return void k("No "+d.mediaType+" bytes to push or stream is inactive.");var i=e(f,d,h.id);m.trigger(g?p.default.INIT_FRAGMENT_LOADED:p.default.MEDIA_FRAGMENT_LOADED,{chunk:i,fragmentModel:a.sender})}}var i=this.context,k=(0,t.default)(i).getInstance().log,m=(0,n.default)(i).getInstance(),o=void 0,q=void 0;return o={getModel:b,isInitializationRequest:c,reset:d},a(),o}Object.defineProperty(c,"__esModule",{value:!0});var f=a(180),g=a(162),h=d(g),i=a(100),j=d(i),k=a(103),l=d(k),m=a(9),n=d(m),o=a(13),p=d(o),q=a(10),r=d(q),s=a(8),t=d(s);e.__dashjs_factory_name="FragmentController",c.default=r.default.getClassFactory(e),b.exports=c.default},{10:10,100:100,103:103,13:13,162:162,180:180,8:8,9:9}],67:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){N={},E(),D()}function b(a,b){var c=k(a),e=d(a,b),f=[];return"fragmentedText"===a?void h(e[0]):(c||(c=L.getSavedMediaSettings(a),j(a,c)),void(e&&0!==e.length&&(c&&e.forEach(function(a){C(c,a)&&f.push(a)}),h(0===f.length?F(e):f.length>1?F(f):f[0]))))}function c(a){var b=a?a.type:null,c=a?a.streamInfo.id:null,d=k(b);return!(!a||!x(b))&&(N[c]=N[c]||G(),!(N[c][b].list.indexOf(a)>=0)&&(N[c][b].list.push(a),d&&C(d,a)&&!e(b,a.streamInfo)&&h(a),!0))}function d(a,b){if(!a||!b)return[];var c=b.id;return N[c]&&N[c][a]?N[c][a].list:[]}function e(a,b){return!a||!b||b&&!N[b.id]?null:N[b.id][a].current}function f(a){var b=a.type,c=a.streamInfo.id;return N[c]&&N[c][b]&&y(N[c][b].current,a)}function h(a){if(a){var b=a.type,c=a.streamInfo,d=c.id,f=e(b,c);if(N[d]&&N[d][b]&&(!f||!y(a,f))){N[d][b].current=a,f&&J.trigger(g.default.CURRENT_TRACK_CHANGED,{oldMediaInfo:f,newMediaInfo:a,switchMode:Q[b]});var h=B(a);h&&N[d][b].storeLastSettings&&(h.roles&&(h.role=h.roles[0],delete h.roles),h.accessibility&&(h.accessibility=h.accessibility[0]),h.audioChannelConfiguration&&(h.audioChannelConfiguration=h.audioChannelConfiguration[0]),L.setSavedMediaSettings(b,h))}}}function j(a,b){a&&b&&(O[a]=b)}function k(a){return a?O[a]:null}function l(a,b){var c=S.indexOf(b)!==-1;return c?void(Q[a]=b):void I("track switch mode is not supported: "+b)}function n(a){return Q[a]}function p(a){var b=T.indexOf(a)!==-1;return b?void(P=a):void I("track selection mode is not supported: "+a)}function w(){return P||v}function x(a){return"audio"===a||"video"===a||"text"===a||"fragmentedText"===a}function y(a,b){var c=a.id===b.id,d=a.viewpoint===b.viewpoint,e=a.lang===b.lang,f=a.roles.toString()===b.roles.toString(),g=a.accessibility.toString()===b.accessibility.toString(),h=a.audioChannelConfiguration.toString()===b.audioChannelConfiguration.toString();return c&&d&&e&&f&&g&&h}function z(a){a&&a.errHandler&&(R=a.errHandler)}function A(){a(),K.resetEmbedded()}function B(a){var b={lang:a.lang,viewpoint:a.viewpoint,roles:a.roles,accessibility:a.accessibility,audioChannelConfiguration:a.audioChannelConfiguration},c=b.lang||b.viewpoint||b.role&&b.role.length>0||b.accessibility&&b.accessibility.length>0||b.audioChannelConfiguration&&b.audioChannelConfiguration.length>0;return c?b:null}function C(a,b){var c=!a.lang||a.lang===b.lang,d=!a.viewpoint||a.viewpoint===b.viewpoint,e=!a.role||!!b.roles.filter(function(b){return b===a.role})[0],f=!a.accessibility||!!b.accessibility.filter(function(b){return b===a.accessibility})[0],g=!a.audioChannelConfiguration||!!b.audioChannelConfiguration.filter(function(b){return b===a.audioChannelConfiguration})[0];return c&&d&&e&&f&&g}function D(){Q={audio:s,video:r}}function E(){O={audio:null,video:null}}function F(a){var b=w(),c=[],d=function(a){var b,c=0,d=[];return a.forEach(function(a){b=Math.max.apply(Math,a.bitrateList.map(function(a){return a.bandwidth})),b>c?(c=b,d=[a]):b===c&&d.push(a)}),d},e=function(a){var b,c=0,d=[];return a.forEach(function(a){b=a.representationCount,b>c?(c=b,d=[a]):b===c&&d.push(a)}),d};switch(b){case t:c=d(a),c.length>1&&(c=e(c));break;case u:c=e(a),c.length>1&&(c=d(a));break;default:I("track selection mode is not supported: "+b)}return c[0]}function G(){return{audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},fragmentedText:{list:[],storeLastSettings:!0,current:null}}}var H=this.context,I=(0,m.default)(H).getInstance().log,J=(0,i.default)(H).getInstance(),K=(0,o.default)(H).getInstance(),L=(0,q.default)(H).getInstance(),M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=[s,r],T=[t,u];return M={initialize:a,checkInitialMediaSettingsForType:b,addTrack:c,getTracksFor:d,getCurrentTrackFor:e,isCurrentTrack:f,setTrack:h,setInitialSettings:j,getInitialSettings:k,setSwitchMode:l,getSwitchMode:n,setSelectionModeForInitialTrack:p,getSelectionModeForInitialTrack:w,isMultiTrackSupportedByType:x,isTracksEqual:y,setConfig:z,reset:A}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(13),g=d(f),h=a(9),i=d(h),j=a(10),k=d(j),l=a(8),m=d(l),n=a(57),o=d(n),p=a(150),q=d(p),r="neverReplace",s="alwaysReplace",t="highestBitrate",u="widestRange",v=t;e.__dashjs_factory_name="MediaController";var w=k.default.getSingletonFactory(e);w.TRACK_SWITCH_MODE_NEVER_REPLACE=r,w.TRACK_SWITCH_MODE_ALWAYS_REPLACE=s,w.TRACK_SELECTION_MODE_HIGHEST_BITRATE=t,w.TRACK_SELECTION_MODE_WIDEST_RANGE=u,w.DEFAULT_INIT_TRACK_SELECTION_MODE=v,c.default=w,b.exports=c.default},{10:10,13:13,150:150,57:57,8:8,9:9}],68:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){var a="WebKitMediaSource"in window,b="MediaSource"in window;return b?new MediaSource:a?new WebKitMediaSource:null}function b(a,b){var c=window.URL.createObjectURL(a);return b.setSource(c),c}function c(a){a.setSource(null)}function d(a,b){return a.duration!=b&&(a.duration=b),a.duration}function e(a){var b=a.sourceBuffers,c=b.length,d=0;if("open"===a.readyState){for(d;d<c;d++){if(b[d].updating)return;if(0===b[d].buffered.length)return}a.endOfStream()}}var f=void 0;return f={createMediaSource:a,attachMediaSource:b,detachMediaSource:c,setDuration:d,signalEndOfStream:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="MediaSourceController",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],69:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){ka=0,la=NaN,ma=null,pa=null,ra=!1,na={},qa=(0,k.default)(Z).getInstance()}function b(a){oa=a,ba=ja.getElement(),X(),pa=oa.manifestInfo.isDynamic,la=oa.start,_.on(o.default.DATA_UPDATE_COMPLETED,H,this),_.on(o.default.BYTES_APPENDED,V,this),_.on(o.default.BUFFER_LEVEL_STATE_CHANGED,W,this),_.on(o.default.PERIOD_SWITCH_STARTED,c,this),ra&&(ra=!1,h())}function c(a){!pa&&a.fromStreamInfo&&na[a.fromStreamInfo.id]&&delete na[a.fromStreamInfo.id]}function d(){var a=B(!0),b=pa?a-oa.start:0;return a+(oa.duration-b)-q()}function e(){return q()>0}function f(){return oa.id}function h(){if(ba){ba.autoplay=!0;var a=ba.play();a&&"undefined"!=typeof Promise&&a instanceof Promise&&a.catch(function(a){"NotAllowedError"===a.name&&_.trigger(o.default.PLAYBACK_NOT_ALLOWED),$("Caught pending play exception - continuing ("+a+")")})}else ra=!0}function j(){if(ba)return ba.paused}function l(){ba&&(ba.pause(),ba.autoplay=!1)}function n(){if(ba)return ba.seeking}function p(a){ja&&($("Requesting seek to time: "+a),ja.setCurrentTime(a))}function q(){if(ba)return ba.currentTime}function r(){if(ba)return ba.playbackRate}function t(){if(ba)return ba.played}function u(){if(ba)return ba.ended}function v(){return pa}function w(a){la=a}function x(){return la}function y(a,b){var c=ha.getMpd(ga.getValue()),d=void 0,e=10;d=qa.getUseSuggestedPresentationDelay()&&c.hasOwnProperty("suggestedPresentationDelay")?c.suggestedPresentationDelay:qa.getLiveDelay()?qa.getLiveDelay():isNaN(a)?2*oa.manifestInfo.minBufferTime:a*qa.getLiveDelayFragmentCount();var f=Math.max(b-e,b/2);return Math.min(d,f)}function z(){ja&&ba&&(_.off(o.default.DATA_UPDATE_COMPLETED,H,this),_.off(o.default.BUFFER_LEVEL_STATE_CHANGED,W,this),_.off(o.default.BYTES_APPENDED,V,this),E(),Y()),ja=null,oa=null,ba=null,pa=null,a()}function A(a){a&&(a.streamController&&(ca=a.streamController),a.timelineConverter&&(da=a.timelineConverter),a.metricsModel&&(ea=a.metricsModel),a.dashMetrics&&(fa=a.dashMetrics),a.manifestModel&&(ga=a.manifestModel),a.dashManifestModel&&(ha=a.dashManifestModel),a.adapter&&(ia=a.adapter),a.videoModel&&(ja=a.videoModel))}function B(a){var b=void 0,c=(0,i.default)(Z).getInstance().getURIFragmentData(),d=parseInt(c.s,10),e=parseInt(c.t,10),f=NaN;if(a||(f=isNaN(d)?e:d),pa)!isNaN(f)&&f>1262304e3&&(b=f-oa.manifestInfo.availableFrom.getTime()/1e3,(b>la||b<la-oa.manifestInfo.DVRWindowSize)&&(b=null)),b=b||la;else if(!isNaN(f)&&f<Math.max(oa.manifestInfo.duration,oa.duration)&&f>=0)b=f;else{var g=na[oa.id];void 0===g&&(g=ca.getActiveStreamCommonEarliestTime()),b=Math.max(g,oa.start)}return b}function C(a){var b,c=ea.getReadOnlyMetricsFor("video")||ea.getReadOnlyMetricsFor("audio"),d=fa.getCurrentDVRInfo(c),e=d?d.range:null;if(!e)return NaN;if(a>e.end)b=Math.max(e.end-2*oa.manifestInfo.minBufferTime,e.start);else{if(!(a<e.start))return a;b=e.start}return b}function D(){if(null===ma){var a=function(){U()};ma=setInterval(a,qa.getWallclockTimeUpdateInterval())}}function E(){clearInterval(ma),ma=null}function F(){var a=B(!1);a>0&&(p(a),$("Starting playback at offset: "+a))}function G(){if(!j()&&pa&&0!==ba.readyState){var a=q(),b=C(a),c=!isNaN(b)&&b!==a;c&&p(b)}}function H(a){if(!a.error){var b=ia.convertDataToTrack(ga.getValue(),a.currentRepresentation),c=b.mediaInfo.streamInfo;oa.id===c.id&&(oa=c,G())}}function I(){_.trigger(o.default.CAN_PLAY)}function J(){$("Native video element event: play"),G(),D(),_.trigger(o.default.PLAYBACK_STARTED,{startTime:q()})}function K(){$("Native video element event: playing"),_.trigger(o.default.PLAYBACK_PLAYING,{playingTime:q()})}function L(){$("Native video element event: pause"),_.trigger(o.default.PLAYBACK_PAUSED,{ended:u()})}function M(){var a=q();$("Seeking to: "+a),D(),_.trigger(o.default.PLAYBACK_SEEKING,{seekTime:a})}function N(){$("Native video element event: seeked"),_.trigger(o.default.PLAYBACK_SEEKED)}function O(){var a=q();a!==ka&&(ka=a,_.trigger(o.default.PLAYBACK_TIME_UPDATED,{timeToEnd:d(),time:a}))}function P(){_.trigger(o.default.PLAYBACK_PROGRESS)}function Q(){var a=r();$("Native video element event: ratechange: ",a),_.trigger(o.default.PLAYBACK_RATE_CHANGED,{playbackRate:a})}function R(){$("Native video element event: loadedmetadata"),(!pa&&oa.isFirst||da.isTimeSyncCompleted())&&F(),_.trigger(o.default.PLAYBACK_METADATA_LOADED),D()}function S(){$("Native video element event: ended"),l(),E(),_.trigger(o.default.PLAYBACK_ENDED)}function T(a){var b=a.target||a.srcElement;_.trigger(o.default.PLAYBACK_ERROR,{error:b.error})}function U(){_.trigger(o.default.WALLCLOCK_TIME_UPDATED,{isDynamic:pa,time:new Date})}function V(a){var b=a.bufferedRanges;if(b&&b.length){var c=Math.max(b.start(0),oa.start),d=void 0===na[oa.id]?c:Math.max(na[oa.id],c);d!==na[oa.id]&&(!pa&&B(!0)<d&&q()<d&&p(d),na[oa.id]=d)}}function W(a){a.streamInfo.id===oa.id&&ja.setStallState(a.mediaType,a.state===g.default.BUFFER_EMPTY)}function X(){ba.addEventListener("canplay",I),ba.addEventListener("play",J),ba.addEventListener("playing",K),ba.addEventListener("pause",L),ba.addEventListener("error",T),ba.addEventListener("seeking",M),ba.addEventListener("seeked",N),ba.addEventListener("timeupdate",O),ba.addEventListener("progress",P),ba.addEventListener("ratechange",Q),ba.addEventListener("loadedmetadata",R),ba.addEventListener("ended",S)}function Y(){ba.removeEventListener("canplay",I),ba.removeEventListener("play",J),ba.removeEventListener("playing",K),ba.removeEventListener("pause",L),ba.removeEventListener("error",T),ba.removeEventListener("seeking",M),ba.removeEventListener("seeked",N),ba.removeEventListener("timeupdate",O),ba.removeEventListener("progress",P),ba.removeEventListener("ratechange",Q),ba.removeEventListener("loadedmetadata",R),ba.removeEventListener("ended",S)}var Z=this.context,$=(0,s.default)(Z).getInstance().log,_=(0,m.default)(Z).getInstance(),aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0,fa=void 0,ga=void 0,ha=void 0,ia=void 0,ja=void 0,ka=void 0,la=void 0,ma=void 0,na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0;return aa={initialize:b,setConfig:A,getStreamStartTime:B,getTimeToStreamEnd:d,isPlaybackStarted:e,getStreamId:f,getTime:q,getPlaybackRate:r,getPlayedRanges:t,getEnded:u,getIsDynamic:v,setLiveStartTime:w,getLiveStartTime:x,computeLiveDelay:y,play:h,isPaused:j,pause:l,isSeeking:n,seek:p,reset:z},a(),aa}Object.defineProperty(c,"__esModule",{value:!0});var f=a(64),g=d(f),h=a(104),i=d(h),j=a(102),k=d(j),l=a(9),m=d(l),n=a(13),o=d(n),p=a(10),q=d(p),r=a(8),s=d(r);e.__dashjs_factory_name="PlaybackController",c.default=q.default.getSingletonFactory(e),b.exports=c.default},{10:10,102:102,104:104,13:13,64:64,8:8,9:9}],70:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){wa=!0,Ra=NaN,Pa=NaN,Qa={},Sa=[],xa=!1,ya=null,za=null,Aa=!0,Ba=!1,Ca=0,Ea=NaN}function c(a,b){sa=a,Ia=b,Fa=(0,h.default)(ha).getInstance(),Ga=(0,n.default)(ha).getInstance(),Ha=(0,j.default)(ha).getInstance(),Ja=(0,N.default)(ha).getInstance(),Ka=Ia.getFragmentController(),La=Ia.getBufferController(),ta=Ka.getModel(sa),ta.setScheduleController(this),ua=Ia.isDynamic(),Oa=qa.getScheduleWhilePaused(),Ma=(0,p.default)(ha).create({dashMetrics:(0,z.default)(ha).getInstance(),metricsModel:(0,v.default)(ha).getInstance(),textSourceBuffer:(0,t.default)(ha).getInstance()}),Na=(0,r.default)(ha).create({adapter:(0,B.default)(ha).getInstance(),sourceBufferController:(0,D.default)(ha).getInstance(),textSourceBuffer:(0,t.default)(ha).getInstance()}),oa.getIsTextTrack(sa)&&ja.on(J.default.TIMED_TEXT_REQUESTED,T,this),ja.on(J.default.QUALITY_CHANGE_REQUESTED,u,this),ja.on(J.default.DATA_UPDATE_STARTED,M,this),ja.on(J.default.DATA_UPDATE_COMPLETED,y,this),ja.on(J.default.FRAGMENT_LOADING_COMPLETED,G,this),ja.on(J.default.STREAM_COMPLETED,E,this),ja.on(J.default.STREAM_INITIALIZED,A,this),ja.on(J.default.BUFFER_LEVEL_STATE_CHANGED,Q,this),ja.on(J.default.BUFFER_CLEARED,O,this),ja.on(J.default.BYTES_APPENDED,K,this),ja.on(J.default.INIT_REQUESTED,o,this),ja.on(J.default.QUOTA_EXCEEDED,R,this),ja.on(J.default.BUFFER_LEVEL_STATE_CHANGED,Q,this),ja.on(J.default.PLAYBACK_SEEKING,V,this),ja.on(J.default.PLAYBACK_STARTED,U,this),ja.on(J.default.PLAYBACK_RATE_CHANGED,W,this),ja.on(J.default.PLAYBACK_TIME_UPDATED,I,this),ja.on(J.default.URL_RESOLUTION_FAILED,S,this),ja.on(J.default.FRAGMENT_LOADING_ABANDONED,L,this)}function d(){va&&!La.getIsBufferingCompleted()&&(fa(),xa=!1,wa?(wa=!1,q(va.quality)):m(0),ia("Schedule controller starting for "+sa))}function e(){xa||(xa=!0,clearTimeout(Da),ia("Schedule controller stopping for "+sa))}function g(a,b){Qa[b]=Qa[b]||{};var c=Ha.getTopQualityIndexFor(a,b);return Qa[b][a]!=c&&(ia("Top quality"+a+" index has changed from "+Qa[b][a]+" to "+c),Qa[b][a]=c,!0)}function i(){if(!(xa||Ba||!La||Fa.isPaused()&&!Oa)){k();var a=Sa.length>0;if(a||g(va.mediaInfo.type,Ia.getStreamInfo().id)||Ma.execute(Ia,sa,Ja.isVideoTrackPresent())){var b=function(){if(va.quality!==Ra)Ra=va.quality,La.switchInitData(Ia.getStreamInfo().id,va.quality);else{var a=Sa.shift();if(Ka.isInitializationRequest(a))q(a.quality);else{var b=Na.execute(Ia,a);b?ta.executeRequest(b):(Ba=!1,m(500))}}};Ba=!0,a?b():(Ha.getPlaybackQuality(Ia),b())}else m(500)}}function k(){var a=1.5*va.fragmentDuration,b=ta.getRequests({state:x.default.FRAGMENT_MODEL_EXECUTED,time:Fa.getTime()+a,threshold:0})[0];b&&Sa.indexOf(b)===-1&&!oa.getIsTextTrack(sa)&&(!Ga.isCurrentTrack(b.mediaInfo)||qa.getFastSwitchEnabled()&&b.quality<va.quality&&La.getBufferLevel()>=a&&Ha.getAbandonmentStateFor(sa)!==j.default.ABANDON_LOAD?(s(b),ia("Reloading outdated fragment at index: ",b.index)):b.quality>va.quality&&Y(Fa.getTime()+La.getBufferLevel()))}function m(a){clearTimeout(Da),Da=setTimeout(i,a)}function o(a){a.sender.getStreamProcessor()===Ia&&q(va.quality)}function q(a){Ra=a;var b=ma.getInitRequest(Ia,a);b&&(Ba=!0,ta.executeRequest(b))}function s(a){Sa.push(a)}function u(a){if(sa===a.mediaType&&Ia.getStreamInfo().id===a.streamInfo.id){if(va=Ia.getRepresentationInfoForQuality(a.newQuality),null===va||void 0===va)throw new Error("Unexpected error! - currentRepresentationInfo is null or undefined");ea(new Date,f.PlayListTrace.REPRESENTATION_SWITCH_STOP_REASON),fa()}}function w(a){var b=ta.getRequests({state:x.default.FRAGMENT_MODEL_EXECUTED,time:Fa.getTime(),threshold:0})[0];b&&Fa.getTime()>=b.startTime&&(b.quality!==Pa&&a&&ja.trigger(J.default.QUALITY_CHANGE_RENDERED,{mediaType:sa,oldQuality:Pa,newQuality:b.quality}),Pa=b.quality)}function y(a){a.error||a.sender.getStreamProcessor()!==Ia||(va=ma.convertDataToTrack(la.getValue(),a.currentRepresentation))}function A(a){a.error||Ia.getStreamInfo().id!==a.streamInfo.id||(va=Ia.getCurrentRepresentationInfo(),ua&&wa&&(pa.setTimeSyncCompleted(!0),C()),xa&&d())}function C(){var a=(0,F.default)(ha).getInstance().getLiveEdge(),b=va.mediaInfo.streamInfo.manifestInfo.DVRWindowSize/2,c=a-Fa.computeLiveDelay(va.fragmentDuration,b),d=ma.getFragmentRequestForTime(Ia,va,c,{ignoreIsFinished:!0});Ea=Fa.getLiveStartTime(),(isNaN(Ea)||d.startTime>Ea)&&(Fa.setLiveStartTime(d.startTime),Ea=d.startTime);var e=na.getCurrentManifestUpdate(ka.getMetricsFor("stream"));ka.updateManifestUpdateInfo(e,{currentTime:Ea,presentationStartTime:a,latency:a-Ea,clientTimeOffset:pa.getClientTimeOffset()})}function E(a){a.fragmentModel===ta&&(e(),Ba=!1,ia("Stream is complete"))}function G(a){a.sender===ta&&(oa.getIsTextTrack(sa)&&(Ba=!1),a.error&&a.request.serviceLocation&&!xa&&(s(a.request),Ba=!1,m(0)))}function I(){w(!0)}function K(a){a.sender.getStreamProcessor()===Ia&&(Ba=!1,m(0))}function L(a){a.streamProcessor===Ia&&(s(a.request),Ba=!1,m(0))}function M(a){a.sender.getStreamProcessor()===Ia&&e()}function O(a){a.sender.getStreamProcessor()===Ia&&(ta.removeExecutedRequestsBeforeTime(a.to),a.hasEnoughSpaceToAppend&&xa&&d())}function Q(a){a.sender.getStreamProcessor()!==Ia||a.state!==l.default.BUFFER_EMPTY||Fa.isSeeking()||(ia("Buffer is empty! Stalling!"),ea(new Date,f.PlayListTrace.REBUFFERING_REASON))}function R(a){a.sender.getStreamProcessor()===Ia&&e()}function S(){ta.abortRequests(),e()}function T(a){a.sender.getStreamProcessor()===Ia&&q(a.index)}function U(){!xa&&Oa||d()}function V(a){Ea=a.seekTime,$(0),xa&&d();var b=na.getCurrentManifestUpdate(ka.getMetricsFor("stream")),c=va.DVRWindow?va.DVRWindow.end-Fa.getTime():NaN;ka.updateManifestUpdateInfo(b,{latency:c})}function W(a){za&&(za.playbackspeed=a.playbackRate.toString())}function X(){return Ea}function Y(a){Ea=a}function Z(){return ta}function $(a){Ca=a}function _(){return Ca}function aa(){return Ia}function ba(){return Ma.getBufferTarget(Ia,sa,Ja.isVideoTrackPresent()); -}function ca(a){ya=a}function da(a,b){ea(a,b),ya=null}function ea(a,b){if(ya&&Aa===!1){var c=za.start,d=a.getTime()-c.getTime();za.duration=d,za.stopreason=b,ya.trace.push(za),Aa=!0}}function fa(){ya&&Aa===!0&&va&&(Aa=!1,za=new f.PlayListTrace,za.representationid=va.id,za.start=new Date,za.mstart=1e3*Fa.getTime(),za.playbackspeed=Fa.getPlaybackRate().toString())}function ga(){ja.off(J.default.DATA_UPDATE_STARTED,M,this),ja.off(J.default.DATA_UPDATE_COMPLETED,y,this),ja.off(J.default.BUFFER_LEVEL_STATE_CHANGED,Q,this),ja.off(J.default.QUALITY_CHANGE_REQUESTED,u,this),ja.off(J.default.FRAGMENT_LOADING_COMPLETED,G,this),ja.off(J.default.STREAM_COMPLETED,E,this),ja.off(J.default.STREAM_INITIALIZED,A,this),ja.off(J.default.QUOTA_EXCEEDED,R,this),ja.off(J.default.BYTES_APPENDED,K,this),ja.off(J.default.BUFFER_CLEARED,O,this),ja.off(J.default.INIT_REQUESTED,o,this),ja.off(J.default.PLAYBACK_RATE_CHANGED,W,this),ja.off(J.default.PLAYBACK_SEEKING,V,this),ja.off(J.default.PLAYBACK_STARTED,U,this),ja.off(J.default.PLAYBACK_TIME_UPDATED,I,this),ja.off(J.default.URL_RESOLUTION_FAILED,S,this),ja.off(J.default.FRAGMENT_LOADING_ABANDONED,L,this),oa.getIsTextTrack(sa)&&ja.off(J.default.TIMED_TEXT_REQUESTED,T,this),e(),w(!1),Ba=!1,Ca=0,Ea=NaN,Fa=null,ya=null}var ha=this.context,ia=(0,P.default)(ha).getInstance().log,ja=(0,H.default)(ha).getInstance(),ka=a.metricsModel,la=a.manifestModel,ma=a.adapter,na=a.dashMetrics,oa=a.dashManifestModel,pa=a.timelineConverter,qa=a.mediaPlayerModel,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0,Pa=void 0,Qa=void 0,Ra=void 0,Sa=void 0;return ra={initialize:c,getStreamProcessor:aa,getSeekTarget:X,setSeekTarget:Y,getFragmentModel:Z,setTimeToLoadDelay:$,getTimeToLoadDelay:_,replaceRequest:s,start:d,stop:e,reset:ga,setPlayList:ca,getBufferTarget:ba,finalisePlayList:da},b(),ra}Object.defineProperty(c,"__esModule",{value:!0});var f=a(182),g=a(69),h=d(g),i=a(61),j=d(i),k=a(64),l=d(k),m=a(67),n=d(m),o=a(144),p=d(o),q=a(145),r=d(q),s=a(57),t=d(s),u=a(103),v=d(u),w=a(100),x=d(w),y=a(17),z=d(y),A=a(15),B=d(A),C=a(71),D=d(C),E=a(155),F=d(E),G=a(9),H=d(G),I=a(13),J=d(I),K=a(10),L=d(K),M=a(72),N=d(M),O=a(8),P=d(O);e.__dashjs_factory_name="ScheduleController",c.default=L.default.getClassFactory(e),b.exports=c.default},{10:10,100:100,103:103,13:13,144:144,145:145,15:15,155:155,17:17,182:182,57:57,61:61,64:64,67:67,69:69,71:71,72:72,8:8,9:9}],71:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=b.codec,d=null;try{if(c.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))throw new y.default("not really supported");d=a.addSourceBuffer(c)}catch(e){if(!b.isText&&c.indexOf('codecs="stpp')===-1&&c.indexOf('codecs="wvtt')===-1)throw e;d=(0,g.default)(t).getInstance(),d.setConfig({errHandler:(0,m.default)(t).getInstance(),adapter:(0,k.default)(t).getInstance(),dashManifestModel:z,mediaController:(0,i.default)(t).getInstance(),videoModel:(0,w.default)(t).getInstance(),streamController:(0,o.default)(t).getInstance(),textTracks:(0,q.default)(t).getInstance(),VTTParser:(0,s.default)(t).getInstance(),TTMLParser:(0,u.default)(t).getInstance()})}return d}function b(a,b){try{a.removeSourceBuffer(b)}catch(c){}}function c(a,b,c){var d,e,f=null,g=0,h=0,i=null,j=null,k=0,l=c||.15;try{f=a.buffered}catch(m){return null}if(null!==f&&void 0!==f){for(e=0,d=f.length;e<d;e++)if(g=f.start(e),h=f.end(e),null===i)k=Math.abs(g-b),b>=g&&b<h?(i=g,j=h):k<=l&&(i=g,j=h);else{if(k=g-j,!(k<=l))break;j=h}if(null!==i)return{start:i,end:j}}return null}function d(a){var b=null;try{return b=a.buffered}catch(c){return null}}function e(a){var b,c,e=d(a),f=0;if(!e)return f;for(c=0,b=e.length;c<b;c++)f+=e.end(c)-e.start(c);return f}function f(a,b,d){var e,f;return e=c(a,b,d),f=null===e?0:e.end-b}function h(a,b){if(!b)return null;var c,e,f,g,h,i,j,k,l,m=d(b);if(!m)return null;for(var n=0,o=m.length;n<o;n++){if(k=a.length>n,h=k?{start:a.start(n),end:a.end(n)}:null,c=m.start(n),e=m.end(n),!h)return l={start:c,end:e};if(f=h.start===c,g=h.end===e,!f||!g){if(f)l={start:h.end,end:e};else{if(!g)return l={start:c,end:e};l={start:c,end:h.start}}return i=a.length>n+1?{start:a.start(n+1),end:a.end(n+1)}:null,j=n+1<o?{start:m.start(n+1),end:m.end(n+1)}:null,!i||j&&j.start===i.start&&j.end===i.end||(l.end=i.start),l}}return null}function j(a,b){var c=b.bytes,d="append"in a?"append":"appendBuffer"in a?"appendBuffer":null,e="Object"===Object.prototype.toString.call(a).slice(8,-1);if(d)try{r(a,function(){e?a[d](c,b):a[d](c),r(a,function(){v.trigger(C.default.SOURCEBUFFER_APPEND_COMPLETED,{buffer:a,bytes:c})})})}catch(f){v.trigger(C.default.SOURCEBUFFER_APPEND_COMPLETED,{buffer:a,bytes:c,error:new y.default(f.code,f.message,null)})}}function l(a,b,c,d){try{r(a,function(){b>=0&&c>b&&"ended"!==d.readyState&&a.remove(b,c),r(a,function(){v.trigger(C.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:a,from:b,to:c})})})}catch(e){v.trigger(C.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:a,from:b,to:c,error:new y.default(e.code,e.message,null)})}}function n(a,b){try{"open"===a.readyState?b.abort():b.setTextTrack&&"ended"===a.readyState&&b.abort()}catch(c){}}function p(a){a&&a.dashManifestModel&&(z=a.dashManifestModel)}function r(a,b){var c,d=50,e=function(){a.updating||(clearInterval(c),b())},f=function c(){a.updating||(a.removeEventListener("updateend",c,!1),b())};if(!a.updating)return void b();if("function"==typeof a.addEventListener)try{a.addEventListener("updateend",f,!1)}catch(g){c=setInterval(e,d)}else c=setInterval(e,d)}var t=this.context,v=(0,A.default)(t).getInstance(),x=void 0,z=void 0;return x={append:j,remove:l,abort:n,createSourceBuffer:a,removeSourceBuffer:b,getBufferRange:c,getAllRanges:d,getTotalBufferedTime:e,getBufferLength:f,getRangeDifference:h,setConfig:p}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(57),g=d(f),h=a(67),i=d(h),j=a(15),k=d(j),l=a(152),m=d(l),n=a(72),o=d(n),p=a(58),q=d(p),r=a(160),s=d(r),t=a(158),u=d(t),v=a(105),w=d(v),x=a(163),y=d(x),z=a(9),A=d(z),B=a(13),C=d(B),D=a(10),E=d(D),F=22;e.__dashjs_factory_name="SourceBufferController";var G=E.default.getSingletonFactory(e);G.QUOTA_EXCEEDED_ERROR_CODE=F,c.default=G,b.exports=c.default},{10:10,105:105,13:13,15:15,152:152,158:158,160:160,163:163,57:57,58:58,67:67,72:72,9:9}],72:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){ma=null,ka=[],wa=(0,u.default)(T).getInstance(),oa=!0,pa=!1,qa=!1,xa=!1,ya=!0,za=null,ra=!1,sa=!1}function b(a,b){oa=a,na=b,ja.initialize(),ha=(0,B.default)(T).getInstance(),Y=(0,k.default)(T).getInstance(),Y.setConfig({log:U,manifestModel:$,dashManifestModel:_}),Y.initialize(Z),ua=(0,s.default)(T).getInstance(),va=(0,g.default)(T).getInstance(),va.setConfig({streamController:W,timelineConverter:ja,metricsModel:ba,dashMetrics:ca,manifestModel:$,dashManifestModel:_,adapter:aa,videoModel:ua}),V.on(o.default.TIME_SYNCHRONIZATION_COMPLETED,D,this),V.on(o.default.PLAYBACK_SEEKING,d,this),V.on(o.default.PLAYBACK_TIME_UPDATED,c,this),V.on(o.default.PLAYBACK_ENDED,p,this),V.on(o.default.PLAYBACK_ERROR,J,this),V.on(o.default.PLAYBACK_STARTED,e,this),V.on(o.default.PLAYBACK_PAUSED,f,this),V.on(o.default.MANIFEST_UPDATED,E,this),V.on(o.default.STREAM_BUFFERING_COMPLETED,h,this)}function c(a){if(F()){var b=ua.getPlaybackQuality();b&&ba.addDroppedFrames("video",b)}va.isSeeking()||a.timeToEnd<=S&&p()}function d(a){var b=j(a.seekTime);b&&b!==la?(H(x.PlayListTrace.END_OF_PERIOD_STOP_REASON),t(la,b,a.seekTime)):H(x.PlayListTrace.USER_REQUEST_STOP_REASON),I(x.PlayList.SEEK_START_REASON)}function e(){ya?(ya=!1,I(x.PlayList.INITIAL_PLAYOUT_START_REASON)):xa&&(xa=!1,I(x.PlayList.RESUME_FROM_PAUSE_START_REASON))}function f(a){a.ended||(xa=!0,H(x.PlayListTrace.USER_REQUEST_STOP_REASON))}function h(){var a=L().isLast;ta&&a&&ea.signalEndOfStream(ta)}function j(a){var b=0,c=null,d=ka.length;d>0&&(b+=ka[0].getStartTime());for(var e=0;e<d;e++)if(c=ka[e],b+=c.getDuration(),a<b)return c;return null}function l(a,b){for(var c=null,d=0,e=0,f=null,g=ka.length,h=0;h<g;h++){if(c=ka[h],e=c.getStartTime(),f=c.getDuration(),Number.isFinite(e)&&(d=e),c.getId()===b)return a-d;Number.isFinite(f)&&(d+=f)}return null}function n(){var a=[];return la.getProcessors().forEach(function(b){a.push(b.getIndexHandler().getEarliestTime())}),Math.min.apply(Math,a)}function p(){var a=r();a&&t(la,a,NaN),H(a?x.PlayListTrace.END_OF_PERIOD_STOP_REASON:x.PlayListTrace.END_OF_CONTENT_STOP_REASON)}function r(){if(la){var a=function(){var a=la.getStreamInfo().start,b=la.getStreamInfo().duration;return{v:ka.filter(function(c){return c.getStreamInfo().start===a+b})[0]}}();if("object"==typeof a)return a.v}}function t(a,b,c){!pa&&b&&a!==b&&(pa=!0,V.trigger(o.default.PERIOD_SWITCH_STARTED,{fromStreamInfo:a?a.getStreamInfo():null,toStreamInfo:b.getStreamInfo()}),a&&a.deactivate(),la=b,va.initialize(la.getStreamInfo()),Aa=G(),v(c))}function v(a){function b(){U("MediaSource is open!"),window.URL.revokeObjectURL(c),ta.removeEventListener("sourceopen",b),ta.removeEventListener("webkitsourceopen",b),y(),w(a)}var c=void 0;ta?ea.detachMediaSource(ua):ta=ea.createMediaSource(),ta.addEventListener("sourceopen",b,!1),ta.addEventListener("webkitsourceopen",b,!1),c=ea.attachMediaSource(ta,ua),U("MediaSource attached to element. Waiting on open...")}function w(a){la.activate(ta),ya||(isNaN(a)?!function(){var a=va.getStreamStartTime(!0);la.getProcessors().forEach(function(b){aa.setIndexHandlerTime(b,a)}),va.seek(a)}():va.seek(a)),la.startEventController(),!oa&&ya||va.play(),pa=!1,V.trigger(o.default.PERIOD_SWITCH_COMPLETED,{toStreamInfo:la.getStreamInfo()})}function y(){var a=la.getStreamInfo().manifestInfo.duration,b=ea.setDuration(ta,a);U("Duration successfully set to: "+b)}function A(a){for(var b=0,c=ka.length;b<c;b++)if(ka[b].getId()===a.id)return ka[b];return null}function C(a){try{var b=aa.getStreamsInfo(a);if(0===b.length)throw new Error("There are no streams");var c=ca.getCurrentManifestUpdate(ba.getMetricsFor("stream"));ba.updateManifestUpdateInfo(c,{currentTime:va.getTime(),buffered:ua.getElement().buffered,presentationStartTime:b[0].start,clientTimeOffset:ja.getClientTimeOffset()});for(var d=0,e=b.length;d<e;d++){var f=b[d],g=A(f);g?g.updateData(f):(g=(0,i.default)(T).create({manifestModel:$,manifestUpdater:Y,adapter:aa,timelineConverter:ja,capabilities:X,errHandler:ia,baseURLController:ga}),ka.push(g),g.initialize(f,ma)),ba.addManifestUpdateStreamInfo(c,f.id,f.index,f.start,f.duration)}la||t(null,ka[0],NaN),V.trigger(o.default.STREAMS_COMPOSED)}catch(h){ia.manifestError(h.message,"nostreamscomposed",a),sa=!0,R()}}function D(){var a=$.getValue();ma&&(V.trigger(o.default.PROTECTION_CREATED,{controller:ma,manifest:a}),ma.setMediaElement(ua.getElement()),na&&ma.setProtectionData(na)),C(a)}function E(a){if(a.error)sa=!0,R();else{var b,c,d=a.manifest,e=aa.getStreamsInfo(d)[0],f=aa.getMediaInfoForType(d,e,"video")||aa.getMediaInfoForType(d,e,"audio");f&&(b=aa.getDataForMedia(f),c=_.getRepresentationsForAdaptation(d,b)[0].useCalculatedLiveEdgeTime,c&&(U("SegmentTimeline detected using calculated Live Edge Time"),wa.setUseManifestDateHeaderTimeSource(!1)));var g=_.getUTCTimingSources(a.manifest),h=!_.getIsDynamic(d)||c?g:g.concat(wa.getUTCTimingSources()),i=(0,q.default)(T).getInstance().isManifestHTTPS();h.forEach(function(a){a.value.replace(/.*?:\/\//g,"")===u.default.DEFAULT_UTC_TIMING_SOURCE.value.replace(/.*?:\/\//g,"")&&(a.value=a.value.replace(i?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),i?"https://":"http://"),U("Matching default timing source protocol to manifest protocol: ",a.value))}),ga.initialize(d),fa.setConfig({metricsModel:ba,dashMetrics:ca}),fa.initialize(h,wa.getUseManifestDateHeaderTimeSource())}}function F(){return void 0===Aa&&(Aa=G()),Aa}function G(){var a=!1;return la.getProcessors().forEach(function(b){"video"===b.getMediaInfo().type&&(a=!0)}),a}function H(a,b){b=b||new Date,za&&(la&&la.getProcessors().forEach(function(c){var d=c.getScheduleController();d&&d.finalisePlayList(b,a)}),ba.addPlayList(za),za=null)}function I(a){za=new x.PlayList,za.start=new Date,za.mstart=1e3*va.getTime(),za.starttype=a,la&&la.getProcessors().forEach(function(a){var b=a.getScheduleController();b&&b.setPlayList(za)})}function J(a){if(a.error){var b="";switch(a.error.code){case 1:b="MEDIA_ERR_ABORTED";break;case 2:b="MEDIA_ERR_NETWORK";break;case 3:b="MEDIA_ERR_DECODE";break;case 4:b="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:b="MEDIA_ERR_ENCRYPTED";break;default:b="UNKNOWN"}ra=!0,a.error.message&&(b+=" ("+a.error.message+")"),a.error.msExtendedCode&&(b+=" (0x"+(a.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),U("Video Element Error: "+b),a.error&&U(a.error),ia.mediaSourceError(b),R()}}function K(){return oa}function L(){return la?la.getStreamInfo():null}function M(a){return la.getId()===a.id}function N(a){return ka.filter(function(b){return b.getId()===a})[0]}function O(a){Z.load(a)}function P(a){Y.setManifest(a)}function Q(a){a&&(a.capabilities&&(X=a.capabilities),a.manifestLoader&&(Z=a.manifestLoader),a.manifestModel&&($=a.manifestModel),a.dashManifestModel&&(_=a.dashManifestModel),a.protectionController&&(ma=a.protectionController),a.adapter&&(aa=a.adapter),a.metricsModel&&(ba=a.metricsModel),a.dashMetrics&&(ca=a.dashMetrics),a.liveEdgeFinder&&(da=a.liveEdgeFinder),a.mediaSourceController&&(ea=a.mediaSourceController),a.timeSyncController&&(fa=a.timeSyncController),a.baseURLController&&(ga=a.baseURLController),a.errHandler&&(ia=a.errHandler),a.timelineConverter&&(ja=a.timelineConverter))}function R(){fa.reset(),H(ra||sa?x.PlayListTrace.FAILURE_STOP_REASON:x.PlayListTrace.USER_REQUEST_STOP_REASON);for(var a=0,b=ka.length;a<b;a++){var g=ka[a];g.reset(ra)}ka=[],V.off(o.default.PLAYBACK_TIME_UPDATED,c,this),V.off(o.default.PLAYBACK_SEEKING,d,this),V.off(o.default.PLAYBACK_ERROR,J,this),V.off(o.default.PLAYBACK_STARTED,e,this),V.off(o.default.PLAYBACK_PAUSED,f,this),V.off(o.default.PLAYBACK_ENDED,p,this),V.off(o.default.MANIFEST_UPDATED,E,this),V.off(o.default.STREAM_BUFFERING_COMPLETED,h,this),ga.reset(),Y.reset(),ba.clearAllCurrentMetrics(),$.setValue(null),Z.reset(),ja.reset(),da.reset(),aa.reset(),ha.reset(),pa=!1,qa=!1,la=null,ra=!1,sa=!1,Aa=void 0,ya=!0,xa=!1,ta&&(ea.detachMediaSource(ua),ta=null),ua=null,ma&&(ma.setMediaElement(null),ma=null,na=null,$.getValue()&&V.trigger(o.default.PROTECTION_DESTROYED,{data:$.getValue().url})),V.trigger(o.default.STREAM_TEARDOWN_COMPLETE)}var S=.1,T=this.context,U=(0,z.default)(T).getInstance().log,V=(0,m.default)(T).getInstance(),W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0,fa=void 0,ga=void 0,ha=void 0,ia=void 0,ja=void 0,ka=void 0,la=void 0,ma=void 0,na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0;return W={initialize:b,getAutoPlay:K,getActiveStreamInfo:L,isStreamActive:M,isVideoTrackPresent:F,getStreamById:N,getTimeRelativeToStreamId:l,load:O,loadWithManifest:P,getActiveStreamCommonEarliestTime:n,setConfig:Q,reset:R},a(),W}Object.defineProperty(c,"__esModule",{value:!0});var f=a(69),g=d(f),h=a(55),i=d(h),j=a(51),k=d(j),l=a(9),m=d(l),n=a(13),o=d(n),p=a(104),q=d(p),r=a(105),s=d(r),t=a(102),u=d(t),v=a(10),w=d(v),x=a(182),y=a(8),z=d(y),A=a(153),B=d(A);e.__dashjs_factory_name="StreamController",c.default=w.default.getSingletonFactory(e),b.exports=c.default},{10:10,102:102,104:104,105:105,13:13,153:153,182:182,51:51,55:55,69:69,8:8,9:9}],73:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){u=!1,v=null,w=null,x=null,y=null,z=null,t=!1,p.on(i.default.DATA_UPDATE_COMPLETED,l,this),p.on(i.default.INIT_FRAGMENT_LOADED,m,this)}function c(a,b,c){x=a,h(b),y=c,z=y.getRepresentationController()}function d(a){try{w=q.createSourceBuffer(v,a),u||(w.hasOwnProperty("initialize")&&w.initialize(x,this),u=!0)}catch(b){r.mediaSourceError("Error creating "+x+" source buffer.")}return w}function e(){return w}function f(a){w=a}function h(a){v=a}function j(){return y}function k(a){p.off(i.default.DATA_UPDATE_COMPLETED,l,this),p.off(i.default.INIT_FRAGMENT_LOADED,m,this),a||(q.abort(v,w),q.removeSourceBuffer(v,w))}function l(a){a.sender.getStreamProcessor()===y&&p.trigger(i.default.TIMED_TEXT_REQUESTED,{index:0,sender:a.sender})}function m(a){a.fragmentModel===y.getFragmentModel()&&a.chunk.bytes&&q.append(w,a.chunk)}function n(){return t}var o=this.context,p=(0,g.default)(o).getInstance(),q=a.sourceBufferController,r=a.errHandler,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,y=void 0,z=void 0;return s={initialize:c,createBuffer:d,getBuffer:e,setBuffer:f,getStreamProcessor:j,getIsBufferingCompleted:n,setMediaSource:h,reset:k},b(),s}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j);e.__dashjs_factory_name="TextController",c.default=k.default.getClassFactory(e),b.exports=c.default},{10:10,13:13,9:9}],74:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){H=b,E=0,F=!1,G=!1,I={"urn:mpeg:dash:utc:http-head:2014":v,"urn:mpeg:dash:utc:http-xsdate:2014":u.bind(null,m),"urn:mpeg:dash:utc:http-iso:2014":u.bind(null,n),"urn:mpeg:dash:utc:direct:2014":t,"urn:mpeg:dash:utc:http-head:2012":v,"urn:mpeg:dash:utc:http-xsdate:2012":u.bind(null,m),"urn:mpeg:dash:utc:http-iso:2012":u.bind(null,n),"urn:mpeg:dash:utc:direct:2012":t,"urn:mpeg:dash:utc:http-ntp:2014":s,"urn:mpeg:dash:utc:ntp:2014":s,"urn:mpeg:dash:utc:sntp:2014":s},e()||(y(a),f(!0))}function b(a){a&&(a.metricsModel&&(J=a.metricsModel),a.dashMetrics&&(K=a.dashMetrics))}function c(){return j()}function d(a){F=a}function e(){return F}function f(a){G=a}function h(a){E=a}function j(){return E}function l(a){var b,c,d=60,e=60,f=1e3,g=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/,h=g.exec(a);return b=Date.UTC(parseInt(h[1],10),parseInt(h[2],10)-1,parseInt(h[3],10),parseInt(h[4],10),parseInt(h[5],10),h[6]&&(parseInt(h[6],10)||0),h[7]&&parseFloat(h[7])*f||0),h[9]&&h[10]&&(c=parseInt(h[9],10)*e+parseInt(h[10],10),b+=("+"===h[8]?-1:1)*c*d*f),new Date(b).getTime()}function m(a){var b=Date.parse(a);return isNaN(b)&&(b=l(a)),b}function n(a){return Date.parse(a)}function r(a){return Date.parse(a)}function s(a,b,c){c()}function t(a,b,c){var d=m(a);return isNaN(d)?void c():void b(d)}function u(a,b,c,d,e){var f,g,h=!1,i=new XMLHttpRequest,j=e?"HEAD":"GET",k=b.match(/\S+/g);b=k.shift(),f=function(){h||(h=!0,k.length?u(a,k.join(" "),c,d,e):d())},g=function(){var b,d;200===i.status&&(b=e?i.getResponseHeader("Date"):i.response,d=a(b),isNaN(d)||(c(d),h=!0))},i.open(j,b),i.timeout=q||0,i.onload=g,i.onloadend=f,i.send()}function v(a,b,c){u(r,a,b,c,!0)}function w(){var a=J.getReadOnlyMetricsFor("stream"),b=K.getLatestMPDRequestHeaderValueByID(a,"Date"),c=null!==b?new Date(b).getTime():Number.NaN;isNaN(c)?x(!0):(h(c-(new Date).getTime()),x(!1,c/1e3,E))}function x(a,b,c){d(!1),C.trigger(k.default.TIME_SYNCHRONIZATION_COMPLETED,{time:b,offset:c,error:a?new g.default(p):null})}function y(a,b){var c=b||0,e=a[c],f=function(a,b){var c=!a||!b;c&&H?w():x(c,a,b)};d(!0),e?I.hasOwnProperty(e.schemeIdUri)?I[e.schemeIdUri](e.value,function(a){var b=(new Date).getTime(),c=a-b;h(c),B("Local time: "+new Date(b)),B("Server time: "+new Date(a)),B("Difference (ms): "+c),f(a,c)},function(){y(a,c+1)}):y(a,c+1):(h(0),f())}function z(){f(!1),d(!1)}var A=this.context,B=(0,o.default)(A).getInstance().log,C=(0,i.default)(A).getInstance(),D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0;return D={initialize:a,getOffsetToDeviceTimeMs:c,setConfig:b,reset:z}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(163),g=d(f),h=a(9),i=d(h),j=a(13),k=d(j),l=a(10),m=d(l),n=a(8),o=d(n),p=1,q=5e3;e.__dashjs_factory_name="TimeSyncController";var r=m.default.getSingletonFactory(e);r.TIME_SYNC_FAILED_ERROR_CODE=p,r.HTTP_TIMEOUT_MS=q,c.default=r,b.exports=c.default},{10:10,13:13,163:163,8:8,9:9}],75:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){A.on(k.default.XLINK_ELEMENT_LOADED,j,C),H=(0,g.default)(z).create({errHandler:a.errHandler,metricsModel:a.metricsModel,requestModifier:a.requestModifier})}function c(a){D=a}function d(a){E=a}function e(a){var b;G=new o.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:D}),F=a,b=m(F.Period_asArray,F,t,r),h(b,t,r)}function f(){A.off(k.default.XLINK_ELEMENT_LOADED,j,C),H&&(H.reset(),H=null)}function h(a,b,c){var d,e,f,g={};for(g.elements=a,g.type=b,g.resolveType=c,0===g.elements.length&&l(g),f=0;f<g.elements.length;f++)d=g.elements[f],e=B.isHTTPURL(d.url)?d.url:d.originalContent.BaseURL+d.url,H.load(e,d,g)}function j(a){var b,c,d,e="<response>",f="</response>",g="";b=a.element,c=a.resolveObject,b.resolvedContent&&(d=b.resolvedContent.indexOf(">")+1,g=b.resolvedContent.substr(0,d)+e+b.resolvedContent.substr(d)+f,b.resolvedContent=G.xml_str2json(g)),x(c)&&l(c)}function l(a){var b,c,d=[];if(n(a),a.resolveType===s&&A.trigger(k.default.XLINK_READY,{manifest:F}),a.resolveType===r)switch(a.type){case t:for(b=0;b<F[t+"_asArray"].length;b++)c=F[t+"_asArray"][b],c.hasOwnProperty(u+"_asArray")&&(d=d.concat(m(c[u+"_asArray"],c,u,r))),c.hasOwnProperty(v+"_asArray")&&(d=d.concat(m(c[v+"_asArray"],c,v,r)));h(d,u,r);break;case u:A.trigger(k.default.XLINK_READY,{manifest:F})}}function m(a,b,c,d){var e,f,g,h=[];for(f=a.length-1;f>=0;f--)e=a[f],e.hasOwnProperty("xlink:href")&&e["xlink:href"]===w&&a.splice(f,1);for(f=0;f<a.length;f++)e=a[f],e.hasOwnProperty("xlink:href")&&e.hasOwnProperty("xlink:actuate")&&e["xlink:actuate"]===d&&(g=p(e["xlink:href"],b,c,f,d,e),h.push(g));return h}function n(a){var b,c,d,e,f,g,h=[];for(e=a.elements.length-1;e>=0;e--){if(b=a.elements[e],c=b.type+"_asArray",!b.resolvedContent||y())delete b.originalContent["xlink:actuate"],delete b.originalContent["xlink:href"],h.push(b.originalContent);else if(b.resolvedContent)for(f=0;f<b.resolvedContent[c].length;f++)d=b.resolvedContent[c][f],h.push(d);for(b.parentElement[c].splice(b.index,1),g=0;g<h.length;g++)b.parentElement[c].splice(b.index+g,0,h[g]);h=[]}a.elements.length>0&&E.run(F)}function p(a,b,c,d,e,f){return{url:a,parentElement:b,type:c,index:d,resolveType:e,originalContent:f,resolvedContent:null,resolved:!1}}function x(a){var b,c;for(b=0;b<a.elements.length;b++)if(c=a.elements[b],c.resolved===!1)return!1;return!0}function y(){return!1}var z=this.context,A=(0,i.default)(z).getInstance(),B=(0,q.default)(z).getInstance(),C=void 0,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0;return C={resolveManifestOnLoad:e,setMatchers:c,setIron:d,reset:f},b(),C}Object.defineProperty(c,"__esModule",{value:!0});var f=a(60),g=d(f),h=a(9),i=d(h),j=a(13),k=d(j),l=a(10),m=d(l),n=a(4),o=d(n),p=a(159),q=d(p),r="onLoad",s="onActuate",t="Period",u="AdaptationSet",v="EventStream",w="urn:mpeg:dash:resolve-to-zero:2013";e.__dashjs_factory_name="XlinkController",c.default=m.default.getClassFactory(e),b.exports=c.default},{10:10,13:13,159:159,4:4,60:60,9:9}],76:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return f=(0,g.default)(d).getInstance({eventBus:a.eventBus,metricsModel:a.metricsModel}),(0,k.default)(d).create(a)}function b(){return(0,o.default)(d).getInstance()}function c(){return(0,m.default)(d).getInstance()}var d=this.context,e=void 0,f=void 0;return e={createMetricsReporting:a,getReportingFactory:b,getMetricsHandlerFactory:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(90),g=d(f),h=a(77),i=d(h),j=a(78),k=d(j),l=a(83),m=d(l),n=a(88),o=d(n),p=a(10),q=d(p);e.__dashjs_factory_name="MetricsReporting";var r=q.default.getClassFactory(e);r.events=i.default,c.default=r,b.exports=c.default},{10:10,77:77,78:78,83:83,88:88,90:90}],77:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(14),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.METRICS_INITIALISATION_COMPLETE="internal_metricsReportingInitialized",this.BECAME_REPORTING_PLAYER="internal_becameReportingPlayer"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{14:14}],78:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(b){if(!b.error){var c=Object.keys(e),d=(0,i.default)(f).getInstance({dashManifestModel:a.dashManifestModel}).getMetrics(b.manifest);d.forEach(function(b){var d=JSON.stringify(b);if(e.hasOwnProperty(d))c.splice(d,1);else try{var h=(0,g.default)(f).create(a);h.initialize(b),e[d]=h}catch(i){}}),c.forEach(function(a){e[a].reset(),delete e[a]}),h.trigger(m.default.METRICS_INITIALISATION_COMPLETE)}}function c(){Object.keys(e).forEach(function(a){e[a].reset()}),e={}}function d(){h.on(o.default.MANIFEST_UPDATED,b),h.on(o.default.STREAM_TEARDOWN_COMPLETE,c)}var e={},f=this.context,h=a.eventBus;return d(),{}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(79),g=d(f),h=a(92),i=d(h),j=a(10),k=d(j),l=a(77),m=d(l),n=a(13),o=d(n);e.__dashjs_factory_name="MetricsCollectionController",c.default=k.default.getClassFactory(e),b.exports=c.default},{10:10,13:13,77:77,79:79,92:92}],79:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(b){try{f=(0,i.default)(h).create({mediaElement:a.mediaElement}),f.initialize(b.Range),e=(0,k.default)(h).create({log:a.log}),e.initialize(b.Reporting,f),d=(0,m.default)(h).create({log:a.log,eventBus:a.eventBus}),d.initialize(b.metrics,e)}catch(g){throw c(),g}}function c(){d&&d.reset(),e&&e.reset(),f&&f.reset()}var d=void 0,e=void 0,f=void 0,g=void 0,h=this.context;return g={initialize:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(81),i=d(h),j=a(82),k=d(j),l=a(80),m=d(l);e.__dashjs_factory_name="MetricsController",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,80:80,81:81,82:82}],80:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){e.forEach(function(b){b.handleNewMetric(a.metric,a.value,a.mediaType)})}function c(a,c){a.split(",").forEach(function(a,b,d){var f;if(a.indexOf("(")!==-1&&a.indexOf(")")===-1){var g=d[b+1];g&&g.indexOf("(")===-1&&g.indexOf(")")!==-1&&(a+=","+g,delete d[b+1])}f=j.create(a,c),f&&e.push(f)}),i.on(k.default.METRIC_ADDED,b,f),i.on(k.default.METRIC_UPDATED,b,f)}function d(){i.off(k.default.METRIC_ADDED,b,f),i.off(k.default.METRIC_UPDATED,b,f),e.forEach(function(a){return a.reset()}),e=[]}var e=[],f=void 0,h=this.context,i=a.eventBus,j=(0,g.default)(h).getInstance({log:a.log,eventBus:a.eventBus});return f={initialize:c,reset:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(83),g=d(f),h=a(10),i=d(h),j=a(53),k=d(j);e.__dashjs_factory_name="MetricsHandlersController",c.default=i.default.getClassFactory(e),b.exports=c.default},{10:10,53:53,83:83}],81:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){a&&a.length&&(a.forEach(function(a){var b=a.starttime,c=b+a.duration;j.add(b,c)}),f=!!a[0]._useWallClockTime)}function c(){j.clear()}function d(){j=(0,i.default)(g).create()}function e(){var a,b=j.length;if(!b)return!0;a=f?(new Date).getTime()/1e3:k.currentTime;for(var c=0;c<b;c+=1){var d=j.start(c),e=j.end(c);if(d<=a&&a<e)return!0}return!1}var f=!1,g=this.context,h=void 0,j=void 0,k=a.mediaElement;return h={initialize:b,reset:c,isEnabled:e},d(),h}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(149),i=d(h);e.__dashjs_factory_name="RangeController",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,149:149}],82:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){a.some(function(a){var c=g.create(a,b);if(c)return e.push(c),!0})}function c(){e.forEach(function(a){return a.reset()}),e=[]}function d(a,b){e.forEach(function(c){return c.report(a,b)})}var e=[],f=void 0,g=(0,i.default)(this.context).getInstance({log:a.log});return f={initialize:b,reset:c,report:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(88),i=d(h);e.__dashjs_factory_name="ReportingController",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,88:88}],83:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(b,c){var d,e=b.match(g);if(e){try{d=j[e[1]](h).create({eventBus:a.eventBus}),d.initialize(e[1],c,e[3],e[5])}catch(i){d=null,f("MetricsHandlerFactory: Could not create handler for type "+e[1]+" with args "+e[3]+", "+e[5]+" ("+i.message+")")}return d}}function c(a,b){j[a]=b}function d(a){delete j[a]}var e=void 0,f=a.log,g=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/,h=this.context,j={BufferLevel:i.default,DVBErrors:k.default,HttpList:m.default,PlayList:o.default,RepSwitchList:o.default,TcpList:o.default};return e={create:b,register:c,unregister:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(84),i=d(h),j=a(85),k=d(j),l=a(87),m=d(l),n=a(86),o=d(n);e.__dashjs_factory_name="MetricsHandlerFactory",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10,84:84,85:85,86:86,87:87}],84:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){try{return Object.keys(o).map(function(a){return o[a]}).reduce(function(a,b){return a.level<b.level?a:b})}catch(a){return}}function b(){var b=a();b&&l!==b.t&&(l=b.t,g.report(j,b))}function c(a,c,d){c&&(h=n.validateN(d),g=c,j=n.reconstructFullMetricName(a,d),k=setInterval(b,h))}function d(){clearInterval(k),k=null,h=0,g=null,l=null}function e(a,b,c){"BufferLevel"===a&&(o[c]=b)}var f=void 0,g=void 0,h=void 0,j=void 0,k=void 0,l=void 0,m=this.context,n=(0,i.default)(m).getInstance(),o=[];return f={initialize:c,reset:d,handleNewMetric:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(91),i=d(h);e.__dashjs_factory_name="BufferLevelHandler",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,91:91}],85:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){h.off(i.default.METRICS_INITIALISATION_COMPLETE,b,this),h.trigger(i.default.BECAME_REPORTING_PLAYER)}function c(a,c){c&&(g=c,h.on(i.default.METRICS_INITIALISATION_COMPLETE,b,this))}function d(){g=null}function e(a,b){"DVBErrors"===a&&g&&g.report(a,b)}var f=void 0,g=void 0,h=a.eventBus;return f={initialize:c,reset:d,handleNewMetric:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(77),i=d(h);c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,77:77}],86:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){ -e=a,f=b}function b(){f=null,e=void 0}function c(a,b){a===e&&f&&f.report(e,b)}var d=void 0,e=void 0,f=void 0;return d={initialize:a,reset:b,handleNewMetric:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="GenericMetricHandler",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10}],87:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){var a=l;a.length&&f&&f.report(j,a),l=[]}function b(b,c,d,e){c&&(g=m.validateN(d),f=c,e&&e.length&&(h=e),j=m.reconstructFullMetricName(b,d,e),k=setInterval(a,g))}function c(){clearInterval(k),k=null,g=null,h=null,l=[],f=null}function d(a,b){"HttpList"===a&&(h&&h!==b.type||l.push(b))}var e=void 0,f=void 0,g=void 0,h=void 0,j=void 0,k=void 0,l=[],m=(0,i.default)(this.context).getInstance();return e={initialize:b,reset:c,handleNewMetric:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(91),i=d(h);e.__dashjs_factory_name="HttpListHandler",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,91:91}],88:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){var c;try{c=e[a.schemeIdUri](f).create(),c.initialize(a,b)}catch(d){c=null,g("ReportingFactory: could not create Reporting with schemeIdUri "+a.schemeIdUri+" ("+d.message+")")}return c}function c(a,b){e[a]=b}function d(a){delete e[a]}var e={"urn:dvb:dash:reporting:2014":i.default},f=this.context,g=a.log,h=void 0;return h={create:b,register:c,unregister:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(89),i=d(h);e.__dashjs_factory_name="ReportingFactory",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10,89:89}],89:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b,c){var d=new XMLHttpRequest,e=function(){var a=q.indexOf(d);a!==-1&&(q.splice(a,1),d.status>=200&&d.status<300?b&&b():c&&c())};q.push(d);try{d.open("GET",a),d.onloadend=e,d.onerror=e,d.send()}catch(f){d.onerror()}}function b(b,c){Array.isArray(c)||(c=[c]),l&&o.isEnabled()&&c.forEach(function(c){var d=g.serialise(c);j&&"DVBErrors"!==b&&(d="metricname="+b+"&"+d),d=n+"?"+d,a(d,null,function(){l=!1})})}function c(a,b){var c;if(o=b,n=a["dvb:reportingUrl"],!n)throw new Error("required parameter missing (dvb:reportingUrl)");m||(c=a["dvb:probability"]||a["dvb:priority"]||0,c&&(1e3===c||c/1e3>=h.random())&&(l=!0),m=!0)}function d(){p||(q.forEach(function(a){return a.abort()}),q=[]),m=!1,l=!1,n=null,o=null}var e=void 0,f=this.context,g=(0,i.default)(f).getInstance(),h=(0,k.default)(f).getInstance(),j=!0,l=!1,m=!1,n=null,o=null,p=!0,q=[];return e={report:b,initialize:c,reset:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(93),i=d(h),j=a(94),k=d(j);e.__dashjs_factory_name="DVBReporting",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,93:93,94:94}],90:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=new g.default;if(r){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);b.mpdurl||(b.mpdurl=r.originalUrl||r.url),b.terror||(b.terror=new Date),q.addDVBErrors(b)}}function c(a){a.error||(r=a.manifest)}function d(a){b({errorcode:g.default.BASE_URL_CHANGED,servicelocation:a.entry})}function e(){b({errorcode:g.default.BECAME_REPORTER})}function f(a){(0===a.responsecode||a.responsecode>=400||a.responsecode<100||a.responsecode>=600)&&b({errorcode:a.responsecode||g.default.CONNECTION_ERROR,url:a.url,terror:a.tresponse,servicelocation:a._serviceLocation})}function h(a){switch(a.metric){case"HttpList":f(a.value)}}function j(a){var c,d=a.error?a.error.code:0;switch(d){case MediaError.MEDIA_ERR_NETWORK:c=g.default.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:c=g.default.CORRUPT_MEDIA_OTHER;break;default:return}b({errorcode:c})}function l(){p.on(i.default.MANIFEST_UPDATED,c,o),p.on(i.default.SERVICE_LOCATION_BLACKLIST_CHANGED,d,o),p.on(k.default.METRIC_ADDED,h,o),p.on(k.default.METRIC_UPDATED,h,o),p.on(k.default.PLAYBACK_ERROR,j,o),p.on(m.default.BECAME_REPORTING_PLAYER,e,o)}function n(){p.off(i.default.MANIFEST_UPDATED,c,o),p.off(i.default.SERVICE_LOCATION_BLACKLIST_CHANGED,d,o),p.off(k.default.METRIC_ADDED,h,o),p.off(k.default.METRIC_UPDATED,h,o),p.off(k.default.PLAYBACK_ERROR,j,o),p.off(m.default.BECAME_REPORTING_PLAYER,e,o)}var o=void 0,p=a.eventBus,q=a.metricsModel,r=void 0;return o={initialise:l,reset:n},l(),o}Object.defineProperty(c,"__esModule",{value:!0});var f=a(95),g=d(f),h=a(13),i=d(h),j=a(53),k=d(j),l=a(77),m=d(l),n=a(10),o=d(n);e.__dashjs_factory_name="DVBErrorsTranslator",c.default=o.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,53:53,77:77,95:95}],91:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){return{reconstructFullMetricName:function(a,b,c){var d=a;return b&&(d+="("+b,c&&c.length&&(d+=","+c),d+=")"),d},validateN:function(a){if(!a)throw new Error("missing n");if(isNaN(a))throw new Error("n is NaN");if(a<0)throw new Error("n must be positive");return a}}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="HandlerHelpers",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],92:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b,c){var d,f,g=e.getMpd(a),h=0;return b?h=g.availabilityStartTime.getTime()/1e3:(d=this.getRegularPeriods(a,g),d.length&&(h=d[0].start)),f=h,c&&c.hasOwnProperty("starttime")&&(f+=c.starttime),f}function c(a){var c=[];return a.Metrics_asArray&&a.Metrics_asArray.forEach(function(d){var f=new g.default,h=e.getIsDynamic(a);d.hasOwnProperty("metrics")&&(f.metrics=d.metrics,d.Range_asArray&&d.Range_asArray.forEach(function(c){var d=new i.default;d.starttime=b(a,h,c),c.hasOwnProperty("duration")?d.duration=c.duration:d.duration=e.getDuration(a),d._useWallClockTime=h,f.Range.push(d)}),d.Reporting_asArray&&(d.Reporting_asArray.forEach(function(a){var b=new k.default;if(a.hasOwnProperty("schemeIdUri")){b.schemeIdUri=a.schemeIdUri;for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);f.Reporting.push(b)}}),c.push(f)))}),c}var d=void 0,e=a.dashManifestModel;return d={getMetrics:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(96),g=d(f),h=a(97),i=d(h),j=a(98),k=d(j),l=a(10),m=d(l);e.__dashjs_factory_name="ManifestParsing",c.default=m.default.getSingletonFactory(e),b.exports=c.default},{10:10,96:96,97:97,98:98}],93:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(b){var c,d,e=[],f=[];for(c in b)if(b.hasOwnProperty(c)&&0!==c.indexOf("_")){if(d=b[c],void 0!==d&&null!==d||(d=""),Array.isArray(d)){if(!d.length)continue;f=[],d.forEach(function(b){var c="Object"!==Object.prototype.toString.call(b).slice(8,-1);f.push(c?b:a(b))}),d=f.map(encodeURIComponent).join(",")}else"string"==typeof d?d=encodeURIComponent(d):d instanceof Date?d=d.toISOString():"number"==typeof d&&(d=Math.round(d));e.push(c+"="+d)}return e.join("&")}return{serialise:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="MetricSerialiser",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],94:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){c&&(g||(g=new d(f)),c.getRandomValues(g),h=0)}function b(b,d){var f;return b||(b=0),d||(d=1),c?(h===g.length&&a(),f=g[h]/e,h+=1):f=Math.random(),f*(d-b)+b}var c=window.crypto||window.msCrypto,d=Uint32Array,e=Math.pow(2,8*d.BYTES_PER_ELEMENT)-1,f=10,g=void 0,h=void 0,i=void 0;return i={random:b},a(),i}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="RNG",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],95:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null};e.SSL_CONNECTION_FAILED_PREFIX="SSL",e.DNS_RESOLUTION_FAILED="C00",e.HOST_UNREACHABLE="C01",e.CONNECTION_REFUSED="C02",e.CONNECTION_ERROR="C03",e.CORRUPT_MEDIA_ISOBMFF="M00",e.CORRUPT_MEDIA_OTHER="M01",e.BASE_URL_CHANGED="F00",e.BECAME_REPORTER="S00",c.default=e,b.exports=c.default},{}],96:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.metrics="",this.Range=[],this.Reporting=[]};c.default=e,b.exports=c.default},{}],97:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.starttime=0,this.duration=1/0,this._useWallClockTime=!1};c.default=e,b.exports=c.default},{}],98:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.schemeIdUri="",this.value=""};c.default=e,b.exports=c.default},{}],99:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(){function a(){l=new n}function b(a,b,c){var d=p.getBaseURLsFromElement(c);a[b]?q.areSimpleEquivalent(d,a[b].data.baseUrls)||(a[b].data.baseUrls=d,a[b].data.selectedIdx=m):a[b]=new n(d)}function c(a){var c=p.getBaseURLsFromElement(a);q.areSimpleEquivalent(c,l.data.baseUrls)||(l.data.baseUrls=c,l.data.selectedIdx=m),a.Period_asArray&&a.Period_asArray.forEach(function(a,c){b(l.children,c,a),a.AdaptationSet_asArray&&a.AdaptationSet_asArray.forEach(function(a,d){b(l.children[c].children,d,a),a.Representation_asArray&&a.Representation_asArray.sort(p.getRepresentationSortFunction()).forEach(function(a,e){b(l.children[c].children[d].children,e,a)})})})}function d(a,b){var c=b||l;a(c.data),c.children&&c.children.forEach(function(b){return d(a,b)})}function e(a){d(function(b){isNaN(b.selectedIdx)||a===b.baseUrls[b.selectedIdx].serviceLocation&&(b.selectedIdx=m)})}function f(a){c(a)}function g(){l=new n}function i(a){var b=l,c=[b.data];return a.forEach(function(a){b=b.children[a],b&&c.push(b.data)}),c.filter(function(a){return a.baseUrls.length})}var k=void 0,l=void 0,o=this.context,p=(0,h.default)(o).getInstance(),q=(0,j.default)(o).getInstance();return k={reset:g,update:f,getForPath:i,invalidateSelectedIndexes:e},a(),k}Object.defineProperty(c,"__esModule",{value:!0});var g=a(22),h=d(g),i=a(156),j=d(i),k=a(10),l=d(k),m=NaN,n=function a(b,c){e(this,a),this.data={baseUrls:b||null,selectedIdx:c||m},this.children=[]};f.__dashjs_factory_name="BaseURLTreeModel",c.default=l.default.getClassFactory(f),b.exports=c.default},{10:10,156:156,22:22}],100:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){D=null,G=null,E=[],F=[],A.on(i.default.LOADING_COMPLETED,w,C)}function c(a){G=a}function d(a){D=a}function e(){return D}function f(a){var b=function(a,b){return a.action===m.default.ACTION_COMPLETE&&a.action===b.action},c=function(a,b){return!isNaN(a.index)&&a.startTime===b.startTime&&a.adaptationIndex===b.adaptationIndex},d=function(a,b){return isNaN(a.index)&&isNaN(b.index)&&a.quality===b.quality},e=function(e){var f=!1;return e.some(function(e){if(c(a,e)||d(a,e)||b(a,e))return f=!0}),f};return e(E)}function h(a){var b=a.state instanceof Array?a.state:[a.state],c=[];return b.forEach(function(b){var d=u(b);c=c.concat(t(d,a))}),c}function j(a){E=E.filter(function(b){return isNaN(b.startTime)||b.startTime>=a})}function k(){G.abort(),F=[]}function l(a){switch(a.action){case m.default.ACTION_COMPLETE:E.push(a),v(a,q),A.trigger(i.default.STREAM_COMPLETED,{request:a,fragmentModel:this});break;case m.default.ACTION_DOWNLOAD:v(a,p),F.push(a),n(a);break;default:z("Unknown request action.")}}function n(a){A.trigger(i.default.FRAGMENT_LOADING_STARTED,{sender:C,request:a}),G.load(a)}function r(a,b,c){for(var d=a.length-1,e=d;e>=0;e--){var f=a[e],g=f.startTime,h=g+f.duration;if(c=void 0!==c?c:f.duration/2,!isNaN(g)&&!isNaN(h)&&b+c>=g&&b-c<h||isNaN(g)&&isNaN(b))return f}return null}function t(a,b){return b.hasOwnProperty("time")?[r(a,b.time,b.threshold)]:a.filter(function(a){for(var c in b)if("state"!==c&&b.hasOwnProperty(c)&&a[c]!=b[c])return!1;return!0})}function u(a){var b=void 0;switch(a){case p:b=F;break;case q:b=E;break;default:b=[]}return b}function v(a,b){B.addSchedulingInfo(a.mediaType,new Date,a.type,a.startTime,a.availabilityStartTime,a.duration,a.quality,a.range,b),B.addRequestsQueue(a.mediaType,F,E)}function w(a){a.sender===G&&(F.splice(F.indexOf(a.request),1),a.response&&!a.error&&E.push(a.request),v(a.request,a.error?s:q),A.trigger(i.default.FRAGMENT_LOADING_COMPLETED,{request:a.request,response:a.response,error:a.error,sender:this}))}function x(){A.off(i.default.LOADING_COMPLETED,w,this),G&&(G.reset(),G=null),E=[],F=[]}var y=this.context,z=(0,o.default)(y).getInstance().log,A=(0,g.default)(y).getInstance(),B=a.metricsModel,C=void 0,D=void 0,E=void 0,F=void 0,G=void 0;return C={setLoader:c,setScheduleController:d,getScheduleController:e,getRequests:h,isFragmentLoaded:f,removeExecutedRequestsBeforeTime:j,abortRequests:k,executeRequest:l,reset:x},b(),C}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j),l=a(164),m=d(l),n=a(8),o=d(n),p="loading",q="executed",r="canceled",s="failed";e.__dashjs_factory_name="FragmentModel";var t=k.default.getClassFactory(e);t.FRAGMENT_MODEL_LOADING=p,t.FRAGMENT_MODEL_EXECUTED=q,t.FRAGMENT_MODEL_CANCELED=r,t.FRAGMENT_MODEL_FAILED=s,c.default=t,b.exports=c.default},{10:10,13:13,164:164,8:8,9:9}],101:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){return f}function b(a){f=a,a&&d.trigger(i.default.MANIFEST_LOADED,{data:a})}var c=this.context,d=(0,g.default)(c).getInstance(),e=void 0,f=void 0;return e={getValue:a,setValue:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j);e.__dashjs_factory_name="ManifestModel",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,9:9}],102:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(){function a(){var a,b;ya=[],xa=!1,wa=!0,Ba=!0,Qa=!1,Sa=!1,Ea={enabled:!0,ttl:l},Fa={enabled:!0,ttl:m},za=k,Aa=void 0,Ca=p,Da=q,Ga=NaN,Ha=t,Ia=u,Ja=v,Ka=w,La=n,Ma=o,Pa=D,Ra={default:E},a={},e(a,i.HTTPRequest.MPD_TYPE,z),e(a,i.HTTPRequest.XLINK_EXPANSION_TYPE,B),e(a,i.HTTPRequest.MEDIA_SEGMENT_TYPE,x),e(a,i.HTTPRequest.INIT_SEGMENT_TYPE,x),e(a,i.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,x),e(a,i.HTTPRequest.INDEX_SEGMENT_TYPE,x),e(a,i.HTTPRequest.OTHER_TYPE,x),Na=a,b={},e(b,i.HTTPRequest.MPD_TYPE,A),e(b,i.HTTPRequest.XLINK_EXPANSION_TYPE,C),e(b,i.HTTPRequest.MEDIA_SEGMENT_TYPE,y),e(b,i.HTTPRequest.INIT_SEGMENT_TYPE,y),e(b,i.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,y),e(b,i.HTTPRequest.INDEX_SEGMENT_TYPE,y),e(b,i.HTTPRequest.OTHER_TYPE,y),Oa=b}function b(a){Qa=a}function c(){return Qa}function d(a){La=a}function f(){return La}function g(a){Ma=a}function h(){return Ma}function j(a){Ga=a}function F(){return isNaN(Ga)?Sa?s:r:Ga}function G(a){Ha=a}function H(){return Ha}function I(a){Ia=a}function J(){return Ia}function K(a){Ja=a}function L(){return Ja}function M(a){Ka=a}function N(){return Ka}function O(a){Ca=a}function P(){return Ca}function Q(a,b){Ea.enabled=a,void 0===b||isNaN(b)||"number"!=typeof b||(Ea.ttl=b)}function R(){return Ea}function S(a,b){Fa.enabled=a,void 0===b||isNaN(b)||"number"!=typeof b||(Fa.ttl=b)}function T(){return Fa}function U(a){Da=a}function V(){return Da}function W(a){Na[i.HTTPRequest.MEDIA_SEGMENT_TYPE]=a}function X(a,b){Na[a]=b}function Y(){return Na[i.HTTPRequest.MEDIA_SEGMENT_TYPE]}function Z(a){return Na[a]}function $(a){Oa[i.HTTPRequest.MEDIA_SEGMENT_TYPE]=a}function _(a,b){Oa[a]=b}function aa(){return Oa[i.HTTPRequest.MEDIA_SEGMENT_TYPE]}function ba(a){return Oa[a]}function ca(a){Pa=a}function da(){return Pa}function ea(a){Ba=a}function fa(){return Ba}function ga(a){za=a}function ha(a){Aa=a}function ia(){return za}function ja(){return Aa}function ka(a){wa=a}function la(){return wa}function ma(a){xa=a}function na(){return xa}function oa(a){ya=a}function pa(){return ya}function qa(a,b){a?Ra[a]=!!b:Object.keys(Ra).forEach(function(a){qa(a,b)})}function ra(a){var b=Ra[a];return void 0===b?Ra.default:b}function sa(){return Sa}function ta(a){Sa=a}function ua(){}var va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0,Pa=void 0,Qa=void 0,Ra=void 0,Sa=void 0;return va={setBufferOccupancyABREnabled:b,getBufferOccupancyABREnabled:c,setBandwidthSafetyFactor:d,getBandwidthSafetyFactor:f,setAbandonLoadTimeout:g,getAbandonLoadTimeout:h,setLastBitrateCachingInfo:Q,getLastBitrateCachingInfo:R,setLastMediaSettingsCachingInfo:S,getLastMediaSettingsCachingInfo:T,setStableBufferTime:j,getStableBufferTime:F,setBufferTimeAtTopQuality:G,getBufferTimeAtTopQuality:H,setBufferTimeAtTopQualityLongForm:I,getBufferTimeAtTopQualityLongForm:J,setLongFormContentDurationThreshold:K,getLongFormContentDurationThreshold:L,setRichBufferThreshold:M,getRichBufferThreshold:N,setBufferToKeep:O,getBufferToKeep:P,setBufferPruningInterval:U,getBufferPruningInterval:V,setFragmentRetryAttempts:W,getFragmentRetryAttempts:Y,setRetryAttemptsForType:X,getRetryAttemptsForType:Z,setFragmentRetryInterval:$,getFragmentRetryInterval:aa,setRetryIntervalForType:_,getRetryIntervalForType:ba,setWallclockTimeUpdateInterval:ca,getWallclockTimeUpdateInterval:da,setScheduleWhilePaused:ea,getScheduleWhilePaused:fa,getUseSuggestedPresentationDelay:na,setUseSuggestedPresentationDelay:ma,setLiveDelayFragmentCount:ga,getLiveDelayFragmentCount:ia,getLiveDelay:ja,setLiveDelay:ha,setUseManifestDateHeaderTimeSource:ka,getUseManifestDateHeaderTimeSource:la,setUTCTimingSources:oa,getUTCTimingSources:pa,setXHRWithCredentialsForType:qa,getXHRWithCredentialsForType:ra,setFastSwitchEnabled:ta,getFastSwitchEnabled:sa,reset:ua},a(),va}Object.defineProperty(c,"__esModule",{value:!0});var g=a(10),h=d(g),i=a(180),j={scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"http://time.akamai.com/?iso"},k=4,l=36e4,m=36e4,n=.9,o=1e4,p=30,q=30,r=12,s=20,t=30,u=60,v=600,w=20,x=3,y=1e3,z=3,A=500,B=1,C=500,D=50,E=!1;f.__dashjs_factory_name="MediaPlayerModel";var F=h.default.getSingletonFactory(f);F.DEFAULT_UTC_TIMING_SOURCE=j,c.default=F,b.exports=c.default},{10:10,180:180}],103:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){T={}}function b(a){a&&a.adapter&&(S=a.adapter)}function c(){Q.trigger(C.default.METRICS_CHANGED)}function d(a){Q.trigger(C.default.METRIC_CHANGED,{mediaType:a}),c()}function e(a,b,c){Q.trigger(C.default.METRIC_UPDATED,{mediaType:a,metric:b,value:c}),d(a)}function f(a,b,c){Q.trigger(C.default.METRIC_ADDED,{mediaType:a,metric:b,value:c}),d(a)}function h(a){delete T[a],d(a)}function k(){T={},c()}function m(a){return T.hasOwnProperty(a)?T[a]:null}function o(a){var b;return T.hasOwnProperty(a)?b=T[a]:(b=new g.default,T[a]=b),b}function q(a,b,c,d,e,g){var h=new i.default;return h.tcpid=b,h.dest=c,h.topen=d,h.tclose=e,h.tconnect=g,o(a).TcpList.push(h),f(a,S.metricsList.TCP_CONNECTION,h),h}function s(a,b,c,d){var e=new j.HTTPRequestTrace;return e.s=b,e.d=c,e.b=d,a.trace.push(e),a.interval||(a.interval=0),a.interval+=c,e}function v(a,b,c,d,e,g,h,i,k,l,m,n,p,q){var r=new j.HTTPRequest;return e&&e!==d&&(v(a,null,c,d,null,null,h,i,null,null,null,n,null,null),r.actualurl=e),r.tcpid=b,r.type=c,r.url=d,r.range=h,r.trequest=i,r.tresponse=k,r.responsecode=m,r._tfinish=l,r._stream=a,r._mediaduration=n,r._responseHeaders=p,r._serviceLocation=g,q?q.forEach(function(a){s(r,a.s,a.d,a.b)}):(delete r.interval,delete r.trace),o(a).HttpList.push(r),f(a,S.metricsList.HTTP_REQUEST,r),r}function x(a,b,c,d,e){var g=new l.default;return g.t=b,g.mt=c,g.to=d,e?g.lto=e:delete g.lto,o(a).RepSwitchList.push(g),f(a,S.metricsList.TRACK_SWITCH,g),g}function z(a,b,c){var d=new n.default;return d.t=b,d.level=c,o(a).BufferLevel.push(d),f(a,S.metricsList.BUFFER_LEVEL,d),d}function B(a,b,c){var d=new p.default;return d.target=c,d.state=b,o(a).BufferState.push(d),f(a,S.metricsList.BUFFER_STATE,d),d}function D(a,b,c,d){var e=new r.default;return e.time=b,e.range=d,e.manifestInfo=c,o(a).DVRInfo.push(e),f(a,S.metricsList.DVR_INFO,e),e}function E(a,b){var c=new t.default,d=o(a).DroppedFrames;return c.time=b.creationTime,c.droppedFrames=b.droppedVideoFrames,d.length>0&&d[d.length-1]==c?d[d.length-1]:(d.push(c),f(a,S.metricsList.DROPPED_FRAMES,c),c)}function F(a,b,c,d,e,g,h,i,j){var k=new w.default;return k.mediaType=a,k.t=b,k.type=c,k.startTime=d,k.availabilityStartTime=e,k.duration=g,k.quality=h,k.range=i,k.state=j,o(a).SchedulingInfo.push(k),f(a,S.metricsList.SCHEDULING_INFO,k),k}function H(a,b,c){var d=new A.default;d.loadingRequests=b,d.executedRequests=c,o(a).RequestsQueue=d,f(a,S.metricsList.REQUESTS_QUEUE,d)}function I(a,b,c,d,e,g,h,i,j,k){var l=new u.ManifestUpdate,m=o("stream");return l.mediaType=a,l.type=b,l.requestTime=c,l.fetchTime=d,l.availabilityStartTime=e,l.presentationStartTime=g,l.clientTimeOffset=h,l.currentTime=i,l.buffered=j,l.latency=k,m.ManifestUpdate.push(l),f(a,S.metricsList.MANIFEST_UPDATE,l),l}function J(a,b){if(a){for(var c in b)a[c]=b[c];e(a.mediaType,S.metricsList.MANIFEST_UPDATE,a)}}function K(a,b,c,d,f){if(a){var g=new u.ManifestUpdateStreamInfo;return g.id=b,g.index=c,g.start=d,g.duration=f,a.streamInfo.push(g),e(a.mediaType,S.metricsList.MANIFEST_UPDATE_STREAM_INFO,a),g}return null}function L(a,b,c,d,f,g,h,i){if(a){var j=new u.ManifestUpdateTrackInfo;return j.id=b,j.index=c,j.streamIndex=d,j.mediaType=f,j.startNumber=h,j.fragmentInfoType=i,j.presentationTimeOffset=g,a.trackInfo.push(j),e(a.mediaType,S.metricsList.MANIFEST_UPDATE_TRACK_INFO,a),j}return null}function M(a){var b="stream";return a.trace&&Array.isArray(a.trace)?a.trace.forEach(function(a){a.hasOwnProperty("subreplevel")&&!a.subreplevel&&delete a.subreplevel}):delete a.trace,o(b).PlayList.push(a),f(b,S.metricsList.PLAY_LIST,a),a}function N(a){var b="stream";return o(b).DVBErrors.push(a),f(b,S.metricsList.DVB_ERRORS,a),a}function O(a,b){var c=new G.default;return c._s=b,o(a).BolaState=[c],f(a,"BolaState",c),c}var P=this.context,Q=(0,y.default)(P).getInstance(),R=void 0,S=void 0,T=void 0;return R={metricsChanged:c,metricChanged:d,metricUpdated:e,metricAdded:f,clearCurrentMetricsForType:h,clearAllCurrentMetrics:k,getReadOnlyMetricsFor:m,getMetricsFor:o,addTcpConnection:q,addHttpRequest:v,addRepresentationSwitch:x,addBufferLevel:z,addBufferState:B,addDVRInfo:D,addDroppedFrames:E,addSchedulingInfo:F,addRequestsQueue:H,addManifestUpdate:I,updateManifestUpdateInfo:J,addManifestUpdateStreamInfo:K,addManifestUpdateRepresentationInfo:L,addPlayList:M,addDVBErrors:N,updateBolaState:O,setConfig:b},a(),R}Object.defineProperty(c,"__esModule",{value:!0});var f=a(169),g=d(f),h=a(186),i=d(h),j=a(180),k=a(183),l=d(k),m=a(176),n=d(m),o=a(177),p=d(o),q=a(178),r=d(q),s=a(179),t=d(s),u=a(181),v=a(185),w=d(v),x=a(9),y=d(x),z=a(184),A=d(z),B=a(13),C=d(B),D=a(10),E=d(D),F=a(175),G=d(F);e.__dashjs_factory_name="MetricsModel",c.default=E.default.getSingletonFactory(e),b.exports=c.default},{10:10,13:13,169:169,175:175,176:176,177:177,178:178,179:179,180:180,181:181,183:183,184:184,185:185,186:186,9:9}],104:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){h=new g.default,i=[],j=!1}function b(){return h}function c(){return i}function d(){return j}function e(a){function b(a,b,c,d){var e=d[0].split(/[=]/);return d.push({key:e[0],value:e[1]}),d.shift(),d}function c(a,b,c){return b>0&&(l&&0===i.length?i=c[b].split(/[&]/):m&&(e=c[b].split(/[&]/))),c}if(!a)return null;var d,e=[],f=new RegExp(/[?]/),g=new RegExp(/[#]/),k=new RegExp(/^(https:)?\/\//i),l=f.test(a),m=g.test(a);return j=k.test(a),d=a.split(/[?#]/).map(c),i.length>0&&(i=i.reduce(b,null)),e.length>0&&(e=e.reduce(b,null),e.forEach(function(a){h[a.key]=a.value})),a}var f=void 0,h=void 0,i=void 0,j=void 0;return f={initialize:a,parseURI:e,getURIFragmentData:b,getURIQueryData:c,isManifestHTTPS:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(174),g=d(f),h=a(10),i=d(h);e.__dashjs_factory_name="URIQueryAndFragmentModel",c.default=i.default.getSingletonFactory(e),b.exports=c.default},{10:10,174:174}],105:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){w=[]}function b(){t.playbackRate=x||1,t.removeEventListener("canplay",b)}function c(a){t&&(t.readyState<=2&&a>0?t.addEventListener("canplay",b):t.playbackRate=a)}function d(a){if(t.currentTime!=a)try{t.currentTime=a}catch(b){0===t.readyState&&b.code===b.INVALID_STATE_ERR&&setTimeout(function(){t.currentTime=a},400)}}function e(){return t}function f(a){t=a,t.preload="auto"}function g(a){a?t.src=a:(t.removeAttribute("src"),t.load())}function h(){return t.src}function i(){return v}function j(a){v=a}function k(){return u}function l(a){u=a,u.style.position="absolute",u.style.display="flex",u.style.overflow="hidden",u.style.pointerEvents="none",u.style.top=0,u.style.left=0}function m(a,b){q(a,b)}function n(){return w.length>0}function o(a){var b=void 0;null===a||t.seeking||w.indexOf(a)!==-1||(w.push(a),1===w.length&&(b=document.createEvent("Event"),b.initEvent("waiting",!0,!1),x=t.playbackRate,c(0),t.dispatchEvent(b)))}function p(a){var b=w.indexOf(a),d=void 0;null!==a&&(b!==-1&&w.splice(b,1),n()===!1&&0===t.playbackRate&&(c(x||1),t.paused||(d=document.createEvent("Event"),d.initEvent("playing",!0,!1),t.dispatchEvent(d))))}function q(a,b){b?o(a):p(a)}function r(){var a="webkitDroppedFrameCount"in t&&"webkitDecodedFrameCount"in t,b="getVideoPlaybackQuality"in t,c=null;return b?c=t.getVideoPlaybackQuality():a&&(c={droppedVideoFrames:t.webkitDroppedFrameCount,totalVideoFrames:t.webkitDroppedFrameCount+t.webkitDecodedFrameCount,creationTime:new Date}),c}var s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0;return s={initialize:a,setCurrentTime:d,setStallState:m,getElement:e,setElement:f,setSource:g,getSource:h,getVideoContainer:i,setVideoContainer:j,getTTMLRenderingDiv:k,setTTMLRenderingDiv:l,getPlaybackQuality:r}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="VideoModel",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],106:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a(1),h=d(g),i=function(){function a(){e(this,a)}return f(a,null,[{key:"findCencContentProtection",value:function(a){for(var b=null,c=0;c<a.length;++c){var d=a[c];"urn:mpeg:dash:mp4protection:2011"===d.schemeIdUri.toLowerCase()&&"cenc"===d.value.toLowerCase()&&(b=d)}return b}},{key:"getPSSHData",value:function(a){var b=8,c=new DataView(a),d=c.getUint8(b);return b+=20,d>0&&(b+=4+16*c.getUint32(b)),b+=4,a.slice(b)}},{key:"getPSSHForKeySystem",value:function(b,c){var d=a.parsePSSHList(c);return d.hasOwnProperty(b.uuid.toLowerCase())?d[b.uuid.toLowerCase()]:null}},{key:"parseInitDataFromContentProtection",value:function(a){return"pssh"in a?h.default.decodeArray(a.pssh.__text).buffer:null}},{key:"parsePSSHList",value:function(a){if(null===a)return[];for(var b=new DataView(a),c=!1,d={},e=0;!c;){var f,g,h,i,j,k=e;if(e>=b.buffer.byteLength)break;if(f=b.getUint32(e),g=e+f,e+=4,1886614376===b.getUint32(e))if(e+=4,h=b.getUint8(e),0===h||1===h){e++,e+=3,i="";var l,m;for(l=0;l<4;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=4,i+="-",l=0;l<2;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=2,i+="-",l=0;l<2;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=2,i+="-",l=0;l<2;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=2,i+="-",l=0;l<6;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;e+=6,i=i.toLowerCase(),j=b.getUint32(e),e+=4,d[i]=b.buffer.slice(k,g),e=g}else e=g;else e=g}return d}}]),a}();c.default=i,b.exports=c.default},{1:1}],107:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){var c=null,d=(0,i.default)(e).getInstance();d.setConfig({log:a.log}),d.initialize();var f=b(a);return!c&&f&&(c=(0,g.default)(e).create({protectionModel:f,protectionKeyController:d,adapter:a.adapter,eventBus:a.eventBus,log:a.log}),a.capabilities.setEncryptedMediaSupported(!0)),c}function b(a){var b=a.log,d=a.eventBus,f=a.videoModel.getElement();return void 0!==f.onencrypted&&void 0!==f.mediaKeys&&void 0!==navigator.requestMediaKeySystemAccess&&"function"==typeof navigator.requestMediaKeySystemAccess?(b("EME detected on this user agent! (ProtectionModel_21Jan2015)"),(0,m.default)(e).create({log:b,eventBus:d})):c(f,u)?(b("EME detected on this user agent! (ProtectionModel_3Feb2014)"),(0,o.default)(e).create({log:b,eventBus:d,api:c(f,u)})):c(f,t)?(b("EME detected on this user agent! (ProtectionModel_01b)"),(0,q.default)(e).create({log:b,eventBus:d,api:c(f,t)})):(b("No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!"),null)}function c(a,b){for(var c=0;c<b.length;c++){var d=b[c];if("function"==typeof a[d[Object.keys(d)[0]]])return d}return null}var d=void 0,e=this.context;return d={createProtectionSystem:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(109),g=d(f),h=a(110),i=d(h),j=a(108),k=d(j),l=a(115),m=d(l),n=a(116),o=d(n),p=a(114),q=d(p),r=a(10),s=d(r),t=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],u=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];e.__dashjs_factory_name="Protection";var v=s.default.getClassFactory(e);v.events=k.default,c.default=v,b.exports=c.default},{10:10,108:108,109:109,110:110,114:114,115:115,116:116}],108:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{ -value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(14),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.INTERNAL_KEY_MESSAGE="internalKeyMessage",this.INTERNAL_KEY_SYSTEM_SELECTED="internalKeySystemSelected",this.KEY_ADDED="public_keyAdded",this.KEY_ERROR="public_keyError",this.KEY_MESSAGE="public_keyMessage",this.KEY_SESSION_CLOSED="public_keySessionClosed",this.KEY_SESSION_CREATED="public_keySessionCreated",this.KEY_SESSION_REMOVED="public_keySessionRemoved",this.KEY_STATUSES_CHANGED="public_keyStatusesChanged",this.KEY_SYSTEM_ACCESS_COMPLETE="keySystemAccessComplete",this.KEY_SYSTEM_SELECTED="public_keySystemSelected",this.LICENSE_REQUEST_COMPLETE="public_licenseRequestComplete",this.NEED_KEY="needkey",this.PROTECTION_CREATED="public_protectioncreated",this.PROTECTION_DESTROYED="public_protectiondestroyed",this.SERVER_CERTIFICATE_UPDATED="serverCertificateUpdated",this.TEARDOWN_COMPLETE="protectionTeardownComplete",this.VIDEO_ELEMENT_SELECTED="videoElementSelected"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{14:14}],109:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){D=x.getKeySystems(),E=[],I=!1,J="temporary",K="",i.default.extend(q.default.events)}function c(a,b,c){if(!I){var d;b||c||(d=z.getStreamsInfo(a)[0]),F=b||(d?z.getMediaInfoForType(a,d,"audio"):null),G=c||(d?z.getMediaInfoForType(a,d,"video"):null);var e=G?G:F,f=x.getSupportedKeySystemsFromContentProtection(e.contentProtection);f&&f.length>0&&t(f,!0),I=!0}}function d(a){var b=g.default.getPSSHForKeySystem(L,a);if(b){for(var c=y.getAllInitData(),d=0;d<c.length;d++)if(x.initDataEquals(b,c[d]))return void B("DRM: Ignoring initData because we have already seen it!");try{y.createKeySession(b,J)}catch(e){A.trigger(i.default.KEY_SESSION_CREATED,{data:null,error:"Error creating key session! "+e.message})}}else A.trigger(i.default.KEY_SESSION_CREATED,{data:null,error:"Selected key system is "+L.systemString+". needkey/encrypted event contains no initData corresponding to that key system!"})}function e(a){y.loadKeySession(a)}function f(a){y.removeKeySession(a)}function h(a){y.closeKeySession(a)}function j(a){y.setServerCertificate(a)}function l(a){a?(y.setMediaElement(a),A.on(i.default.NEED_KEY,w,this),A.on(i.default.INTERNAL_KEY_MESSAGE,v,this)):null===a&&(y.setMediaElement(a),A.off(i.default.NEED_KEY,w,this),A.off(i.default.INTERNAL_KEY_MESSAGE,v,this))}function n(a){J=a}function o(a){K=a}function p(a){H=a}function r(){l(null),L=void 0,y&&(y.reset(),y=null)}function s(a){var b=null,c=a.systemString;return H&&(b=c in H?H[c]:null),b}function t(a,b){var c=this,e=[],f=[];G&&f.push(new k.default(G.codec,K)),F&&e.push(new k.default(F.codec,K));var g,h=new m.default(e,f,"optional","temporary"===J?"optional":"required",[J]),j=[];if(L){for(g=0;g<a.length;g++)if(L===a[g].ks){var l=function(){j.push({ks:a[g].ks,configs:[h]});var e=function e(f){A.off(i.default.KEY_SYSTEM_ACCESS_COMPLETE,e,c),f.error?b||A.trigger(i.default.KEY_SYSTEM_SELECTED,{error:"DRM: KeySystem Access Denied! -- "+f.error}):(B("DRM: KeySystem Access Granted"),A.trigger(i.default.KEY_SYSTEM_SELECTED,{data:f.data}),d(a[g].initData))};return A.on(i.default.KEY_SYSTEM_ACCESS_COMPLETE,e,c),y.requestKeySystemAccess(j),"break"}();if("break"===l)break}}else if(void 0===L){L=null,E.push(a);for(var n=0;n<a.length;n++)j.push({ks:a[n].ks,configs:[h]});var o,p=function a(d){A.off(i.default.KEY_SYSTEM_ACCESS_COMPLETE,a,c),d.error?(L=void 0,A.off(i.default.INTERNAL_KEY_SYSTEM_SELECTED,q,c),b||A.trigger(i.default.KEY_SYSTEM_SELECTED,{data:null,error:"DRM: KeySystem Access Denied! -- "+d.error})):(o=d.data,B("DRM: KeySystem Access Granted ("+o.keySystem.systemString+")! Selecting key system..."),y.selectKeySystem(o))},q=function a(e){if(A.off(i.default.INTERNAL_KEY_SYSTEM_SELECTED,a,c),A.off(i.default.KEY_SYSTEM_ACCESS_COMPLETE,p,c),e.error)L=void 0,b||A.trigger(i.default.KEY_SYSTEM_SELECTED,{data:null,error:"DRM: Error selecting key system! -- "+e.error});else{L=y.getKeySystem(),A.trigger(i.default.KEY_SYSTEM_SELECTED,{data:o});for(var f=0;f<E.length;f++)for(g=0;g<E[f].length;g++)if(L===E[f][g].ks){d(E[f][g].initData);break}}};A.on(i.default.INTERNAL_KEY_SYSTEM_SELECTED,q,c),A.on(i.default.KEY_SYSTEM_ACCESS_COMPLETE,p,c),y.requestKeySystemAccess(j)}else E.push(a)}function u(a,b){A.trigger(i.default.LICENSE_REQUEST_COMPLETE,{data:a,error:b})}function v(a){if(B("DRM: onKeyMessage"),a.error)return void B(a.error);var b=a.data;A.trigger(i.default.KEY_MESSAGE,{data:b});var c=b.messageType?b.messageType:"license-request",d=b.message,e=b.sessionToken,f=s(L),h=L.systemString,j=x.getLicenseServer(L,f,c),k={sessionToken:e,messageType:c};if(!j)return B("DRM: License server request not required for this message (type = "+a.data.messageType+"). Session ID = "+e.getSessionID()),void u(k);if(x.isClearKey(L)){var l=x.processClearKeyLicenseRequest(f,d);if(l)return B("DRM: ClearKey license request handled by application!"),u(k),void y.updateKeySession(e,l)}var m=new XMLHttpRequest,n=null;if(f&&f.serverURL){var o=f.serverURL;"string"==typeof o&&""!==o?n=o:"object"==typeof o&&o.hasOwnProperty(c)&&(n=o[c])}else f&&f.laURL&&""!==f.laURL?n=f.laURL:(n=L.getLicenseServerURLFromInitData(g.default.getPSSHData(e.initData)),n||(n=a.data.laURL));if(n=j.getServerURLFromMessage(n,d,c),!n)return void u(k,"DRM: No license server URL specified!");m.open(j.getHTTPMethod(c),n,!0),m.responseType=j.getResponseType(h,c),m.onload=function(){200==this.status?(u(k),y.updateKeySession(e,j.getLicenseMessage(this.response,h,c))):u(k,"DRM: "+h+' update, XHR status is "'+this.statusText+'" ('+this.status+"), expected to be 200. readyState is "+this.readyState+". Response is "+(this.response?j.getErrorResponse(this.response,h,c):"NONE"))},m.onabort=function(){u(k,"DRM: "+h+' update, XHR aborted. status is "'+this.statusText+'" ('+this.status+"), readyState is "+this.readyState)},m.onerror=function(){u(k,"DRM: "+h+' update, XHR error. status is "'+this.statusText+'" ('+this.status+"), readyState is "+this.readyState)};var p=function(a){var b;if(a)for(b in a)"authorization"===b.toLowerCase()&&(m.withCredentials=!0),m.setRequestHeader(b,a[b])};f&&p(f.httpRequestHeaders),p(L.getRequestHeadersFromMessage(d)),f&&f.withCredentials&&(m.withCredentials=!0),m.send(L.getLicenseRequestFromMessage(d))}function w(a){if(B("DRM: onNeedKey"),"cenc"!==a.key.initDataType)return void B("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+a.key.initDataType);var b=a.key.initData;ArrayBuffer.isView(b)&&(b=b.buffer),B("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(b)));var c=x.getSupportedKeySystems(b,H);return 0===c.length?void B("DRM: Received needkey event with initData, but we don't support any of the key systems!"):void t(c,!1)}var x=a.protectionKeyController,y=a.protectionModel,z=a.adapter,A=a.eventBus,B=a.log,C=void 0,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0;return C={initialize:c,createKeySession:d,loadKeySession:e,removeKeySession:f,closeKeySession:h,setServerCertificate:j,setMediaElement:l,setSessionType:n,setRobustnessLevel:o,setProtectionData:p,reset:r},b(),C}Object.defineProperty(c,"__esModule",{value:!0});var f=a(106),g=d(f),h=a(13),i=d(h),j=a(127),k=d(j),l=a(126),m=d(l),n=a(10),o=d(n),p=a(107),q=d(p);e.__dashjs_factory_name="ProtectionController",c.default=o.default.getClassFactory(e),b.exports=c.default},{10:10,106:106,107:107,126:126,127:127,13:13}],110:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){a&&a.log&&(t=a.log)}function b(){v=[];var a;a=(0,m.default)(p).getInstance(),v.push(a),a=(0,k.default)(p).getInstance(),v.push(a),a=(0,i.default)(p).getInstance(),v.push(a),w=a}function c(){return v}function d(a){for(var b=0;b<v.length;b++)if(v[b].systemString===a)return v[b];return null}function e(a){return a===w}function f(a,b){if(a.byteLength===b.byteLength){for(var c=new Uint8Array(a),d=new Uint8Array(b),e=0;e<c.length;e++)if(c[e]!==d[e])return!1;return!0}return!1}function h(a){var b,c,d,e,f=[];if(a)for(d=0;d<v.length;++d)for(c=v[d],e=0;e<a.length;++e)if(b=a[e],b.schemeIdUri.toLowerCase()===c.schemeIdURI){var g=c.getInitData(b);g&&f.push({ks:v[d],initData:g})}return f}function j(a,b){var c,d=[],e=g.default.parsePSSHList(a);for(c=0;c<v.length;++c){var f=v[c].systemString,h=!b||f in b;v[c].uuid in e&&h&&d.push({ks:v[c],initData:e[v[c].uuid]})}return d}function l(a,b,c){if("license-release"===c||"individualization-request"===c)return null;var d=null;return b&&b.hasOwnProperty("drmtoday")?d=(0,o.default)(p).getInstance():"com.widevine.alpha"===a.systemString?d=(0,s.default)(p).getInstance():"com.microsoft.playready"===a.systemString?d=(0,q.default)(p).getInstance():"org.w3.clearkey"===a.systemString&&(d=(0,u.default)(p).getInstance()),d}function n(a,b){try{return w.getClearKeysFromProtectionData(a,b)}catch(c){return t("Failed to retrieve clearkeys from ProtectionData"),null}}var p=this.context,r=void 0,t=void 0,v=void 0,w=void 0;return r={initialize:b,isClearKey:e,initDataEquals:f,getKeySystems:c,getKeySystemBySystemString:d,getSupportedKeySystemsFromContentProtection:h,getSupportedKeySystems:j,getLicenseServer:l,processClearKeyLicenseRequest:n,setConfig:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(106),g=d(f),h=a(111),i=d(h),j=a(113),k=d(j),l=a(112),m=d(l),n=a(118),o=d(n),p=a(119),q=d(p),r=a(120),s=d(r),t=a(117),u=d(t),v=a(10),w=d(v);e.__dashjs_factory_name="ProtectionKeyController",c.default=w.default.getSingletonFactory(e),b.exports=c.default},{10:10,106:106,111:111,112:112,113:113,117:117,118:118,119:119,120:120}],111:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=null;if(a){for(var d=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(b))),e=[],f=0;f<d.kids.length;f++){var h=d.kids[f],j=a.clearkeys.hasOwnProperty(h)?a.clearkeys[h]:null;if(!j)throw new Error("DRM: ClearKey keyID ("+h+") is not known!");e.push(new g.default(h,j))}c=new i.default(e)}return c}function b(a){return k.default.parseInitDataFromContentProtection(a)}function c(){return null}function d(a){return new Uint8Array(a)}function e(){return null}var f=void 0;return f={uuid:n,schemeIdURI:p,systemString:o,getInitData:b,getRequestHeadersFromMessage:c,getLicenseRequestFromMessage:d,getLicenseServerURLFromInitData:e,getClearKeysFromProtectionData:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(124),g=d(f),h=a(121),i=d(h),j=a(106),k=d(j),l=a(10),m=d(l),n="1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",o="org.w3.clearkey",p="urn:uuid:"+n;e.__dashjs_factory_name="KeySystemClearKey",c.default=m.default.getSingletonFactory(e),b.exports=c.default},{10:10,106:106,121:121,124:124}],112:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){var b,c,d={},e=new DOMParser,f="utf16"===h?new Uint16Array(a):new Uint8Array(a);b=String.fromCharCode.apply(null,f),c=e.parseFromString(b,"application/xml");for(var g=c.getElementsByTagName("name"),i=c.getElementsByTagName("value"),j=0;j<g.length;j++)d[g[j].childNodes[0].nodeValue]=i[j].childNodes[0].nodeValue;return d.hasOwnProperty("Content")&&(d["Content-Type"]=d.Content,delete d.Content),d}function b(a){var b,c,d=null,e=new DOMParser,f="utf16"===h?new Uint16Array(a):new Uint8Array(a);if(b=String.fromCharCode.apply(null,f),c=e.parseFromString(b,"application/xml"),c.getElementsByTagName("Challenge")[0]){var g=c.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;g&&(d=m.default.decode(g))}return d}function c(a){if(a)for(var b=new DataView(a),c=b.getUint16(4,!0),d=6,e=new DOMParser,f=0;f<c;f++){var g=b.getUint16(d,!0);d+=2;var h=b.getUint16(d,!0);if(d+=2,1===g){var i=a.slice(d,d+h),j=String.fromCharCode.apply(null,new Uint16Array(i)),k=e.parseFromString(j,"application/xml");if(k.getElementsByTagName("LA_URL")[0]){var l=k.getElementsByTagName("LA_URL")[0].childNodes[0].nodeValue;if(l)return l}if(k.getElementsByTagName("LUI_URL")[0]){var m=k.getElementsByTagName("LUI_URL")[0].childNodes[0].nodeValue;if(m)return m}}else d+=h}return null}function d(a){var b,c,d,e,f,h=new Uint8Array([112,115,115,104,0,0,0,0]),i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),j=0,k=null;if("pssh"in a)return g.default.parseInitDataFromContentProtection(a);if("pro"in a)k=m.default.decodeArray(a.pro.__text);else{if(!("prheader"in a))return null;k=m.default.decodeArray(a.prheader.__text)}return b=k.length,c=4+h.length+i.length+4+b,d=new ArrayBuffer(c),e=new Uint8Array(d),f=new DataView(d),f.setUint32(j,c),j+=4,e.set(h,j),j+=h.length,e.set(i,j),j+=i.length,f.setUint32(j,b),j+=4,e.set(k,j),j+=b,e.buffer}function e(a){if("utf8"!==a&&"utf16"!==a)throw new i.default("Illegal PlayReady message format! -- "+a);h=a}var f=void 0,h="utf16";return f={uuid:n,schemeIdURI:p,systemString:o,getInitData:d,getRequestHeadersFromMessage:a,getLicenseRequestFromMessage:b,getLicenseServerURLFromInitData:c,setPlayReadyMessageFormat:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(106),g=d(f),h=a(163),i=d(h),j=a(10),k=d(j),l=a(1),m=d(l),n="9a04f079-9840-4286-ab92-e65be0885f95",o="com.microsoft.playready",p="urn:uuid:"+n;e.__dashjs_factory_name="KeySystemPlayReady",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{1:1,10:10,106:106,163:163}],113:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return g.default.parseInitDataFromContentProtection(a)}function b(){return null}function c(a){return new Uint8Array(a)}function d(){return null}var e=void 0;return e={uuid:j,schemeIdURI:l,systemString:k,getInitData:a,getRequestHeadersFromMessage:b,getLicenseRequestFromMessage:c,getLicenseServerURLFromInitData:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(106),g=d(f),h=a(10),i=d(h),j="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",k="com.widevine.alpha",l="urn:uuid:"+j;e.__dashjs_factory_name="KeySystemWidevine",c.default=i.default.getSingletonFactory(e),b.exports=c.default},{10:10,106:106}],114:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){E=null,F=null,I=[],J=[],G=(0,g.default)(z).getInstance(),H=(0,u.default)(z).getInstance(),L=w()}function c(){E&&y();for(var a=0;a<J.length;a++)p(J[a]);A.trigger(s.default.TEARDOWN_COMPLETE)}function d(){return F}function e(){for(var a=[],b=0;b<I.length;b++)a.push(I[b].initData);for(var b=0;b<J.length;b++)a.push(J[b].initData);return a}function f(a){var b=E;b||(b=document.createElement("video"));for(var c=!1,d=0;d<a.length;d++)for(var e=a[d].ks.systemString,f=a[d].configs,g=null,h=null,i=0;i<f.length;i++){var j=f[i].videoCapabilities;if(j&&0!==j.length){h=[];for(var k=0;k<j.length;k++)""!==b.canPlayType(j[k].contentType,e)&&h.push(j[k])}if(!(!g&&!h||g&&0===g.length||h&&0===h.length)){c=!0;var l=new o.default(g,h),m=G.getKeySystemBySystemString(e);A.trigger(s.default.KEY_SYSTEM_ACCESS_COMPLETE,{data:new q.default(m,l)});break}}c||A.trigger(s.default.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})}function h(a){F=a.keySystem,A.trigger(s.default.INTERNAL_KEY_SYSTEM_SELECTED)}function j(a){E!==a&&(E&&y(),E=a,E&&(E.addEventListener(C.keyerror,L),E.addEventListener(C.needkey,L),E.addEventListener(C.keymessage,L),E.addEventListener(C.keyadded,L),A.trigger(s.default.VIDEO_ELEMENT_SELECTED)))}function l(a){if(!F)throw new Error("Can not create sessions until you have selected a key system");if(K||0===J.length){var b={sessionID:null,initData:a,getSessionID:function(){return this.sessionID},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"}};return I.push(b),E[C.generateKeyRequest](F.systemString,new Uint8Array(a)),b}throw new Error("Multiple sessions not allowed!")}function n(a,b){var c=a.sessionID;if(G.isClearKey(F))for(var d=0;d<b.keyPairs.length;d++)E[C.addKey](F.systemString,b.keyPairs[d].key,b.keyPairs[d].keyID,c);else E[C.addKey](F.systemString,new Uint8Array(b),a.initData,c)}function p(a){E[C.cancelKeyRequest](F.systemString,a.sessionID)}function r(){}function t(){}function v(){}function w(){return{handleEvent:function(a){var b=null;switch(a.type){case C.needkey:var c=ArrayBuffer.isView(a.initData)?a.initData.buffer:a.initData;A.trigger(s.default.NEED_KEY,{key:new i.default(c,"cenc")});break;case C.keyerror:if(b=x(J,a.sessionId),b||(b=x(I,a.sessionId)),b){var d="";switch(a.errorCode.code){case 1:d+="MEDIA_KEYERR_UNKNOWN - An unspecified error occurred. This value is used for errors that don't match any of the other codes.";break;case 2:d+="MEDIA_KEYERR_CLIENT - The Key System could not be installed or updated.";break;case 3:d+="MEDIA_KEYERR_SERVICE - The message passed into update indicated an error from the license service.";break;case 4:d+="MEDIA_KEYERR_OUTPUT - There is no available output device with the required characteristics for the content protection system.";break;case 5:d+="MEDIA_KEYERR_HARDWARECHANGE - A hardware configuration change caused a content protection error.";break;case 6:d+="MEDIA_KEYERR_DOMAIN - An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain."}d+=" System Code = "+a.systemCode,A.trigger(s.default.KEY_ERROR,{data:new k.default(b,d)})}else B("No session token found for key error");break;case C.keyadded:b=x(J,a.sessionId),b||(b=x(I,a.sessionId)),b?(B("DRM: Key added."),A.trigger(s.default.KEY_ADDED,{data:b})):B("No session token found for key added");break;case C.keymessage:if(K=null!==a.sessionId&&void 0!==a.sessionId,K?(b=x(J,a.sessionId),!b&&I.length>0&&(b=I.shift(),J.push(b),b.sessionID=a.sessionId)):I.length>0&&(b=I.shift(),J.push(b),0!==I.length&&H.mediaKeyMessageError("Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!")),b){var e=ArrayBuffer.isView(a.message)?a.message.buffer:a.message;b.keyMessage=e,A.trigger(s.default.INTERNAL_KEY_MESSAGE,{data:new m.default(b,e,a.defaultURL)})}else B("No session token found for key message")}}}}function x(a,b){if(b&&a){for(var c=a.length,d=0;d<c;d++)if(a[d].sessionID==b)return a[d];return null}return null}function y(){E.removeEventListener(C.keyerror,L),E.removeEventListener(C.needkey,L),E.removeEventListener(C.keymessage,L),E.removeEventListener(C.keyadded,L)}var z=this.context,A=a.eventBus,B=a.log,C=a.api,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0;return D={getAllInitData:e,requestKeySystemAccess:f,getKeySystem:d,selectKeySystem:h,setMediaElement:j,createKeySession:l,updateKeySession:n,closeKeySession:p,setServerCertificate:r,loadKeySession:t,removeKeySession:v,reset:c},b(),D}Object.defineProperty(c,"__esModule",{value:!0});var f=a(110),g=d(f),h=a(128),i=d(h),j=a(122),k=d(j),l=a(123),m=d(l),n=a(126),o=d(n),p=a(125),q=d(p),r=a(13),s=d(r),t=a(152),u=d(t),v=a(10),w=d(v);e.__dashjs_factory_name="ProtectionModel_01b",c.default=w.default.getClassFactory(e),b.exports=c.default},{10:10,110:110,122:122,123:123,125:125,126:126,128:128,13:13,152:152}],115:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){A=null,B=null,C=null,D=[],F=(0,g.default)(G).getInstance(),E=w()}function c(){var a,b=D.length;if(0!==b)for(var c=function(a){x(a),0===D.length&&(B?(B.removeEventListener("encrypted",E),B.setMediaKeys(null).then(function(){H.trigger(q.default.TEARDOWN_COMPLETE)})):H.trigger(q.default.TEARDOWN_COMPLETE))},d=0;d<b;d++)a=D[d],function(b){a.session.closed.then(function(){c(b)}),v(a).catch(function(){c(b)})}(a);else H.trigger(q.default.TEARDOWN_COMPLETE)}function d(){return A}function e(){for(var a=[],b=0;b<D.length;b++)a.push(D[b].initData);return a}function f(a){u(a,0)}function h(a){a.mksa.createMediaKeys().then(function(b){A=a.keySystem,C=b,B&&B.setMediaKeys(C),H.trigger(q.default.INTERNAL_KEY_SYSTEM_SELECTED)}).catch(function(){H.trigger(q.default.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+a.keySystem.systemString+")! Could not create MediaKeys -- TODO"})})}function j(a){B!==a&&(B&&(B.removeEventListener("encrypted",E),B.setMediaKeys(null)),B=a,B&&(B.addEventListener("encrypted",E),C&&B.setMediaKeys(C)))}function l(a){if(!A||!C)throw new Error("Can not set server certificate until you have selected a key system");C.setServerCertificate(a).then(function(){I("DRM: License server certificate successfully updated."),H.trigger(q.default.SERVER_CERTIFICATE_UPDATED)}).catch(function(a){H.trigger(q.default.SERVER_CERTIFICATE_UPDATED,{error:"Error updating server certificate -- "+a.name})})}function n(a,b){if(!A||!C)throw new Error("Can not create sessions until you have selected a key system");var c=C.createSession(b),d=y(c,a,b);c.generateRequest("cenc",a).then(function(){I("DRM: Session created. SessionID = "+d.getSessionID()),H.trigger(q.default.KEY_SESSION_CREATED,{data:d})}).catch(function(a){x(d),H.trigger(q.default.KEY_SESSION_CREATED,{data:null,error:"Error generating key request -- "+a.name})})}function p(a,b){var c=a.session;F.isClearKey(A)&&(b=b.toJWK()),c.update(b).catch(function(b){H.trigger(q.default.KEY_ERROR,{data:new k.default(a,"Error sending update() message! "+b.name)})})}function r(a){if(!A||!C)throw new Error("Can not load sessions until you have selected a key system");var b=C.createSession();b.load(a).then(function(c){if(c){var d=y(b);I("DRM: Session created. SessionID = "+d.getSessionID()),H.trigger(q.default.KEY_SESSION_CREATED,{data:d})}else H.trigger(q.default.KEY_SESSION_CREATED,{data:null,error:"Could not load session! Invalid Session ID ("+a+")"})}).catch(function(b){H.trigger(q.default.KEY_SESSION_CREATED,{data:null,error:"Could not load session ("+a+")! "+b.name})})}function s(a){var b=a.session;b.remove().then(function(){I("DRM: Session removed. SessionID = "+a.getSessionID()),H.trigger(q.default.KEY_SESSION_REMOVED,{data:a.getSessionID()})},function(b){H.trigger(q.default.KEY_SESSION_REMOVED,{data:null,error:"Error removing session ("+a.getSessionID()+"). "+b.name})})}function t(a){v(a).catch(function(b){x(a),H.trigger(q.default.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+a.getSessionID()+") "+b.name})})}function u(a,b){!function(b){var c=a[b].ks,d=a[b].configs;navigator.requestMediaKeySystemAccess(c.systemString,d).then(function(a){var b="function"==typeof a.getConfiguration?a.getConfiguration():null,d=new o.default(c,b);d.mksa=a,H.trigger(q.default.KEY_SYSTEM_ACCESS_COMPLETE,{data:d})}).catch(function(){++b<a.length?u(a,b):H.trigger(q.default.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied!"})})}(b)}function v(a){var b=a.session;return b.removeEventListener("keystatuseschange",a),b.removeEventListener("message",a),b.close()}function w(){return{handleEvent:function(a){switch(a.type){case"encrypted":if(a.initData){var b=ArrayBuffer.isView(a.initData)?a.initData.buffer:a.initData;H.trigger(q.default.NEED_KEY,{key:new i.default(b,a.initDataType)})}}}}}function x(a){for(var b=0;b<D.length;b++)if(D[b]===a){D.splice(b,1);break}}function y(a,b,c){var d={session:a,initData:b,handleEvent:function(a){switch(a.type){case"keystatuseschange":H.trigger(q.default.KEY_STATUSES_CHANGED,{data:this});break;case"message":var b=ArrayBuffer.isView(a.message)?a.message.buffer:a.message;H.trigger(q.default.INTERNAL_KEY_MESSAGE,{data:new m.default(this,b,void 0,a.messageType)})}},getSessionID:function(){return a.sessionId},getExpirationTime:function(){return a.expiration},getKeyStatuses:function(){return a.keyStatuses},getSessionType:function(){return c}};return a.addEventListener("keystatuseschange",d),a.addEventListener("message",d),a.closed.then(function(){x(d),I("DRM: Session closed. SessionID = "+d.getSessionID()),H.trigger(q.default.KEY_SESSION_CLOSED,{data:d.getSessionID()})}),D.push(d),d}var z,A,B,C,D,E,F,G=this.context,H=a.eventBus,I=a.log;return z={getAllInitData:e,requestKeySystemAccess:f,getKeySystem:d,selectKeySystem:h,setMediaElement:j,setServerCertificate:l,createKeySession:n,updateKeySession:p,loadKeySession:r,removeKeySession:s,closeKeySession:t,reset:c},b(),z}Object.defineProperty(c,"__esModule",{value:!0});var f=a(110),g=d(f),h=a(128),i=d(h),j=a(122),k=d(j),l=a(123),m=d(l),n=a(125),o=d(n),p=a(13),q=d(p),r=a(10),s=d(r);e.__dashjs_factory_name="ProtectionModel_21Jan2015",c.default=s.default.getClassFactory(e),b.exports=c.default},{10:10,110:110,122:122,123:123,125:125,128:128,13:13}],116:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){D=null,E=null,F=null,G=null,H=[],J=(0,g.default)(y).getInstance(),I=v()}function c(){try{for(var a=0;a<H.length;a++)p(H[a]);D&&D.removeEventListener(B.needkey,I),z.trigger(s.default.TEARDOWN_COMPLETE)}catch(b){z.trigger(s.default.TEARDOWN_COMPLETE,{error:"Error tearing down key sessions and MediaKeys! -- "+b.message})}}function d(){return E}function e(){for(var a=[],b=0;b<H.length;b++)a.push(H[b].initData);return a}function f(a){for(var b=!1,c=0;c<a.length;c++)for(var d=a[c].ks.systemString,e=a[c].configs,f=null,g=null,h=0;h<e.length;h++){var i=e[h].audioCapabilities,j=e[h].videoCapabilities;if(i&&0!==i.length){f=[];for(var k=0;k<i.length;k++)window[B.MediaKeys].isTypeSupported(d,i[k].contentType)&&f.push(i[k])}if(j&&0!==j.length){g=[];for(var l=0;l<j.length;l++)window[B.MediaKeys].isTypeSupported(d,j[l].contentType)&&g.push(j[l])}if(!(!f&&!g||f&&0===f.length||g&&0===g.length)){b=!0;var m=new o.default(f,g),n=J.getKeySystemBySystemString(d);z.trigger(s.default.KEY_SYSTEM_ACCESS_COMPLETE,{data:new q.default(n,m)});break}}b||z.trigger(s.default.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})}function h(a){try{F=a.mediaKeys=new window[B.MediaKeys](a.keySystem.systemString),E=a.keySystem,G=a,D&&w(),z.trigger(s.default.INTERNAL_KEY_SYSTEM_SELECTED)}catch(b){z.trigger(s.default.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+E.systemString+")! Could not create MediaKeys -- TODO"})}}function j(a){D!==a&&(D&&D.removeEventListener(B.needkey,I),D=a,D&&(D.addEventListener(B.needkey,I),F&&w()))}function l(a){if(!E||!F||!G)throw new Error("Can not create sessions until you have selected a key system");var b=null;if(null!==G.ksConfiguration.videoCapabilities&&G.ksConfiguration.videoCapabilities.length>0&&(b=G.ksConfiguration.videoCapabilities[0]),null===b&&null!==G.ksConfiguration.audioCapabilities&&G.ksConfiguration.audioCapabilities.length>0&&(b=G.ksConfiguration.audioCapabilities[0]),null===b)throw new Error("Can not create sessions for unknown content types.");var c=b.contentType,d=F.createSession(c,new Uint8Array(a)),e=x(d,a);d.addEventListener(B.error,e),d.addEventListener(B.message,e),d.addEventListener(B.ready,e),d.addEventListener(B.close,e),H.push(e),A("DRM: Session created. SessionID = "+e.getSessionID()),z.trigger(s.default.KEY_SESSION_CREATED,{data:e})}function n(a,b){var c=a.session;J.isClearKey(E)?c.update(new Uint8Array(b.toJWK())):c.update(new Uint8Array(b))}function p(a){var b=a.session;b.removeEventListener(B.error,a),b.removeEventListener(B.message,a),b.removeEventListener(B.ready,a),b.removeEventListener(B.close,a);for(var c=0;c<H.length;c++)if(H[c]===a){H.splice(c,1);break}b[B.release]()}function r(){}function t(){}function u(){}function v(){return{handleEvent:function(a){switch(a.type){case B.needkey:if(a.initData){var b=ArrayBuffer.isView(a.initData)?a.initData.buffer:a.initData;z.trigger(s.default.NEED_KEY,{key:new i.default(b,"cenc")})}}}}}function w(){var a=null,b=function(){D.removeEventListener("loadedmetadata",a),D[B.setMediaKeys](F),z.trigger(s.default.VIDEO_ELEMENT_SELECTED)};D.readyState>=1?b():(a=b.bind(this),D.addEventListener("loadedmetadata",a))}function x(a,b){return{session:a,initData:b,getSessionID:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(a){switch(a.type){case B.error:var b="KeyError";z.trigger(s.default.KEY_ERROR,{data:new k.default(this,b)});break;case B.message:var c=ArrayBuffer.isView(a.message)?a.message.buffer:a.message;z.trigger(s.default.INTERNAL_KEY_MESSAGE,{data:new m.default(this,c,a.destinationURL)});break;case B.ready:A("DRM: Key added."),z.trigger(s.default.KEY_ADDED);break;case B.close:A("DRM: Session closed. SessionID = "+this.getSessionID()),z.trigger(s.default.KEY_SESSION_CLOSED,{data:this.getSessionID()})}}}}var y=this.context,z=a.eventBus,A=a.log,B=a.api,C=void 0,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0;return C={getAllInitData:e,requestKeySystemAccess:f,getKeySystem:d,selectKeySystem:h,setMediaElement:j,createKeySession:l,updateKeySession:n,closeKeySession:p,setServerCertificate:r,loadKeySession:t,removeKeySession:u,reset:c},b(),C}Object.defineProperty(c,"__esModule",{value:!0});var f=a(110),g=d(f),h=a(128),i=d(h),j=a(122),k=d(j),l=a(123),m=d(l),n=a(126),o=d(n),p=a(125),q=d(p),r=a(13),s=d(r),t=a(10),u=d(t);e.__dashjs_factory_name="ProtectionModel_3Feb2014",c.default=u.default.getClassFactory(e),b.exports=c.default},{10:10,110:110,122:122,123:123,125:125,126:126,128:128,13:13}],117:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(b)));a+="/?";for(var d=0;d<c.kids.length;d++)a+=c.kids[d]+"&";return a=a.substring(0,a.length-1)}function b(){return"GET"}function c(){return"json"}function d(a){if(!a.hasOwnProperty("keys"))return null;for(var b=[],c=0;c<a.keys.length;c++){var d=a.keys[c],e=d.kid.replace(/=/g,""),f=d.k.replace(/=/g,"");b.push(new g.default(e,f))}return new i.default(b)}function e(a){return String.fromCharCode.apply(null,new Uint8Array(a))}var f=void 0;return f={getServerURLFromMessage:a,getHTTPMethod:b,getResponseType:c,getLicenseMessage:d,getErrorResponse:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(124),g=d(f),h=a(121),i=d(h),j=a(10),k=d(j);e.__dashjs_factory_name="ClearKey",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{10:10,121:121,124:124}],118:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a}function b(){return"POST"}function c(a){return f[a].responseType}function d(a,b){return f[b].getLicenseMessage(a)}function e(a,b){return f[b].getErrorResponse(a)}var f={"com.widevine.alpha":{responseType:"json",getLicenseMessage:function(a){return i.default.decodeArray(a.license)},getErrorResponse:function(a){return a}},"com.microsoft.playready":{responseType:"arraybuffer",getLicenseMessage:function(a){return a},getErrorResponse:function(a){return String.fromCharCode.apply(null,new Uint8Array(a))}}},g=void 0;return g={getServerURLFromMessage:a,getHTTPMethod:b,getResponseType:c,getLicenseMessage:d,getErrorResponse:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(1),i=d(h);e.__dashjs_factory_name="DRMToday",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{1:1,10:10}],119:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a}function b(){return"POST"}function c(){return"arraybuffer"}function d(a){return a}function e(a){return String.fromCharCode.apply(null,new Uint8Array(a))}var f=void 0;return f={getServerURLFromMessage:a,getHTTPMethod:b,getResponseType:c,getLicenseMessage:d,getErrorResponse:e}}Object.defineProperty(c,"__esModule",{value:!0 -});var f=a(10),g=d(f);e.__dashjs_factory_name="PlayReady",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],120:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a}function b(){return"POST"}function c(){return"arraybuffer"}function d(a){return a}function e(a){return String.fromCharCode.apply(null,new Uint8Array(a))}var f=void 0;return f={getServerURLFromMessage:a,getHTTPMethod:b,getResponseType:c,getLicenseMessage:d,getErrorResponse:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="Widevine",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],121:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b,c){if(d(this,a),c&&"persistent"!==c&&"temporary"!==c)throw new Error("Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'");this.keyPairs=b,this.type=c}return e(a,[{key:"toJWK",value:function(){var a,b=this.keyPairs.length,c={keys:[]};for(a=0;a<b;a++){var d={kty:"oct",alg:"A128KW",kid:this.keyPairs[a].keyID,k:this.keyPairs[a].key};c.keys.push(d)}this.type&&(c.type=this.type);var e=JSON.stringify(c),f=e.length,g=new ArrayBuffer(f),h=new Uint8Array(g);for(a=0;a<f;a++)h[a]=e.charCodeAt(a);return g}}]),a}();c.default=f,b.exports=c.default},{}],122:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.sessionToken=b,this.error=c};c.default=e,b.exports=c.default},{}],123:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e,f){d(this,a),this.sessionToken=b,this.message=c,this.defaultURL=e,this.messageType=f?f:"license-request"};c.default=e,b.exports=c.default},{}],124:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.keyID=b,this.key=c};c.default=e,b.exports=c.default},{}],125:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.keySystem=b,this.ksConfiguration=c};c.default=e,b.exports=c.default},{}],126:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e,f,g){d(this,a),this.initDataTypes=["cenc"],b&&b.length&&(this.audioCapabilities=b),c&&c.length&&(this.videoCapabilities=c),this.distinctiveIdentifier=e,this.persistentState=f,this.sessionTypes=g};c.default=e,b.exports=c.default},{}],127:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.contentType=b,this.robustness=c};c.default=e,b.exports=c.default},{}],128:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.initData=b,this.initDataType=c};c.default=e,b.exports=c.default},{}],129:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=b.droppedVideoFrames-e;e=b.droppedVideoFrames;var g=b.totalVideoFrames-f;f=b.totalVideoFrames,d[a]?(d[a].droppedVideoFrames+=c,d[a].totalVideoFrames+=g):d[a]={droppedVideoFrames:c,totalVideoFrames:g}}function b(){return d}function c(a){d=[],e=a.droppedVideoFrames,f=a.totalVideoFrames}var d=[],e=0,f=0;return{push:a,getFrameHistory:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="DroppedFramesHistory";var h=g.default.getClassFactory(e);c.default=h,b.exports=c.default},{10:10}],130:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){return n.mediaInfo.streamInfo}function c(){return n.mediaInfo}function d(){return n}function e(){return p}function f(){return n.mediaInfo.streamInfo.manifestInfo}function g(){return o}function h(){return q}function i(){return r}function j(){return s}function k(){return t}function l(){return u}var m=void 0,n=a.streamProcessor.getCurrentRepresentationInfo(),o=a.streamProcessor,p=a.currentValue,q=a.playbackIndex,r=a.switchHistory,s=a.droppedFramesHistory,t=a.currentRequest,u=a.hasRichBuffer;return m={getCurrentValue:e,getManifestInfo:f,getMediaInfo:c,getPlaybackIndex:h,getDroppedFramesHistory:j,getCurrentRequest:k,getSwitchHistory:i,getStreamInfo:b,getStreamProcessor:g,getTrackInfo:d,hasRichBuffer:l}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="RulesContext",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10}],131:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){j={}}function b(a){a&&a.abrRulesCollection&&(j[n]=a.abrRulesCollection)}function c(a,b,c,d,f,g){var h,j,k={},l={},m=a.length,n=m,o=e(b,d),p=function(a){var b,e,f;if(a.value!==i.default.NO_CHANGE){var h=g(k[a.priority],a.value);h!==k[a.priority]&&(k[a.priority]=h,l[a.priority]=a.reason)}--m||(k[i.default.WEAK]!==i.default.NO_CHANGE&&(f=i.default.WEAK,b=k[i.default.WEAK],e=l[i.default.WEAK]),k[i.default.DEFAULT]!==i.default.NO_CHANGE&&(f=i.default.DEFAULT,b=k[i.default.DEFAULT],e=l[i.default.DEFAULT]),k[i.default.STRONG]!==i.default.NO_CHANGE&&(f=i.default.STRONG,b=k[i.default.STRONG],e=l[i.default.STRONG]),f!=i.default.STRONG&&f!=i.default.WEAK&&(f=i.default.DEFAULT),c(void 0!==b?{value:b,confidence:f,reason:e}:{value:d,confidence:f,reason:{name:"NO_CHANGE"}}))};for(k[i.default.STRONG]=i.default.NO_CHANGE,k[i.default.WEAK]=i.default.NO_CHANGE,k[i.default.DEFAULT]=i.default.NO_CHANGE,j=0;j<n;j++)h=a[j],h.execute(o,p)}function d(){var a,b,c=j[n],d=(c.getRules(k.default.QUALITY_SWITCH_RULES)||[]).concat(c.getRules(k.default.ABANDON_FRAGMENT_RULES)||[]),e=d.length;for(b=0;b<e;b++)a=d[b],"function"==typeof a.reset&&a.reset();j={}}function e(a,b){return(0,g.default)(f).create({streamProcessor:a,currentValue:b})}var f=this.context,h=void 0,j=void 0;return h={initialize:a,setConfig:b,applyRules:c,reset:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(130),g=d(f),h=a(132),i=d(h),j=a(134),k=d(j),l=a(10),m=d(l),n=0;e.__dashjs_factory_name="RulesController";var o=m.default.getSingletonFactory(e);o.ABR_RULE=n,c.default=o,b.exports=c.default},{10:10,130:130,132:132,134:134}],132:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c=void 0===a?h:a,d=void 0===b?null:b,e={value:c,reason:d};return e}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=-1;e.__dashjs_factory_name="SwitchRequest";var i=g.default.getClassFactory(e);i.NO_CHANGE=h,c.default=i,b.exports=c.default},{10:10}],133:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){d[a.oldValue]||(d[a.oldValue]={noDrops:0,drops:0,dropSize:0});var b=a.newValue-a.oldValue,c=b<0?1:0,f=c?-b:0,g=c?0:1;if(d[a.oldValue].drops+=c,d[a.oldValue].dropSize+=f,d[a.oldValue].noDrops+=g,e.push({idx:a.oldValue,noDrop:g,drop:c,dropSize:f}),e.length>h){var i=e.shift();d[i.idx].drops-=i.drop,d[i.idx].dropSize-=i.dropSize,d[i.idx].noDrops-=i.noDrop}}function b(){return d}function c(){d=[],e=[]}var d=[],e=[];return{push:a,getSwitchRequests:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=8;e.__dashjs_factory_name="SwitchRequestHistory";var i=g.default.getClassFactory(e);c.default=i,b.exports=c.default},{10:10}],134:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){l=[],n=[];var a=(0,w.default)(h).getInstance(),b=(0,y.default)(h).getInstance(),c=(0,u.default)(h).getInstance();c.getBufferOccupancyABREnabled()?(l.push((0,q.default)(h).create({metricsModel:a,dashMetrics:(0,y.default)(h).getInstance()})),n.push((0,s.default)(h).create({metricsModel:a,dashMetrics:(0,y.default)(h).getInstance()}))):(l.push((0,g.default)(h).create({metricsModel:a,dashMetrics:b})),l.push((0,i.default)(h).create({metricsModel:a})),l.push((0,o.default)(h).create()),l.push((0,m.default)(h).create()),n.push((0,k.default)(h).create()))}function b(a){switch(a){case D:return l;case E:return n;default:return null}}function c(a){return a.filter(function(a){return a.value>C.default.NO_CHANGE})}function d(a){if(0!==a.length)return a.reduce(function(a,b){return a.value<b.value?a:b})}function e(a){var b=l.map(function(b){return b.getMaxIndex(a)}),e=c(b),f=d(e);return f||(0,C.default)(h).create()}function f(a){var b=n.map(function(b){return b.shouldAbandon(a)}),e=c(b),f=d(e);return f||(0,C.default)(h).create()}var h=this.context,j=void 0,l=void 0,n=void 0;return j={initialize:a,getRules:b,getMaxQuality:e,shouldAbandonFragment:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(141),g=d(f),h=a(139),i=d(h),j=a(135),k=d(j),l=a(138),m=d(l),n=a(140),o=d(n),p=a(137),q=d(p),r=a(136),s=d(r),t=a(102),u=d(t),v=a(103),w=d(v),x=a(17),y=d(x),z=a(10),A=d(z),B=a(132),C=d(B),D="qualitySwitchRules",E="abandonFragmentRules";e.__dashjs_factory_name="ABRRulesCollection";var F=A.default.getSingletonFactory(e);F.QUALITY_SWITCH_RULES=D,F.ABANDON_FRAGMENT_RULES=E,c.default=F,b.exports=c.default},{10:10,102:102,103:103,132:132,135:135,136:136,137:137,138:138,139:139,140:140,141:141,17:17}],135:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){p={},r={},s=[],t=(0,i.default)(n).getInstance(),u=(0,k.default)(n).getInstance(),v=(0,m.default)(n).getInstance()}function b(a,b){p[a]=p[a]||{},p[a][b]=p[a][b]||{}}function c(a,b){s[a]=s[a]||[],s[a].push(b)}function d(a){var d=a.getMediaInfo(),f=d.type,i=a.getCurrentRequest(),k=(0,g.default)(n).create(g.default.NO_CHANGE,{name:e.__dashjs_factory_name});if(!isNaN(i.index)){b(f,i.index);var m=t.getStableBufferTime(),q=u.getCurrentBufferLevel(v.getReadOnlyMetricsFor(f));if(q>m)return k;var w=p[f][i.index];if(null===w||null===i.firstByteDate||r.hasOwnProperty(w.id))return k;if(void 0===w.firstByteTime&&(s[f]=[],w.firstByteTime=i.firstByteDate.getTime(),w.segmentDuration=i.duration,w.bytesTotal=i.bytesTotal,w.id=i.index),w.bytesLoaded=i.bytesLoaded,w.elapsedTime=(new Date).getTime()-w.firstByteTime,w.bytesLoaded>0&&w.elapsedTime>0&&c(f,Math.round(8*w.bytesLoaded/w.elapsedTime)),s[f].length>=l&&w.elapsedTime>j&&w.bytesLoaded<w.bytesTotal){var x=s[f].reduce(function(a,b){return a+b},0);if(w.measuredBandwidthInKbps=Math.round(x/s[f].length),w.estimatedTimeOfDownload=+(8*w.bytesTotal/w.measuredBandwidthInKbps/1e3).toFixed(2),w.estimatedTimeOfDownload<w.segmentDuration*h||0===a.getTrackInfo().quality)return k;if(!r.hasOwnProperty(w.id)){var y=a.getStreamProcessor().getABRController(),z=w.bytesTotal-w.bytesLoaded,A=y.getBitrateList(d),B=y.getQualityForBitrate(d,w.measuredBandwidthInKbps*t.getBandwidthSafetyFactor()),C=w.bytesTotal*A[B].bitrate/A[y.getQualityFor(f,d.streamInfo)].bitrate;z>C&&(k.value=B,k.reason.throughput=w.measuredBandwidthInKbps,k.reason.fragmentID=w.id,r[w.id]=w,o("AbandonRequestsRule ( ",f,"frag id",w.id,") is asking to abandon and switch to quality to ",B," measured bandwidth was",w.measuredBandwidthInKbps),delete p[f][w.id])}}else w.bytesLoaded===w.bytesTotal&&delete p[f][w.id]}return k}function f(){a()}var h=1.8,j=500,l=5,n=this.context,o=(0,q.default)(n).getInstance().log,p=void 0,r=void 0,s=void 0,t=void 0,u=void 0,v=void 0,w={shouldAbandon:d,reset:f};return a(),w}Object.defineProperty(c,"__esModule",{value:!0});var f=a(132),g=d(f),h=a(102),i=d(h),j=a(17),k=d(j),l=a(103),m=d(l),n=a(10),o=d(n),p=a(8),q=d(p);e.__dashjs_factory_name="AbandonRequestsRule",c.default=o.default.getClassFactory(e),b.exports=c.default},{10:10,102:102,103:103,132:132,17:17,8:8}],136:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){s={},t=(0,i.default)(l).getInstance()}function c(a,b,c){s[a]={index:b,quality:c}}function d(a,b,c){var d=s[a];return!d||(b!==d.index||c<d.quality)}function f(a){var b=a.getMediaInfo(),f=b.type,h=q.getReadOnlyMetricsFor(f),i=a.getCurrentRequest(),m=(0,g.default)(l).create(g.default.NO_CHANGE,{name:e.__dashjs_factory_name});if(0===h.BolaState.length)return n("WARNING: executing BolaAbandonRule before initializing BolaRule"),s[f]=null,m;var r=h.BolaState[0]._s,t=i.index,u=i.quality;if(isNaN(t)||0===u||!d(f,t,u)||!i.firstByteDate)return m;var v=Date.now(),w=v-i.firstByteDate.getTime(),x=i.bytesLoaded,y=i.bytesTotal,z=y-x,A=i.duration,B=p.getCurrentBufferLevel(h)?p.getCurrentBufferLevel(h):0,C=B+r.placeholderBuffer,D=8*x/(.001*w),E=r.bandwidthSafetyFactor*D,F=.001*(i.firstByteDate.getTime()-i.requestStartDate.getTime());F<.001*k&&(F=.001*k);var G=F+8*y/E,H="";o.default.BOLA_DEBUG&&(H="index="+t+" quality="+u+" bytesLoaded/bytesTotal="+x+"/"+y+" bufferLevel="+B+" timeSince1stByte="+(w/1e3).toFixed(3)+" estThroughput="+(E/1e6).toFixed(3)+" latency="+F.toFixed(3));var I=y*r.bitrates[0]/r.bitrates[u],J=z-F*E/8;if(J<1&&(J=1),w<j||z<=I||B>r.bufferTarget||J<=I||G<=A)return m;var K=C-F;K<0&&(K=0);for(var L=0;L+1<u&&y*r.bitrates[L+1]/r.bitrates[u]<J;)++L;var M=u;if(r.state===o.default.BOLA_STATE_STARTUP){M=0;for(var N=0;N<=L&&(I=y*r.bitrates[N]/r.bitrates[u],!(8*I/A>E));++N)M=N}else for(var O=(r.Vp*(r.utilities[u]+r.gp)-K)/J,N=0;N<=L;++N){I=y*r.bitrates[N]/r.bitrates[u];var P=(r.Vp*(r.utilities[N]+r.gp)-K)/I;P>O&&(M=N,O=P)}var Q=r.rebufferSafetyFactor*D*(B-F)/8;if(M===u&&J>Q&&(M=L),M===u)return m;for(;M>0&&(I=y*r.bitrates[M]/r.bitrates[u],!(I<=Q));)--M;var R=NaN;if(M>0){var S=r.utilities[M],T=r.utilities[M-1],P=r.bitrates[M],U=r.bitrates[M-1];R=r.Vp*((P*T-U*S)/(P-U)+r.gp)}else{var S=r.utilities[0],T=r.utilities[1],P=r.bitrates[0],U=r.bitrates[1];R=r.Vp*((P*T-U*S)/(P-U)+r.gp),R-=A}return C>R&&(r.placeholderBuffer=R-B,r.placeholderBuffer<0&&(r.placeholderBuffer=0)),r.lastQuality=M,q.updateBolaState(f,r),o.default.BOLA_DEBUG&&n("BolaDebug "+f+" BolaAbandonRule abandon to "+M+" - "+H),c(f,t,u),m.value=M,m.reason.state=r.state,m.reason.throughput=D,m.reason.bufferLevel=B,m.reason.bytesLoaded=i.bytesLoaded,m.reason.bytesTotal=i.bytesTotal,m.reason.elapsedTimeMs=w,m}function h(){s={}}var j=500,k=200,l=this.context,n=(0,m.default)(l).getInstance().log,p=a.dashMetrics,q=a.metricsModel,r=void 0,s=void 0,t=void 0;return r={shouldAbandon:f,reset:h},b(),r}Object.defineProperty(c,"__esModule",{value:!0});var f=a(132),g=d(f),h=a(102),i=d(h),j=a(10),k=d(j),l=a(8),m=d(l),n=a(137),o=d(n);e.__dashjs_factory_name="BolaAbandonRule",c.default=k.default.getClassFactory(e),b.exports=c.default},{10:10,102:102,132:132,137:137,8:8}],137:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){O={},P={},Q={},R=[],S=(0,k.default)(I).getInstance(),T=(0,m.default)(I).getInstance(),U=(0,p.default)(I).getInstance(),M.on(t.default.BUFFER_EMPTY,q,N),M.on(t.default.PLAYBACK_SEEKING,s,N),M.on(t.default.PERIOD_SWITCH_STARTED,u,N),M.on(t.default.MEDIA_FRAGMENT_LOADED,D,N)}function c(a){return a.map(function(a){return Math.log(a)})}function d(a,b,d,e){var f=NaN;if(e?(f=0,e.forEach(function(a,b){a>e[f]&&(f=b)})):(e=c(d),f=e.length-1),0===f)return null;var g=1-e[0]+(e[f]-e[0])/(b/a-1),h=a/(e[0]+g-1);return{utilities:e,gp:g,Vp:h}}function f(a){var b={},c=a.getMediaInfo(),e=a.getStreamProcessor(),f=a.getStreamInfo(),g=a.getTrackInfo(),h=e.isDynamic(),i=f.manifestInfo.duration,j=g.fragmentDuration,k=c.bitrateList.map(function(a){return a.bandwidth}),l=d(A,B,k,null);if(null===l)return b.state=w,b;if(b.state=x,b.bitrates=k,b.utilities=l.utilities,b.Vp=l.Vp,b.gp=l.gp,b.isDynamic=h,b.movieDuration=i,b.fragmentDuration=j,b.bandwidthSafetyFactor=S.getBandwidthSafetyFactor(),b.rebufferSafetyFactor=C,b.bufferTarget=S.getStableBufferTime(),b.lastQuality=0,b.placeholderBuffer=0,b.throughputCount=h?G:H,z){for(var m="",n=0;n<k.length;++n){var o=l.utilities[n],p=k[n],q=0;if(n>0){var r=l.utilities[n-1],s=k[n-1];q=l.Vp*((r*p-o*s)/(p-s)+l.gp)}var t=l.Vp*(o+l.gp);m+="\n"+n+":"+(1e-6*k[n]).toFixed(3)+"Mbps "+q.toFixed(3)+"/"+t.toFixed(3)}J("BolaDebug "+c.type+" bitrates"+m)}return b}function h(a,b){for(var c=a.bitrates.length,d=NaN,e=NaN,f=0;f<c;++f){var g=(a.Vp*(a.utilities[f]+a.gp)-b)/a.bitrates[f];(isNaN(e)||g>=e)&&(e=g,d=f)}return d}function i(a,b){for(var c=K.getHttpRequests(a),d=[],e=c.length-1;e>=0&&d.length<b;--e){var f=c[e];f.type===n.HTTPRequest.MEDIA_SEGMENT_TYPE&&f._tfinish&&f.tresponse&&f.trace&&d.push(f)}return d}function j(a,b,c){var d=i(a,b);if(0===d.length)return 0;for(var e=0,f="",g=0;g<d.length;++g){var h=.001*(d[g]._tfinish.getTime()-d[g].trequest.getTime()),j=8*d[g].trace.reduce(function(a,b){return a+b.b[0]},0);z&&(f+=" "+(1e-6*j).toFixed(3)+"/"+h.toFixed(3)+"="+(1e-6*j/h).toFixed(3)+"Mbps"),e+=h/j}return z&&J("BolaDebug "+c+" BolaRule recent throughput = "+(d.length/(1e6*e)).toFixed(3)+"Mbps:"+f),d.length/e}function l(a,b){var c=0;return a.bitrates.some(function(a,d){return a>b||(c=d,!1)}),c}function o(a,b){var c=Date.now(),d=O[b],e=Q[b],f=NaN;if(O[b]=c,Q[b]=!1,!e){var g=i(a,1);g.length>0&&(f=g[0]._tfinish.getTime(),f>c&&(f=c))}var h=0;return h=e||d>f?c-d:c-f,isNaN(h)||h<=0?0:.001*h}function q(){z&&J("BolaDebug BUFFER_EMPTY"),R.forEach(function(a){var b=L.getReadOnlyMetricsFor(a);if(0!==b.BolaState.length){var c=b.BolaState[0]._s;c.state===y&&(c.placeholderBuffer=0,L.updateBolaState(a,c))}})}function s(a){z&&J("BolaDebug PLAYBACK_SEEKING "+a.seekTime.toFixed(3)),R.forEach(function(a){var b=L.getReadOnlyMetricsFor(a);if(0!==b.BolaState.length){var c=b.BolaState[0]._s;c.state!==w&&(c.state=x),L.updateBolaState(a,c)}}),P={},Q={}}function u(){}function D(a){if(a&&a.chunk&&a.chunk.mediaInfo){var b=a.chunk.mediaInfo.type,c=a.chunk.start;void 0===b||isNaN(c)||(c<=P[b]?Q[b]=!0:(Q[b]=!1,P[b]=c))}}function E(a){var b=a.getStreamProcessor();b.getScheduleController().setTimeToLoadDelay(0);var c=(0,g.default)(I).create(g.default.NO_CHANGE,{name:e.__dashjs_factory_name}),d=a.getMediaInfo(),i=d.type,k=L.getReadOnlyMetricsFor(i);if(0===k.BolaState.length){z&&J("BolaDebug "+i+"\nBolaDebug "+i+" BolaRule for state=- fragmentStart="+U.getIndexHandlerTime(a.getStreamProcessor()).toFixed(3));var m=f(a);L.updateBolaState(i,m);var n=0;if(m.state!==w){R.push(i);var p=j(k,m.throughputCount,i);if(0===p)return z&&J("BolaDebug "+i+" BolaRule quality unchanged for INITIALIZE"),c;n=l(m,p*m.bandwidthSafetyFactor),m.lastQuality=n,c.value=n,c.reason.state=m.state,c.reason.throughput=p}return z&&J("BolaDebug "+i+" BolaRule quality "+n+" for INITIALIZE"),c}var q=k.BolaState[0]._s;if(q.state===w)return z&&J("BolaDebug "+i+" BolaRule quality 0 for ONE_BITRATE"),c;var r=q.bitrates,s=q.utilities;z&&J("BolaDebug "+i+"\nBolaDebug "+i+" EXECUTE BolaRule for state="+q.state+" fragmentStart="+U.getIndexHandlerTime(a.getStreamProcessor()).toFixed(3));var t=K.getCurrentBufferLevel(k)?K.getCurrentBufferLevel(k):0,u=j(k,q.throughputCount,i);t<=.1&&(q.placeholderBuffer=0);var v=o(k,i);v>0&&(q.placeholderBuffer+=v),q.placeholderBuffer<0&&(q.placeholderBuffer=0);var A=t+q.placeholderBuffer,B=h(q,A);if(z&&J("BolaDebug "+i+" BolaRule bufferLevel="+t.toFixed(3)+"(+"+q.placeholderBuffer.toFixed(3)+"="+A.toFixed(3)+") recentThroughput="+(1e-6*u).toFixed(3)+" tentativeQuality="+B),q.state===x){var n=l(q,u*q.bandwidthSafetyFactor);if(t>q.fragmentDuration/C){q.state=y;for(var D=0,E=0;E<n;++E){var F=q.Vp*(q.gp+(r[n]*s[E]-r[E]*s[n])/(r[n]-r[E]));F>D&&(D=F)}D>t&&(q.placeholderBuffer=D-t)}return z&&J("BolaDebug "+i+" BolaRule quality "+n+" for STARTUP"),q.lastQuality=n,L.updateBolaState(i,q),c.value=n,c.reason.state=x,c.reason.throughput=u,c}if(B>q.lastQuality){var n=l(q,u);B>n&&(n<q.lastQuality&&(n=q.lastQuality),B=n)}if(u>0)for(var G=C*u*t/q.fragmentDuration;B>0&&r[B]>G;)--B;var H=0,M=q.Vp*(s[B]+q.gp);return H=A-M,H>0&&(H>q.placeholderBuffer?(H-=q.placeholderBuffer,q.placeholderBuffer=0):(q.placeholderBuffer-=H,H=0)),H>0?B===r.length-1?H=0:b.getScheduleController().setTimeToLoadDelay(1e3*H):H=0,q.lastQuality=B,L.updateBolaState(i,q),c.value=B,c.reason.state=q.state,c.reason.throughput=u,c.reason.bufferLevel=t,z&&J("BolaDebug "+i+" BolaRule quality "+B+" delay="+H.toFixed(3)+" for STEADY"),c}function F(){M.off(t.default.BUFFER_EMPTY,q,N),M.off(t.default.PLAYBACK_SEEKING,s,N),M.off(t.default.PERIOD_SWITCH_STARTED,u,N),M.off(t.default.MEDIA_FRAGMENT_LOADED,D,N),b()}var G=2,H=3,I=this.context,J=(0,v.default)(I).getInstance().log,K=a.dashMetrics,L=a.metricsModel,M=(0,r.default)(I).getInstance(),N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0;return N={getMaxIndex:E,reset:F},b(),N}Object.defineProperty(c,"__esModule",{value:!0});var f=a(132),g=d(f),h=a(10),i=d(h),j=a(102),k=d(j),l=a(69),m=d(l),n=a(180),o=a(15),p=d(o),q=a(9),r=d(q),s=a(13),t=d(s),u=a(8),v=d(u),w=0,x=1,y=2,z=!1,A=10,B=30,C=.5;e.__dashjs_factory_name="BolaRule";var D=i.default.getClassFactory(e);D.BOLA_STATE_ONE_BITRATE=w,D.BOLA_STATE_STARTUP=x,D.BOLA_STATE_STEADY=y,D.BOLA_DEBUG=z,c.default=D,b.exports=c.default},{10:10,102:102,13:13,132:132,15:15,180:180,69:69,8:8,9:9}],138:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){var f=a.getDroppedFramesHistory();if(f){for(var g=f.getFrameHistory(),h=0,j=0,k=i.default.NO_CHANGE,l=1;l<g.length;l++)if(g[l]&&(h=g[l].droppedVideoFrames,j=g[l].totalVideoFrames,j>e&&h/j>d)){k=l-1,c("DroppedFramesRule, index: "+k+" Dropped Frames: "+h+" Total Frames: "+j);break}return(0,i.default)(b).create(k,{droppedFrames:h})}return(0,i.default)(b).create()}var b=this.context,c=(0,k.default)(b).getInstance().log,d=.15,e=375;return{getMaxIndex:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(132),i=d(h),j=a(8),k=d(j);e.__dashjs_factory_name="DroppedFramesRule";var l=g.default.getClassFactory(e);c.default=l,b.exports=c.default},{10:10,132:132,8:8}],139:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){p={},r=0,s=1e3,l.on(k.default.PLAYBACK_SEEKING,e,n)}function c(a){var b=(new Date).getTime(),c=a.getMediaInfo().type,e=m.getReadOnlyMetricsFor(c),f=e.BufferState.length>0?e.BufferState[e.BufferState.length-1]:null,i=(0,q.default)(h).create();return b-r<s||null===f?i:(d(c,f.state),f.state===g.default.BUFFER_EMPTY&&void 0!==p[c].firstBufferLoadedEvent&&(j("Switch to index 0; buffer is empty."),i.value=0,i.reason="InsufficientBufferRule: Buffer is empty"),r=b,i)}function d(a,b){p[a]=p[a]||{},p[a].state=b,b!==g.default.BUFFER_LOADED||p[a].firstBufferLoadedEvent||(p[a].firstBufferLoadedEvent=!0)}function e(){p={}}function f(){l.off(k.default.PLAYBACK_SEEKING,e,n),p={},r=0}var h=this.context,j=(0,o.default)(h).getInstance().log,l=(0,i.default)(h).getInstance(),m=a.metricsModel,n=void 0,p=void 0,r=void 0,s=void 0;return n={getMaxIndex:c,reset:f},b(),n}Object.defineProperty(c,"__esModule",{value:!0});var f=a(64),g=d(f),h=a(9),i=d(h),j=a(13),k=d(j),l=a(10),m=d(l),n=a(8),o=d(n),p=a(132),q=d(p);e.__dashjs_factory_name="InsufficientBufferRule",c.default=m.default.getClassFactory(e),b.exports=c.default},{10:10,13:13,132:132,64:64,8:8,9:9}],140:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){for(var f=a.getSwitchHistory(),g=f.getSwitchRequests(),h=0,i=0,j=0,l=(0,k.default)(b).create(),m=0;m<g.length;m++)if(void 0!==g[m]&&(h+=g[m].drops,i+=g[m].noDrops,j+=g[m].dropSize,h+i>=e&&h/i>d)){l.value=m>0?m-1:0,l.reason={index:l.value,drops:h,noDrops:i,dropSize:j},c("Switch history rule index: "+l.value+" samples: "+(h+i)+" drops: "+h);break}return l}var b=this.context,c=(0,i.default)(b).getInstance().log,d=.075,e=6;return{getMaxIndex:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(8),i=d(h),j=a(132),k=d(j);e.__dashjs_factory_name="SwitchRequest";var l=g.default.getClassFactory(e);c.default=l,b.exports=c.default},{10:10,132:132,8:8}],141:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){D=[],E=[],F=(0,k.default)(z).getInstance()}function c(a,b){D[a]=D[a]||[],D[a].push(b)}function d(a,b){if(E[a]||(E[a]=[]),E[a].push(b),E[a].length>t)return E[a].shift()}function e(a){var b=void 0;return E[a]&&E[a].length>0&&(b=E[a].reduce(function(a,b){return a+b})/E[a].length),b}function f(a,b){var c=Math.min(D[a].length,b?q:s),d=D[a].slice(c*-1,D[a].length);return d.length>1&&d.reduce(function(a,b){return(a*y<=b||a>=b*x)&&c++,b}),c=Math.min(D[a].length,c),D[a].slice(c*-1,D[a].length)}function h(a,b){var c=f(a,b),d=0;if(c.length>0){var e=c.reduce(function(a,b){return a+b},0);d=e/c.length}return D[a].length>=o&&D[a].shift(),d/1e3*F.getBandwidthSafetyFactor()}function j(a,b,c){var d=!1;if(a<w&&(d=!0),!d)switch(c){case"video":d=b<u;break;case"audio":d=b<v}return d}function m(a){var b=a.getMediaInfo(),f=b.type,k=C.getReadOnlyMetricsFor(f),m=a.getStreamProcessor(),n=m.getABRController(),o=m.isDynamic(),p=B.getCurrentHttpRequest(k),q=k.BufferState.length>0?k.BufferState[k.BufferState.length-1]:null,s=a.hasRichBuffer(),t=(0,r.default)(z).create();if(!k||!p||p.type!==l.HTTPRequest.MEDIA_SEGMENT_TYPE||!q||s)return t;var u=void 0,v=void 0;if(p.trace&&p.trace.length){v=p.tresponse.getTime()-p.trequest.getTime()||1,u=p._tfinish.getTime()-p.tresponse.getTime()||1;var w=p.trace.reduce(function(a,b){return a+b.b[0]},0),x=Math.round(8*w/(u/1e3)),y=void 0,F=void 0;j(v,u,f)?D[f]&&E[f]?(y=h(f,o),F=e(f)):(y=x/1e3,F=v):(c(f,x),y=h(f,o),d(f,v),F=e(f,o)),n.setAverageThroughput(f,y),n.getAbandonmentStateFor(f)!==i.default.ABANDON_LOAD&&(q.state===g.default.BUFFER_LOADED||o)&&(t.value=n.getQualityForBitrate(b,y,F),m.getScheduleController().setTimeToLoadDelay(0),A("ThroughputRule requesting switch to index: ",t.value,"type: ",f,"Average throughput",Math.round(y),"kbps"),t.reason={throughput:y,latency:F})}return t}function n(){b()}var o=20,q=3,s=4,t=s,u=50,v=5,w=50,x=1.3,y=1.3,z=this.context,A=(0,p.default)(z).getInstance().log,B=a.dashMetrics,C=a.metricsModel,D=void 0,E=void 0,F=void 0,G={getMaxIndex:m,reset:n};return b(),G}Object.defineProperty(c,"__esModule",{value:!0});var f=a(64),g=d(f),h=a(61),i=d(h),j=a(102),k=d(j),l=a(180),m=a(10),n=d(m),o=a(8),p=d(o),q=a(132),r=d(q);e.__dashjs_factory_name="ThroughputRule",c.default=n.default.getClassFactory(e),b.exports=c.default},{10:10,102:102,132:132,180:180,61:61,64:64,8:8}],142:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b,c=0;return a&&a.some(function(a,b){return c=b,!d.contains(a.serviceLocation)})&&(b=a[c]),b}var c=void 0,d=a.blacklistController;return c={select:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="BasicSelector",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10}],143:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=[],c=function(a){return!b.length||!a.dvb_priority||b.indexOf(a.dvb_priority)===-1},d=function(a){return!f.contains(a.serviceLocation)||(a.dvb_priority&&b.push(a.dvb_priority),!1)};return a.filter(d).filter(c)}function c(a){var b,c,d=function(a,b){var c=a.dvb_priority-b.dvb_priority;return isNaN(c)?0:c},e=function(a,b,c){return!b||c[0].dvb_priority&&a.dvb_priority&&c[0].dvb_priority===a.dvb_priority},f=0,g=[],h=0;if(c=a.sort(d).filter(e),c.length)return c.length>1&&(c.forEach(function(a){f+=a.dvb_weight,g.push(f)}),b=Math.floor(Math.random()*(f-1)),g.every(function(a,c){return h=c,!(b<a)})),c[h]}function d(a){return a&&c(b(a))}var e=void 0,f=a.blacklistController;return e={select:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="DVBSelector",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10}],144:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){k=(0,g.default)(e).getInstance(),l=(0,i.default)(e).getInstance()}function c(a,b,c){var e=f.getCurrentBufferLevel(h.getReadOnlyMetricsFor(b));return e<d(a,b,c)}function d(a,b,c){var d=NaN,e=a.getCurrentRepresentationInfo();if("fragmentedText"===b)d=j.getAllTracksAreDisabled()?0:e.fragmentDuration;else if("audio"===b&&c){var g=f.getCurrentBufferLevel(h.getReadOnlyMetricsFor("video"));d=Math.floor(Math.max(g,e.fragmentDuration))}else{var i=e.mediaInfo.streamInfo,l=a.getABRController();if(l.isPlayingAtTopQuality(i)){var m=i.manifestInfo.duration>=k.getLongFormContentDurationThreshold();d=m?k.getBufferTimeAtTopQualityLongForm():k.getBufferTimeAtTopQuality()}else d=k.getStableBufferTime()}return d}var e=this.context,f=a.dashMetrics,h=a.metricsModel,j=a.textSourceBuffer,k=void 0,l=void 0,m={execute:c,getBufferTarget:d};return b(),m}Object.defineProperty(c,"__esModule",{value:!0});var f=a(102),g=d(f),h=a(69),i=d(h),j=a(10),k=d(j);e.__dashjs_factory_name="BufferLevelRule",c.default=k.default.getClassFactory(e),b.exports=c.default},{10:10,102:102,69:69}],145:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){var c=a.getCurrentRepresentationInfo(),g=c.mediaInfo,i=g.type,j=a.getScheduleController(),k=j.getSeekTarget(),l=!isNaN(k),m=a.getBuffer(),n=l?k:e.getIndexHandlerTime(a);if(isNaN(n)||"fragmentedText"===i&&h.getAllTracksAreDisabled())return null;if(l&&j.setSeekTarget(NaN),m){var o=f.getBufferRange(a.getBuffer(),n);null!==o&&(d("Prior to making a request for time, NextFragmentRequestRule is aligning index handler's currentTime with bufferedRange.end.",n," was changed to ",o.end),n=o.end)}var p=void 0;return b?(n=b.startTime+b.duration/2,p=e.getFragmentRequestForTime(a,c,n,{timeThreshold:0,ignoreIsFinished:!0})):(p=e.getFragmentRequestForTime(a,c,n,{keepIdx:!l}),p&&a.getFragmentModel().isFragmentLoaded(p)&&(p=e.getNextFragmentRequest(a,c)),p&&(e.setIndexHandlerTime(a,p.startTime+p.duration),p.delayLoadingTime=(new Date).getTime()+j.getTimeToLoadDelay(),j.setTimeToLoadDelay(0))),p}var c=this.context,d=(0,g.default)(c).getInstance().log,e=a.adapter,f=a.sourceBufferController,h=a.textSourceBuffer,i={execute:b};return i}Object.defineProperty(c,"__esModule",{value:!0});var f=a(8),g=d(f),h=a(10),i=d(h);e.__dashjs_factory_name="NextFragmentRequestRule",c.default=i.default.getClassFactory(e),b.exports=c.default},{10:10,8:8}],146:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){n=(0,m.default)(f).create({updateEventName:i.default.SERVICE_LOCATION_BLACKLIST_CHANGED,loadFailedEventName:i.default.FRAGMENT_LOADING_COMPLETED}),p=(0,q.default)(f).create({blacklistController:n}),r=(0,o.default)(f).create({blacklistController:n}),s=p}function b(a){a.selector&&(s=a.selector)}function c(a){s=j.getIsDVB(a)?r:p}function d(a){var b=a.baseUrls,c=a.selectedIdx;if(!isNaN(c))return b[c];var d=s.select(b);return d?(a.selectedIdx=b.indexOf(d),d):void h.trigger(i.default.URL_RESOLUTION_FAILED,{error:new Error(t,u)})}function e(){n.reset()}var f=this.context,h=(0,g.default)(f).getInstance(),j=(0,k.default)(f).getInstance(),l=void 0,n=void 0,p=void 0,r=void 0,s=void 0;return l={chooseSelectorFromManifest:c,select:d,reset:e, -setConfig:b},a(),l}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(22),k=d(j),l=a(63),m=d(l),n=a(143),o=d(n),p=a(142),q=d(p),r=a(10),s=d(r),t=1,u="Failed to resolve a valid URL";e.__dashjs_factory_name="BaseURLSelector";var v=s.default.getClassFactory(e);v.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=t,v.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE=u,c.default=v,b.exports=c.default},{10:10,13:13,142:142,143:143,22:22,63:63,9:9}],147:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){if(!a)return null;void 0===a.fileStart&&(a.fileStart=0);var b=k.default.parseBuffer(a),d=(0,g.default)(c).create();return d.setData(b),d}var b=void 0,c=this.context;return b={parse:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(154),g=d(f),h=a(10),i=d(h),j=a(6),k=d(j);e.__dashjs_factory_name="BoxParser",c.default=i.default.getSingletonFactory(e),b.exports=c.default},{10:10,154:154,6:6}],148:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){g=!1}function b(){var a="WebKitMediaSource"in window,b="MediaSource"in window;return a||b}function c(){return g}function d(a){g=a}function e(a,b){var c=a.canPlayType(b);return"probably"===c||"maybe"===c}var f=void 0,g=void 0;return f={supportsMediaSource:b,supportsEncryptedMedia:c,supportsCodec:e,setEncryptedMediaSupported:d},a(),f}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="Capabilities",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],149:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=0;for(c=0;c<this.customTimeRangeArray.length&&a>this.customTimeRangeArray[c].start;c++);for(this.customTimeRangeArray.splice(c,0,{start:a,end:b}),c=0;c<this.customTimeRangeArray.length-1;c++)this.mergeRanges(c,c+1)&&c--;this.length=this.customTimeRangeArray.length}function b(){this.customTimeRangeArray=[],this.length=0}function c(a,b){for(var c=0;c<this.customTimeRangeArray.length;c++)if(a<=this.customTimeRangeArray[c].start&&b>=this.customTimeRangeArray[c].end)this.customTimeRangeArray.splice(c,1),c--;else{if(a>this.customTimeRangeArray[c].start&&b<this.customTimeRangeArray[c].end){this.customTimeRangeArray.splice(c+1,0,{start:b,end:this.customTimeRangeArray[c].end}),this.customTimeRangeArray[c].end=a;break}a>this.customTimeRangeArray[c].start&&a<this.customTimeRangeArray[c].end?this.customTimeRangeArray[c].end=a:b>this.customTimeRangeArray[c].start&&b<this.customTimeRangeArray[c].end&&(this.customTimeRangeArray[c].start=b)}this.length=this.customTimeRangeArray.length}function d(a,b){var c=this.customTimeRangeArray[a],d=this.customTimeRangeArray[b];return c.start<=d.start&&d.start<=c.end&&c.end<=d.end?(c.end=d.end,this.customTimeRangeArray.splice(b,1),!0):d.start<=c.start&&c.start<=d.end&&d.end<=c.end?(c.start=d.start,this.customTimeRangeArray.splice(b,1),!0):d.start<=c.start&&c.start<=d.end&&c.end<=d.end?(this.customTimeRangeArray.splice(a,1),!0):c.start<=d.start&&d.start<=c.end&&d.end<=c.end&&(this.customTimeRangeArray.splice(b,1),!0)}function e(a){return this.customTimeRangeArray[a].start}function f(a){return this.customTimeRangeArray[a].end}var g=[],h=0;return{customTimeRangeArray:g,length:h,add:a,clear:b,remove:c,mergeRanges:d,start:e,end:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="CustomTimeRanges",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10}],150:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){if(void 0!==t)return t;t=!1;var b,c="1",d="1";try{"undefined"!=typeof window&&(b=window[a])}catch(e){return r("Warning: DOMStorage access denied: "+e.message),t}if(!b||a!==o&&a!==p)return t;try{b.setItem(c,d),b.removeItem(c),t=!0}catch(e){r("Warning: DOMStorage is supported, but cannot be used: "+e.message)}return t}function b(){a(o)&&l.forEach(function(a){var b=localStorage.getItem(a.oldKey);if(b){localStorage.removeItem(a.oldKey);try{localStorage.setItem(a.newKey,b)}catch(c){r(c.message)}}})}function c(){u=(0,i.default)(q).getInstance(),b()}function d(){var a=6e5;return Math.round((new Date).getTime()/a)*a}function e(b,c){return a(b)&&u["get"+c+"CachingInfo"]().enabled}function f(a){if(!e(o,"LastMediaSettings"))return null;var b=n.replace(/\?/,a),c=JSON.parse(localStorage.getItem(b))||{},d=(new Date).getTime()-parseInt(c.timestamp,10)>=u.getLastMediaSettingsCachingInfo().ttl||!1,f=c.settings;return d&&(localStorage.removeItem(b),f=null),f}function g(a){var b=NaN;if(e(o,"LastBitrate")){var c=m.replace(/\?/,a),d=JSON.parse(localStorage.getItem(c))||{},f=(new Date).getTime()-parseInt(d.timestamp,10)>=u.getLastBitrateCachingInfo().ttl||!1,g=parseInt(d.bitrate,10);isNaN(g)||f?f&&localStorage.removeItem(c):(b=g,r("Last saved bitrate for "+a+" was "+g))}return b}function h(a,b){if(e(o,"LastMediaSettings")){var c=n.replace(/\?/,a);try{localStorage.setItem(c,JSON.stringify({settings:b,timestamp:d()}))}catch(f){r(f.message)}}}function j(a,b){if(e(o,"LastBitrate")&&b){var c=m.replace(/\?/,a);try{localStorage.setItem(c,JSON.stringify({bitrate:b/1e3,timestamp:d()}))}catch(f){r(f.message)}}}var q=this.context,r=(0,k.default)(q).getInstance().log,s=void 0,t=void 0,u=void 0;return s={getSavedBitrateSettings:g,setSavedBitrateSettings:j,getSavedMediaSettings:f,setSavedMediaSettings:h,isSupported:a},c(),s}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(102),i=d(h),j=a(8),k=d(j),l=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}],m="dashjs_?_bitrate",n="dashjs_?_settings",o="localStorage",p="sessionStorage";e.__dashjs_factory_name="DOMStorage";var q=g.default.getSingletonFactory(e);c.default=q,b.exports=c.default},{10:10,102:102,8:8}],151:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){return o}function c(a){o=a}function d(a,b){var c=!0,d=0,e=void 0,f=void 0;if(void 0===b&&(b=!1),a.tag>16777215?(n.getUint32(o)!==a.tag&&(c=!1),d=4):a.tag>65535?(e=n.getUint16(o),f=n.getUint8(o+2),256*e+f!==a.tag&&(c=!1),d=3):a.tag>255?(n.getUint16(o)!==a.tag&&(c=!1),d=2):(n.getUint8(o)!==a.tag&&(c=!1),d=1),!c&&a.required&&!b)throw new i.default("required tag not found");return c&&(o+=d),c}function e(a,b){var c=d(a,b);return c&&h(),c}function f(a){var b=void 0;return d(a),b=h(),m[a.parse](b)}function g(a,b){var c=d(a,b),e=void 0;return c&&(e=h(),o+=e),c}function h(a){var b=1,c=128,d=8,e=-1,f=0,g=n.getUint8(o),h=void 0;for(h=0;h<d;h+=1){if((g&c)===c){f=void 0===a?g&~c:g,e=h;break}c>>=1}for(h=0;h<e;h+=1,b+=1)f=f<<8|255&n.getUint8(o+b);return o+=b,f}function j(a){var b=void 0;switch(a){case 4:b=n.getFloat32(o),o+=4;break;case 8:b=n.getFloat64(o),o+=8}return b}function k(a){var b=0,c=void 0;for(c=0;c<a;c+=1)b<<=8,b|=255&n.getUint8(o+c);return o+=a,b}function l(){return o<n.byteLength}var m=void 0,n=new DataView(a.data),o=0;return m={getPos:b,setPos:c,consumeTag:d,consumeTagAndSize:e,parseTag:f,skipOverElement:g,getMatroskaCodedNum:h,getMatroskaFloat:j,getMatroskaUint:k,moreData:l}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(163),i=d(h);e.__dashjs_factory_name="EBMLParser",c.default=g.default.getClassFactory(e),b.exports=c.default},{10:10,163:163}],152:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){l.trigger(i.default.ERROR,{error:"capability",event:a})}function b(a,b,c){l.trigger(i.default.ERROR,{error:"download",event:{id:a,url:b,request:c}})}function c(a,b,c,d){l.trigger(i.default.ERROR,{error:"manifestError",event:{message:a,id:b,manifest:c,event:d}})}function d(a,b,c){l.trigger(i.default.ERROR,{error:"cc",event:{message:a,id:b,cc:c}})}function e(a){l.trigger(i.default.ERROR,{error:"mediasource",event:a})}function f(a){l.trigger(i.default.ERROR,{error:"key_session",event:a})}function h(a){l.trigger(i.default.ERROR,{error:"key_message",event:a})}var j=void 0,k=this.context,l=(0,g.default)(k).getInstance();return j={capabilityError:a,downloadError:b,manifestError:c,timedTextError:d,mediaSourceError:e,mediaKeySessionError:f,mediaKeyMessageError:h}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(9),g=d(f),h=a(13),i=d(h),j=a(10),k=d(j),l="mediasource",m="mediakeys",n="manifest",o="SIDX",p="content",q="initialization",r="xlink",s="codec",t="parse",u="nostreams",v="parse";e.__dashjs_factory_name="ErrorHandler";var w=k.default.getSingletonFactory(e);w.CAPABILITY_ERROR_MEDIASOURCE=l,w.CAPABILITY_ERROR_MEDIAKEYS=m,w.DOWNLOAD_ERROR_ID_MANIFEST=n,w.DOWNLOAD_ERROR_ID_SIDX=o,w.DOWNLOAD_ERROR_ID_CONTENT=p,w.DOWNLOAD_ERROR_ID_INITIALIZATION=q,w.DOWNLOAD_ERROR_ID_XLINK=r,w.MANIFEST_ERROR_ID_CODEC=s,w.MANIFEST_ERROR_ID_PARSE=t,w.MANIFEST_ERROR_ID_NOSTREAMS=u,w.TIMED_TEXT_ERROR_ID_PARSE=v,c.default=w,b.exports=c.default},{10:10,13:13,9:9}],153:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){var b=a.streamId,c=a.mediaInfo.type,e=a.quality;d[b]=d[b]||{},d[b][c]=d[b][c]||{},d[b][c][e]=a}function b(a,b,c){return d[a][b][c]}function c(){d={}}var d={},e={save:a,extract:b,reset:c};return e}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="InitCache",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],154:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a&&k&&k.boxes&&0!==k.boxes.length?i(k.fetch(a)):null}function b(a){for(var b,c=k.fetchAll(a),d=[],e=0,f=c.length;e<f;e++)b=i(c[e]),b&&d.push(b);return d}function c(a){k=a}function d(){if(!k||!k.boxes||!k.boxes.length)return null;var a=k.boxes[k.boxes.length-1].type,c=b(a);return c[c.length-1]}function e(){return k._cursor.offset}function f(){l={offset:"_offset",size:"size",type:"type"},m={references:"references",timescale:"timescale",earliest_presentation_time:"earliest_presentation_time",first_offset:"first_offset"},n={reference_type:"reference_type",referenced_size:"referenced_size",subsegment_duration:"subsegment_duration"},o={id:"id",value:"value",timescale:"timescale",scheme_id_uri:"scheme_id_uri",presentation_time_delta:"presentation_time_delta",event_duration:"event_duration",message_data:"message_data"},p={timescale:"timescale"},q={sequence_number:"sequence_number"},r={samples_with_subsamples:"samples_with_subsamples"},s={base_data_offset:"base_data_offset",sample_description_index:"sample_description_index",default_sample_duration:"default_sample_duration",default_sample_size:"default_sample_size",default_sample_flags:"default_sample_flags",flags:"flags"},t={version:"version",baseMediaDecodeTime:"baseMediaDecodeTime",flags:"flags"},u={sample_count:"sample_count",first_sample_flags:"first_sample_flags",data_offset:"data_offset",flags:"flags",samples:"samples"},v={sample_size:"sample_size",sample_duration:"sample_duration",sample_composition_time_offset:"sample_composition_time_offset"}}function h(a,b,c){for(var d in c)b[d]=a[c[d]]}function i(a){if(!a)return null;var b,c,d=new g.default;switch(h(a,d,l),a.hasOwnProperty("_incomplete")&&(d.isComplete=!a._incomplete),d.type){case"sidx":if(h(a,d,m),d.references)for(b=0,c=d.references.length;b<c;b++)h(a.references[b],d.references[b],n);break;case"emsg":h(a,d,o);break;case"mdhd":h(a,d,p);break;case"mfhd":h(a,d,q);break;case"subs":h(a,d,r);break;case"tfhd":h(a,d,s);break;case"tfdt":h(a,d,t);break;case"trun":if(h(a,d,u),d.samples)for(b=0,c=d.samples.length;b<c;b++)h(a.samples[b],d.samples[b],v)}return d}var j=void 0,k=void 0,l=void 0,m=void 0,n=void 0,o=void 0,p=void 0,q=void 0,r=void 0,s=void 0,t=void 0,u=void 0,v=void 0;return j={getBox:a,getBoxes:b,setData:c,getLastBox:d,getOffset:e},f(),j}Object.defineProperty(c,"__esModule",{value:!0});var f=a(166),g=d(f),h=a(10),i=d(h);e.__dashjs_factory_name="IsoFile",c.default=i.default.getClassFactory(e),b.exports=c.default},{10:10,166:166}],155:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){e=a,f=b}function b(){var a=f.getCurrentRepresentationInfo(),b=a.DVRWindow.end;return a.useCalculatedLiveEdgeTime&&(b=e.getExpectedLiveEdge(),e.setClientTimeOffset(b-a.DVRWindow.end)),b}function c(){e=null,f=null}var d=void 0,e=void 0,f=void 0;return d={initialize:a,getLiveEdge:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="LiveEdgeFinder";var h=g.default.getSingletonFactory(e);c.default=h,b.exports=c.default},{10:10}],156:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){return JSON.stringify(a)===JSON.stringify(b)}var b=void 0;return b={areSimpleEquivalent:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="ObjectUtils",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],157:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a}function b(a){return a}var c=void 0;return c={modifyRequestURL:a,modifyRequestHeader:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="RequestModifier",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],158:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){a&&a.videoModel&&(da=a.videoModel)}function b(a){if(a.hasOwnProperty("begin")&&a.hasOwnProperty("end")){var b=o(a.begin),c=o(a.end);return[b,c]}return null}function c(){var a="cue_TTML_"+fa;return fa++,a}function d(a,b,c){function d(a,b){if(a.hasOwnProperty(b)){var c=a[b];f.indexOf(c)<0&&f.push(c)}}for(var e=[],f=[],g=[],h=0;h<a.length;h++){var i=a[h];d(i,"begin"),d(i,"end")}if(0===f.length)return g;if("undefined"!=typeof b&&"undefined"!=typeof c){for(var h=0;h<f.length;h++){var j=o(f[h]);b<j&&j<c&&e.push(j)}e.push(b),e.push(c)}else for(var h=0;h<f.length;h++)e.push(o(f[h]));e.sort(function(a,b){return a-b});for(var h=0;h<e.length-1;h++)g.push([e[h],e[h+1]]);return g}function e(a,b){return"undefined"!=typeof startInterval&&a<b&&(a=b),a}function f(a,b){return"undefined"!=typeof b&&a>b&&(a=b),a}function g(a,b,c){var d=o(a.begin),g=o(a.end);return d=e(d,b),g=f(g,c),"undefined"!=typeof b&&"undefined"!=typeof c&&(g<b||d>c)?(N("TTML: Cue "+d+"-"+g+" outside interval "+b+"-"+c),null):[d,g]}function h(a,c){var d=!0;if(a.hasOwnProperty("span")){var e=b(a.span);null!==e&&(d=e[0]<c[1]&&e[1]>c[0])}return d}function j(a,e,f,i){var j=void 0,k=void 0,l=void 0,m=void 0,n=void 0,o=void 0,r="";if(Q=ea.xml_str2json(a),!Q)throw new Error("TTML document could not be parsed");if(da.getTTMLRenderingDiv()&&(n="html"),j=Q.tt,!j)throw new Error("TTML document lacks tt element");var s=p(j,"http://www.w3.org/ns/ttml");if(s&&q(j,s),m=j["tts:extent"],k=j.head,!k)throw new Error("TTML document lacks head element");k.layout&&(S=k.layout.region_asArray),k.styling&&(R=k.styling.style_asArray);var t={};if(i)for(o=0;o<i.length;o++){var x="urn:mpeg:14496-30:subs:"+(o+1).toString(),y="data:image/png;base64,"+btoa(i[o]);t[x]=y}if(k.metadata){var z=k.metadata.image_asArray;if(z)for(o=0;o<z.length;o++){var x="#"+z[o]["xml:id"],A=z[o].imagetype.toLowerCase(),y="data:image/"+A+";base64,"+z[o].__text;t[x]=y}}if(l=j.body,!l)throw new Error("TTML document lacks body element");var B=G(),F=da.getElement().clientWidth,L=da.getElement().clientHeight,M=[F/B[0],L/B[1]];X["font-size"]=M[1]+"px;";var O=[];if(S)for(o=0;o<S.length;o++)O.push(D(JSON.parse(JSON.stringify(S[o])),M));var P=p(Q.tt,"http://www.w3.org/ns/ttml#parameter");j.hasOwnProperty(P+":frameRate")&&(j.frameRate=parseInt(j[P+":frameRate"],10));for(var W=[],Y=j.body_asArray[0].__children,Z=0;Z<Y.length;Z++){var $=Y[Z].div,_=null;if(null===(_=b($))){var aa=$.p_asArray;if(null===_&&(!aa||0===aa.length))return r="TTML has div that contains no timing and no paragraphs.",N(r),W;for(var ba=0;ba<aa.length;ba++){var ca=aa[ba],fa=ca.span_asArray,ga=[];if(ca.hasOwnProperty("begin")&&ca.hasOwnProperty("end")){var ha=g(ca,e,f);null!==ha&&ga.push(ha)}else ga=d(fa,e,f);if(0!==ga.length)for(var ia=ca.__children,ja=0;ja<ga.length;ja++){for(var ka=ga[ja],la=[],ma=0;ma<ia.length;ma++){var na=ia[ma];h(na,ka)&&la.push(na)}if(0!==la.length)if("html"===n){U={},V={},T={};var oa=J(ca,$,M),pa=K(ca,M),qa=pa[1];pa=pa[0];var ra=document.createElement("div");ra.className=qa;var sa=I(la,M);sa.className="cueDirUniWrapper",u("unicode-bidi",pa)&&(sa.style.cssText+=v("unicode-bidi",pa),w("unicode-bidi",pa)),u("direction",pa)&&(sa.style.cssText+=v("direction",pa),w("direction",pa)),u("padding-left",pa)&&u("padding-right",pa)&&(sa.innerHTML=H(sa,pa)),u("padding-left",pa)&&u("padding-right",pa)&&(w("padding-left",pa),w("padding-right",pa));var ta="";if(u("regionID",oa)){var ua=v("regionID",oa);ta=ua.slice(ua.indexOf(":")+1,ua.length-1)}pa&&(ra.style.cssText=pa.join(" ")+"display:flex;"),oa&&(oa=oa.join(" ")),ra.appendChild(sa);var va=document.createElement("div");va.appendChild(ra),va.id=c(),va.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+oa,0===Object.keys(T).length&&(T.defaultFontSize="100"),W.push({start:ka[0],end:ka[1],type:"html",cueHTMLElement:va,regions:O,regionID:ta,cueID:va.id,videoHeight:L,videoWidth:F,cellResolution:B,fontSize:T||{defaultFontSize:"100"},lineHeight:U,linePadding:V})}else{var wa="",xa=la;xa.length&&xa.forEach(function(a){if(a.hasOwnProperty("span")){var b=a.span.__children;b.forEach(function(a){b.hasOwnProperty("metadata")||(a.hasOwnProperty("#text")?wa+=a["#text"].replace(/[\r\n]+/gm," ").trim():"br"in a&&(wa+="\n"))})}else wa+=a.hasOwnProperty("br")?"\n":a["#text"].replace(/[\r\n]+/gm," ").trim()}),W.push({start:ka[0],end:ka[1],data:wa,type:"text"})}}else r="TTML: Empty paragraph"}}else{var ya=void 0;if($.region){var za=E(S,$.region);ya=C(za,m)}ya||(ya=C($,m));var Aa=$["smpte:backgroundImage"];void 0!==Aa&&void 0!==t[Aa]&&W.push({start:_[0],end:_[1],id:c(),data:t[Aa],type:"image",layout:ya})}}if(""!==r&&N(r),W.length>0)return W;throw new Error(r)}function n(){P=/^([0-9][0-9]+):([0-5][0-9]):([0-5][0-9])|(60)(\.([0-9])+)?$/,T={},U={},V={},W={top:"auto;",left:"auto;",width:"90%;",height:"10%;","align-items":"flex-start;",overflow:"visible;","-ms-writing-mode":"lr-tb, horizontal-tb;","-webkit-writing-mode":"horizontal-tb;","-moz-writing-mode":"horizontal-tb;","writing-mode":"horizontal-tb;"},X={color:"rgb(255,255,255);",direction:"ltr;","font-family":"monospace, sans-serif;","font-style":"normal;","line-height":"normal;","font-weight":"normal;","text-align":"start;","justify-content":"flex-start;","text-decoration":"none;","unicode-bidi":"normal;","white-space":"normal;",width:"100%;"},Y={monospace:"font-family: monospace;",sansSerif:"font-family: sans-serif;",serif:"font-family: serif;",monospaceSansSerif:"font-family: monospace, sans-serif;",monospaceSerif:"font-family: monospace, serif;",proportionalSansSerif:"font-family: Arial;",proportionalSerif:"font-family: Times New Roman;",default:"font-family: monospace, sans-serif;"},Z={right:["justify-content: flex-end;","text-align: right;"],start:["justify-content: flex-start;","text-align: start;"],center:["justify-content: center;","text-align: center;"],end:["justify-content: flex-end;","text-align: end;"],left:["justify-content: flex-start;","text-align: left;"]},$={start:"text-align: start;",center:"text-align: center;",end:"text-align: end;",auto:""},_={wrap:"white-space: normal;",noWrap:"white-space: nowrap;"},aa={normal:"unicode-bidi: normal;",embed:"unicode-bidi: embed;",bidiOverride:"unicode-bidi: bidi-override;"},ba={before:"align-items: flex-start;",center:"align-items: center;",after:"align-items: flex-end;"},ca={lrtb:"-webkit-writing-mode: horizontal-tb;writing-mode: horizontal-tb;",rltb:"-webkit-writing-mode: horizontal-tb;writing-mode: horizontal-tb;direction: rtl;unicode-bidi: bidi-override;",tbrl:"-webkit-writing-mode: vertical-rl;writing-mode: vertical-rl;-webkit-text-orientation: upright;text-orientation: upright;",tblr:"-webkit-writing-mode: vertical-lr;writing-mode: vertical-lr;-webkit-text-orientation: upright;text-orientation: upright;",lr:"-webkit-writing-mode: horizontal-tb;writing-mode: horizontal-tb;",rl:"-webkit-writing-mode: horizontal-tb;writing-mode: horizontal-tb;direction: rtl;",tb:"-webkit-writing-mode: vertical-rl;writing-mode: vertical-rl;-webkit-text-orientation: upright;text-orientation: upright;"},ea=new i.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,matchers:[]})}function o(a){var b,c,d,e=P.test(a);if(!e)return NaN;if(b=a.split(":"),c=parseFloat(b[0])*l+parseFloat(b[1])*m+parseFloat(b[2]),b[3]){if(d=Q.tt.frameRate,!d||isNaN(d))return NaN;c+=parseFloat(b[3])/d}return c}function p(a,b){var c=Object.keys(a).filter(function(c){return("xmlns"===c.split(":")[0]||"xmlns"===c.split(":")[1])&&a[c]===b}).map(function(a){return a.split(":")[2]||a.split(":")[1]});return 1!=c.length?null:c[0]}function q(a,b){for(var c in a)if(a.hasOwnProperty(c)){if(("object"==typeof a[c]||a[c]instanceof Object)&&!Array.isArray(a[c]))q(a[c],b);else if(Array.isArray(a[c]))for(var d=0;d<a[c].length;d++)q(a[c][d],b);var e=b+":",f=c.indexOf(e);if(f>=0){var g=c.slice(f+e.length);a[g]=a[c],delete a[c]}}}function r(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function s(a){var b=a.slice(1),c=b.match(/.{2}/g),d=parseFloat(parseInt(parseInt(c[3],16)/255*1e3,10)/1e3),e=c.slice(0,3).map(function(a){return parseInt(a,16)});return"rgba("+e.join(",")+","+d+");"}function t(a){var b=void 0,c=void 0,d=void 0;return b=a.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(","),c=parseInt(b[b.length-1],10)/255,d="rgba("+b[0]+","+b[1]+","+b[2]+","+c+");"}function u(a,b){for(var c=0;c<b.length;c++)if(b[c].indexOf(a)>-1)return!0;return!1}function v(a,b){for(var c=0;c<b.length;c++)if(b[c].indexOf(a)>-1)return b[c];return null}function w(a,b){b.splice(b.indexOf(v(a,b)),1)}function x(a,b){for(var c=0;c<a.length;c++)for(var d=0;d<b.length;d++)a[c]&&a[c].split(":")[0].indexOf(b[d].split(":")[0])>-1&&a.splice(c,1);return a.concat(b)}function y(a){var b=new Array(2),c=a.indexOf(":")===-1?0:a.indexOf(":"),d=void 0;return a.indexOf("%")===-1?a.indexOf("c")===-1?a.indexOf("p")===-1?b[0]=b[1]=null:(b[0]="p",d=a.indexOf("p")):(b[0]="c",d=a.indexOf("c")):(b[0]="%",d=a.indexOf("%")),b[1]=a.slice(c,d),b}function z(a,b,c){var d,e,f=[];for(var g in a)if(a.hasOwnProperty(g)){var h=g.replace("ebutts:","");h=h.replace("xml:",""),h=h.replace("tts:",""),h=r(h),a[h]=a[g],delete a[g]}if("line-padding"in a){var i=parseFloat(a["line-padding"].slice(a["line-padding"].indexOf(":")+1,a["line-padding"].indexOf("c")));"id"in a&&(V[a.id]=i);var j=i*b[0]+"px;";f.push("padding-left:"+j),f.push("padding-right:"+j)}if("font-size"in a){var k=y(a["font-size"]),l=parseFloat(k[1]);"id"in a&&(T[a.id]=k),"%"===k[0]?d=l/100*b[1]+"px;":"c"===k[0]&&(d=l*b[1]+"px;"),f.push("font-size:"+d)}if("line-height"in a)if("normal"===a["line-height"])f.push("line-height: normal;");else{var m=y(a["line-height"]),n=parseFloat(m[1]);"id"in a&&(U[a.id]=m),"%"===m[0]?e=n/100*b[1]+"px;":"c"===m[0]&&(e=n*b[1]+"px;"),f.push("line-height:"+e)}"font-family"in a&&(a["font-family"]in Y?f.push(Y[a["font-family"]]):f.push("font-family:"+a["font-family"]+";")),"text-align"in a&&a["text-align"]in Z&&(f.push(Z[a["text-align"]][0]),f.push(Z[a["text-align"]][1])),"multi-row-align"in a&&(u("text-align",f)&&"auto"!=a["multi-row-align"]&&w("text-align",f),a["multi-row-align"]in $&&f.push($[a["multi-row-align"]]));var o;return"background-color"in a&&(o=a["background-color"].indexOf("#")>-1&&a["background-color"].length-1===8?s(a["background-color"]):a["background-color"].indexOf("rgba")>-1?t(a["background-color"]):a["background-color"]+";",f.push("background-color: "+o)),"color"in a&&(o=a.color.indexOf("#")>-1&&a.color.length-1===8?s(a.color):a.color.indexOf("rgba")>-1?t(a.color):a.color+";",f.push("color: "+o)),"wrap-option"in a&&(a["wrap-option"]in _?f.push(_[a["wrap-option"]]):f.push("white-space:"+a["wrap-option"])),"unicode-bidi"in a&&(a["unicode-bidi"]in aa?f.push(aa[a["unicode-bidi"]]):f.push("unicode-bidi:"+a["unicode-bidi"])),"font-style"in a&&f.push("font-style:"+a["font-style"]+";"),"font-weight"in a&&f.push("font-weight:"+a["font-weight"]+";"),"direction"in a&&f.push("direction:"+a.direction+";"),"text-decoration"in a&&f.push("text-decoration:"+a["text-decoration"]+";"),c&&(f=f.concat(D(a,b))),Q.tt.hasOwnProperty("xml:space")&&"preserve"===Q.tt["xml:space"]&&f.push("white-space: pre;"),f}function A(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(d["xml:id"]===b||d.id===b)return d}return null}function B(a,b,c){var d=[],e=a.match(/\S+/g);return e.forEach(function(a){var e=A(R,a);if(e){var f=z(JSON.parse(JSON.stringify(e)),b,c);d=d.concat(f)}}),d}function C(a,b){var c=/([\d\.]+)(%|px)\s+([\d\.]+)(%|px)/;if("tts:extent"in a&&"tts:origin"in a){var d=c.exec(a["tts:extent"]),e=c.exec(a["tts:origin"]);if(null===d||null===e)return N("Bad extent or origin: "+a["tts:extent"]+" "+a["tts:origin"]),null;var f=parseFloat(d[1]),g=parseFloat(d[3]),h=parseFloat(e[1]),i=parseFloat(e[3]);if(b){var j=c.exec(b);if(null===j||"px"!==j[2]||"px"!==j[4])return N("Bad tt.extent: "+b),null;var k=parseFloat(j[1]),l=parseFloat(j[3]);"px"===d[2]&&(f=f/k*100),"px"===d[4]&&(g=g/l*100),"px"===e[2]&&(h=h/k*100),"px"===e[4]&&(i=i/l*100)}return{left:h,top:i,width:f,height:g}}return null}function D(a,b){var c=[];for(var d in a){var e=d.replace("tts:","");e=e.replace("xml:",""),e=r(e),a[e]=a[d],e!==d&&delete a[d]}if("extent"in a){var f=a.extent.split(/\s/);c.push("width: "+f[0]+";"),c.push("height: "+f[1]+";")}if("origin"in a){var g=a.origin.split(/\s/);c.push("left: "+g[0]+";"),c.push("top: "+g[1]+";")}if("display-align"in a&&c.push(ba[a["display-align"]]),"writing-mode"in a&&c.push(ca[a["writing-mode"]]),"style"in a){var h=B(a.style,b,!0);c=c.concat(h)}return"padding"in a&&c.push("padding:"+a.padding+";"),"overflow"in a&&c.push("overflow:"+a.overflow+";"),"show-background"in a&&c.push("show-background:"+a["show-background"]+";"),"id"in a&&c.push("regionID:"+a.id+";"),c}function E(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(d["xml:id"]===b||d.id===b)return d}return null}function F(a,b){var c=[],d=a.match(/\S+/g);return d.forEach(function(a){var d=E(S,a);if(d){var e=D(JSON.parse(JSON.stringify(d)),b);c=c.concat(e)}}),c}function G(){var a=[32,15];return Q.tt.hasOwnProperty("ttp:cellResolution")?Q.tt["ttp:cellResolution"].split(" ").map(parseFloat):a}function H(a,b){for(var c=v("padding-left",b),d=v("padding-right",b),e=c.concat(" "+d+" "),f="",g="",h="",i=Array.prototype.slice.call(a.children),j=a.getElementsByClassName("lineBreak")[0],k=i.indexOf(j),l=[];k!=-1;)l.push(k),k=i.indexOf(j,k+1);var m="</span>",n="<br>",o='<span class="spanPadding" style="-webkit-box-decoration-break: clone; box-decoration-break: clone; ';if(l.length)l.forEach(function(a,b){if(0===b){for(var c="",d=0;d<a;d++)f+=i[d].outerHTML,0===d&&(c=e.concat(i[d].style.cssText));f=o+c+'">'+f}for(var j="",k=a+1;k<i.length;k++)g+=i[k].outerHTML,k===i.length-1&&(j+=e.concat(i[k].style.cssText));g=o+j+'">'+g,f&&g&&b===l.length-1?h+=f+m+n+g+m:f&&g&&b!==l.length-1?h+=f+m+n+g+m+n:f&&!g?h+=f+m:!f&&g&&b===l.length-1?h+=g+m:!f&&g&&b!==l.length-1&&(h+=g+m+n)});else{for(var p="",q=0;q<i.length;q++)p+=i[q].style.cssText;h=o+e+p+'">'+a.innerHTML+m}return h}function I(a,b){var c=document.createElement("div");return a.forEach(function(a){if(!a.hasOwnProperty("metadata"))if(a.hasOwnProperty("span")){var d=a.span.__children,e=document.createElement("span");if(a.span.hasOwnProperty("style")){var f=B(a.span.style,b);e.className="spanPadding "+a.span.style,e.style.cssText=f.join(" ")}d.forEach(function(a){if(!d.hasOwnProperty("metadata"))if(a.hasOwnProperty("#text")){var b=document.createTextNode(a["#text"]);e.appendChild(b)}else if("br"in a){e.hasChildNodes()&&c.appendChild(e);var f=document.createElement("br");f.className="lineBreak",c.appendChild(f);var g=document.createElement("span");g.className=e.className,g.style.cssText=e.style.cssText,e=g}}),c.appendChild(e)}else if(a.hasOwnProperty("br")){var g=document.createElement("br");g.className="lineBreak",c.appendChild(g)}else if(a.hasOwnProperty("#text")){var h=document.createElement("span");h.textContent=a["#text"],c.appendChild(h)}}),c}function J(a,b,c){var d,e,f=[],g=a.region,h=b.region;return h&&(d=F(h,c)),g?(e=f.concat(F(g,c)),f=d?x(d,e):e):d&&(f=d),L(f,W),f}function K(a,b){var c,d,e,f=[],g=a.style,h=Q.tt.body.style,i=Q.tt.body.div.style,j="";return h&&(c=B(h,b),j="paragraph "+h),i&&(d=B(i,b),c?(d=x(c,d),j+=" "+i):j="paragraph "+i),g?(e=B(g,b),c&&d?(f=x(d,e),j+=" "+g):c?(f=x(c,e),j+=" "+g):d?(f=x(d,e),j+=" "+g):(f=e,j="paragraph "+g)):c&&!d?f=c:!c&&d&&(f=d),L(f,X),[f,j]}function L(a,b){for(var c in b)b.hasOwnProperty(c)&&(u(c,a)||a.push(c+":"+b[c]))}var M=this.context,N=(0,k.default)(M).getInstance().log,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0,V=void 0,W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0,fa=0;return O={parse:j,setConfig:a},n(),O}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(4),i=d(h),j=a(8),k=d(j),l=3600,m=60;e.__dashjs_factory_name="TTMLParser",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10,4:4,8:8}],159:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){try{new window.URL("x","http://y");h=l}catch(a){}finally{h=h||m}}function b(a){var b=a.indexOf("/"),c=a.lastIndexOf("/");return b!==-1?c===b+1?a:(a.indexOf("?")!==-1&&(a=a.substring(0,a.indexOf("?"))),a.substring(0,c+1)):""}function c(a){var b=a.match(k);return b?b[1]:""}function d(a){return!i.test(a)}function e(a){return d(a)&&"/"===a.charAt(0)}function f(a){return j.test(a)}function g(a,b){return h(a,b)}var h=void 0,i=/^[a-z][a-z0-9+\-.]*:/i,j=/^https?:\/\//i,k=/^([a-z][a-z0-9+\-.]*:\/\/[^\/]+)\/?/i,l=function(a,b){try{return new window.URL(a,b).toString()}catch(c){return a}},m=function(a,f){var g=b;if(!f)return a;if(!d(a))return a;e(a)&&(g=c);var h=g(f),i="/"!==h.charAt(h.length-1)&&"/"!==a.charAt(0)?"/":"";return[h,a].join(i)};a();var n={parseBaseUrl:b,parseOrigin:c,isRelative:d,isPathAbsolute:e,isHTTPURL:f,resolve:g};return n}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f);e.__dashjs_factory_name="URLUtils",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10}],160:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){k=/(?:\r\n|\r|\n)/gm,l=/-->/,m=/(^[\s]+|[\s]+$)/g,n=/\s\b/g}function b(a){var b,e,g=[];a=a.split(k),b=a.length,e=-1;for(var i=0;i<b;i++){var j=a[i];if(j.length>0&&"WEBVTT"!==j&&j.match(l)){var n=d(j),o=n.cuePoints,p=n.styles,q=f(a,i+1),r=c(o[0].replace(m,"")),s=c(o[1].replace(m,""));!isNaN(r)&&!isNaN(s)&&r>=e&&s>r?""!==q?(e=r,g.push({start:r,end:s,data:q,styles:p})):h("Skipping cue due to empty/malformed cue text"):h("Skipping cue due to incorrect cue timing")}}return g}function c(a){var b=a.split(":"),c=b.length-1;return a=60*parseInt(b[c-1],10)+parseFloat(b[c]),2===c&&(a+=3600*parseInt(b[0],10)),a}function d(a){var b=a.split(l),c=b[1].split(n);return c.shift(),b[1]=c[0],c.shift(),{cuePoints:b,styles:e(c)}}function e(a){var b={};return a.forEach(function(a){if(a.split(/:/).length>1){var c=a.split(/:/)[1];c&&c.search(/%/)!=-1&&(c=parseInt(c.replace(/%/,""),10)),(a.match(/align/)||a.match(/A/))&&(b.align=c),(a.match(/line/)||a.match(/L/))&&(b.line=c),(a.match(/position/)||a.match(/P/))&&(b.position=c), -(a.match(/size/)||a.match(/S/))&&(b.size=c)}}),b}function f(a,b){for(var c,d=b,e="",f="";""!==a[d]&&d<a.length;)d++;if(c=d-b,c>1)for(var g=0;g<c;g++){if(f=a[b+g],f.match(l)){e="";break}e+=f,g!==c-1&&(e+="\n")}else f=a[b],f.match(l)||(e=f);return decodeURI(e)}var g=this.context,h=(0,i.default)(g).getInstance().log,j=void 0,k=void 0,l=void 0,m=void 0,n=void 0;return j={parse:b},a(),j}Object.defineProperty(c,"__esModule",{value:!0});var f=a(10),g=d(f),h=a(8),i=d(h);e.__dashjs_factory_name="VTTParser",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{10:10,8:8}],161:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.qualityIndex=NaN};c.default=e,b.exports=c.default},{}],162:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.streamId=null,this.mediaInfo=null,this.segmentType=null,this.quality=NaN,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN};c.default=e,b.exports=c.default},{}],163:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e){d(this,a),this.code=b||null,this.message=c||null,this.data=e||null};c.default=e,b.exports=c.default},{}],164:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.action=a.ACTION_DOWNLOAD,this.startTime=NaN,this.mediaType=null,this.mediaInfo=null,this.type=null,this.duration=NaN,this.timescale=NaN,this.range=null,this.url=null,this.serviceLocation=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.quality=NaN,this.index=NaN,this.availabilityStartTime=null,this.availabilityEndTime=null,this.wallStartTime=null,this.bytesLoaded=NaN,this.bytesTotal=NaN,this.delayLoadingTime=NaN,this.responseType="arraybuffer"};e.ACTION_DOWNLOAD="download",e.ACTION_COMPLETE="complete",c.default=e,b.exports=c.default},{}],165:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(164),i=d(h),j=function(a){function b(a){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.url=a||null,this.checkForExistenceOnly=!0}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{164:164}],166:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.offset=NaN,this.type=null,this.size=NaN,this.isComplete=!0};c.default=e,b.exports=c.default},{}],167:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.DVRWindowSize=NaN,this.loadedTime=null,this.availableFrom=null,this.minBufferTime=NaN,this.duration=NaN,this.isDynamic=!1,this.maxFragmentDuration=null};c.default=e,b.exports=c.default},{}],168:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.index=null,this.type=null,this.streamInfo=null,this.representationCount=0,this.lang=null,this.viewpoint=null,this.accessibility=null,this.audioChannelConfiguration=null,this.roles=null,this.codec=null,this.mimeType=null,this.contentProtection=null,this.isText=!1,this.KID=null,this.bitrateList=null};c.default=e,b.exports=c.default},{}],169:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[],this.BolaState=[]};c.default=e,b.exports=c.default},{}],170:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.index=null,this.start=NaN,this.duration=NaN,this.manifestInfo=null,this.isLast=!0,this.isFirst=!0};c.default=e,b.exports=c.default},{}],171:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(164),i=d(h),j=function(a){function b(a,c){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.url=a||null,this.type=c||null,this.mediaType="stream",this.responseType="text"}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{164:164}],172:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.video=null,this.captionData=null,this.label=null,this.lang=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1};c.default=e,b.exports=c.default},{}],173:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.quality=null,this.DVRWindow=null,this.fragmentDuration=null,this.mediaInfo=null,this.MSETimeOffset=null};c.default=e,b.exports=c.default},{}],174:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null};c.default=e,b.exports=c.default},{}],175:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this._s=void 0};c.default=e,b.exports=c.default},{}],176:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.t=null,this.level=null};c.default=e,b.exports=c.default},{}],177:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var f=a(64),g=d(f),h=function a(){e(this,a),this.target=null,this.state=g.default.BUFFER_EMPTY};c.default=h,b.exports=c.default},{64:64}],178:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.time=null,this.range=null,this.manifestInfo=null};c.default=e,b.exports=c.default},{}],179:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.time=null,this.droppedFrames=null};c.default=e,b.exports=c.default},{}],180:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this._stream=null,this._tfinish=null,this._mediaduration=null,this._responseHeaders=null,this._serviceLocation=null},f=function a(){d(this,a),this.s=null,this.d=null,this.b=[]};e.MPD_TYPE="MPD",e.XLINK_EXPANSION_TYPE="XLinkExpansion",e.INIT_SEGMENT_TYPE="InitializationSegment",e.INDEX_SEGMENT_TYPE="IndexSegment",e.MEDIA_SEGMENT_TYPE="MediaSegment",e.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",e.OTHER_TYPE="other",c.HTTPRequest=e,c.HTTPRequestTrace=f},{}],181:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.trackInfo=[]},f=function a(){d(this,a),this.id=null,this.index=null,this.start=null,this.duration=null},g=function a(){d(this,a),this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null};c.ManifestUpdate=e,c.ManifestUpdateStreamInfo=f,c.ManifestUpdateTrackInfo=g},{}],182:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.start=null,this.mstart=null,this.starttype=null,this.trace=[]};e.INITIAL_PLAYOUT_START_REASON="initial_playout",e.SEEK_START_REASON="seek",e.RESUME_FROM_PAUSE_START_REASON="resume",e.METRICS_COLLECTION_START_REASON="metrics_collection_start";var f=function a(){d(this,a),this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null};f.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",f.REBUFFERING_REASON="rebuffering",f.USER_REQUEST_STOP_REASON="user_request",f.END_OF_PERIOD_STOP_REASON="end_of_period",f.END_OF_CONTENT_STOP_REASON="end_of_content",f.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",f.FAILURE_STOP_REASON="failure",c.PlayList=e,c.PlayListTrace=f},{}],183:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.t=null,this.mt=null,this.to=null,this.lto=null};c.default=e,b.exports=c.default},{}],184:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.loadingRequests=[],this.executedRequests=[]};c.default=e,b.exports=c.default},{}],185:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null};c.default=e,b.exports=c.default},{}],186:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.tcpid=null,this.dest=null,this.topen=null,this.tclose=null,this.tconnect=null};c.default=e,b.exports=c.default},{}]},{},[5]); +/*! v2.9.2-a77e5268, 2018-10-29T22:03:48Z */ +!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c,d){"use strict";var e={};e.encode=function(a){for(var b=[],c=0;c<a.length;++c){var d=a.charCodeAt(c);d<128?b.push(d):d<2048?(b.push(192|d>>6),b.push(128|63&d)):d<65536?(b.push(224|d>>12),b.push(128|63&d>>6),b.push(128|63&d)):(b.push(240|d>>18),b.push(128|63&d>>12),b.push(128|63&d>>6),b.push(128|63&d))}return b},e.decode=function(a){for(var b=[],c=0;c<a.length;){var d=a[c++];d<128||(d<224?(d=(31&d)<<6,d|=63&a[c++]):d<240?(d=(15&d)<<12,d|=(63&a[c++])<<6,d|=63&a[c++]):(d=(7&d)<<18,d|=(63&a[c++])<<12,d|=(63&a[c++])<<6,d|=63&a[c++])),b.push(String.fromCharCode(d))}return b.join("")};var f={};!function(b){var c=function(a){for(var c=0,d=[],e=0|a.length/3;0<e--;){var f=(a[c]<<16)+(a[c+1]<<8)+a[c+2];c+=3,d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push(b.charAt(63&f>>6)),d.push(b.charAt(63&f))}if(2==a.length-c){var f=(a[c]<<16)+(a[c+1]<<8);d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push(b.charAt(63&f>>6)),d.push("=")}else if(1==a.length-c){var f=a[c]<<16;d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push("==")}return d.join("")},d=function(){for(var a=[],c=0;c<b.length;++c)a[b.charCodeAt(c)]=c;return a["=".charCodeAt(0)]=0,a}(),g=function(a){for(var b=0,c=[],e=0|a.length/4;0<e--;){var f=(d[a.charCodeAt(b)]<<18)+(d[a.charCodeAt(b+1)]<<12)+(d[a.charCodeAt(b+2)]<<6)+d[a.charCodeAt(b+3)];c.push(255&f>>16),c.push(255&f>>8),c.push(255&f),b+=4}return c&&("="==a.charAt(b-2)?(c.pop(),c.pop()):"="==a.charAt(b-1)&&c.pop()),c},h={};h.encode=function(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b},h.decode=function(b){for(var c=0;c<s.length;++c)a[c]=String.fromCharCode(a[c]);return a.join("")},f.decodeArray=function(a){var b=g(a);return new Uint8Array(b)},f.encodeASCII=function(a){var b=h.encode(a);return c(b)},f.decodeASCII=function(a){var b=g(a);return h.decode(b)},f.encode=function(a){var b=e.encode(a);return c(b)},f.decode=function(a){var b=g(a);return e.decode(b)}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),void 0!==d&&(d.decode=f.decode,d.decodeArray=f.decodeArray,d.encode=f.encode,d.encodeASCII=f.encodeASCII)},{}],2:[function(a,b,c){"use strict";!function(a){var b={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},c=function(a){var c=a;return b.hasOwnProperty(a)&&(c=b[a]),String.fromCharCode(c)},d=15,e=32,f={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},g={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},i={25:2,26:4,29:6,30:8,31:10,27:13,28:15},j=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],k={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(a){this.time=a},log:function(a,b){var c=this.verboseFilter[a];this.verboseLevel>=c&&console.log(this.time+" ["+a+"] "+b)}},l=function(a){for(var b=[],c=0;c<a.length;c++)b.push(a[c].toString(16));return b},m=function(a,b,c,d,e){this.foreground=a||"white",this.underline=b||!1,this.italics=c||!1,this.background=d||"black",this.flash=e||!1};m.prototype={reset:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},setStyles:function(a){for(var b=["foreground","underline","italics","background","flash"],c=0;c<b.length;c++){var d=b[c];a.hasOwnProperty(d)&&(this[d]=a[d])}},isDefault:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},equals:function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},copy:function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},toString:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}};var n=function(a,b,c,d,e,f){this.uchar=a||" ",this.penState=new m(b,c,d,e,f)};n.prototype={reset:function(){this.uchar=" ",this.penState.reset()},setChar:function(a,b){this.uchar=a,this.penState.copy(b)},setPenState:function(a){this.penState.copy(a)},equals:function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},copy:function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},isEmpty:function(){return" "===this.uchar&&this.penState.isDefault()}};var o=function(){this.chars=[];for(var a=0;a<e;a++)this.chars.push(new n);this.pos=0,this.currPenState=new m};o.prototype={equals:function(a){for(var b=!0,c=0;c<e;c++)if(!this.chars[c].equals(a.chars[c])){b=!1;break}return b},copy:function(a){for(var b=0;b<e;b++)this.chars[b].copy(a.chars[b])},isEmpty:function(){for(var a=!0,b=0;b<e;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},setCursor:function(a){this.pos!==a&&(this.pos=a),this.pos<0?(k.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>e&&(k.log("ERROR","Too large cursor position "+this.pos),this.pos=e)},moveCursor:function(a){var b=this.pos+a;if(a>1)for(var c=this.pos+1;c<b+1;c++)this.chars[c].setPenState(this.currPenState);this.setCursor(b)},backSpace:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},insertChar:function(a){a>=144&&this.backSpace();var b=c(a);if(this.pos>=e)return void k.log("ERROR","Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},clearFromPos:function(a){var b;for(b=a;b<e;b++)this.chars[b].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var a=[],b=!0,c=0;c<e;c++){var d=this.chars[c].uchar;" "!==d&&(b=!1),a.push(d)}return b?"":a.join("")},setPenStyles:function(a){this.currPenState.setStyles(a),this.chars[this.pos].setPenState(this.currPenState)}};var p=function(){this.rows=[];for(var a=0;a<d;a++)this.rows.push(new o);this.currRow=d-1,this.nrRollUpRows=null,this.reset()};p.prototype={reset:function(){for(var a=0;a<d;a++)this.rows[a].clear();this.currRow=d-1},equals:function(a){for(var b=!0,c=0;c<d;c++)if(!this.rows[c].equals(a.rows[c])){b=!1;break}return b},copy:function(a){for(var b=0;b<d;b++)this.rows[b].copy(a.rows[b])},isEmpty:function(){for(var a=!0,b=0;b<d;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(a){this.rows[this.currRow].insertChar(a)},setPen:function(a){this.rows[this.currRow].setPenStyles(a)},moveCursor:function(a){this.rows[this.currRow].moveCursor(a)},setCursor:function(a){k.log("INFO","setCursor: "+a),this.rows[this.currRow].setCursor(a)},setPAC:function(a){k.log("INFO","pacData = "+JSON.stringify(a));var b=a.row-1;this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.currRow=b;var c=this.rows[this.currRow];if(null!==a.indent){var d=a.indent,e=Math.max(d-1,0);c.setCursor(a.indent),a.color=c.chars[e].penState.foreground}var f={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(f)},setBkgData:function(a){k.log("INFO","bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},setRollUpRows:function(a){this.nrRollUpRows=a},rollUp:function(){if(null===this.nrRollUpRows)return void k.log("DEBUG","roll_up but nrRollUpRows not set yet");k.log("TEXT",this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),k.log("INFO","Rolling up")},getDisplayText:function(a){a=a||!1;for(var b=[],c="",e=-1,f=0;f<d;f++){var g=this.rows[f].getTextString();g&&(e=f+1,a?b.push("Row "+e+': "'+g+'"'):b.push(g.trim()))}return b.length>0&&(c=a?"["+b.join(" | ")+"]":b.join("\n")),c},getTextAndFormat:function(){return this.rows}};var q=function(a,b){this.chNr=a,this.outputFilter=b,this.mode=null,this.verbose=0,this.displayedMemory=new p,this.nonDisplayedMemory=new p,this.lastOutputScreen=new p,this.currRollUpRow=this.displayedMemory.rows[d-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};q.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[d-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(a){this.outputFilter=a},setPAC:function(a){this.writeScreen.setPAC(a)},setBkgData:function(a){this.writeScreen.setBkgData(a)},setMode:function(a){a!==this.mode&&(this.mode=a,k.log("INFO","MODE="+a),"MODE_POP-ON"==this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a)},insertChars:function(a){for(var b=0;b<a.length;b++)this.writeScreen.insertChar(a[b]);var c=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";k.log("INFO",c+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(k.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},cc_RCL:function(){k.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},cc_BS:function(){k.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},cc_AOF:function(){},cc_AON:function(){},cc_DER:function(){k.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},cc_RU:function(a){k.log("INFO","RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},cc_FON:function(){k.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},cc_RDC:function(){k.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},cc_TR:function(){k.log("INFO","TR"),this.setMode("MODE_TEXT")},cc_RTD:function(){k.log("INFO","RTD"),this.setMode("MODE_TEXT")},cc_EDM:function(){k.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},cc_CR:function(){k.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},cc_ENM:function(){k.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},cc_EOC:function(){if(k.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,k.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()},cc_TO:function(a){k.log("INFO","TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},cc_MIDROW:function(a){var b={flash:!1};if(b.underline=a%2==1,b.italics=a>=46,b.italics)b.foreground="white";else{var c=Math.floor(a/2)-16,d=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=d[c]}k.log("INFO","MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},outputDataUpdate:function(){var a=k.time;null!==a&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(a,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:a):this.cueStartTime=a,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))}};var r=function(a,b,c){this.field=a||1,this.outputs=[b,c],this.channels=[new q(1,b),new q(2,c)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};r.prototype={getHandler:function(a){return this.channels[a].getHandler()},setHandler:function(a,b){this.channels[a].setHandler(b)},addData:function(a,b){var c,d,e,f=!1;this.lastTime=a,k.setTime(a);for(var g=0;g<b.length;g+=2)if(d=127&b[g],e=127&b[g+1],d>=16&&d<=31&&d===this.lastCmdA&&e===this.lastCmdB)this.lastCmdA=null,this.lastCmdB=null,k.log("DEBUG","Repeated command ("+l([d,e])+") is dropped");else if(0!==d||0!==e){if(k.log("DATA","["+l([b[g],b[g+1]])+"] -> ("+l([d,e])+")"),c=this.parseCmd(d,e),c||(c=this.parseMidrow(d,e)),c||(c=this.parsePAC(d,e)),c||(c=this.parseBackgroundAttributes(d,e)),!c&&(f=this.parseChars(d,e)))if(this.currChNr&&this.currChNr>=0){var h=this.channels[this.currChNr-1];h.insertChars(f)}else k.log("WARNING","No channel found yet. TEXT-MODE?");c?this.dataCounters.cmd+=2:f?this.dataCounters.char+=2:(this.dataCounters.other+=2,k.log("WARNING","Couldn't parse cleaned data "+l([d,e])+" orig: "+l([b[g],b[g+1]])))}else this.dataCounters.padding+=2},parseCmd:function(a,b){var c=null,d=(20===a||21===a||28===a||29===a)&&32<=b&&b<=47,e=(23===a||31===a)&&33<=b&&b<=35;if(!d&&!e)return!1;c=20===a||21===a||23===a?1:2;var f=this.channels[c-1];return 20===a||21===a||28===a||29===a?32===b?f.cc_RCL():33===b?f.cc_BS():34===b?f.cc_AOF():35===b?f.cc_AON():36===b?f.cc_DER():37===b?f.cc_RU(2):38===b?f.cc_RU(3):39===b?f.cc_RU(4):40===b?f.cc_FON():41===b?f.cc_RDC():42===b?f.cc_TR():43===b?f.cc_RTD():44===b?f.cc_EDM():45===b?f.cc_CR():46===b?f.cc_ENM():47===b&&f.cc_EOC():f.cc_TO(b-32),this.lastCmdA=a,this.lastCmdB=b,this.currChNr=c,!0},parseMidrow:function(a,b){var c=null;if((17===a||25===a)&&32<=b&&b<=47){if((c=17===a?1:2)!==this.currChNr)return k.log("ERROR","Mismatch channel in midrow parsing"),!1;var d=this.channels[c-1];return d.insertChars([32]),d.cc_MIDROW(b),k.log("DEBUG","MIDROW ("+l([a,b])+")"),this.lastCmdA=a,this.lastCmdB=b,!0}return!1},parsePAC:function(a,b){var c=null,d=null,e=(17<=a&&a<=23||25<=a&&a<=31)&&64<=b&&b<=127,j=(16===a||24===a)&&64<=b&&b<=95;if(!e&&!j)return!1;c=a<=23?1:2,d=64<=b&&b<=95?1===c?f[a]:h[a]:1===c?g[a]:i[a];var k=this.interpretPAC(d,b);return this.channels[c-1].setPAC(k),this.lastCmdA=a,this.lastCmdB=b,this.currChNr=c,!0},interpretPAC:function(a,b){var c=b,d={color:null,italics:!1,indent:null,underline:!1,row:a};return c=b>95?b-96:b-64,d.underline=1==(1&c),c<=13?d.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(c/2)]:c<=15?(d.italics=!0,d.color="white"):d.indent=4*Math.floor((c-16)/2),d},parseChars:function(a,b){var d=null,e=null,f=null;if(a>=25?(d=2,f=a-8):(d=1,f=a),17<=f&&f<=19){var g=b;g=17===f?b+80:18===f?b+112:b+144,k.log("INFO","Special char '"+c(g)+"' in channel "+d),e=[g],this.lastCmdA=a,this.lastCmdB=b}else 32<=a&&a<=127&&(e=0===b?[a]:[a,b],this.lastCmdA=null,this.lastCmdB=null);if(e){var h=l(e);k.log("DEBUG","Char codes = "+h.join(","))}return e},parseBackgroundAttributes:function(a,b){var c,d,e,f,g=(16===a||24===a)&&32<=b&&b<=47,h=(23===a||31===a)&&45<=b&&b<=47;return!(!g&&!h)&&(c={},16===a||24===a?(d=Math.floor((b-32)/2),c.background=j[d],b%2==1&&(c.background=c.background+"_semi")):45===b?c.background="transparent":(c.foreground="black",47===b&&(c.underline=!0)),e=a<24?1:2,f=this.channels[e-1],f.setBkgData(c),this.lastCmdA=a,this.lastCmdB=b,!0)},reset:function(){for(var a=0;a<this.channels.length;a++)this.channels[a]&&this.channels[a].reset();this.lastCmdA=null,this.lastCmdB=null},cueSplitAtTime:function(a){for(var b=0;b<this.channels.length;b++)this.channels[b]&&this.channels[b].cueSplitAtTime(a)}};var s=function(a,b,c){for(var d=0,e=b,f=[],g=function(a,b,c,d){if(4!==a||b<8)return null;var e=c.getUint8(d),f=c.getUint16(d+1),g=c.getUint32(d+3),h=c.getUint8(d+7);return 181==e&&49==f&&1195456820==g&&3==h};e<b+c;){if(d=a.getUint32(e),6===(31&a.getUint8(e+4)))for(var h=e+5,i=-1;h<e+4+d-1;){i=0;for(var j=255;255===j;)j=a.getUint8(h),i+=j,h++;var k=0;for(j=255;255===j;)j=a.getUint8(h),k+=j,h++;g(i,k,a,h)&&f.push([h,k]),h+=k}e+=d+4}return f},t=function(a,b){var c=b[0],d=[[],[]];c+=8;var e=31&a.getUint8(c);c+=2;for(var f=0;f<e;f++){var g=a.getUint8(c),h=4&g,i=3&g;c++;var j=a.getUint8(c);c++;var k=a.getUint8(c);c++,h&&(127&j)+(127&k)!=0&&(0===i?(d[0].push(j),d[0].push(k)):1===i&&(d[1].push(j),d[1].push(k)))}return d};a.logger=k,a.PenState=m,a.CaptionScreen=p,a.Cea608Parser=r,a.findCea608Nalus=s,a.extractCea608DataFromRange=t}(void 0===c?(void 0).cea608parser={}:c)},{}],3:[function(a,b,c){"use strict";function d(a){function b(){void 0===a.escapeMode&&(a.escapeMode=!0),void 0===a.attributePrefix&&(a.attributePrefix="_"),a.arrayAccessForm=a.arrayAccessForm||"none",a.emptyNodeForm=a.emptyNodeForm||"text",void 0===a.enableToStringFunc&&(a.enableToStringFunc=!0),a.arrayAccessFormPaths=a.arrayAccessFormPaths||[],void 0===a.skipEmptyTextNodesForObj&&(a.skipEmptyTextNodesForObj=!0),void 0===a.stripWhitespaces&&(a.stripWhitespaces=!0),a.datetimeAccessFormPaths=a.datetimeAccessFormPaths||[],void 0===a.useDoubleQuotes&&(a.useDoubleQuotes=!1),a.xmlElementsFilter=a.xmlElementsFilter||[],a.jsonPropertiesFilter=a.jsonPropertiesFilter||[],void 0===a.keepCData&&(a.keepCData=!1),void 0===a.ignoreRoot&&(a.ignoreRoot=!1)}function c(){}function d(a){var b=a.localName;return null==b&&(b=a.baseName),null!=b&&""!=b||(b=a.nodeName),b}function e(a){return a.prefix}function f(a){return"string"==typeof a?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):a}function g(a,b,c,d){for(var e=0;e<a.length;e++){var f=a[e];if("string"==typeof f){if(f==d)break}else if(f instanceof RegExp){if(f.test(d))break}else if("function"==typeof f&&f(b,c,d))break}return e!=a.length}function h(b,c,d){switch(a.arrayAccessForm){case"property":b[c]instanceof Array?b[c+"_asArray"]=b[c]:b[c+"_asArray"]=[b[c]]}!(b[c]instanceof Array)&&a.arrayAccessFormPaths.length>0&&g(a.arrayAccessFormPaths,b,c,d)&&(b[c]=[b[c]])}function i(a){var b=a.split(/[-T:+Z]/g),c=new Date(b[0],b[1]-1,b[2]),d=b[5].split(".");if(c.setHours(b[3],b[4],d[0]),d.length>1&&c.setMilliseconds(d[1]),b[6]&&b[7]){var e=60*b[6]+Number(b[7]);e=0+("-"==(/\d\d-\d\d:\d\d$/.test(a)?"-":"+")?-1*e:e),c.setMinutes(c.getMinutes()-e-c.getTimezoneOffset())}else-1!==a.indexOf("Z",a.length-1)&&(c=new Date(Date.UTC(c.getFullYear(),c.getMonth(),c.getDate(),c.getHours(),c.getMinutes(),c.getSeconds(),c.getMilliseconds())));return c}function j(b,c,d){if(a.datetimeAccessFormPaths.length>0){var e=d.split(".#")[0];return g(a.datetimeAccessFormPaths,b,c,e)?i(b):b}return b}function k(b,c,d,e){return!(c==z.ELEMENT_NODE&&a.xmlElementsFilter.length>0)||g(a.xmlElementsFilter,b,d,e)}function l(b,c){if(b.nodeType==z.DOCUMENT_NODE){for(var f=new Object,g=b.childNodes,i=0;i<g.length;i++){var m=g[i];if(m.nodeType==z.ELEMENT_NODE)if(a.ignoreRoot)f=l(m);else{f={};var n=d(m);f[n]=l(m)}}return f}if(b.nodeType==z.ELEMENT_NODE){var f=new Object;f.__cnt=0;for(var o=[],g=b.childNodes,i=0;i<g.length;i++){var m=g[i],n=d(m);if(m.nodeType!=z.COMMENT_NODE){var p=c+"."+n;if(k(f,m.nodeType,n,p))if(f.__cnt++,null==f[n]){var q=l(m,p);if("#text"!=n||/[^\s]/.test(q)){var r={};r[n]=q,o.push(r)}f[n]=q,h(f,n,p)}else{null!=f[n]&&(f[n]instanceof Array||(f[n]=[f[n]],h(f,n,p)));var q=l(m,p);if("#text"!=n||/[^\s]/.test(q)){var r={};r[n]=q,o.push(r)}f[n][f[n].length]=q}}}f.__children=o;for(var s=d(b),t=0;t<b.attributes.length;t++){var u=b.attributes[t];f.__cnt++;for(var v=u.value,w=0,x=a.matchers.length;w<x;w++){var y=a.matchers[w];y.test(u,s)&&(v=y.converter(u.value))}f[a.attributePrefix+u.name]=v}var A=e(b);return null!=A&&""!=A&&(f.__cnt++,f.__prefix=A),null!=f["#text"]&&(f.__text=f["#text"],f.__text instanceof Array&&(f.__text=f.__text.join("\n")),a.stripWhitespaces&&(f.__text=f.__text.trim()),delete f["#text"],"property"==a.arrayAccessForm&&delete f["#text_asArray"],f.__text=j(f.__text,n,c+"."+n)),null!=f["#cdata-section"]&&(f.__cdata=f["#cdata-section"],delete f["#cdata-section"],"property"==a.arrayAccessForm&&delete f["#cdata-section_asArray"]),0==f.__cnt&&"text"==a.emptyNodeForm?f="":1==f.__cnt&&null!=f.__text?f=f.__text:1!=f.__cnt||null==f.__cdata||a.keepCData?f.__cnt>1&&null!=f.__text&&a.skipEmptyTextNodesForObj&&(a.stripWhitespaces&&""==f.__text||""==f.__text.trim())&&delete f.__text:f=f.__cdata,delete f.__cnt,!a.enableToStringFunc||null==f.__text&&null==f.__cdata||(f.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),f}if(b.nodeType==z.TEXT_NODE||b.nodeType==z.CDATA_SECTION_NODE)return b.nodeValue}function m(b,c,d,e){var g="<"+(null!=b&&null!=b.__prefix?b.__prefix+":":"")+c;if(null!=d)for(var h=0;h<d.length;h++){var i=d[h],j=b[i];a.escapeMode&&(j=f(j)),g+=" "+i.substr(a.attributePrefix.length)+"=",a.useDoubleQuotes?g+='"'+j+'"':g+="'"+j+"'"}return g+=e?"/>":">"}function n(a,b){return"</"+(null!=a.__prefix?a.__prefix+":":"")+b+">"}function o(a,b){return-1!==a.indexOf(b,a.length-b.length)}function p(b,c){return!!("property"==a.arrayAccessForm&&o(c.toString(),"_asArray")||0==c.toString().indexOf(a.attributePrefix)||0==c.toString().indexOf("__")||b[c]instanceof Function)}function q(a){var b=0;if(a instanceof Object)for(var c in a)p(a,c)||b++;return b}function r(b,c,d){return 0==a.jsonPropertiesFilter.length||""==d||g(a.jsonPropertiesFilter,b,c,d)}function s(b){var c=[];if(b instanceof Object)for(var d in b)-1==d.toString().indexOf("__")&&0==d.toString().indexOf(a.attributePrefix)&&c.push(d);return c}function t(b){var c="";return null!=b.__cdata&&(c+="<![CDATA["+b.__cdata+"]]>"),null!=b.__text&&(a.escapeMode?c+=f(b.__text):c+=b.__text),c}function u(b){var c="";return b instanceof Object?c+=t(b):null!=b&&(a.escapeMode?c+=f(b):c+=b),c}function v(a,b){return""===a?b:a+"."+b}function w(a,b,c,d){var e="";if(0==a.length)e+=m(a,b,c,!0);else for(var f=0;f<a.length;f++)e+=m(a[f],b,s(a[f]),!1),e+=x(a[f],v(d,b)),e+=n(a[f],b);return e}function x(a,b){var c="";if(q(a)>0)for(var d in a)if(!p(a,d)&&(""==b||r(a,d,v(b,d)))){var e=a[d],f=s(e);if(null==e||void 0==e)c+=m(e,d,f,!0);else if(e instanceof Object)if(e instanceof Array)c+=w(e,d,f,b);else if(e instanceof Date)c+=m(e,d,f,!1),c+=e.toISOString(),c+=n(e,d);else{var g=q(e);g>0||null!=e.__text||null!=e.__cdata?(c+=m(e,d,f,!1),c+=x(e,v(b,d)),c+=n(e,d)):c+=m(e,d,f,!0)}else c+=m(e,d,f,!1),c+=u(e),c+=n(e,d)}return c+=u(a)}var y="1.2.0";a=a||{},b(),c();var z={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};this.parseXmlString=function(a){window.ActiveXObject||window;if(void 0===a)return null;var b;if(window.DOMParser){var c=new window.DOMParser;try{b=c.parseFromString(a,"text/xml"),b.getElementsByTagNameNS("*","parsererror").length>0&&(b=null)}catch(d){b=null}}else 0==a.indexOf("<?")&&(a=a.substr(a.indexOf("?>")+2)),b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a);return b},this.asArray=function(a){return void 0===a||null==a?[]:a instanceof Array?a:[a]},this.toXmlDateTime=function(a){return a instanceof Date?a.toISOString():"number"==typeof a?new Date(a).toISOString():null},this.asDateTime=function(a){return"string"==typeof a?i(a):a},this.xml2json=function(a){return l(a)},this.xml_str2json=function(a){var b=this.parseXmlString(a);return null!=b?this.xml2json(b):null},this.json2xml_str=function(a){return x(a,"")},this.json2xml=function(a){var b=this.json2xml_str(a);return this.parseXmlString(b)},this.getVersion=function(){return y}}Object.defineProperty(c,"__esModule",{value:!0}),c.default=d,b.exports=c.default},{}],4:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}Object.defineProperty(c,"__esModule",{value:!0});var e=a(5),f=a(117),g=d(f),h=a(151),i=d(h),j=a(95),k=d(j),l=a(46),m=d(l);dashjs.Protection=i.default,dashjs.MetricsReporting=g.default,dashjs.MediaPlayerFactory=k.default,dashjs.Debug=m.default,c.default=dashjs,c.MediaPlayer=e.MediaPlayer,c.Protection=i.default,c.MetricsReporting=g.default,c.MediaPlayerFactory=k.default,c.Debug=m.default},{117:117,151:151,46:46,5:5,95:95}],5:[function(a,b,c){(function(b){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}Object.defineProperty(c,"__esModule",{value:!0});var e=a(93),f=d(e),g=a(48),h=d(g),i=a(46),j=d(i),k=a(49),l="undefined"!=typeof window&&window||b,m=l.dashjs;m||(m=l.dashjs={}),m.MediaPlayer=f.default,m.FactoryMaker=h.default,m.Debug=j.default,m.Version=(0,k.getVersionString)(),c.default=m,c.MediaPlayer=f.default,c.FactoryMaker=h.default,c.Debug=j.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{46:46,48:48,49:49,93:93}],6:[function(a,b,c){/*! codem-isoboxer v0.3.5 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */ +var d={};d.parseBuffer=function(a){return new e(a).parse()},d.addBoxProcessor=function(a,b){"string"==typeof a&&"function"==typeof b&&(f.prototype._boxProcessors[a]=b)},d.createFile=function(){return new e},d.createBox=function(a,b,c){var d=f.create(a);return b&&b.append(d,c),d},d.createFullBox=function(a,b,c){var e=d.createBox(a,b,c);return e.version=0,e.flags=0,e},d.Utils={},d.Utils.dataViewToString=function(a,b){var c=b||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(c).decode(a);var d=[],e=0;if("utf-8"===c)for(;e<a.byteLength;){var f=a.getUint8(e++);f<128||(f<224?(f=(31&f)<<6,f|=63&a.getUint8(e++)):f<240?(f=(15&f)<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++)):(f=(7&f)<<18,f|=(63&a.getUint8(e++))<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++))),d.push(String.fromCharCode(f))}else for(;e<a.byteLength;)d.push(String.fromCharCode(a.getUint8(e++)));return d.join("")},d.Utils.utf8ToByteArray=function(a){var b,c;if("undefined"!=typeof TextEncoder)b=(new TextEncoder).encode(a);else for(b=[],c=0;c<a.length;++c){var d=a.charCodeAt(c);d<128?b.push(d):d<2048?(b.push(192|d>>6),b.push(128|63&d)):d<65536?(b.push(224|d>>12),b.push(128|63&d>>6),b.push(128|63&d)):(b.push(240|d>>18),b.push(128|63&d>>12),b.push(128|63&d>>6),b.push(128|63&d))}return b},d.Utils.appendBox=function(a,b,c){if(b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,-1!==c){if(void 0===c||null===c)return void a.boxes.push(b);var d,e=-1;if("number"==typeof c)e=c;else{if("string"==typeof c)d=c;else{if("object"!=typeof c||!c.type)return void a.boxes.push(b);d=c.type}for(var f=0;f<a.boxes.length;f++)if(d===a.boxes[f].type){e=f+1;break}}a.boxes.splice(e,0,b)}},void 0!==c&&(c.parseBuffer=d.parseBuffer,c.addBoxProcessor=d.addBoxProcessor,c.createFile=d.createFile,c.createBox=d.createBox,c.createFullBox=d.createFullBox,c.Utils=d.Utils),d.Cursor=function(a){this.offset=void 0===a?0:a};var e=function(a){this._cursor=new d.Cursor,this.boxes=[],a&&(this._raw=new DataView(a))};e.prototype.fetch=function(a){var b=this.fetchAll(a,!0);return b.length?b[0]:null},e.prototype.fetchAll=function(a,b){var c=[];return e._sweep.call(this,a,c,b),c},e.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var a=f.parse(this);if(void 0===a.type)break;this.boxes.push(a)}return this},e._sweep=function(a,b,c){this.type&&this.type==a&&b.push(this);for(var d in this.boxes){if(b.length&&c)return;e._sweep.call(this.boxes[d],a,b,c)}},e.prototype.write=function(){var a,b=0;for(a=0;a<this.boxes.length;a++)b+=this.boxes[a].getLength(!1);var c=new Uint8Array(b);for(this._rawo=new DataView(c.buffer),this.bytes=c,this._cursor.offset=0,a=0;a<this.boxes.length;a++)this.boxes[a].write();return c.buffer},e.prototype.append=function(a,b){d.Utils.appendBox(this,a,b)};var f=function(){this._cursor=new d.Cursor};f.parse=function(a){var b=new f;return b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,b._parseBox(),a._cursor.offset=b._raw.byteOffset+b._raw.byteLength,b},f.create=function(a){var b=new f;return b.type=a,b.boxes=[],b},f.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],f.prototype._boxProcessors={},f.prototype._procField=function(a,b,c){this._parsing?this[a]=this._readField(b,c):this._writeField(b,c,this[a])},f.prototype._procFieldArray=function(a,b,c,d){var e;if(this._parsing)for(this[a]=[],e=0;e<b;e++)this[a][e]=this._readField(c,d);else for(e=0;e<this[a].length;e++)this._writeField(c,d,this[a][e])},f.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},f.prototype._procEntries=function(a,b,c){var d;if(this._parsing)for(this[a]=[],d=0;d<b;d++)this[a].push({}),c.call(this,this[a][d]);else for(d=0;d<b;d++)c.call(this,this[a][d])},f.prototype._procSubEntries=function(a,b,c,d){var e;if(this._parsing)for(a[b]=[],e=0;e<c;e++)a[b].push({}),d.call(this,a[b][e]);else for(e=0;e<c;e++)d.call(this,a[b][e])},f.prototype._procEntryField=function(a,b,c,d){this._parsing?a[b]=this._readField(c,d):this._writeField(c,d,a[b])},f.prototype._procSubBoxes=function(a,b){var c;if(this._parsing)for(this[a]=[],c=0;c<b;c++)this[a].push(f.parse(this));else for(c=0;c<b;c++)this._rawo?this[a][c].write():this.size+=this[a][c].getLength()},f.prototype._readField=function(a,b){switch(a){case"uint":return this._readUint(b);case"int":return this._readInt(b);case"template":return this._readTemplate(b);case"string":return-1===b?this._readTerminatedString():this._readString(b);case"data":return this._readData(b);case"utf8":return this._readUTF8String();default:return-1}},f.prototype._readInt=function(a){var b=null,c=this._cursor.offset-this._raw.byteOffset;switch(a){case 8:b=this._raw.getInt8(c);break;case 16:b=this._raw.getInt16(c);break;case 32:b=this._raw.getInt32(c);break;case 64:var d=this._raw.getInt32(c),e=this._raw.getInt32(c+4);b=d*Math.pow(2,32)+e}return this._cursor.offset+=a>>3,b},f.prototype._readUint=function(a){var b,c,d=null,e=this._cursor.offset-this._raw.byteOffset;switch(a){case 8:d=this._raw.getUint8(e);break;case 16:d=this._raw.getUint16(e);break;case 24:b=this._raw.getUint16(e),c=this._raw.getUint8(e+2),d=(b<<8)+c;break;case 32:d=this._raw.getUint32(e);break;case 64:b=this._raw.getUint32(e),c=this._raw.getUint32(e+4),d=b*Math.pow(2,32)+c}return this._cursor.offset+=a>>3,d},f.prototype._readString=function(a){for(var b="",c=0;c<a;c++){var d=this._readUint(8);b+=String.fromCharCode(d)}return b},f.prototype._readTemplate=function(a){return this._readUint(a/2)+this._readUint(a/2)/Math.pow(2,a/2)},f.prototype._readTerminatedString=function(){for(var a="";this._cursor.offset-this._offset<this._raw.byteLength;){var b=this._readUint(8);if(0===b)break;a+=String.fromCharCode(b)}return a},f.prototype._readData=function(a){var b=a>0?a:this._raw.byteLength-(this._cursor.offset-this._offset);if(b>0){var c=new Uint8Array(this._raw.buffer,this._cursor.offset,b);return this._cursor.offset+=b,c}return null},f.prototype._readUTF8String=function(){var a=this._raw.byteLength-(this._cursor.offset-this._offset),b=null;return a>0&&(b=new DataView(this._raw.buffer,this._cursor.offset,a),this._cursor.offset+=a),b?d.Utils.dataViewToString(b):b},f.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)return void(this._root._incomplete=!0);switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset+8);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())},f.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},f.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(f.parse(this))},f.prototype.append=function(a,b){d.Utils.appendBox(this,a,b)},f.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var a=0;a<this.boxes.length;a++)this.size+=this.boxes[a].getLength();return this._data&&this._writeData(this._data),this.size},f.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var a=0;a<this.boxes.length;a++)this.boxes[a].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},f.prototype._writeInt=function(a,b){if(this._rawo){var c=this._cursor.offset-this._rawo.byteOffset;switch(a){case 8:this._rawo.setInt8(c,b);break;case 16:this._rawo.setInt16(c,b);break;case 32:this._rawo.setInt32(c,b);break;case 64:var d=Math.floor(b/Math.pow(2,32)),e=b-d*Math.pow(2,32);this._rawo.setUint32(c,d),this._rawo.setUint32(c+4,e)}this._cursor.offset+=a>>3}else this.size+=a>>3},f.prototype._writeUint=function(a,b){if(this._rawo){var c,d,e=this._cursor.offset-this._rawo.byteOffset;switch(a){case 8:this._rawo.setUint8(e,b);break;case 16:this._rawo.setUint16(e,b);break;case 24:c=(16776960&b)>>8,d=255&b,this._rawo.setUint16(e,c),this._rawo.setUint8(e+2,d);break;case 32:this._rawo.setUint32(e,b);break;case 64:c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32),this._rawo.setUint32(e,c),this._rawo.setUint32(e+4,d)}this._cursor.offset+=a>>3}else this.size+=a>>3},f.prototype._writeString=function(a,b){for(var c=0;c<a;c++)this._writeUint(8,b.charCodeAt(c))},f.prototype._writeTerminatedString=function(a){if(0!==a.length){for(var b=0;b<a.length;b++)this._writeUint(8,a.charCodeAt(b));this._writeUint(8,0)}},f.prototype._writeTemplate=function(a,b){var c=Math.floor(b),d=(b-c)*Math.pow(2,a/2);this._writeUint(a/2,c),this._writeUint(a/2,d)},f.prototype._writeData=function(a){var b;if(a)if(this._rawo){if(a instanceof Array){for(var c=this._cursor.offset-this._rawo.byteOffset,b=0;b<a.length;b++)this._rawo.setInt8(c+b,a[b]);this._cursor.offset+=a.length}a instanceof Uint8Array&&(this._root.bytes.set(a,this._cursor.offset),this._cursor.offset+=a.length)}else this.size+=a.length},f.prototype._writeUTF8String=function(a){var b=d.Utils.utf8ToByteArray(a);if(this._rawo)for(var c=new DataView(this._rawo.buffer,this._cursor.offset,b.length),e=0;e<b.length;e++)c.setUint8(e,b[e]);else this.size+=b.length},f.prototype._writeField=function(a,b,c){switch(a){case"uint":this._writeUint(b,c);break;case"int":this._writeInt(b,c);break;case"template":this._writeTemplate(b,c);break;case"string":-1==b?this._writeTerminatedString(c):this._writeString(b,c);break;case"data":this._writeData(c);break;case"utf8":this._writeUTF8String(c)}},f.prototype._boxProcessors.avc1=f.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},f.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},f.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"segment_duration","uint",1===this.version?64:32),this._procEntryField(a,"media_time","int",1===this.version?64:32),this._procEntryField(a,"media_rate_integer","int",16),this._procEntryField(a,"media_rate_fraction","int",16)})},f.prototype._boxProcessors.emsg=function(){this._procFullBox(),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("message_data","data",-1)},f.prototype._boxProcessors.free=f.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},f.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},f.prototype._boxProcessors.ftyp=f.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var a=-1;this._parsing&&(a=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",a,"string",4)},f.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},f.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},f.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},f.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},f.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},f.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},f.prototype._boxProcessors.mp4a=f.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},f.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},f.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},f.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},f.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},f.prototype._boxProcessors.sdtp=function(){this._procFullBox();var a=-1;this._parsing&&(a=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",a,"uint",8)},f.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,function(a){this._parsing||(a.reference=(1&a.reference_type)<<31,a.reference|=2147483647&a.referenced_size,a.sap=(1&a.starts_with_SAP)<<31,a.sap|=(3&a.SAP_type)<<28,a.sap|=268435455&a.SAP_delta_time),this._procEntryField(a,"reference","uint",32),this._procEntryField(a,"subsegment_duration","uint",32),this._procEntryField(a,"sap","uint",32),this._parsing&&(a.reference_type=a.reference>>31&1,a.referenced_size=2147483647&a.reference,a.starts_with_SAP=a.sap>>31&1,a.SAP_type=a.sap>>28&7,a.SAP_delta_time=268435455&a.sap)})},f.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},f.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,function(a){this._procEntryField(a,"ranges_count","uint",32),this._procSubEntries(a,"ranges",a.ranges_count,function(a){this._procEntryField(a,"level","uint",8),this._procEntryField(a,"range_size","uint",24)})})},f.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},f.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"sample_delta","uint",32),this._procEntryField(a,"subsample_count","uint",16),this._procSubEntries(a,"subsamples",a.subsample_count,function(a){this._procEntryField(a,"subsample_size","uint",1===this.version?32:16),this._procEntryField(a,"subsample_priority","uint",8),this._procEntryField(a,"discardable","uint",8),this._procEntryField(a,"codec_specific_parameters","uint",32)})})},f.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},f.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},f.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},f.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,function(a){this._procEntryField(a,"time","uint",1===this.version?64:32),this._procEntryField(a,"moof_offset","uint",1===this.version?64:32),this._procEntryField(a,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(a,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(a,"sample_number","uint",8*(this.length_size_of_sample_num+1))})},f.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},f.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},f.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,function(a){256&this.flags&&this._procEntryField(a,"sample_duration","uint",32),512&this.flags&&this._procEntryField(a,"sample_size","uint",32),1024&this.flags&&this._procEntryField(a,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(a,"sample_composition_time_offset",1===this.version?"int":"uint",32)})},f.prototype._boxProcessors["url "]=f.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},f.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},f.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},f.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},f.prototype._boxProcessors.vtte=function(){}},{}],7:[function(a,b,c){"use strict";var d=Array.isArray,e=Object.keys,f=Object.prototype.hasOwnProperty;b.exports=function a(b,c){if(b===c)return!0;var g,h,i,j=d(b),k=d(c);if(j&&k){if((h=b.length)!=c.length)return!1;for(g=0;g<h;g++)if(!a(b[g],c[g]))return!1;return!0}if(j!=k)return!1;var l=b instanceof Date,m=c instanceof Date;if(l!=m)return!1;if(l&&m)return b.getTime()==c.getTime();var n=b instanceof RegExp,o=c instanceof RegExp;if(n!=o)return!1;if(n&&o)return b.toString()==c.toString();if(b instanceof Object&&c instanceof Object){var p=e(b);if((h=p.length)!==e(c).length)return!1;for(g=0;g<h;g++)if(!f.call(c,p[g]))return!1;for(g=0;g<h;g++)if(i=p[g],!a(b[i],c[i]))return!1;return!0}return!1}},{}],8:[function(a,b,c){!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===f||b===k?62:b===g||b===l?63:b<h?-1:b<h+10?b-h+26+26:b<j+26?b-j:b<i+26?b-i+26:void 0}function c(a){function c(a){j[l++]=a}var d,f,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new e(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,f=0;d<g;d+=4,f+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function d(a){function b(a){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var d,e,f,g=a.length%3,h="";for(d=0,f=a.length-g;d<f;d+=3)e=(a[d]<<16)+(a[d+1]<<8)+a[d+2],h+=c(e);switch(g){case 1:e=a[a.length-1],h+=b(e>>2),h+=b(e<<4&63),h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=b(e>>10),h+=b(e>>4&63),h+=b(e<<2&63),h+="="}return h}var e="undefined"!=typeof Uint8Array?Uint8Array:Array,f="+".charCodeAt(0),g="/".charCodeAt(0),h="0".charCodeAt(0),i="a".charCodeAt(0),j="A".charCodeAt(0),k="-".charCodeAt(0),l="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=d}(void 0===c?this.base64js={}:c)},{}],9:[function(a,b,c){},{}],10:[function(a,b,c){(function(b){/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> + * @license MIT + */ +"use strict";function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(c){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(f.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,b<0?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;c<b;c++)a[c]=0;return a}function h(a,b,c){return"string"==typeof c&&""!==c||(c="utf8"),a=p(a,0|s(b,c)),a.write(b,c),a}function i(a,b){if(f.isBuffer(b))return j(a,b);if(Y(b))return k(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return l(a,b);if(b instanceof ArrayBuffer)return m(a,b)}return b.length?n(a,b):o(a,b)}function j(a,b){var c=0|q(b.length);return a=p(a,c),b.copy(a,0,0,c),a}function k(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;d<c;d+=1)a[d]=255&b[d];return a}function l(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;d<c;d+=1)a[d]=255&b[d];return a}function m(a,b){return f.TYPED_ARRAY_SUPPORT?(b.byteLength,a=f._augment(new Uint8Array(b))):a=l(a,new Uint8Array(b)),a}function n(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;d<c;d+=1)a[d]=255&b[d];return a}function o(a,b){var c,d=0;"Buffer"===b.type&&Y(b.data)&&(c=b.data,d=0|q(c.length)),a=p(a,d);for(var e=0;e<d;e+=1)a[e]=255&c[e];return a}function p(a,b){return f.TYPED_ARRAY_SUPPORT?(a=f._augment(new Uint8Array(b)),a.__proto__=f.prototype):(a.length=b,a._isBuffer=!0),0!==b&&b<=f.poolSize>>>1&&(a.parent=Z),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return R(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return U(a).length;default:if(d)return R(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b|=0,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),b<0&&(b=0),c>this.length&&(c=this.length),c<=b)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d))>e&&(d=e):d=e;var f=b.length;if(f%2!=0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g<d;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function v(a,b,c,d){return V(R(b,a.length-c),a,c,d)}function w(a,b,c,d){return V(S(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return V(U(b),a,c,d)}function z(a,b,c,d){return V(T(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?W.fromByteArray(a):W.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;e<c;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128==(192&i)&&(l=(31&f)<<6|63&i)>127&&(g=l);break;case 3:i=a[e+1],j=a[e+2],128==(192&i)&&128==(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j)>2047&&(l<55296||l>57343)&&(g=l);break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128==(192&i)&&128==(192&j)&&128==(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k)>65535&&l<1114112&&(g=l)}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=$)return String.fromCharCode.apply(String,a);for(var c="",d=0;d<b;)c+=String.fromCharCode.apply(String,a.slice(d,d+=$));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;e++)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;e++)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||b<0)&&(b=0),(!c||c<0||c>d)&&(c=d);for(var e="",f=b;f<c;f++)e+=Q(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function H(a,b,c){if(a%1!=0||a<0)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||b<g)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function J(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e<f;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function K(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e<f;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||b<f)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(c<0)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(aa,""),a.length<2)return"";for(;a.length%4!=0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Q(a){return a<16?"0"+a.toString(16):a.toString(16)}function R(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g<d;g++){if((c=a.charCodeAt(g))>55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=65536+(e-55296<<10|c-56320)}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function S(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function T(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);g++)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);return f}function U(a){return W.toByteArray(O(a))}function V(a,b,c,d){for(var e=0;e<d&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var W=a(8),X=a(14),Y=a(11);c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var Z={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT?(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array):(f.prototype.length=void 0,f.prototype.parent=void 0),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);e<g&&a[e]===b[e];)++e;return e!==g&&(c=a[e],d=b[e]),c<d?-1:d<c?1:0},f.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(a,b){if(!Y(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new f(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new f(b),e=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(d,e),e+=g.length}return d},f.byteLength=s,f.prototype.toString=function(){var a=0|this.length;return 0===a?"":0===arguments.length?B(this,0,a):t.apply(this,arguments)},f.prototype.equals=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a||0===f.compare(this,a)},f.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e<a.length;e++)if(a[c+e]===b[-1===d?0:e-d]){if(-1===d&&(d=e),e-d+1===b.length)return c+d}else d=-1;return-1}if(b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(b<0&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c)<0&&(a=0):a>c&&(a=c),b<0?(b+=c)<0&&(b=0):b>c&&(b=c),b<a&&(b=a);var d;if(f.TYPED_ARRAY_SUPPORT)d=f._augment(this.subarray(a,b));else{var e=b-a;d=new f(e,void 0);for(var g=0;g<e;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},f.prototype.readUIntLE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},f.prototype.readUIntBE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b|=0,c|=0,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f<c&&(e*=256);)this[b+f]=a/e&255;return b+c},f.prototype.writeUIntBE=function(a,b,c,d){a=+a,b|=0,c|=0,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=c-1,f=1;for(this[b+e]=255&a;--e>=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=a<0?1:0;for(this[b]=255&a;++f<c&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=a<0?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),a<0&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d<c&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var e,g=d-c;if(this===a&&c<b&&b<d)for(e=g-1;e>=0;e--)a[e+b]=this[e+c];else if(g<1e3||!f.TYPED_ARRAY_SUPPORT)for(e=0;e<g;e++)a[e+b]=this[e+c];else a._set(this.subarray(c,c+g),b);return g},f.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),c<b)throw new RangeError("end < start");if(c!==b&&0!==this.length){if(b<0||b>=this.length)throw new RangeError("start out of bounds");if(c<0||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;d<c;d++)this[d]=a;else{var e=R(a.toString()),f=e.length;for(d=b;d<c;d++)this[d]=e[d%f]}return this}},f.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(f.TYPED_ARRAY_SUPPORT)return new f(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;b<c;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var _=f.prototype;f._augment=function(a){return a.constructor=f,a._isBuffer=!0,a._set=a.set,a.get=_.get,a.set=_.set,a.write=_.write,a.toString=_.toString,a.toLocaleString=_.toString,a.toJSON=_.toJSON,a.equals=_.equals,a.compare=_.compare,a.indexOf=_.indexOf,a.copy=_.copy,a.slice=_.slice,a.readUIntLE=_.readUIntLE,a.readUIntBE=_.readUIntBE,a.readUInt8=_.readUInt8,a.readUInt16LE=_.readUInt16LE,a.readUInt16BE=_.readUInt16BE,a.readUInt32LE=_.readUInt32LE,a.readUInt32BE=_.readUInt32BE,a.readIntLE=_.readIntLE,a.readIntBE=_.readIntBE,a.readInt8=_.readInt8,a.readInt16LE=_.readInt16LE,a.readInt16BE=_.readInt16BE,a.readInt32LE=_.readInt32LE,a.readInt32BE=_.readInt32BE,a.readFloatLE=_.readFloatLE,a.readFloatBE=_.readFloatBE,a.readDoubleLE=_.readDoubleLE,a.readDoubleBE=_.readDoubleBE,a.writeUInt8=_.writeUInt8,a.writeUIntLE=_.writeUIntLE,a.writeUIntBE=_.writeUIntBE,a.writeUInt16LE=_.writeUInt16LE,a.writeUInt16BE=_.writeUInt16BE,a.writeUInt32LE=_.writeUInt32LE,a.writeUInt32BE=_.writeUInt32BE,a.writeIntLE=_.writeIntLE,a.writeIntBE=_.writeIntBE,a.writeInt8=_.writeInt8,a.writeInt16LE=_.writeInt16LE,a.writeInt16BE=_.writeInt16BE,a.writeInt32LE=_.writeInt32LE,a.writeInt32BE=_.writeInt32BE,a.writeFloatLE=_.writeFloatLE,a.writeFloatBE=_.writeFloatBE,a.writeDoubleLE=_.writeDoubleLE,a.writeDoubleBE=_.writeDoubleBE,a.fill=_.fill,a.inspect=_.inspect,a.toArrayBuffer=_.toArrayBuffer,a};var aa=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{11:11,14:14,8:8}],11:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],12:[function(a,b,c){(function(a){function b(a){return Array.isArray?Array.isArray(a):"[object Array]"===q(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return"[object RegExp]"===q(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return"[object Date]"===q(a)}function n(a){return"[object Error]"===q(a)||a instanceof Error}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||void 0===a}function q(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer=a.isBuffer}).call(this,{isBuffer:a(16)})},{16:16}],13:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||a<0||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if((b=arguments[1])instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;i<d;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;i<d;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;i<d;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){return this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){return a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],14:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],15:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],16:[function(a,b,c){function d(a){return!!a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}function e(a){return"function"==typeof a.readFloatLE&&"function"==typeof a.slice&&d(a.slice(0,0))}/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh <https://feross.org> + * @license MIT + */ +b.exports=function(a){return null!=a&&(d(a)||e(a)||!!a._isBuffer)}},{}],17:[function(a,b,c){(function(a){"use strict";function c(b,c,d,e){if("function"!=typeof b)throw new TypeError('"callback" argument must be a function');var f,g,h=arguments.length;switch(h){case 0:case 1:return a.nextTick(b);case 2:return a.nextTick(function(){b.call(null,c)});case 3:return a.nextTick(function(){b.call(null,c,d)});case 4:return a.nextTick(function(){b.call(null,c,d,e)});default:for(f=new Array(h-1),g=0;g<f.length;)f[g++]=arguments[g];return a.nextTick(function(){b.apply(null,f)})}}!a.version||0===a.version.indexOf("v0.")||0===a.version.indexOf("v1.")&&0!==a.version.indexOf("v1.8.")?b.exports={nextTick:c}:b.exports=a}).call(this,a(18))},{18:18}],18:[function(a,b,c){function d(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}function f(a){if(l===setTimeout)return setTimeout(a,0);if((l===d||!l)&&setTimeout)return l=setTimeout,setTimeout(a,0);try{return l(a,0)}catch(b){try{return l.call(null,a,0)}catch(b){return l.call(this,a,0)}}}function g(a){if(m===clearTimeout)return clearTimeout(a);if((m===e||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(a);try{return m(a)}catch(b){try{return m.call(null,a)}catch(b){return m.call(this,a)}}}function h(){q&&o&&(q=!1,o.length?p=o.concat(p):r=-1,p.length&&i())}function i(){if(!q){var a=f(h);q=!0;for(var b=p.length;b;){for(o=p,p=[];++r<b;)o&&o[r].run();r=-1,b=p.length}o=null,q=!1,g(a)}}function j(a,b){this.fun=a,this.array=b}function k(){}var l,m,n=b.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:d}catch(a){l=d}try{m="function"==typeof clearTimeout?clearTimeout:e}catch(a){m=e}}();var o,p=[],q=!1,r=-1;n.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];p.push(new j(a,b)),1!==p.length||q||f(i)},j.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=k,n.addListener=k,n.once=k,n.off=k,n.removeListener=k,n.removeAllListeners=k,n.emit=k,n.prependListener=k,n.prependOnceListener=k,n.listeners=function(a){return[]},n.binding=function(a){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(a){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],19:[function(a,b,c){b.exports=a(20)},{20:20}],20:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);j.call(this,a),k.call(this,a),a&&!1===a.readable&&(this.readable=!1),a&&!1===a.writable&&(this.writable=!1),this.allowHalfOpen=!0,a&&!1===a.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",e)}function e(){this.allowHalfOpen||this._writableState.ended||g.nextTick(f,this)}function f(a){a.end()}var g=a(17),h=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b};b.exports=d;var i=a(12);i.inherits=a(15);var j=a(22),k=a(24);i.inherits(d,j);for(var l=h(k.prototype),m=0;m<l.length;m++){var n=l[m];d.prototype[n]||(d.prototype[n]=k.prototype[n])}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(a){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=a,this._writableState.destroyed=a)}}),d.prototype._destroy=function(a,b){this.push(null),this.end(),g.nextTick(b,a)}},{12:12,15:15,17:17,22:22,24:24}],21:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);e.call(this,a)}b.exports=d;var e=a(23),f=a(12);f.inherits=a(15),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{12:12,15:15,23:23}],22:[function(a,b,c){(function(c,d){"use strict";function e(a){return L.from(a)}function f(a){return L.isBuffer(a)||a instanceof M}function g(a,b,c){if("function"==typeof a.prependListener)return a.prependListener(b,c);a._events&&a._events[b]?I(a._events[b])?a._events[b].unshift(c):a._events[b]=[c,a._events[b]]:a.on(b,c)}function h(b,c){H=H||a(20),b=b||{};var d=c instanceof H;this.objectMode=!!b.objectMode,d&&(this.objectMode=this.objectMode||!!b.readableObjectMode);var e=b.highWaterMark,f=b.readableHighWaterMark,g=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:d&&(f||0===f)?f:g,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new R,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(Q||(Q=a(29).StringDecoder),this.decoder=new Q(b.encoding),this.encoding=b.encoding)}function i(b){if(H=H||a(20),!(this instanceof i))return new i(b);this._readableState=new h(b,this),this.readable=!0,b&&("function"==typeof b.read&&(this._read=b.read),"function"==typeof b.destroy&&(this._destroy=b.destroy)),K.call(this)}function j(a,b,c,d,f){var g=a._readableState;if(null===b)g.reading=!1,p(a,g);else{var h;f||(h=l(g,b)),h?a.emit("error",h):g.objectMode||b&&b.length>0?("string"==typeof b||g.objectMode||Object.getPrototypeOf(b)===L.prototype||(b=e(b)),d?g.endEmitted?a.emit("error",new Error("stream.unshift() after end event")):k(a,g,b,!0):g.ended?a.emit("error",new Error("stream.push() after EOF")):(g.reading=!1,g.decoder&&!c?(b=g.decoder.write(b),g.objectMode||0!==b.length?k(a,g,b,!1):s(a,g)):k(a,g,b,!1))):d||(g.reading=!1)}return m(g)}function k(a,b,c,d){b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,d?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&q(a)),s(a,b)}function l(a,b){var c;return f(b)||"string"==typeof b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function m(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function n(a){return a>=U?a=U:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function o(a,b){return a<=0||0===b.length&&b.ended?0:b.objectMode?1:a!==a?b.flowing&&b.length?b.buffer.head.data.length:b.length:(a>b.highWaterMark&&(b.highWaterMark=n(a)),a<=b.length?a:b.ended?b.length:(b.needReadable=!0,0))}function p(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,q(a)}}function q(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(P("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?G.nextTick(r,a):r(a))}function r(a){P("emit readable"),a.emit("readable"),y(a)}function s(a,b){b.readingMore||(b.readingMore=!0,G.nextTick(t,a,b))}function t(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(P("maybeReadMore read 0"),a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function u(a){return function(){var b=a._readableState;P("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,0===b.awaitDrain&&J(a,"data")&&(b.flowing=!0,y(a))}}function v(a){P("readable nexttick read 0"),a.read(0)}function w(a,b){b.resumeScheduled||(b.resumeScheduled=!0,G.nextTick(x,a,b))}function x(a,b){b.reading||(P("resume read 0"),a.read(0)),b.resumeScheduled=!1,b.awaitDrain=0,a.emit("resume"),y(a),b.flowing&&!b.reading&&a.read(0)}function y(a){var b=a._readableState;for(P("flow",b.flowing);b.flowing&&null!==a.read(););}function z(a,b){if(0===b.length)return null;var c;return b.objectMode?c=b.buffer.shift():!a||a>=b.length?(c=b.decoder?b.buffer.join(""):1===b.buffer.length?b.buffer.head.data:b.buffer.concat(b.length),b.buffer.clear()):c=A(a,b.buffer,b.decoder),c}function A(a,b,c){var d;return a<b.head.data.length?(d=b.head.data.slice(0,a),b.head.data=b.head.data.slice(a)):d=a===b.head.data.length?b.shift():c?B(a,b):C(a,b),d}function B(a,b){var c=b.head,d=1,e=c.data;for(a-=e.length;c=c.next;){var f=c.data,g=a>f.length?f.length:a;if(g===f.length?e+=f:e+=f.slice(0,a),0===(a-=g)){g===f.length?(++d,c.next?b.head=c.next:b.head=b.tail=null):(b.head=c,c.data=f.slice(g));break}++d}return b.length-=d,e}function C(a,b){var c=L.allocUnsafe(a),d=b.head,e=1;for(d.data.copy(c),a-=d.data.length;d=d.next;){var f=d.data,g=a>f.length?f.length:a;if(f.copy(c,c.length-a,0,g),0===(a-=g)){g===f.length?(++e,d.next?b.head=d.next:b.head=b.tail=null):(b.head=d,d.data=f.slice(g));break}++e}return b.length-=e,c}function D(a){var b=a._readableState;if(b.length>0)throw new Error('"endReadable()" called on non-empty stream');b.endEmitted||(b.ended=!0,G.nextTick(E,b,a))}function E(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function F(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1}var G=a(17);b.exports=i;var H,I=a(28);i.ReadableState=h;var J=(a(13).EventEmitter,function(a,b){return a.listeners(b).length}),K=a(27),L=a(34).Buffer,M=d.Uint8Array||function(){},N=a(12);N.inherits=a(15);var O=a(9),P=void 0;P=O&&O.debuglog?O.debuglog("stream"):function(){};var Q,R=a(25),S=a(26);N.inherits(i,K);var T=["error","close","destroy","pause","resume"];Object.defineProperty(i.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(a){this._readableState&&(this._readableState.destroyed=a)}}),i.prototype.destroy=S.destroy,i.prototype._undestroy=S.undestroy,i.prototype._destroy=function(a,b){this.push(null),b(a)},i.prototype.push=function(a,b){var c,d=this._readableState;return d.objectMode?c=!0:"string"==typeof a&&(b=b||d.defaultEncoding,b!==d.encoding&&(a=L.from(a,b),b=""),c=!0),j(this,a,b,!1,c)},i.prototype.unshift=function(a){return j(this,a,null,!0,!1)},i.prototype.isPaused=function(){return!1===this._readableState.flowing},i.prototype.setEncoding=function(b){return Q||(Q=a(29).StringDecoder),this._readableState.decoder=new Q(b),this._readableState.encoding=b,this};var U=8388608;i.prototype.read=function(a){P("read",a),a=parseInt(a,10);var b=this._readableState,c=a;if(0!==a&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return P("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?D(this):q(this),null;if(0===(a=o(a,b))&&b.ended)return 0===b.length&&D(this),null;var d=b.needReadable;P("need readable",d),(0===b.length||b.length-a<b.highWaterMark)&&(d=!0,P("length less than watermark",d)),b.ended||b.reading?(d=!1,P("reading or ended",d)):d&&(P("do read"),b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1,b.reading||(a=o(c,b)));var e;return e=a>0?z(a,b):null,null===e?(b.needReadable=!0,a=0):b.length-=a,0===b.length&&(b.ended||(b.needReadable=!0),c!==a&&b.ended&&D(this)),null!==e&&this.emit("data",e),e},i.prototype._read=function(a){this.emit("error",new Error("_read() is not implemented"))},i.prototype.pipe=function(a,b){function d(a,b){P("onunpipe"),a===m&&b&&!1===b.hasUnpiped&&(b.hasUnpiped=!0,f())}function e(){P("onend"),a.end()}function f(){P("cleanup"),a.removeListener("close",j),a.removeListener("finish",k),a.removeListener("drain",q),a.removeListener("error",i),a.removeListener("unpipe",d),m.removeListener("end",e),m.removeListener("end",l),m.removeListener("data",h),r=!0,!n.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function h(b){P("ondata"),s=!1,!1!==a.write(b)||s||((1===n.pipesCount&&n.pipes===a||n.pipesCount>1&&-1!==F(n.pipes,a))&&!r&&(P("false write response, pause",m._readableState.awaitDrain),m._readableState.awaitDrain++,s=!0),m.pause())}function i(b){P("onerror",b),l(),a.removeListener("error",i),0===J(a,"error")&&a.emit("error",b)}function j(){a.removeListener("finish",k),l()}function k(){P("onfinish"),a.removeListener("close",j),l()}function l(){P("unpipe"),m.unpipe(a)}var m=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=a;break;case 1:n.pipes=[n.pipes,a];break;default:n.pipes.push(a)}n.pipesCount+=1,P("pipe count=%d opts=%j",n.pipesCount,b);var o=(!b||!1!==b.end)&&a!==c.stdout&&a!==c.stderr,p=o?e:l;n.endEmitted?G.nextTick(p):m.once("end",p),a.on("unpipe",d);var q=u(m);a.on("drain",q);var r=!1,s=!1;return m.on("data",h),g(a,"error",i),a.once("close",j),a.once("finish",k),a.emit("pipe",m),n.flowing||(P("pipe resume"),m.resume()),a},i.prototype.unpipe=function(a){var b=this._readableState,c={hasUnpiped:!1};if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this,c),this);if(!a){var d=b.pipes,e=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var f=0;f<e;f++)d[f].emit("unpipe",this,c);return this}var g=F(b.pipes,a);return-1===g?this:(b.pipes.splice(g,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this,c),this)},i.prototype.on=function(a,b){var c=K.prototype.on.call(this,a,b);if("data"===a)!1!==this._readableState.flowing&&this.resume();else if("readable"===a){var d=this._readableState;d.endEmitted||d.readableListening||(d.readableListening=d.needReadable=!0,d.emittedReadable=!1,d.reading?d.length&&q(this):G.nextTick(v,this))}return c},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var a=this._readableState;return a.flowing||(P("resume"),a.flowing=!0,w(this,a)),this},i.prototype.pause=function(){return P("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(P("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(a){var b=this,c=this._readableState,d=!1;a.on("end",function(){if(P("wrapped end"),c.decoder&&!c.ended){var a=c.decoder.end();a&&a.length&&b.push(a)}b.push(null)}),a.on("data",function(e){if(P("wrapped data"),c.decoder&&(e=c.decoder.write(e)),(!c.objectMode||null!==e&&void 0!==e)&&(c.objectMode||e&&e.length)){b.push(e)||(d=!0,a.pause())}});for(var e in a)void 0===this[e]&&"function"==typeof a[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));for(var f=0;f<T.length;f++)a.on(T[f],this.emit.bind(this,T[f]));return this._read=function(b){P("wrapped _read",b),d&&(d=!1,a.resume())},this},Object.defineProperty(i.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),i._fromList=z}).call(this,a(18),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{12:12,13:13,15:15,17:17,18:18,20:20,25:25,26:26,27:27,28:28,29:29,34:34,9:9}],23:[function(a,b,c){"use strict";function d(a,b){var c=this._transformState;c.transforming=!1;var d=c.writecb;if(!d)return this.emit("error",new Error("write callback called multiple times"));c.writechunk=null,c.writecb=null,null!=b&&this.push(b),d(a);var e=this._readableState;e.reading=!1,(e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}function e(a){if(!(this instanceof e))return new e(a);h.call(this,a),this._transformState={afterTransform:d.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,a&&("function"==typeof a.transform&&(this._transform=a.transform),"function"==typeof a.flush&&(this._flush=a.flush)),this.on("prefinish",f)}function f(){var a=this;"function"==typeof this._flush?this._flush(function(b,c){g(a,b,c)}):g(this,null,null)}function g(a,b,c){if(b)return a.emit("error",b);if(null!=c&&a.push(c),a._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(a._transformState.transforming)throw new Error("Calling transform done when still transforming");return a.push(null)}b.exports=e;var h=a(20),i=a(12);i.inherits=a(15),i.inherits(e,h),e.prototype.push=function(a,b){return this._transformState.needTransform=!1,h.prototype.push.call(this,a,b)},e.prototype._transform=function(a,b,c){throw new Error("_transform() is not implemented")},e.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},e.prototype._read=function(a){var b=this._transformState;null!==b.writechunk&&b.writecb&&!b.transforming?(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform)):b.needTransform=!0},e.prototype._destroy=function(a,b){var c=this;h.prototype._destroy.call(this,a,function(a){b(a),c.emit("close")})}},{12:12,15:15,20:20}],24:[function(a,b,c){(function(c,d){"use strict";function e(a){var b=this;this.next=null,this.entry=null,this.finish=function(){A(b,a)}}function f(a){return H.from(a)}function g(a){return H.isBuffer(a)||a instanceof I}function h(){}function i(b,c){C=C||a(20),b=b||{};var d=c instanceof C;this.objectMode=!!b.objectMode,d&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var f=b.highWaterMark,g=b.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=f||0===f?f:d&&(g||0===g)?g:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=!1===b.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){r(c,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function j(b){if(C=C||a(20),!(K.call(j,this)||this instanceof C))return new j(b);this._writableState=new i(b,this),this.writable=!0,b&&("function"==typeof b.write&&(this._write=b.write),"function"==typeof b.writev&&(this._writev=b.writev),"function"==typeof b.destroy&&(this._destroy=b.destroy),"function"==typeof b.final&&(this._final=b.final)),G.call(this)}function k(a,b){var c=new Error("write after end");a.emit("error",c),B.nextTick(b,c)}function l(a,b,c,d){var e=!0,f=!1;return null===c?f=new TypeError("May not write null values to stream"):"string"==typeof c||void 0===c||b.objectMode||(f=new TypeError("Invalid non-string/buffer chunk")),f&&(a.emit("error",f),B.nextTick(d,f),e=!1),e}function m(a,b,c){return a.objectMode||!1===a.decodeStrings||"string"!=typeof b||(b=H.from(b,c)),b}function n(a,b,c,d,e,f){if(!c){var g=m(b,d,e);d!==g&&(c=!0,e="buffer",d=g)}var h=b.objectMode?1:d.length;b.length+=h;var i=b.length<b.highWaterMark;if(i||(b.needDrain=!0),b.writing||b.corked){var j=b.lastBufferedRequest;b.lastBufferedRequest={chunk:d,encoding:e,isBuf:c,callback:f,next:null},j?j.next=b.lastBufferedRequest:b.bufferedRequest=b.lastBufferedRequest,b.bufferedRequestCount+=1}else o(a,b,!1,h,d,e,f);return i}function o(a,b,c,d,e,f,g){b.writelen=d,b.writecb=g,b.writing=!0,b.sync=!0,c?a._writev(e,b.onwrite):a._write(e,f,b.onwrite),b.sync=!1}function p(a,b,c,d,e){--b.pendingcb,c?(B.nextTick(e,d),B.nextTick(y,a,b),a._writableState.errorEmitted=!0,a.emit("error",d)):(e(d),a._writableState.errorEmitted=!0,a.emit("error",d),y(a,b))}function q(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function r(a,b){var c=a._writableState,d=c.sync,e=c.writecb;if(q(c),b)p(a,c,d,b,e);else{var f=v(c);f||c.corked||c.bufferProcessing||!c.bufferedRequest||u(a,c),d?D(s,a,c,f,e):s(a,c,f,e)}}function s(a,b,c,d){c||t(a,b),b.pendingcb--,d(),y(a,b)}function t(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function u(a,b){b.bufferProcessing=!0;var c=b.bufferedRequest;if(a._writev&&c&&c.next){var d=b.bufferedRequestCount,f=new Array(d),g=b.corkedRequestsFree;g.entry=c;for(var h=0,i=!0;c;)f[h]=c,c.isBuf||(i=!1),c=c.next,h+=1;f.allBuffers=i,o(a,b,!0,b.length,f,"",g.finish),b.pendingcb++,b.lastBufferedRequest=null,g.next?(b.corkedRequestsFree=g.next,g.next=null):b.corkedRequestsFree=new e(b),b.bufferedRequestCount=0}else{for(;c;){var j=c.chunk,k=c.encoding,l=c.callback;if(o(a,b,!1,b.objectMode?1:j.length,j,k,l),c=c.next,b.bufferedRequestCount--,b.writing)break}null===c&&(b.lastBufferedRequest=null)}b.bufferedRequest=c,b.bufferProcessing=!1}function v(a){return a.ending&&0===a.length&&null===a.bufferedRequest&&!a.finished&&!a.writing}function w(a,b){a._final(function(c){b.pendingcb--,c&&a.emit("error",c),b.prefinished=!0,a.emit("prefinish"),y(a,b)})}function x(a,b){b.prefinished||b.finalCalled||("function"==typeof a._final?(b.pendingcb++,b.finalCalled=!0,B.nextTick(w,a,b)):(b.prefinished=!0,a.emit("prefinish")))}function y(a,b){var c=v(b);return c&&(x(a,b),0===b.pendingcb&&(b.finished=!0,a.emit("finish"))),c}function z(a,b,c){b.ending=!0,y(a,b),c&&(b.finished?B.nextTick(c):a.once("finish",c)),b.ended=!0,a.writable=!1}function A(a,b,c){var d=a.entry;for(a.entry=null;d;){var e=d.callback;b.pendingcb--,e(c),d=d.next}b.corkedRequestsFree?b.corkedRequestsFree.next=a:b.corkedRequestsFree=a}var B=a(17);b.exports=j;var C,D=!c.browser&&["v0.10","v0.9."].indexOf(c.version.slice(0,5))>-1?setImmediate:B.nextTick;j.WritableState=i;var E=a(12);E.inherits=a(15);var F={deprecate:a(37)},G=a(27),H=a(34).Buffer,I=d.Uint8Array||function(){},J=a(26);E.inherits(j,G),i.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(i.prototype,"buffer",{get:F.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(a){}}();var K;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(K=Function.prototype[Symbol.hasInstance],Object.defineProperty(j,Symbol.hasInstance,{value:function(a){return!!K.call(this,a)||this===j&&(a&&a._writableState instanceof i)}})):K=function(a){return a instanceof this},j.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},j.prototype.write=function(a,b,c){var d=this._writableState,e=!1,i=!d.objectMode&&g(a);return i&&!H.isBuffer(a)&&(a=f(a)),"function"==typeof b&&(c=b,b=null),i?b="buffer":b||(b=d.defaultEncoding),"function"!=typeof c&&(c=h),d.ended?k(this,c):(i||l(this,d,a,c))&&(d.pendingcb++,e=n(this,d,i,a,b,c)),e},j.prototype.cork=function(){this._writableState.corked++},j.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||u(this,a))},j.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);return this._writableState.defaultEncoding=a,this},Object.defineProperty(j.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),j.prototype._write=function(a,b,c){c(new Error("_write() is not implemented"))},j.prototype._writev=null,j.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||z(this,d,c)},Object.defineProperty(j.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(a){this._writableState&&(this._writableState.destroyed=a)}}),j.prototype.destroy=J.destroy,j.prototype._undestroy=J.undestroy,j.prototype._destroy=function(a,b){this.end(),b(a)}}).call(this,a(18),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{12:12,15:15,17:17,18:18,20:20,26:26,27:27,34:34,37:37}],25:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){a.copy(b,c)}var f=a(34).Buffer,g=a(9);b.exports=function(){function a(){d(this,a),this.head=null,this.tail=null,this.length=0}return a.prototype.push=function(a){var b={data:a,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length},a.prototype.unshift=function(a){var b={data:a,next:this.head};0===this.length&&(this.tail=b),this.head=b,++this.length},a.prototype.shift=function(){if(0!==this.length){var a=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},a.prototype.clear=function(){this.head=this.tail=null,this.length=0},a.prototype.join=function(a){if(0===this.length)return"";for(var b=this.head,c=""+b.data;b=b.next;)c+=a+b.data;return c},a.prototype.concat=function(a){if(0===this.length)return f.alloc(0);if(1===this.length)return this.head.data;for(var b=f.allocUnsafe(a>>>0),c=this.head,d=0;c;)e(c.data,b,d),d+=c.data.length,c=c.next;return b},a}(),g&&g.inspect&&g.inspect.custom&&(b.exports.prototype[g.inspect.custom]=function(){var a=g.inspect({length:this.length});return this.constructor.name+" "+a})},{34:34,9:9}],26:[function(a,b,c){"use strict";function d(a,b){var c=this,d=this._readableState&&this._readableState.destroyed,e=this._writableState&&this._writableState.destroyed;return d||e?(b?b(a):!a||this._writableState&&this._writableState.errorEmitted||g.nextTick(f,this,a),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(a){!b&&a?(g.nextTick(f,c,a),c._writableState&&(c._writableState.errorEmitted=!0)):b&&b(a)}),this)}function e(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function f(a,b){a.emit("error",b)}var g=a(17);b.exports={destroy:d,undestroy:e}},{17:17}],27:[function(a,b,c){b.exports=a(13).EventEmitter},{13:13}],28:[function(a,b,c){arguments[4][11][0].apply(c,arguments)},{11:11}],29:[function(a,b,c){"use strict";function d(a){if(!a)return"utf8";for(var b;;)switch(a){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return a;default:if(b)return;a=(""+a).toLowerCase(),b=!0}}function e(a){var b=d(a);if("string"!=typeof b&&(s.isEncoding===t||!t(a)))throw new Error("Unknown encoding: "+a);return b||a}function f(a){this.encoding=e(a);var b;switch(this.encoding){case"utf16le":this.text=m,this.end=n,b=4;break;case"utf8":this.fillLast=j,b=4;break;case"base64":this.text=o,this.end=p,b=3;break;default:return this.write=q,void(this.end=r)}this.lastNeed=0,this.lastTotal=0,this.lastChar=s.allocUnsafe(b)}function g(a){return a<=127?0:a>>5==6?2:a>>4==14?3:a>>3==30?4:a>>6==2?-1:-2}function h(a,b,c){var d=b.length-1;if(d<c)return 0;var e=g(b[d]);return e>=0?(e>0&&(a.lastNeed=e-1),e):--d<c||-2===e?0:(e=g(b[d]))>=0?(e>0&&(a.lastNeed=e-2),e):--d<c||-2===e?0:(e=g(b[d]),e>=0?(e>0&&(2===e?e=0:a.lastNeed=e-3),e):0)}function i(a,b,c){if(128!=(192&b[0]))return a.lastNeed=0,"�";if(a.lastNeed>1&&b.length>1){if(128!=(192&b[1]))return a.lastNeed=1,"�";if(a.lastNeed>2&&b.length>2&&128!=(192&b[2]))return a.lastNeed=2,"�"}}function j(a){var b=this.lastTotal-this.lastNeed,c=i(this,a,b);return void 0!==c?c:this.lastNeed<=a.length?(a.copy(this.lastChar,b,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(a.copy(this.lastChar,b,0,a.length),void(this.lastNeed-=a.length))}function k(a,b){var c=h(this,a,b);if(!this.lastNeed)return a.toString("utf8",b);this.lastTotal=c;var d=a.length-(c-this.lastNeed);return a.copy(this.lastChar,0,d),a.toString("utf8",b,d)}function l(a){var b=a&&a.length?this.write(a):"";return this.lastNeed?b+"�":b}function m(a,b){if((a.length-b)%2==0){var c=a.toString("utf16le",b);if(c){var d=c.charCodeAt(c.length-1);if(d>=55296&&d<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=a[a.length-2],this.lastChar[1]=a[a.length-1],c.slice(0,-1)}return c}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=a[a.length-1],a.toString("utf16le",b,a.length-1)}function n(a){var b=a&&a.length?this.write(a):"";if(this.lastNeed){var c=this.lastTotal-this.lastNeed;return b+this.lastChar.toString("utf16le",0,c)}return b}function o(a,b){var c=(a.length-b)%3;return 0===c?a.toString("base64",b):(this.lastNeed=3-c,this.lastTotal=3,1===c?this.lastChar[0]=a[a.length-1]:(this.lastChar[0]=a[a.length-2],this.lastChar[1]=a[a.length-1]),a.toString("base64",b,a.length-c))}function p(a){var b=a&&a.length?this.write(a):"";return this.lastNeed?b+this.lastChar.toString("base64",0,3-this.lastNeed):b}function q(a){return a.toString(this.encoding)}function r(a){return a&&a.length?this.write(a):""}var s=a(34).Buffer,t=s.isEncoding||function(a){switch((a=""+a)&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};c.StringDecoder=f,f.prototype.write=function(a){if(0===a.length)return"";var b,c;if(this.lastNeed){if(void 0===(b=this.fillLast(a)))return"";c=this.lastNeed,this.lastNeed=0}else c=0;return c<a.length?b?b+this.text(a,c):this.text(a,c):b||""},f.prototype.end=l,f.prototype.text=k,f.prototype.fillLast=function(a){if(this.lastNeed<=a.length)return a.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);a.copy(this.lastChar,this.lastTotal-this.lastNeed,0,a.length),this.lastNeed-=a.length}},{34:34}],30:[function(a,b,c){b.exports=a(31).PassThrough},{31:31}],31:[function(a,b,c){c=b.exports=a(22),c.Stream=c,c.Readable=c,c.Writable=a(24),c.Duplex=a(20),c.Transform=a(23),c.PassThrough=a(21)},{20:20,21:21,22:22,23:23,24:24}],32:[function(a,b,c){b.exports=a(31).Transform},{31:31}],33:[function(a,b,c){b.exports=a(24)},{24:24}],34:[function(a,b,c){function d(a,b){for(var c in a)b[c]=a[c]}function e(a,b,c){return g(a,b,c)}var f=a(10),g=f.Buffer;g.from&&g.alloc&&g.allocUnsafe&&g.allocUnsafeSlow?b.exports=f:(d(f,c),c.Buffer=e),d(g,e),e.from=function(a,b,c){if("number"==typeof a)throw new TypeError("Argument must not be a number");return g(a,b,c)},e.alloc=function(a,b,c){if("number"!=typeof a)throw new TypeError("Argument must be a number");var d=g(a);return void 0!==b?"string"==typeof c?d.fill(b,c):d.fill(b):d.fill(0),d},e.allocUnsafe=function(a){if("number"!=typeof a)throw new TypeError("Argument must be a number");return g(a)},e.allocUnsafeSlow=function(a){if("number"!=typeof a)throw new TypeError("Argument must be a number");return f.SlowBuffer(a)}},{10:10}],35:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a(13).EventEmitter;a(15)(d,e),d.Readable=a(31),d.Writable=a(33),d.Duplex=a(19),d.Transform=a(32),d.PassThrough=a(30),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&!1===b.end||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{13:13,15:15,19:19,30:30,31:31,32:32,33:33}],36:[function(a,b,c){function d(a){ +if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a(10).Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";a=a.slice(c,a.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var d=b.charCodeAt(b.length-1);if(!(d>=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{10:10}],37:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(d){return!1}var c=a.localStorage[b];return null!=c&&"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],38:[function(a,b,c){!function(a,b,c,d,e){function f(a){this.node=a}function g(){this.events=[],this.head=null,this.body=null}function h(){this.styling=null,this.layout=null}function i(){this.styles={}}function j(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function k(){this.regions={}}function l(a){this.kind=a,this.begin=null,this.end=null,this.styleAttrs=null,this.regionID=null,this.sets=null,this.timeContainer=null}function m(){l.call(this,"body")}function n(){l.call(this,"div")}function o(){l.call(this,"p")}function p(){l.call(this,"span"),this.space=null}function q(){l.call(this,"span"),this.space=null,this.text=null}function r(){l.call(this,"br")}function s(){this.id=null,this.begin=null,this.end=null,this.styleAttrs=null,this.sets=null}function t(){this.begin=null,this.end=null,this.qname=null,this.value=null}function u(a){return a&&"xml:id"in a.attributes?a.attributes["xml:id"].value||null:null}function v(a){return a&&"region"in a.attributes?a.attributes.region.value:""}function w(a,b){var c=a&&"timeContainer"in a.attributes?a.attributes.timeContainer.value:null;return c&&"par"!==c?"seq"===c?"seq":(K(b,"Illegal value of timeContainer (assuming 'par')"),"par"):"par"}function x(a){return a&&"style"in a.attributes?a.attributes.style.value.split(" "):[]}function y(a,b){var c={};if(null!==a)for(var e in a.attributes){var f=a.attributes[e].uri+" "+a.attributes[e].local,g=d.byQName[f];if(void 0!==g){var h=g.parse(a.attributes[e].value);null!==h?(c[f]=h,g===d.byName.zIndex&&J(b,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):K(b,"Cannot parse styling attribute "+f+" --\x3e "+a.attributes[e].value)}}return c}function z(a,b,c){for(var d in a.attributes)if(a.attributes[d].uri===b&&a.attributes[d].local===c)return a.attributes[d].value;return null}function A(a,b){var d=z(a,c.ns_ittp,"aspectRatio"),e=null;if(null!==d){var f=/(\d+) (\d+)/,g=f.exec(d);if(null!==g){var h=parseInt(g[1]),i=parseInt(g[2]);0!==h&&0!==i?e=h/i:K(b,"Illegal aspectRatio values (ignoring)")}else K(b,"Malformed aspectRatio attribute (ignoring)")}return e}function B(a,b){var d=z(a,c.ns_ttp,"cellResolution"),e=15,f=32;if(null!==d){var g=/(\d+) (\d+)/,h=g.exec(d);null!==h?(f=parseInt(h[1]),e=parseInt(h[2])):J(b,"Malformed cellResolution value (using initial value instead)")}return{w:f,h:e}}function C(a,b){var d,e=z(a,c.ns_ttp,"frameRate"),f=30;if(null!==e){d=/(\d+)/.exec(e),null!==d?f=parseInt(d[1]):J(b,"Malformed frame rate attribute (using initial value instead)")}var g=z(a,c.ns_ttp,"frameRateMultiplier"),h=1;if(null!==g){d=/(\d+) (\d+)/.exec(g),null!==d?h=parseInt(d[1])/parseInt(d[2]):J(b,"Malformed frame rate multiplier attribute (using initial value instead)")}var i=h*f,j=1,k=z(a,c.ns_ttp,"tickRate");if(null===k)null!==e&&(j=i);else{d=/(\d+)/.exec(k),null!==d?j=parseInt(d[1]):J(b,"Malformed tick rate attribute (using initial value instead)")}return{effectiveFrameRate:i,tickRate:j}}function D(a,b){var d=z(a,c.ns_tts,"extent");if(null===d)return null;var f=d.split(" ");if(2!==f.length)return J(b,"Malformed extent (ignoring)"),null;var g=e.parseLength(f[0]),h=e.parseLength(f[1]);return h&&g?{h:h,w:g}:(J(b,"Malformed extent values (ignoring)"),null)}function E(a,b,c){var d,e=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/,f=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/,g=/^(\d+(?:\.\d+)?)f$/,h=/^(\d+(?:\.\d+)?)t$/,i=/^(\d+(?:\.\d+)?)ms$/,j=/^(\d+(?:\.\d+)?)s$/,k=/^(\d+(?:\.\d+)?)h$/,l=/^(\d+(?:\.\d+)?)m$/,m=null;return null!==(d=g.exec(c))?null!==b&&(m=parseFloat(d[1])/b):null!==(d=h.exec(c))?null!==a&&(m=parseFloat(d[1])/a):null!==(d=i.exec(c))?m=parseFloat(d[1])/1e3:null!==(d=j.exec(c))?m=parseFloat(d[1]):null!==(d=k.exec(c))?m=3600*parseFloat(d[1]):null!==(d=l.exec(c))?m=60*parseFloat(d[1]):null!==(d=e.exec(c))?m=3600*parseInt(d[1])+60*parseInt(d[2])+parseFloat(d[3]):null!==(d=f.exec(c))&&null!==b&&(m=3600*parseInt(d[1])+60*parseInt(d[2])+parseInt(d[3])+(null===d[4]?0:parseInt(d[4])/b)),m}function F(a,b,c,d){var e=b&&"seq"===b.timeContainer,f=0;c&&"begin"in c.attributes&&null===(f=E(a.tickRate,a.effectiveFrameRate,c.attributes.begin.value))&&(J(d,"Malformed begin value "+c.attributes.begin.value+" (using 0)"),f=0);var g=e?0:null;c&&"dur"in c.attributes&&null===(g=E(a.tickRate,a.effectiveFrameRate,c.attributes.dur.value))&&J(d,"Malformed dur value "+c.attributes.dur.value+" (ignoring)");var h=null;c&&"end"in c.attributes&&null===(h=E(a.tickRate,a.effectiveFrameRate,c.attributes.end.value))&&J(d,"Malformed end value (ignoring)");var i=0;if(b&&(i=e&&"contents"in b&&b.contents.length>0?b.contents[b.contents.length-1].end:b.begin||0),f+=i,null!==g)h=f+g;else{var j=b&&"end"in b?b.end:Number.POSITIVE_INFINITY;h=null!==h?h+i:j}return{begin:f,end:h}}function G(a,b,c){for(;b.styleRefs.length>0;){var d=b.styleRefs.pop();d in a.styles?(G(a,a.styles[d],c),I(a.styles[d].styleAttrs,b.styleAttrs)):K(c,"Non-existant style id referenced")}}function H(a,b,c,d){for(var e=b.length-1;e>=0;e--){var f=b[e];f in a.styles?I(a.styles[f].styleAttrs,c):K(d,"Non-existant style id referenced")}}function I(a,b){for(var c in a)c in b||(b[c]=a[c])}function J(a,b){if(a&&a.warn&&a.warn(b))throw b}function K(a,b){if(a&&a.error&&a.error(b))throw b}function L(a,b){throw a&&a.fatal&&a.fatal(b),b}function M(a,b){for(var c,d=0,e=a.length-1;d<=e;){c=Math.floor((d+e)/2);var f=a[c];if(f<b)d=c+1;else{if(!(f>b))return{found:!0,index:c};e=c-1}}return{found:!1,index:d}}a.fromXML=function(a,d,e){var l=b.parser(!0,{xmlns:!0}),u=[],v=[],w=[],x=0,y=null;l.onclosetag=function(a){if(u[0]instanceof i)for(var b in u[0].styles)G(u[0],u[0].styles[b],d);else if(u[0]instanceof o||u[0]instanceof p){if(u[0].contents.length>1){var g,h=[u[0].contents[0]];for(g=1;g<u[0].contents.length;g++)u[0].contents[g]instanceof q&&h[h.length-1]instanceof q?h[h.length-1].text+=u[0].contents[g].text:h.push(u[0].contents[g]);u[0].contents=h}u[0]instanceof p&&1===u[0].contents.length&&u[0].contents[0]instanceof q&&null===u[0].text&&(u[0].text=u[0].contents[0].text,delete u[0].contents)}else u[0]instanceof f&&(u[0].node.uri===c.ns_tt&&"metadata"===u[0].node.local?x--:x>0&&e&&"onCloseTag"in e&&e.onCloseTag());w.shift(),v.shift(),u.shift()},l.ontext=function(a){if(void 0===u[0]);else if(u[0]instanceof p||u[0]instanceof o){var b=new q;b.initFromText(y,u[0],a,w[0],d),u[0].contents.push(b)}else u[0]instanceof f&&x>0&&e&&"onText"in e&&e.onText(a)},l.onopentag=function(a){var b=a.attributes["xml:space"];b?w.unshift(b.value):0===w.length?w.unshift("default"):w.unshift(w[0]);var l=a.attributes["xml:lang"];if(l?v.unshift(l.value):0===v.length?v.unshift(""):v.unshift(v[0]),a.uri===c.ns_tt)if("tt"===a.local)null!==y&&L("Two <tt> elements at ("+this.line+","+this.column+")"),y=new g,y.initFromNode(a,d),u.unshift(y);else if("head"===a.local)u[0]instanceof g||L("Parent of <head> element is not <tt> at ("+this.line+","+this.column+")"),null!==y.head&&L("Second <head> element at ("+this.line+","+this.column+")"),y.head=new h,u.unshift(y.head);else if("styling"===a.local)u[0]instanceof h||L("Parent of <styling> element is not <head> at ("+this.line+","+this.column+")"),null!==y.head.styling&&L("Second <styling> element at ("+this.line+","+this.column+")"),y.head.styling=new i,u.unshift(y.head.styling);else if("style"===a.local){var q;u[0]instanceof i?(q=new j,q.initFromNode(a,d),q.id?y.head.styling.styles[q.id]=q:K("<style> element missing @id attribute"),u.unshift(q)):u[0]instanceof s?(q=new j,q.initFromNode(a,d),I(q.styleAttrs,u[0].styleAttrs),u.unshift(q)):L(d,"Parent of <style> element is not <styling> or <region> at ("+this.line+","+this.column+")")}else if("layout"===a.local)u[0]instanceof h||L(d,"Parent of <layout> element is not <head> at "+this.line+","+this.column+")"),null!==y.head.layout&&L(d,"Second <layout> element at "+this.line+","+this.column+")"),y.head.layout=new k,u.unshift(y.head.layout);else if("region"===a.local){u[0]instanceof k||L(d,"Parent of <region> element is not <layout> at "+this.line+","+this.column+")");var z=new s;z.initFromNode(y,a,d),!z.id||z.id in y.head.layout.regions?K(d,"Ignoring <region> with duplicate or missing @id at "+this.line+","+this.column+")"):(y.head.layout.regions[z.id]=z,y._registerEvent(z)),u.unshift(z)}else if("body"===a.local){u[0]instanceof g||L(d,"Parent of <body> element is not <tt> at "+this.line+","+this.column+")"),null!==y.body&&L(d,"Second <body> element at "+this.line+","+this.column+")");var A=new m;A.initFromNode(y,a,d),y._registerEvent(A),y.body=A,u.unshift(A)}else if("div"===a.local){u[0]instanceof n||u[0]instanceof m||L(d,"Parent of <div> element is not <body> or <div> at "+this.line+","+this.column+")");var B=new n;B.initFromNode(y,u[0],a,d),y._registerEvent(B),u[0].contents.push(B),u.unshift(B)}else if("p"===a.local){u[0]instanceof n||L(d,"Parent of <p> element is not <div> at "+this.line+","+this.column+")");var C=new o;C.initFromNode(y,u[0],a,d),y._registerEvent(C),u[0].contents.push(C),u.unshift(C)}else if("span"===a.local){u[0]instanceof p||u[0]instanceof o||L(d,"Parent of <span> element is not <span> or <p> at "+this.line+","+this.column+")");var D=new p;D.initFromNode(y,u[0],a,w[0],d),y._registerEvent(D),u[0].contents.push(D),u.unshift(D)}else if("br"===a.local){u[0]instanceof p||u[0]instanceof o||L(d,"Parent of <br> element is not <span> or <p> at "+this.line+","+this.column+")");var E=new r;E.initFromNode(y,u[0],a,d),y._registerEvent(E),u[0].contents.push(E),u.unshift(E)}else if("set"===a.local){u[0]instanceof p||u[0]instanceof o||u[0]instanceof n||u[0]instanceof m||u[0]instanceof s||u[0]instanceof r||L(d,"Parent of <set> element is not a content element or a region at "+this.line+","+this.column+")");var F=new t;F.initFromNode(y,u[0],a,d),y._registerEvent(F),u[0].sets.push(F),u.unshift(F)}else u.unshift(new f(a));else u.unshift(new f(a));if(u[0]instanceof f)if(a.uri===c.ns_tt&&"metadata"===a.local)x++;else if(x>0&&e&&"onOpenTag"in e){var G=[];for(var H in a.attributes)G[a.attributes[H].uri+" "+a.attributes[H].local]={uri:a.attributes[H].uri,local:a.attributes[H].local,value:a.attributes[H].value};e.onOpenTag(a.uri,a.local,G)}},l.write(a).close(),null!==y.head?delete y.head.styling:y.head=new h,null===y.head.layout&&(y.head.layout=new k);var z=!1;for(var A in y.head.layout.regions){z=!0;break}if(!z){var B=s.createDefaultRegion();y.head.layout.regions[B.id]=B}return y},g.prototype.initFromNode=function(a,b){this.cellResolution=B(a,b);var d=C(a,b);this.effectiveFrameRate=d.effectiveFrameRate,this.tickRate=d.tickRate,this.aspectRatio=A(a,b);var e=z(a,c.ns_ttp,"timeBase");null!==e&&"media"!==e&&L(b,"Unsupported time base");var f=D(a,b);null===f?this.pxDimensions={h:480,w:640}:("px"===f.h.unit&&"px"===f.w.unit||L(b,"Extent on TT must be in px or absent"),this.pxDimensions={h:f.h.value,w:f.w.value})},g.prototype._registerEvent=function(a){if(!(a.end<=a.begin)){var b=M(this.events,a.begin);if(b.found||this.events.splice(b.index,0,a.begin),a.end!==Number.POSITIVE_INFINITY){var c=M(this.events,a.end);c.found||this.events.splice(c.index,0,a.end)}}},g.prototype.getMediaTimeRange=function(){return[this.events[0],this.events[this.events.length-1]]},g.prototype.getMediaTimeEvents=function(){return this.events},j.prototype.initFromNode=function(a,b){this.id=u(a),this.styleAttrs=y(a,b),this.styleRefs=x(a)},l.prototype.initFromNode=function(a,b,c,d){var e=F(a,b,c,d);this.begin=e.begin,this.end=e.end,this.styleAttrs=y(c,d),null!==a.head&&null!==a.head.styling&&H(a.head.styling,x(c),this.styleAttrs,d),this.regionID=v(c),this.sets=[],this.timeContainer=w(c,d)},m.prototype.initFromNode=function(a,b,c){l.prototype.initFromNode.call(this,a,null,b,c),this.contents=[]},n.prototype.initFromNode=function(a,b,c,d){l.prototype.initFromNode.call(this,a,b,c,d),this.contents=[]},o.prototype.initFromNode=function(a,b,c,d){l.prototype.initFromNode.call(this,a,b,c,d),this.contents=[]},p.prototype.initFromNode=function(a,b,c,d,e){l.prototype.initFromNode.call(this,a,b,c,e),this.space=d,this.contents=[]},q.prototype.initFromText=function(a,b,c,d,e){l.prototype.initFromNode.call(this,a,b,null,e),this.text=c,this.space=d},r.prototype.initFromNode=function(a,b,c,d){l.prototype.initFromNode.call(this,a,b,c,d)},s.createDefaultRegion=function(){var a=new s;return a.id="",a.begin=0,a.end=Number.POSITIVE_INFINITY,a.styleAttrs={},a.sets=[],a},s.prototype.initFromNode=function(a,b,c){this.id=u(b);var d=F(a,null,b,c);this.begin=d.begin,this.end=d.end,this.styleAttrs=y(b,c),this.sets=[],null!==a.head&&null!==a.head.styling&&H(a.head.styling,x(b),this.styleAttrs,c)},t.prototype.initFromNode=function(a,b,c,d){var e=F(a,b,c,d);this.begin=e.begin,this.end=e.end;var f=y(c,d);for(var g in f){if(this.qname){K(d,"More than one style specified on set");break}this.qname=g,this.value=f[g]}}}(void 0===c?this.imscDoc={}:c,"undefined"==typeof sax?a(45):sax,"undefined"==typeof imscNames?a(42):imscNames,"undefined"==typeof imscStyles?a(43):imscStyles,"undefined"==typeof imscUtils?a(44):imscUtils)},{42:42,43:43,44:44,45:45}],39:[function(a,b,c){!function(a,b,c){function d(a,b,h){var j;if("region"===h.kind?(j=document.createElement("div"),j.style.position="absolute"):"body"===h.kind?j=document.createElement("div"):"div"===h.kind?j=document.createElement("div"):"p"===h.kind?j=document.createElement("p"):"span"===h.kind?j=document.createElement("span"):"br"===h.kind&&(j=document.createElement("br")),!j)return void n(a.errorHandler,"Error processing ISD element kind: "+h.kind);j.style.margin="0";for(var k in o){var l=o[k],m=h.styleAttrs[l.qname];void 0!==m&&null!==l.map&&l.map(a,j,h,m)}var p=j,q=h.styleAttrs[c.byName.multiRowAlign.qname];if(q&&"auto"!==q){var r=document.createElement("span");r.style.display="inline-block",r.style.textAlign=q,j.appendChild(r),p=r,a.mra=q}var s=h.styleAttrs[c.byName.linePadding.qname];if(s&&s>0&&(a.lp=s),"span"===h.kind&&h.text)if(a.lp||a.mra)for(var t=0;t<h.text.length;t++){var u=document.createElement("span");u.textContent=h.text.charAt(t),j.appendChild(u)}else j.textContent=h.text;b.appendChild(j);for(var v in h.contents)d(a,p,h.contents[v]);if((a.lp||a.mra)&&"p"===h.kind){var w=[];f(p,w,"red"),i(w,a.lp*a.h),a.lp&&delete a.lp,a.mra&&delete a.mra}if("region"===h.kind){var x=[];g(p,x);var y=h.styleAttrs[c.byName.writingMode.qname];if(("lrtb"===y||"lr"===y||"rltb"===y||"rl"===y)&&a.enableRollUp&&h.contents.length>0&&"after"===h.styleAttrs[c.byName.displayAlign.qname]){var z=""===h.id?"_":h.id,A=new e(z,x);if(a.currentISDState[A.id]=A,a.previousISDState&&A.id in a.previousISDState&&a.previousISDState[A.id].plist.length>0&&A.plist.length>1&&A.plist[A.plist.length-2].text===a.previousISDState[A.id].plist[a.previousISDState[A.id].plist.length-1].text){var B=j.firstElementChild;B.style.bottom="-"+A.plist[A.plist.length-1].height+"px",B.style.transition="transform 0.4s",B.style.position="relative",B.style.transform="translateY(-"+A.plist[A.plist.length-1].height+"px)"}}}}function e(a,b){this.id=a,this.plist=b}function f(a,b,c){if(0===a.childElementCount)b.push({element:a,bgcolor:c});else for(var d=a.style.backgroundColor||c,e=a.firstChild;e;)e.nodeType===Node.ELEMENT_NODE&&f(e,b,d),e=e.nextSibling}function g(a,b){if(0===a.childElementCount&&"span"===a.localName){var c=a.getBoundingClientRect();0!==b.length&&h(c.top,c.height,b[b.length-1].top,b[b.length-1].height)?(c.top<b[b.length-1].top&&(b[b.length-1].top=c.top),c.height>b[b.length-1].height&&(b[b.length-1].height=c.height),b[b.length-1].text+=a.textContent):b.push({top:c.top,height:c.height,text:a.textContent})}else for(var d=a.firstChild;d;)d.nodeType===Node.ELEMENT_NODE&&g(d,b),d=d.nextSibling}function h(a,b,c,d){return a+b<c+d&&a>c||c+d<=a+b&&c>=a}function i(a,b){for(var c=null,d=!0,e=!1,f=0;f<=a.length;f++)if(f===a.length||"br"!==a[f].element.localName){if(null===c||f===a.length||!h(a[f].element.getBoundingClientRect().top,a[f].element.getBoundingClientRect().height,a[c].element.getBoundingClientRect().top,a[c].element.getBoundingClientRect().height)){if(b&&!d){for(;--f>=0;)if(0!==a[f].element.getBoundingClientRect().width){if(k(a[f].element,a[f].color,b),0!==a[f].element.getBoundingClientRect().width&&h(a[f].element.getBoundingClientRect().top,a[f].element.getBoundingClientRect().height,a[c].element.getBoundingClientRect().top,a[c].element.getBoundingClientRect().height))break;l(a[f].element)}d=!0;continue}if(f!==a.length&&null!==c&&!e){var g=document.createElement("br");a[f].element.parentElement.insertBefore(g,a[f].element),a.splice(f,0,{element:g}),e=!0;continue}if(f!==a.length&&b)for(;f<a.length;f++)if(0!==a[f].element.getBoundingClientRect().width){j(a[f].element,a[f].color,b);break}d=!1,e=!1,c=f}}else e=!0}function j(a,b,c){a.style.paddingLeft=c+"px",a.style.backgroundColor=b}function k(a,b,c){a.style.paddingRight=c+"px",a.style.backgroundColor=b}function l(a){a.style.paddingRight=null}function m(a,b){this.qname=a,this.map=b}function n(a,b){if(a&&a.error&&a.error(b))throw b}a.render=function(a,b,c,e,f,g,h,i,j){var k=e||b.clientHeight,l=f||b.clientWidth;if(null!==a.aspectRatio){var m=k*a.aspectRatio;m>l?k=Math.round(l/a.aspectRatio):l=m}var n=document.createElement("div");n.style.position="relative",n.style.width=l+"px",n.style.height=k+"px",n.style.margin="auto",n.style.top=0,n.style.bottom=0,n.style.left=0,n.style.right=0,n.style.zIndex=0;var o={h:k,w:l,regionH:null,regionW:null,imgResolver:c,displayForcedOnlyMode:g||!1,isd:a,errorHandler:h,previousISDState:i,enableRollUp:j||!1,currentISDState:{}};b.appendChild(n);for(var p in a.contents)d(o,n,a.contents[p]);return o.currentISDState};var o=[new m("http://www.w3.org/ns/ttml#styling backgroundColor",function(a,b,c,d){b.style.backgroundColor="rgba("+d[0].toString()+","+d[1].toString()+","+d[2].toString()+","+(d[3]/255).toString()+")"}),new m("http://www.w3.org/ns/ttml#styling color",function(a,b,c,d){b.style.color="rgba("+d[0].toString()+","+d[1].toString()+","+d[2].toString()+","+(d[3]/255).toString()+")"}),new m("http://www.w3.org/ns/ttml#styling direction",function(a,b,c,d){b.style.direction=d}),new m("http://www.w3.org/ns/ttml#styling display",function(a,b,c,d){}),new m("http://www.w3.org/ns/ttml#styling displayAlign",function(a,b,c,d){b.style.display="flex",b.style.flexDirection="column","before"===d?b.style.justifyContent="flex-start":"center"===d?b.style.justifyContent="center":"after"===d&&(b.style.justifyContent="flex-end")}),new m("http://www.w3.org/ns/ttml#styling extent",function(a,b,c,d){a.regionH=d.h*a.h,a.regionW=d.w*a.w;var e=0,f=0,g=c.styleAttrs["http://www.w3.org/ns/ttml#styling padding"];g&&(e=(g[0]+g[2])*a.h,f=(g[1]+g[3])*a.w),b.style.height=a.regionH-e+"px",b.style.width=a.regionW-f+"px"}),new m("http://www.w3.org/ns/ttml#styling fontFamily",function(a,b,c,d){var e=[];for(var f in d)"monospaceSerif"===d[f]?(e.push("Courier New"),e.push('"Liberation Mono"'),e.push("Courier"),e.push("monospace")):"proportionalSansSerif"===d[f]?(e.push("Arial"),e.push("Helvetica"),e.push('"Liberation Sans"'),e.push("sans-serif")):"monospace"===d[f]?e.push("monospace"):"sansSerif"===d[f]?e.push("sans-serif"):"serif"===d[f]?e.push("serif"):"monospaceSansSerif"===d[f]?(e.push("Consolas"),e.push("monospace")):"proportionalSerif"===d[f]?e.push("serif"):e.push(d[f]);b.style.fontFamily=e.join(",")}),new m("http://www.w3.org/ns/ttml#styling fontSize",function(a,b,c,d){b.style.fontSize=d*a.h+"px"}),new m("http://www.w3.org/ns/ttml#styling fontStyle",function(a,b,c,d){b.style.fontStyle=d}),new m("http://www.w3.org/ns/ttml#styling fontWeight",function(a,b,c,d){b.style.fontWeight=d}),new m("http://www.w3.org/ns/ttml#styling lineHeight",function(a,b,c,d){b.style.lineHeight="normal"===d?"normal":d*a.h+"px"}),new m("http://www.w3.org/ns/ttml#styling opacity",function(a,b,c,d){b.style.opacity=d}),new m("http://www.w3.org/ns/ttml#styling origin",function(a,b,c,d){b.style.top=d.h*a.h+"px",b.style.left=d.w*a.w+"px"}),new m("http://www.w3.org/ns/ttml#styling overflow",function(a,b,c,d){b.style.overflow=d}),new m("http://www.w3.org/ns/ttml#styling padding",function(a,b,c,d){var e=[];e[0]=d[0]*a.h+"px",e[1]=d[3]*a.w+"px",e[2]=d[2]*a.h+"px",e[3]=d[1]*a.w+"px",b.style.padding=e.join(" ")}),new m("http://www.w3.org/ns/ttml#styling showBackground",null),new m("http://www.w3.org/ns/ttml#styling textAlign",function(a,b,d,e){var f,g=d.styleAttrs[c.byName.direction.qname];f="start"===e?"rtl"===g?"right":"left":"end"===e?"rtl"===g?"left":"right":e,b.style.textAlign=f}),new m("http://www.w3.org/ns/ttml#styling textDecoration",function(a,b,c,d){b.style.textDecoration=d.join(" ").replace("lineThrough","line-through")}),new m("http://www.w3.org/ns/ttml#styling textOutline",function(a,b,c,d){b.style.textShadow="none"===d?"":"rgba("+d.color[0].toString()+","+d.color[1].toString()+","+d.color[2].toString()+","+(d.color[3]/255).toString()+") 0px 0px "+d.thickness*a.h+"px"}),new m("http://www.w3.org/ns/ttml#styling unicodeBidi",function(a,b,c,d){var e;e="bidiOverride"===d?"bidi-override":d,b.style.unicodeBidi=e}),new m("http://www.w3.org/ns/ttml#styling visibility",function(a,b,c,d){b.style.visibility=d}),new m("http://www.w3.org/ns/ttml#styling wrapOption",function(a,b,c,d){"wrap"===d?"preserve"===c.space?b.style.whiteSpace="pre-wrap":b.style.whiteSpace="normal":"preserve"===c.space?b.style.whiteSpace="pre":b.style.whiteSpace="noWrap"}),new m("http://www.w3.org/ns/ttml#styling writingMode",function(a,b,c,d){"lrtb"===d||"lr"===d?b.style.writingMode="horizontal-tb":"rltb"===d||"rl"===d?b.style.writingMode="horizontal-tb":"tblr"===d?b.style.writingMode="vertical-lr":"tbrl"!==d&&"tb"!==d||(b.style.writingMode="vertical-rl")}),new m("http://www.w3.org/ns/ttml#styling zIndex",function(a,b,c,d){b.style.zIndex=d}),new m("http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt backgroundImage",function(a,b,c,d){if(null!==a.imgResolver&&null!==d){var e=document.createElement("img"),f=a.imgResolver(d,e);f&&(e.src=f),e.height=a.regionH,e.width=a.regionW,b.appendChild(e)}}),new m("http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay",function(a,b,c,d){a.displayForcedOnlyMode&&!1===d&&(b.style.visibility="hidden")})],p={};for(var q in o)p[o[q].qname]=o[q]}(void 0===c?this.imscHTML={}:c,"undefined"==typeof imscNames?a(42):imscNames,"undefined"==typeof imscStyles?a(43):imscStyles)},{42:42,43:43}],40:[function(a,b,c){!function(a,b,c){function d(a,b,g,j,k,l,m,n){if(b<m.begin||b>=m.end)return null;var o="regionID"in m&&""!==m.regionID?m.regionID:l;if(null!==k&&o!==g.id&&(!("contents"in m)||"contents"in m&&0===m.contents.length||""!==o))return null;var p=new h(m);for(var q in m.sets)b<m.sets[q].begin||b>=m.sets[q].end||(p.styleAttrs[m.sets[q].qname]=m.sets[q].value);var r={};for(var s in p.styleAttrs)if(r[s]=!0,s===c.byName.writingMode.qname&&!(c.byName.direction.qname in p.styleAttrs)){var t=p.styleAttrs[s];"lrtb"===t||"lr"===t?p.styleAttrs[c.byName.direction.qname]="ltr":"rltb"!==t&&"rl"!==t||(p.styleAttrs[c.byName.direction.qname]="rtl")}if(null!==k)for(var u in c.all){var v=c.all[u];if(v.qname===c.byName.textDecoration.qname){var w=k.styleAttrs[v.qname],x=p.styleAttrs[v.qname],y=[];void 0===x?y=w:-1===x.indexOf("none")?((-1===x.indexOf("noUnderline")&&-1!==w.indexOf("underline")||-1!==x.indexOf("underline"))&&y.push("underline"),(-1===x.indexOf("noLineThrough")&&-1!==w.indexOf("lineThrough")||-1!==x.indexOf("lineThrough"))&&y.push("lineThrough"),(-1===x.indexOf("noOverline")&&-1!==w.indexOf("overline")||-1!==x.indexOf("overline"))&&y.push("overline")):y.push("none"),p.styleAttrs[v.qname]=y}else v.inherit&&v.qname in k.styleAttrs&&!(v.qname in p.styleAttrs)&&(p.styleAttrs[v.qname]=k.styleAttrs[v.qname])}for(var z in c.all){var A=c.all[z];A.qname in p.styleAttrs||("region"===p.kind||!1===A.inherit&&null!==A.initial)&&(p.styleAttrs[A.qname]=A.parse(A.initial),r[A.qname]=!0)}for(var B in c.all){var C=c.all[B];if(C.qname in r&&null!==C.compute){var D=C.compute(a,k,p,p.styleAttrs[C.qname]);null!==D?p.styleAttrs[C.qname]=D:i(n,"Style '"+C.qname+"' on element '"+p.kind+"' cannot be computed")}}if("none"===p.styleAttrs[c.byName.display.qname])return null;var E;null===k?E=null===j?[]:[j]:"contents"in m&&(E=m.contents);for(var F in E){var G=d(a,b,g,j,p,o,E[F]);null!==G&&p.contents.push(G.element)}for(var H in p.styleAttrs){-1===c.byQName[H].applies.indexOf(p.kind)&&delete p.styleAttrs[H]}if("span"===p.kind&&p.text&&"default"===p.space){var I=p.text.replace(/\s+/g," ");p.text=I}if("p"===p.kind){var J=[];e(p,J);for(var K=0,L="after_br",M=0;;)if("after_br"===L)K>=J.length||"br"===J[K].kind?(L="before_br",M=K,K--):("preserve"!==J[K].space&&(J[K].text=J[K].text.replace(/^\s+/g,"")),J[K].text.length>0?(L="looking_br",K++):J.splice(K,1));else if("before_br"===L)if(K<0||"br"===J[K].kind){if(L="after_br",(K=M+1)>=J.length)break}else if("preserve"!==J[K].space&&(J[K].text=J[K].text.replace(/\s+$/g,"")),J[K].text.length>0){if(L="after_br",(K=M+1)>=J.length)break}else J.splice(K,1),K--;else K>=J.length||"br"===J[K].kind?(L="before_br",M=K,K--):K++;f(p)}return"div"===p.kind&&c.byName.backgroundImage.qname in p.styleAttrs||"br"===p.kind||"contents"in p&&p.contents.length>0||"span"===p.kind&&null!==p.text||"region"===p.kind&&"always"===p.styleAttrs[c.byName.showBackground.qname]?{region_id:o,element:p}:null}function e(a,b){if("contents"in a)for(var c in a.contents)e(a.contents[c],b);else b.push(a)}function f(a){if("br"===a.kind)return!1;if("text"in a)return 0===a.text.length;if("contents"in a){for(var b=a.contents.length;b--;)f(a.contents[b])&&a.contents.splice(b,1);return 0===a.contents.length}}function g(a){this.contents=[],this.aspectRatio=a.aspectRatio}function h(a){this.kind=a.kind||"region",a.id&&(this.id=a.id),this.styleAttrs={};for(var b in a.styleAttrs)this.styleAttrs[b]=a.styleAttrs[b];"text"in a?this.text=a.text:"br"!==a.kind&&(this.contents=[]),"space"in a&&(this.space=a.space)}function i(a,b){if(a&&a.error&&a.error(b))throw b}a.generateISD=function(a,b,c){var e=new g(a);for(var f in a.head.layout.regions){var h=d(a,b,a.head.layout.regions[f],a.body,null,"",a.head.layout.regions[f],c);null!==h&&e.contents.push(h.element)}return e}}(void 0===c?this.imscISD={}:c,"undefined"==typeof imscNames?a(42):imscNames,"undefined"==typeof imscStyles?a(43):imscStyles)},{42:42,43:43}],41:[function(a,b,c){c.generateISD=a(40).generateISD,c.fromXML=a(38).fromXML,c.renderHTML=a(39).render},{38:38,39:39,40:40}],42:[function(a,b,c){!function(a){a.ns_tt="http://www.w3.org/ns/ttml",a.ns_tts="http://www.w3.org/ns/ttml#styling",a.ns_ttp="http://www.w3.org/ns/ttml#parameter",a.ns_xml="http://www.w3.org/XML/1998/namespace",a.ns_itts="http://www.w3.org/ns/ttml/profile/imsc1#styling",a.ns_ittp="http://www.w3.org/ns/ttml/profile/imsc1#parameter",a.ns_smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt",a.ns_ebutts="urn:ebu:tt:style"}(void 0===c?this.imscNames={}:c)},{}],43:[function(a,b,c){!function(a,b,c){function d(a,b,c,d,e,f,g,h){this.name=b,this.ns=a,this.qname=a+" "+b,this.inherit=e,this.animatable=f,this.initial=c,this.applies=d,this.parse=g,this.compute=h}a.all=[new d(b.ns_tts,"backgroundColor","transparent",["body","div","p","region","span"],!1,!0,c.parseColor,null),new d(b.ns_tts,"color","white",["span"],!0,!0,c.parseColor,null),new d(b.ns_tts,"direction","ltr",["p","span"],!0,!0,function(a){return a},null),new d(b.ns_tts,"display","auto",["body","div","p","region","span"],!1,!0,function(a){return a},null),new d(b.ns_tts,"displayAlign","before",["region"],!1,!0,function(a){return a},null),new d(b.ns_tts,"extent","auto",["tt","region"],!1,!0,function(a){if("auto"===a)return a;var b=a.split(" ");if(2!==b.length)return null;var d=c.parseLength(b[0]),e=c.parseLength(b[1]);return e&&d?{h:e,w:d}:null},function(a,b,c,d){var e,f;if("auto"===d)e=1;else if("%"===d.h.unit)e=d.h.value/100;else{if("px"!==d.h.unit)return null;e=d.h.value/a.pxDimensions.h}if("auto"===d)f=1;else if("%"===d.w.unit)f=d.w.value/100;else{if("px"!==d.w.unit)return null;f=d.w.value/a.pxDimensions.w}return{h:e,w:f}}),new d(b.ns_tts,"fontFamily","default",["span"],!0,!0,function(a){var b=a.split(","),c=[];for(var d in b)"'"!==b[d].charAt(0)&&'"'!==b[d].charAt(0)&&"default"===b[d]?c.push("monospaceSerif"):c.push(b[d]);return c},null),new d(b.ns_tts,"fontSize","1c",["span"],!0,!0,c.parseLength,function(b,c,d,e){var f;if("%"===e.unit)f=null!==c?c.styleAttrs[a.byName.fontSize.qname]*e.value/100:e.value/100/b.cellResolution.h;else if("em"===e.unit)f=null!==c?c.styleAttrs[a.byName.fontSize.qname]*e.value:e.value/b.cellResolution.h;else if("c"===e.unit)f=e.value/b.cellResolution.h;else{if("px"!==e.unit)return null;f=e.value/b.pxDimensions.h}return f}),new d(b.ns_tts,"fontStyle","normal",["span"],!0,!0,function(a){return a},null),new d(b.ns_tts,"fontWeight","normal",["span"],!0,!0,function(a){return a},null),new d(b.ns_tts,"lineHeight","normal",["p"],!0,!0,function(a){return"normal"===a?a:c.parseLength(a)},function(b,c,d,e){var f;if("normal"===e)f=e;else if("%"===e.unit)f=d.styleAttrs[a.byName.fontSize.qname]*e.value/100;else if("em"===e.unit)f=d.styleAttrs[a.byName.fontSize.qname]*e.value;else if("c"===e.unit)f=e.value/b.cellResolution.h;else{if("px"!==e.unit)return null;f=e.value/b.pxDimensions.h}return f +}),new d(b.ns_tts,"opacity",1,["region"],!1,!0,parseFloat,null),new d(b.ns_tts,"origin","auto",["region"],!1,!0,function(a){if("auto"===a)return a;var b=a.split(" ");if(2!==b.length)return null;var d=c.parseLength(b[0]),e=c.parseLength(b[1]);return e&&d?{h:e,w:d}:null},function(a,b,c,d){var e,f;if("auto"===d)e=0;else if("%"===d.h.unit)e=d.h.value/100;else{if("px"!==d.h.unit)return null;e=d.h.value/a.pxDimensions.h}if("auto"===d)f=0;else if("%"===d.w.unit)f=d.w.value/100;else{if("px"!==d.w.unit)return null;f=d.w.value/a.pxDimensions.w}return{h:e,w:f}}),new d(b.ns_tts,"overflow","hidden",["region"],!1,!0,function(a){return a},null),new d(b.ns_tts,"padding","0px",["region"],!1,!0,function(a){var b=a.split(" ");if(b.length>4)return null;var d=[];for(var e in b){var f=c.parseLength(b[e]);if(!f)return null;d.push(f)}return d},function(b,c,d,e){var f;if(1===e.length)f=[e[0],e[0],e[0],e[0]];else if(2===e.length)f=[e[0],e[1],e[0],e[1]];else if(3===e.length)f=[e[0],e[1],e[2],e[1]];else{if(4!==e.length)return null;f=[e[0],e[1],e[2],e[3]]}var g=d.styleAttrs[a.byName.writingMode.qname];if("lrtb"===g||"lr"===g)f=[f[0],f[3],f[2],f[1]];else if("rltb"===g||"rl"===g)f=[f[0],f[1],f[2],f[3]];else if("tblr"===g)f=[f[3],f[0],f[1],f[2]];else{if("tbrl"!==g&&"tb"!==g)return null;f=[f[3],f[2],f[1],f[0]]}var h=[];for(var i in f)if(0===f[i].value)h[i]=0;else if("%"===f[i].unit)h[i]="0"===i||"2"===i?d.styleAttrs[a.byName.extent.qname].h*f[i].value/100:d.styleAttrs[a.byName.extent.qname].w*f[i].value/100;else if("em"===f[i].unit)h[i]=d.styleAttrs[a.byName.fontSize.qname]*f[i].value;else if("c"===f[i].unit)h[i]=f[i].value/b.cellResolution.h;else{if("px"!==f[i].unit)return null;h[i]=f[i].value/b.pxDimensions.h}return h}),new d(b.ns_tts,"showBackground","always",["region"],!1,!0,function(a){return a},null),new d(b.ns_tts,"textAlign","start",["p"],!0,!0,function(a){return a},function(a,b,c,d){return"left"===d?"start":"right"===d?"end":d}),new d(b.ns_tts,"textDecoration","none",["span"],!0,!0,function(a){return a.split(" ")},null),new d(b.ns_tts,"textOutline","none",["span"],!0,!0,function(a){if("none"===a)return a;var b={},d=a.split(" ");if(0===d.length||d.length>2)return null;var e=c.parseColor(d[0]);if(b.color=e,null!==e&&d.shift(),1!==d.length)return null;var f=c.parseLength(d[0]);return f?(b.thickness=f,b):null},function(b,c,d,e){if("none"===e)return e;var f={};if(null===e.color?f.color=d.styleAttrs[a.byName.color.qname]:f.color=e.color,"%"===e.thickness.unit)f.thickness=d.styleAttrs[a.byName.fontSize.qname]*e.thickness.value/100;else if("em"===e.thickness.unit)f.thickness=d.styleAttrs[a.byName.fontSize.qname]*e.thickness.value;else if("c"===e.thickness.unit)f.thickness=e.thickness.value/b.cellResolution.h;else{if("px"!==e.thickness.unit)return null;f.thickness=e.thickness.value/b.pxDimensions.h}return f}),new d(b.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,function(a){return a},null),new d(b.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,function(a){return a},null),new d(b.ns_tts,"wrapOption","wrap",["span"],!0,!0,function(a){return a},null),new d(b.ns_tts,"writingMode","lrtb",["region"],!1,!0,function(a){return a},null),new d(b.ns_tts,"zIndex","auto",["region"],!1,!0,function(a){var b;return"auto"===a?b=a:(b=parseInt(a),isNaN(b)&&(b=null)),b},null),new d(b.ns_ebutts,"linePadding","0c",["p"],!0,!1,c.parseLength,function(a,b,c,d){return"c"===d.unit?d.value/a.cellResolution.h:null}),new d(b.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,function(a){return a},null),new d(b.ns_smpte,"backgroundImage",null,["div"],!1,!1,function(a){return a},null),new d(b.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,function(a){return"true"===a},null)],a.byQName={};for(var e in a.all)a.byQName[a.all[e].qname]=a.all[e];a.byName={};for(var f in a.all)a.byName[a.all[f].name]=a.all[f]}(void 0===c?this.imscStyles={}:c,"undefined"==typeof imscNames?a(42):imscNames,"undefined"==typeof imscUtils?a(44):imscUtils)},{42:42,44:44}],44:[function(a,b,c){!function(a){var b=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,c=/rgb\((\d+),(\d+),(\d+)\)/,d=/rgba\((\d+),(\d+),(\d+),(\d+)\)/,e={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};a.parseColor=function(a){var f,g=null;return a in e?g=e[a]:null!==(f=b.exec(a))?g=[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16),void 0!==f[4]?parseInt(f[4],16):255]:null!==(f=c.exec(a))?g=[parseInt(f[1]),parseInt(f[2]),parseInt(f[3]),255]:null!==(f=d.exec(a))&&(g=[parseInt(f[1]),parseInt(f[2]),parseInt(f[3]),parseInt(f[4])]),g};var f=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%)$/;a.parseLength=function(a){var b,c=null;return null!==(b=f.exec(a))&&(c={value:parseFloat(b[1]),unit:b[2]}),c}}(void 0===c?this.imscUtils={}:c)},{}],45:[function(a,b,c){(function(b){!function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);var e=this;f(e),e.q=e.c="",e.bufferCheckPosition=c.MAX_BUFFER_LENGTH,e.opt=b||{},e.opt.lowercase=e.opt.lowercase||e.opt.lowercasetags,e.looseCase=e.opt.lowercase?"toLowerCase":"toUpperCase",e.tags=[],e.closed=e.closedRoot=e.sawRoot=!1,e.tag=e.error=null,e.strict=!!a,e.noscript=!(!a&&!e.opt.noscript),e.state=U.BEGIN,e.strictEntities=e.opt.strictEntities,e.ENTITIES=e.strictEntities?Object.create(c.XML_ENTITIES):Object.create(c.ENTITIES),e.attribList=[],e.opt.xmlns&&(e.ns=Object.create(P)),e.trackPosition=!1!==e.opt.position,e.trackPosition&&(e.position=e.line=e.column=0),n(e,"onready")}function e(a){for(var b=Math.max(c.MAX_BUFFER_LENGTH,10),d=0,e=0,f=D.length;e<f;e++){var g=a[D[e]].length;if(g>b)switch(D[e]){case"textNode":p(a);break;case"cdata":o(a,"oncdata",a.cdata),a.cdata="";break;case"script":o(a,"onscript",a.script),a.script="";break;default:r(a,"Max buffer length exceeded: "+D[e])}d=Math.max(d,g)}var h=c.MAX_BUFFER_LENGTH-d;a.bufferCheckPosition=h+a.position}function f(a){for(var b=0,c=D.length;b<c;b++)a[D[b]]=""}function g(a){p(a),""!==a.cdata&&(o(a,"oncdata",a.cdata),a.cdata=""),""!==a.script&&(o(a,"onscript",a.script),a.script="")}function h(a,b){return new i(a,b)}function i(a,b){if(!(this instanceof i))return new i(a,b);E.apply(this),this._parser=new d(a,b),this.writable=!0,this.readable=!0;var c=this;this._parser.onend=function(){c.emit("end")},this._parser.onerror=function(a){c.emit("error",a),c._parser.error=null},this._decoder=null,F.forEach(function(a){Object.defineProperty(c,"on"+a,{get:function(){return c._parser["on"+a]},set:function(b){if(!b)return c.removeAllListeners(a),c._parser["on"+a]=b,b;c.on(a,b)},enumerable:!0,configurable:!1})})}function j(a){return a.split("").reduce(function(a,b){return a[b]=!0,a},{})}function k(a){return"[object RegExp]"===Object.prototype.toString.call(a)}function l(a,b){return k(a)?!!b.match(a):a[b]}function m(a,b){return!l(a,b)}function n(a,b,c){a[b]&&a[b](c)}function o(a,b,c){a.textNode&&p(a),n(a,b,c)}function p(a){a.textNode=q(a.opt,a.textNode),a.textNode&&n(a,"ontext",a.textNode),a.textNode=""}function q(a,b){return a.trim&&(b=b.trim()),a.normalize&&(b=b.replace(/\s+/g," ")),b}function r(a,b){return p(a),a.trackPosition&&(b+="\nLine: "+a.line+"\nColumn: "+a.column+"\nChar: "+a.c),b=new Error(b),a.error=b,n(a,"onerror",b),a}function s(a){return a.sawRoot&&!a.closedRoot&&t(a,"Unclosed root tag"),a.state!==U.BEGIN&&a.state!==U.BEGIN_WHITESPACE&&a.state!==U.TEXT&&r(a,"Unexpected end"),p(a),a.c="",a.closed=!0,n(a,"onend"),d.call(a,a.strict,a.opt),a}function t(a,b){if("object"!=typeof a||!(a instanceof d))throw new Error("bad call to strictFail");a.strict&&r(a,b)}function u(a){a.strict||(a.tagName=a.tagName[a.looseCase]());var b=a.tags[a.tags.length-1]||a,c=a.tag={name:a.tagName,attributes:{}};a.opt.xmlns&&(c.ns=b.ns),a.attribList.length=0,o(a,"onopentagstart",c)}function v(a,b){var c=a.indexOf(":"),d=c<0?["",a]:a.split(":"),e=d[0],f=d[1];return b&&"xmlns"===a&&(e="xmlns",f=""),{prefix:e,local:f}}function w(a){if(a.strict||(a.attribName=a.attribName[a.looseCase]()),-1!==a.attribList.indexOf(a.attribName)||a.tag.attributes.hasOwnProperty(a.attribName))return void(a.attribName=a.attribValue="");if(a.opt.xmlns){var b=v(a.attribName,!0),c=b.prefix,d=b.local;if("xmlns"===c)if("xml"===d&&a.attribValue!==N)t(a,"xml: prefix must be bound to "+N+"\nActual: "+a.attribValue);else if("xmlns"===d&&a.attribValue!==O)t(a,"xmlns: prefix must be bound to "+O+"\nActual: "+a.attribValue);else{var e=a.tag,f=a.tags[a.tags.length-1]||a;e.ns===f.ns&&(e.ns=Object.create(f.ns)),e.ns[d]=a.attribValue}a.attribList.push([a.attribName,a.attribValue])}else a.tag.attributes[a.attribName]=a.attribValue,o(a,"onattribute",{name:a.attribName,value:a.attribValue});a.attribName=a.attribValue=""}function x(a,b){if(a.opt.xmlns){var c=a.tag,d=v(a.tagName);c.prefix=d.prefix,c.local=d.local,c.uri=c.ns[d.prefix]||"",c.prefix&&!c.uri&&(t(a,"Unbound namespace prefix: "+JSON.stringify(a.tagName)),c.uri=d.prefix);var e=a.tags[a.tags.length-1]||a;c.ns&&e.ns!==c.ns&&Object.keys(c.ns).forEach(function(b){o(a,"onopennamespace",{prefix:b,uri:c.ns[b]})});for(var f=0,g=a.attribList.length;f<g;f++){var h=a.attribList[f],i=h[0],j=h[1],k=v(i,!0),l=k.prefix,m=k.local,n=""===l?"":c.ns[l]||"",p={name:i,value:j,prefix:l,local:m,uri:n};l&&"xmlns"!==l&&!n&&(t(a,"Unbound namespace prefix: "+JSON.stringify(l)),p.uri=l),a.tag.attributes[i]=p,o(a,"onattribute",p)}a.attribList.length=0}a.tag.isSelfClosing=!!b,a.sawRoot=!0,a.tags.push(a.tag),o(a,"onopentag",a.tag),b||(a.noscript||"script"!==a.tagName.toLowerCase()?a.state=U.TEXT:a.state=U.SCRIPT,a.tag=null,a.tagName=""),a.attribName=a.attribValue="",a.attribList.length=0}function y(a){if(!a.tagName)return t(a,"Weird empty close tag."),a.textNode+="</>",void(a.state=U.TEXT);if(a.script){if("script"!==a.tagName)return a.script+="</"+a.tagName+">",a.tagName="",void(a.state=U.SCRIPT);o(a,"onscript",a.script),a.script=""}var b=a.tags.length,c=a.tagName;a.strict||(c=c[a.looseCase]());for(var d=c;b--;){if(a.tags[b].name===d)break;t(a,"Unexpected close tag")}if(b<0)return t(a,"Unmatched closing tag: "+a.tagName),a.textNode+="</"+a.tagName+">",void(a.state=U.TEXT);a.tagName=c;for(var e=a.tags.length;e-- >b;){var f=a.tag=a.tags.pop();a.tagName=a.tag.name,o(a,"onclosetag",a.tagName);var g={};for(var h in f.ns)g[h]=f.ns[h];var i=a.tags[a.tags.length-1]||a;a.opt.xmlns&&f.ns!==i.ns&&Object.keys(f.ns).forEach(function(b){var c=f.ns[b];o(a,"onclosenamespace",{prefix:b,uri:c})})}0===b&&(a.closedRoot=!0),a.tagName=a.attribValue=a.attribName="",a.attribList.length=0,a.state=U.TEXT}function z(a){var b,c=a.entity,d=c.toLowerCase(),e="";return a.ENTITIES[c]?a.ENTITIES[c]:a.ENTITIES[d]?a.ENTITIES[d]:(c=d,"#"===c.charAt(0)&&("x"===c.charAt(1)?(c=c.slice(2),b=parseInt(c,16),e=b.toString(16)):(c=c.slice(1),b=parseInt(c,10),e=b.toString(10))),c=c.replace(/^0+/,""),e.toLowerCase()!==c?(t(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCodePoint(b))}function A(a,b){"<"===b?(a.state=U.OPEN_WAKA,a.startTagPosition=a.position):m(G,b)&&(t(a,"Non-whitespace before first tag."),a.textNode=b,a.state=U.TEXT)}function B(a,b){var c="";return b<a.length&&(c=a.charAt(b)),c}function C(a){var b=this;if(this.error)throw this.error;if(b.closed)return r(b,"Cannot write after close. Assign an onready handler.");if(null===a)return s(b);"object"==typeof a&&(a=a.toString());for(var c=0,d="";;){if(d=B(a,c++),b.c=d,!d)break;switch(b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++),b.state){case U.BEGIN:if(b.state=U.BEGIN_WHITESPACE,"\ufeff"===d)continue;A(b,d);continue;case U.BEGIN_WHITESPACE:A(b,d);continue;case U.TEXT:if(b.sawRoot&&!b.closedRoot){for(var f=c-1;d&&"<"!==d&&"&"!==d;)(d=B(a,c++))&&b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++);b.textNode+=a.substring(f,c-1)}"<"!==d||b.sawRoot&&b.closedRoot&&!b.strict?(!m(G,d)||b.sawRoot&&!b.closedRoot||t(b,"Text data outside of root node."),"&"===d?b.state=U.TEXT_ENTITY:b.textNode+=d):(b.state=U.OPEN_WAKA,b.startTagPosition=b.position);continue;case U.SCRIPT:"<"===d?b.state=U.SCRIPT_ENDING:b.script+=d;continue;case U.SCRIPT_ENDING:"/"===d?b.state=U.CLOSE_TAG:(b.script+="<"+d,b.state=U.SCRIPT);continue;case U.OPEN_WAKA:if("!"===d)b.state=U.SGML_DECL,b.sgmlDecl="";else if(l(G,d));else if(l(Q,d))b.state=U.OPEN_TAG,b.tagName=d;else if("/"===d)b.state=U.CLOSE_TAG,b.tagName="";else if("?"===d)b.state=U.PROC_INST,b.procInstName=b.procInstBody="";else{if(t(b,"Unencoded <"),b.startTagPosition+1<b.position){var g=b.position-b.startTagPosition;d=new Array(g).join(" ")+d}b.textNode+="<"+d,b.state=U.TEXT}continue;case U.SGML_DECL:(b.sgmlDecl+d).toUpperCase()===L?(o(b,"onopencdata"),b.state=U.CDATA,b.sgmlDecl="",b.cdata=""):b.sgmlDecl+d==="--"?(b.state=U.COMMENT,b.comment="",b.sgmlDecl=""):(b.sgmlDecl+d).toUpperCase()===M?(b.state=U.DOCTYPE,(b.doctype||b.sawRoot)&&t(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):">"===d?(o(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=U.TEXT):l(J,d)?(b.state=U.SGML_DECL_QUOTED,b.sgmlDecl+=d):b.sgmlDecl+=d;continue;case U.SGML_DECL_QUOTED:d===b.q&&(b.state=U.SGML_DECL,b.q=""),b.sgmlDecl+=d;continue;case U.DOCTYPE:">"===d?(b.state=U.TEXT,o(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=d,"["===d?b.state=U.DOCTYPE_DTD:l(J,d)&&(b.state=U.DOCTYPE_QUOTED,b.q=d));continue;case U.DOCTYPE_QUOTED:b.doctype+=d,d===b.q&&(b.q="",b.state=U.DOCTYPE);continue;case U.DOCTYPE_DTD:b.doctype+=d,"]"===d?b.state=U.DOCTYPE:l(J,d)&&(b.state=U.DOCTYPE_DTD_QUOTED,b.q=d);continue;case U.DOCTYPE_DTD_QUOTED:b.doctype+=d,d===b.q&&(b.state=U.DOCTYPE_DTD,b.q="");continue;case U.COMMENT:"-"===d?b.state=U.COMMENT_ENDING:b.comment+=d;continue;case U.COMMENT_ENDING:"-"===d?(b.state=U.COMMENT_ENDED,b.comment=q(b.opt,b.comment),b.comment&&o(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+d,b.state=U.COMMENT);continue;case U.COMMENT_ENDED:">"!==d?(t(b,"Malformed comment"),b.comment+="--"+d,b.state=U.COMMENT):b.state=U.TEXT;continue;case U.CDATA:"]"===d?b.state=U.CDATA_ENDING:b.cdata+=d;continue;case U.CDATA_ENDING:"]"===d?b.state=U.CDATA_ENDING_2:(b.cdata+="]"+d,b.state=U.CDATA);continue;case U.CDATA_ENDING_2:">"===d?(b.cdata&&o(b,"oncdata",b.cdata),o(b,"onclosecdata"),b.cdata="",b.state=U.TEXT):"]"===d?b.cdata+="]":(b.cdata+="]]"+d,b.state=U.CDATA);continue;case U.PROC_INST:"?"===d?b.state=U.PROC_INST_ENDING:l(G,d)?b.state=U.PROC_INST_BODY:b.procInstName+=d;continue;case U.PROC_INST_BODY:if(!b.procInstBody&&l(G,d))continue;"?"===d?b.state=U.PROC_INST_ENDING:b.procInstBody+=d;continue;case U.PROC_INST_ENDING:">"===d?(o(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=U.TEXT):(b.procInstBody+="?"+d,b.state=U.PROC_INST_BODY);continue;case U.OPEN_TAG:l(R,d)?b.tagName+=d:(u(b),">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:(m(G,d)&&t(b,"Invalid character in tag name"),b.state=U.ATTRIB));continue;case U.OPEN_TAG_SLASH:">"===d?(x(b,!0),y(b)):(t(b,"Forward-slash in opening tag not followed by >"),b.state=U.ATTRIB);continue;case U.ATTRIB:if(l(G,d))continue;">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:l(Q,d)?(b.attribName=d,b.attribValue="",b.state=U.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case U.ATTRIB_NAME:"="===d?b.state=U.ATTRIB_VALUE:">"===d?(t(b,"Attribute without value"),b.attribValue=b.attribName,w(b),x(b)):l(G,d)?b.state=U.ATTRIB_NAME_SAW_WHITE:l(R,d)?b.attribName+=d:t(b,"Invalid attribute name");continue;case U.ATTRIB_NAME_SAW_WHITE:if("="===d)b.state=U.ATTRIB_VALUE;else{if(l(G,d))continue;t(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",o(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",">"===d?x(b):l(Q,d)?(b.attribName=d,b.state=U.ATTRIB_NAME):(t(b,"Invalid attribute name"),b.state=U.ATTRIB)}continue;case U.ATTRIB_VALUE:if(l(G,d))continue;l(J,d)?(b.q=d,b.state=U.ATTRIB_VALUE_QUOTED):(t(b,"Unquoted attribute value"),b.state=U.ATTRIB_VALUE_UNQUOTED,b.attribValue=d);continue;case U.ATTRIB_VALUE_QUOTED:if(d!==b.q){"&"===d?b.state=U.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=d;continue}w(b),b.q="",b.state=U.ATTRIB_VALUE_CLOSED;continue;case U.ATTRIB_VALUE_CLOSED:l(G,d)?b.state=U.ATTRIB:">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:l(Q,d)?(t(b,"No whitespace between attributes"),b.attribName=d,b.attribValue="",b.state=U.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case U.ATTRIB_VALUE_UNQUOTED:if(m(K,d)){"&"===d?b.state=U.ATTRIB_VALUE_ENTITY_U:b.attribValue+=d;continue}w(b),">"===d?x(b):b.state=U.ATTRIB;continue;case U.CLOSE_TAG:if(b.tagName)">"===d?y(b):l(R,d)?b.tagName+=d:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=U.SCRIPT):(m(G,d)&&t(b,"Invalid tagname in closing tag"),b.state=U.CLOSE_TAG_SAW_WHITE);else{if(l(G,d))continue;m(Q,d)?b.script?(b.script+="</"+d,b.state=U.SCRIPT):t(b,"Invalid tagname in closing tag."):b.tagName=d}continue;case U.CLOSE_TAG_SAW_WHITE:if(l(G,d))continue;">"===d?y(b):t(b,"Invalid characters in closing tag");continue;case U.TEXT_ENTITY:case U.ATTRIB_VALUE_ENTITY_Q:case U.ATTRIB_VALUE_ENTITY_U:var h,i;switch(b.state){case U.TEXT_ENTITY:h=U.TEXT,i="textNode";break;case U.ATTRIB_VALUE_ENTITY_Q:h=U.ATTRIB_VALUE_QUOTED,i="attribValue";break;case U.ATTRIB_VALUE_ENTITY_U:h=U.ATTRIB_VALUE_UNQUOTED,i="attribValue"}";"===d?(b[i]+=z(b),b.entity="",b.state=h):l(b.entity.length?T:S,d)?b.entity+=d:(t(b,"Invalid character in entity name"),b[i]+="&"+b.entity+d,b.entity="",b.state=h);continue;default:throw new Error(b,"Unknown state: "+b.state)}}return b.position>=b.bufferCheckPosition&&e(b),b}c.parser=function(a,b){return new d(a,b)},c.SAXParser=d,c.SAXStream=i,c.createStream=h,c.MAX_BUFFER_LENGTH=65536;var D=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];c.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(a){function b(){}return b.prototype=a,new b}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),d.prototype={end:function(){s(this)},write:C,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){g(this)}};var E;try{E=a(35).Stream}catch(W){E=function(){}}var F=c.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});i.prototype=Object.create(E.prototype,{constructor:{value:i}}),i.prototype.write=function(c){if("function"==typeof b&&"function"==typeof b.isBuffer&&b.isBuffer(c)){if(!this._decoder){var d=a(36).StringDecoder;this._decoder=new d("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},i.prototype.end=function(a){return a&&a.length&&this.write(a),this._parser.end(),!0},i.prototype.on=function(a,b){var c=this;return c._parser["on"+a]||-1===F.indexOf(a)||(c._parser["on"+a]=function(){var b=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,a),c.emit.apply(c,b)}),E.prototype.on.call(c,a,b)};var G="\r\n\t ",H="0124356789",I="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",J="'\"",K=G+">",L="[CDATA[",M="DOCTYPE",N="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",P={xml:N,xmlns:O};G=j(G),H=j(H),I=j(I);var Q=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,S=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;J=j(J),K=j(K);var U=0;c.STATE={BEGIN:U++,BEGIN_WHITESPACE:U++,TEXT:U++,TEXT_ENTITY:U++,OPEN_WAKA:U++,SGML_DECL:U++,SGML_DECL_QUOTED:U++,DOCTYPE:U++,DOCTYPE_QUOTED:U++,DOCTYPE_DTD:U++,DOCTYPE_DTD_QUOTED:U++,COMMENT_STARTING:U++,COMMENT:U++,COMMENT_ENDING:U++,COMMENT_ENDED:U++,CDATA:U++,CDATA_ENDING:U++,CDATA_ENDING_2:U++,PROC_INST:U++,PROC_INST_BODY:U++,PROC_INST_ENDING:U++,OPEN_TAG:U++,OPEN_TAG_SLASH:U++,ATTRIB:U++,ATTRIB_NAME:U++,ATTRIB_NAME_SAW_WHITE:U++,ATTRIB_VALUE:U++,ATTRIB_VALUE_QUOTED:U++,ATTRIB_VALUE_CLOSED:U++,ATTRIB_VALUE_UNQUOTED:U++,ATTRIB_VALUE_ENTITY_Q:U++,ATTRIB_VALUE_ENTITY_U:U++,CLOSE_TAG:U++,CLOSE_TAG_SAW_WHITE:U++,SCRIPT:U++,SCRIPT_ENDING:U++},c.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},c.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(c.ENTITIES).forEach(function(a){var b=c.ENTITIES[a],d="number"==typeof b?String.fromCharCode(b):b;c.ENTITIES[a]=d});for(var V in c.STATE)c.STATE[c.STATE[V]]=V;U=c.STATE,/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */ +String.fromCodePoint||function(){var a=String.fromCharCode,b=Math.floor,c=function(){var c,d,e=16384,f=[],g=-1,h=arguments.length;if(!h)return"";for(var i="";++g<h;){var j=Number(arguments[g]);if(!isFinite(j)||j<0||j>1114111||b(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?f.push(j):(j-=65536,c=55296+(j>>10),d=j%1024+56320,f.push(c,d)),(g+1===h||f.length>e)&&(i+=a.apply(null,f),f.length=0)}return i};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:c,configurable:!0,writable:!0}):String.fromCodePoint=c}()}(void 0===c?this.sax={}:c)}).call(this,a(10).Buffer)},{10:10,35:35,36:36}],46:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){B=!0,C=!0,E=o,D=(new Date).getTime(),"undefined"!=typeof window&&window.console&&(z[m]=b(window.console.error),z[n]=b(window.console.error),z[o]=b(window.console.warn),z[p]=b(window.console.info),z[q]=b(window.console.debug))}function b(a){return a&&a.bind?a.bind(window.console):window.console.log.bind(window.console)}function c(a){return{fatal:r.bind(a),error:s.bind(a),warn:t.bind(a),info:u.bind(a),debug:v.bind(a)}}function d(a){E=a}function e(){return E}function f(a){B=a}function h(a){C=a}function j(a){E=a?q:l}function k(){return E!==l}function r(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];w.apply(void 0,[m,this].concat(b))}function s(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];w.apply(void 0,[n,this].concat(b))}function t(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];w.apply(void 0,[o,this].concat(b))}function u(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];w.apply(void 0,[p,this].concat(b))}function v(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];w.apply(void 0,[q,this].concat(b))}function w(a,b){var c="",d=null;B&&(d=(new Date).getTime(),c+="["+(d-D)+"]"),C&&b&&b.getClassName&&(c+="["+b.getClassName()+"]",b.getType&&(c+="["+b.getType()+"]")),c.length>0&&(c+=" ");for(var e=arguments.length,f=Array(e>2?e-2:0),g=2;g<e;g++)f[g-2]=arguments[g];Array.apply(null,f).forEach(function(a){c+=a+" "}),z[a]&&E>=a&&z[a](c),y.trigger(i.default.LOG,{message:c,level:a})}var x=this.context,y=(0,g.default)(x).getInstance(),z=[],A=void 0,B=void 0,C=void 0,D=void 0,E=void 0;return A={getLogger:c,setLogTimestampVisible:f,setCalleeNameVisible:h,setLogToBrowserConsole:j,getLogToBrowserConsole:k,setLogLevel:d,getLogLevel:e},a(),A}Object.defineProperty(c,"__esModule",{value:!0});var f=a(47),g=d(f),h=a(53),i=d(h),j=a(48),k=d(j),l=0,m=1,n=2,o=3,p=4,q=5;e.__dashjs_factory_name="Debug";var r=k.default.getSingletonFactory(e);r.LOG_LEVEL_NONE=l,r.LOG_LEVEL_FATAL=m,r.LOG_LEVEL_ERROR=n,r.LOG_LEVEL_WARNING=o,r.LOG_LEVEL_INFO=p,r.LOG_LEVEL_DEBUG=q,k.default.updateSingletonFactory(e.__dashjs_factory_name,r),c.default=r,b.exports=c.default},{47:47,48:48,53:53}],47:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b,c){var e=arguments.length<=3||void 0===arguments[3]?h:arguments[3];if(!a)throw new Error("event type cannot be null or undefined");if(!b||"function"!=typeof b)throw new Error("listener must be a function: "+b);if(!(d(a,b,c)>=0)){f[a]=f[a]||[];var g={callback:b,scope:c,priority:e};f[a].some(function(b,c){if(b&&e>b.priority)return f[a].splice(c,0,g),!0})||f[a].push(g)}}function b(a,b,c){if(a&&b&&f[a]){var e=d(a,b,c);e<0||(f[a][e]=null)}}function c(a,b){if(a&&f[a]){if(b=b||{},b.hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");b.type=a,f[a]=f[a].filter(function(a){return a}),f[a].forEach(function(a){return a&&a.callback.call(a.scope,b)})}}function d(a,b,c){var d=-1;return f[a]?(f[a].some(function(a,e){if(a&&a.callback===b&&(!c||c===a.scope))return d=e,!0}),d):d}function e(){f={}}var f={};return{on:a,off:b,trigger:c,reset:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=0,i=5e3;e.__dashjs_factory_name="EventBus";var j=g.default.getSingletonFactory(e);j.EVENT_PRIORITY_LOW=h,j.EVENT_PRIORITY_HIGH=i,g.default.updateSingletonFactory(e.__dashjs_factory_name,j),c.default=j,b.exports=c.default},{48:48}],48:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d=function(){function a(a,b,c,d){!d[a]&&b&&(d[a]={instance:b,override:c})}function b(a,b){for(var c in n){var d=n[c];if(d.context===a&&d.name===b)return d.instance}return null}function c(a,b,c){for(var d in n){var e=n[d];if(e.context===a&&e.name===b)return void(n[d].instance=c)}n.push({name:b,context:a,instance:c})}function d(a,b){return b[a]}function e(a,b,c){a in c&&(c[a]=b)}function f(a,b){e(a,b,p)}function g(a){return d(a,p)}function h(a){var b=d(a.__dashjs_factory_name,p);return b||(b=function(b){return void 0===b&&(b={}),{create:function(){return l(a,b,arguments)}}},p[a.__dashjs_factory_name]=b),b}function i(a,b){e(a,b,o)}function j(a){return d(a,o)}function k(a){var c=d(a.__dashjs_factory_name,o);return c||(c=function(c){var d=void 0;return void 0===c&&(c={}),{getInstance:function(){return d||(d=b(c,a.__dashjs_factory_name)),d||(d=l(a,c,arguments),n.push({name:a.__dashjs_factory_name,context:c,instance:d})),d}}},o[a.__dashjs_factory_name]=c),c}function l(a,b,c){var d=void 0,e=a.__dashjs_factory_name,f=b[e];if(f){var g=f.instance;if(!f.override)return g.apply({context:b,factory:m},c);d=a.apply({context:b},c),g=g.apply({context:b,factory:m,parent:d},c);for(var h in g)d.hasOwnProperty(h)&&(d[h]=g[h])}else d=a.apply({context:b},c);return d.getClassName=function(){return e},d}var m=void 0,n=[],o={},p={};return m={extend:a,getSingletonInstance:b,setSingletonInstance:c,getSingletonFactory:k,getSingletonFactoryByName:j,updateSingletonFactory:i,getClassFactory:h,getClassFactoryByName:g,updateClassFactory:f}}();c.default=d,b.exports=c.default},{}],49:[function(a,b,c){"use strict";function d(){return e}Object.defineProperty(c,"__esModule",{value:!0}),c.getVersionString=d;var e="2.9.2"},{}],50:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(51),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE=10,this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE=11,this.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE=12,this.SEGMENTS_UPDATE_FAILED_ERROR_CODE=13,this.SEGMENTS_UNAVAILABLE_ERROR_CODE=14,this.SEGMENT_BASE_LOADER_ERROR_CODE=15,this.TIME_SYNC_FAILED_ERROR_CODE=16,this.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE=17,this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE=18,this.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=19,this.APPEND_ERROR_CODE=20,this.REMOVE_ERROR_CODE=21,this.DATA_UPDATE_FAILED_ERROR_CODE=22,this.CAPABILITY_MEDIASOURCE_ERROR_CODE=23,this.CAPABILITY_MEDIAKEYS_ERROR_CODE=24,this.DOWNLOAD_ERROR_ID_MANIFEST_CODE=25,this.DOWNLOAD_ERROR_ID_MANIFEST="manifest",this.DOWNLOAD_ERROR_ID_SIDX_CODE=26,this.DOWNLOAD_ERROR_ID_CONTENT_CODE=27,this.DOWNLOAD_ERROR_ID_CONTENT="content",this.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE=28,this.DOWNLOAD_ERROR_ID_INITIALIZATION="initialization",this.DOWNLOAD_ERROR_ID_XLINK_CODE=29,this.DOWNLOAD_ERROR_ID_XLINK="xlink",this.MANIFEST_ERROR_ID_CODEC_CODE=30,this.MANIFEST_ERROR_ID_PARSE_CODE=31,this.MANIFEST_ERROR_ID_NOSTREAMS_CODE=32,this.TIMED_TEXT_ERROR_ID_PARSE_CODE=33,this.MANIFEST_ERROR_ID_MULTIPLEXED_CODE=34,this.MEDIASOURCE_TYPE_UNSUPPORTED_CODE=35,this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE="parsing failed for ",this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading manifest: ",this.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading Xlink element: ",this.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE="Segments update failed",this.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE="no segments are available yet",this.SEGMENT_BASE_LOADER_ERROR_MESSAGE="error loading segments",this.TIME_SYNC_FAILED_ERROR_MESSAGE="Failed to synchronize time",this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE="request is null",this.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE="Failed to resolve a valid URL",this.APPEND_ERROR_MESSAGE="chunk is not defined",this.REMOVE_ERROR_MESSAGE="buffer is not defined",this.DATA_UPDATE_FAILED_ERROR_MESSAGE="Data update failed",this.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE="mediasource is not supported",this.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE="mediakeys is not supported",this.TIMED_TEXT_ERROR_MESSAGE_PARSE="parsing error :",this.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE="Error creating source buffer of type : "}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{51:51}],51:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a)}return e(a,[{key:"extend",value:function(a,b){if(a){var c=!!b&&b.override,d=!!b&&b.publicOnly;for(var e in a)!a.hasOwnProperty(e)||this[e]&&!c||d&&-1===a[e].indexOf("public_")||(this[e]=a[e])}}}]),a}();c.default=f,b.exports=c.default},{}],52:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(54),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.BUFFERING_COMPLETED="bufferingCompleted",this.BUFFER_CLEARED="bufferCleared",this.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",this.BYTES_APPENDED="bytesAppended",this.BYTES_APPENDED_END_FRAGMENT="bytesAppendedEndFragment",this.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",this.CURRENT_TRACK_CHANGED="currentTrackChanged",this.DATA_UPDATE_COMPLETED="dataUpdateCompleted",this.DATA_UPDATE_STARTED="dataUpdateStarted",this.INITIALIZATION_LOADED="initializationLoaded",this.INIT_FRAGMENT_LOADED="initFragmentLoaded",this.INIT_REQUESTED="initRequested",this.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",this.LIVE_EDGE_SEARCH_COMPLETED="liveEdgeSearchCompleted",this.LOADING_COMPLETED="loadingCompleted",this.LOADING_PROGRESS="loadingProgress",this.LOADING_DATA_PROGRESS="loadingDataProgress",this.LOADING_ABANDONED="loadingAborted",this.MANIFEST_UPDATED="manifestUpdated",this.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",this.QUOTA_EXCEEDED="quotaExceeded",this.REPRESENTATION_UPDATED="representationUpdated",this.SEGMENTS_LOADED="segmentsLoaded",this.SERVICE_LOCATION_BLACKLIST_ADD="serviceLocationBlacklistAdd",this.SERVICE_LOCATION_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",this.SOURCEBUFFER_REMOVE_COMPLETED="sourceBufferRemoveCompleted",this.STREAMS_COMPOSED="streamsComposed",this.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",this.STREAM_COMPLETED="streamCompleted",this.TEXT_TRACKS_QUEUE_INITIALIZED="textTracksQueueInitialized",this.TIMED_TEXT_REQUESTED="timedTextRequested",this.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",this.URL_RESOLUTION_FAILED="urlResolutionFailed",this.VIDEO_CHUNK_RECEIVED="videoChunkReceived",this.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",this.XLINK_ELEMENT_LOADED="xlinkElementLoaded",this.XLINK_READY="xlinkReady"}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{54:54}],53:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(52),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).apply(this,arguments)}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{52:52}],54:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a)}return e(a,[{key:"extend",value:function(a,b){if(a){var c=!!b&&b.override,d=!!b&&b.publicOnly;for(var e in a)!a.hasOwnProperty(e)||this[e]&&!c||d&&-1===a[e].indexOf("public_")||(this[e]=a[e])}}}]),a}();c.default=f,b.exports=c.default},{}],55:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){J()}function b(a){a&&a.dashManifestModel&&(L=a.dashManifestModel)}function c(a,b){return b&&a?b.getRepresentationForQuality(a.quality):null}function d(a){return a&&a.streamInfo&&void 0!==a.streamInfo.id&&N[a.streamInfo.id]?N[a.streamInfo.id][a.index]:null}function e(a,b){for(var c=b.length,d=0;d<c;d++){var e=b[d];if(a.id===e.id)return e}return null}function f(a){var b=new i.default,c=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index],d=L.getRepresentationFor(a.index,c);return b.id=a.id,b.quality=a.index,b.bandwidth=L.getBandwidth(d),b.DVRWindow=a.segmentAvailabilityRange,b.fragmentDuration=a.segmentDuration||(a.segments&&a.segments.length>0?a.segments[0].duration:NaN),b.MSETimeOffset=a.MSETimeOffset,b.useCalculatedLiveEdgeTime=a.useCalculatedLiveEdgeTime,b.mediaInfo=h(a.adaptation),b}function h(a){var b=new k.default,c=a.period.mpd.manifest.Period_asArray[a.period.index].AdaptationSet_asArray[a.index],d=void 0;return b.id=a.id,b.index=a.index,b.type=a.type,b.streamInfo=n(a.period),b.representationCount=L.getRepresentationCount(c),b.lang=L.getLanguageForAdaptation(c),d=L.getViewpointForAdaptation(c),b.viewpoint=d?d.value:void 0,b.accessibility=L.getAccessibilityForAdaptation(c).map(function(a){var c=a.value,d=c;return a.schemeIdUri&&a.schemeIdUri.search("cea-608")>=0&&void 0!==u.default&&(d=c?"cea-608:"+c:"cea-608",b.embeddedCaptions=!0),d}),b.audioChannelConfiguration=L.getAudioChannelConfigurationForAdaptation(c).map(function(a){return a.value}),b.roles=L.getRolesForAdaptation(c).map(function(a){return a.value}),b.codec=L.getCodec(c),b.mimeType=L.getMimeType(c),b.contentProtection=L.getContentProtectionData(c),b.bitrateList=L.getBitrateListForAdaptation(c),b.contentProtection&&b.contentProtection.forEach(function(a){a.KID=L.getKID(a)}),b.isText=L.getIsTextTrack(b.mimeType),b}function j(a,b,c){a.id=b,a.index=100+parseInt(b.substring(2,3)),a.type=g.default.EMBEDDED_TEXT,a.codec="cea-608-in-SEI",a.isText=!0,a.isEmbedded=!0,a.lang=c,a.roles=["caption"]}function l(a){a.type=g.default.IMAGE}function n(a){var b=new m.default;return b.id=a.id,b.index=a.index,b.start=a.start,b.duration=a.duration,b.manifestInfo=p(a.mpd),b.isLast=1===a.mpd.manifest.Period_asArray.length||Math.abs(b.start+b.duration-b.manifestInfo.duration)<1,b}function p(a){var b=new o.default;return b.DVRWindowSize=a.timeShiftBufferDepth,b.loadedTime=a.manifest.loadedTime,b.availableFrom=a.availabilityStartTime,b.minBufferTime=a.manifest.minBufferTime,b.maxFragmentDuration=a.maxSegmentDuration,b.duration=L.getDuration(a.manifest),b.isDynamic=L.getIsDynamic(a.manifest),b}function r(a,b){if(0===M.length)return null;var c=M[0].mpd.manifest,d=L.getAdaptationForType(c,a.index,b,a);if(!d)return null;var f=e(a,M),g=f.id,i=L.getIndexForAdaptation(d,c,a.index);return N[g]=N[g]||L.getAdaptationsForPeriod(f),h(N[g][i])}function s(a,b,c){var d=M,f=c,i=[],k=void 0,m=void 0,n=void 0,o=void 0,p=void 0,q=void 0;if(f){t();var r=L.getMpd(f);d=L.getRegularPeriods(r)}else{if(!(M.length>0))return i;f=M[0].mpd.manifest}var s=e(a,d),u=s.id,v=L.getAdaptationsForType(f,a.index,b!==g.default.EMBEDDED_TEXT?b:g.default.VIDEO);if(!v)return i;for(N[u]=N[u]||L.getAdaptationsForPeriod(s),o=0,q=v.length;o<q;o++)if(k=v[o],n=L.getIndexForAdaptation(k,f,a.index),m=h(N[u][n]),b===g.default.EMBEDDED_TEXT){var w=m.accessibility.length;for(p=0;p<w;p++)if(m){var x=m.accessibility[p];if(0===x.indexOf("cea-608:")){var y=x.substring(8),z=y.split(";");if("CC"===z[0].substring(0,2))for(p=0;p<z.length;p++)m||(m=h.call(this,N[u][n])),j(m,z[p].substring(0,3),z[p].substring(4)),i.push(m),m=null;else for(p=0;p<z.length;p++)m||(m=h.call(this,N[u][n])),j(m,"CC"+(p+1),z[p]),i.push(m),m=null}else 0===x.indexOf("cea-608")&&(j(m,g.default.CC1,"eng"),i.push(m),m=null)}}else b===g.default.IMAGE?(l(m),i.push(m),m=null):m&&i.push(m);return i}function t(){if(!L||!L.hasOwnProperty("getMpd")||!L.hasOwnProperty("getRegularPeriods"))throw new Error("setConfig function has to be called previously")}function w(a){if(!a)return null;t();var b=L.getMpd(a);M=L.getRegularPeriods(b),N={}}function x(a,b){var c=[],d=M;if(a){t();var e=L.getMpd(a);d=L.getRegularPeriods(e)}b||(b=d.length);for(var f=0;f<b;f++)c.push(n(d[f]));return c}function y(a){if(!(a&&a.hasOwnProperty("getRepresentationController")&&a.hasOwnProperty("getIndexHandler")&&a.hasOwnProperty("getMediaInfo")&&a.hasOwnProperty("getType")&&a.hasOwnProperty("getStreamInfo")))throw new Error("streamProcessor parameter is missing or malformed!")}function z(a){if(!a||!a.hasOwnProperty("getRepresentationForQuality")||!a.hasOwnProperty("getCurrentRepresentation"))throw new Error("representationController parameter is missing or malformed!")}function A(a,b){var c=void 0,d=void 0,e=void 0;return y(a),(0,v.checkInteger)(b),c=a.getRepresentationController(),e=a.getIndexHandler(),d=c?c.getRepresentationForQuality(b):null,e?e.getInitRequest(d):null}function B(a,b,d,e){var f=void 0,g=void 0,h=void 0,i=null;return y(a),f=a.getRepresentationController(),g=c(b,f),h=a.getIndexHandler(),h&&(i=void 0!==d&&void 0!==e?h.getSegmentRequestForTime(g,d,e):h.getNextSegmentRequest(g)),i}function C(a){y(a);var b=a.getIndexHandler();return b?b.getCurrentTime():NaN}function D(a,b){y(a);var c=a.getIndexHandler();c&&c.setCurrentTime(b)}function E(a){y(a);var b=a.getIndexHandler();b&&b.resetIndex()}function F(a){y(a);var b=e(a.getStreamInfo(),M),c=a.getMediaInfo(),f=d(c),g=a.getType(),h=void 0,i=void 0;h=c?c.id:null,M.length>0&&(i=h?L.getAdaptationForId(h,M[0].mpd.manifest,b.index):L.getAdaptationForIndex(c.index,M[0].mpd.manifest,b.index),a.getRepresentationController().updateData(i,f,g))}function G(a,b){z(a);var c=void 0;return void 0!==b?((0,v.checkInteger)(b),c=a.getRepresentationForQuality(b)):c=a.getCurrentRepresentation(),c?f(c):null}function H(a,b,c){if(!a||!b)return null;var d=new q.default,e=a.scheme_id_uri,f=a.value,g=a.timescale,h=a.presentation_time_delta,i=a.event_duration,j=a.id,k=a.message_data,l=c*g+h;return b[e]?(d.eventStream=b[e],d.eventStream.value=f,d.eventStream.timescale=g,d.duration=i,d.id=j,d.presentationTime=l,d.messageData=k,d.presentationTimeDelta=h,d):null}function I(a,b){var f=[];if(0===M.length)return f;var g=M[0].mpd.manifest;return a instanceof m.default?f=L.getEventsForPeriod(e(a,M)):a instanceof k.default?f=L.getEventStreamForAdaptationSet(g,d(a)):a instanceof i.default&&(f=L.getEventStreamForRepresentation(g,c(a,b.getRepresentationController()))),f}function J(){M=[],N={}}var K=void 0,L=void 0,M=void 0,N=void 0;return K={convertDataToRepresentationInfo:f,getDataForMedia:d,getStreamsInfo:x,getMediaInfoForType:r,getAllMediaInfoForType:s,getRepresentationInfo:G,updateData:F,getInitRequest:A,getFragmentRequest:B,getIndexHandlerTime:C,setIndexHandlerTime:D,getEventsFor:I,getEvent:H,setConfig:b,updatePeriods:w,reset:J,resetIndexHandler:E},a(),K}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(224),i=d(h),j=a(222),k=d(j),l=a(225),m=d(l),n=a(221),o=d(n),p=a(83),q=d(p),r=a(48),s=d(r),t=a(2),u=d(t),v=a(208);e.__dashjs_factory_name="DashAdapter",c.default=s.default.getSingletonFactory(e),b.exports=c.default},{101:101,2:2,208:208,221:221,222:222,224:224,225:225,48:48,83:83}],56:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){_=(0,x.default)(Q).getInstance().getLogger($),s(),T=c(a.mimeType)?(0,I.default)(Q).getInstance():(0,G.default)(Q).getInstance(),T.setConfig({baseURLController:Z,metricsModel:W,mediaPlayerModel:X,errHandler:Y}),R.on(p.default.INITIALIZATION_LOADED,O,$),R.on(p.default.SEGMENTS_LOADED,P,$)}function c(a){return"webm"===a.split("/")[1].toLowerCase()}function d(b){da=b,T.initialize(),ea=(0,E.default)(Q).create(a,f())}function e(){return da?da.getType():null}function f(){var a=da?da.getStreamInfo():null;return a?a.manifestInfo.isDynamic:null}function h(){return da?da.getMediaInfo():null}function j(){return da}function l(a){ca=a}function o(){return ca}function q(){aa=-1}function s(){q(),ca=0,ba=null,da=null,ea=null}function u(){s(),R.off(p.default.INITIALIZATION_LOADED,O,$),R.off(p.default.SEGMENTS_LOADED,P,$)}function v(a,b,c){var d=Z.resolve(c.path),e=void 0,f=void 0;return d&&b!==d.url&&S.isRelative(b)?(e=d.url,f=d.serviceLocation,b&&(e=S.resolve(b,e))):e=b,!S.isRelative(e)&&(a.url=e,a.serviceLocation=f,!0)}function w(a,b){var c=new k.default,d=a.adaptation.period,e=d.start,g=f();if(c.mediaType=b,c.type=n.HTTPRequest.INIT_SEGMENT_TYPE,c.range=a.range,c.availabilityStartTime=U.calcAvailabilityStartTimeFromPresentationTime(e,d.mpd,g),c.availabilityEndTime=U.calcAvailabilityEndTimeFromPresentationTime(e+d.duration,d.mpd,g),c.quality=a.index,c.mediaInfo=h(),c.representationId=a.id,v(c,a.initialization,a))return c}function y(a){return a?w(a,e()):null}function A(a){var b=!1,c=f();if(c||aa!==a.availableSegmentsNumber){var d=(0,C.getSegmentByIndex)(aa,a);if(d){var e=parseFloat((d.presentationStartTime-a.adaptation.period.start).toFixed(5)),g=a.adaptation.period.duration;_.debug(a.segmentInfoType+": "+e+" / "+g),b=(a.segmentInfoType!==i.default.SEGMENT_TIMELINE||!c)&&e>=g}else _.debug("isMediaFinished - no segment found")}else b=!0;return b}function D(a){ea.getSegments(a,ba,aa,F)}function F(a,b){if(a.segments=b,b&&b.length>0&&f()){var c=b[b.length-1],d=c.presentationStartTime,e=W.getMetricsFor(g.default.STREAM);U.setExpectedLiveEdge(d),W.updateManifestUpdateInfo(V.getCurrentManifestUpdate(e),{presentationStartTime:d})}}function H(a){if(!a)throw new Error("no representation");a.segments=null,D(a)}function J(a,b){var c=B.default.hasInitialization(a),d=B.default.hasSegments(a),g=void 0;if(a.segmentDuration||a.segments||H(a),a.segmentAvailabilityRange=U.calcSegmentAvailabilityRange(a,f()),a.segmentAvailabilityRange.end<a.segmentAvailabilityRange.start&&!a.useCalculatedLiveEdgeTime)return g=new m.default(t.default.SEGMENTS_UNAVAILABLE_ERROR_CODE,t.default.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE,{availabilityDelay:a.segmentAvailabilityRange.start-a.segmentAvailabilityRange.end}),void R.trigger(p.default.REPRESENTATION_UPDATED,{sender:this,representation:a,error:g});b||q(),a.segmentDuration&&H(a),c||T.loadInitialization(a),d||T.loadSegments(a,e(),a.indexRange),c&&d&&R.trigger(p.default.REPRESENTATION_UPDATED,{sender:this,representation:a})}function K(a,b,c){var d=b.segments,e=d?d.length:null,f=-1,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0;if(d&&e>0)for(c=void 0===c||null===c?X.getSegmentOverlapToleranceTime():c,k=0;k<e;k++)if(h=d[k],i=h.presentationStartTime,j=h.duration,g=void 0===c||null===c?j/2:c,a+g>=i&&a-g<i+j){f=h.availabilityIdx;break}return f}function L(a){if(null===a||void 0===a)return null;var b=new k.default,c=a.representation,d=c.adaptation.period.mpd.manifest.Period_asArray[c.adaptation.period.index].AdaptationSet_asArray[c.adaptation.index].Representation_asArray[c.index].bandwidth,f=a.media;return f=(0,C.replaceTokenForTemplate)(f,"Number",a.replacementNumber),f=(0,C.replaceTokenForTemplate)(f,"Time",a.replacementTime),f=(0,C.replaceTokenForTemplate)(f,"Bandwidth",d),f=(0,C.replaceIDForTemplate)(f,c.id),f=(0,C.unescapeDollarsInTemplate)(f),b.mediaType=e(),b.type=n.HTTPRequest.MEDIA_SEGMENT_TYPE,b.range=a.mediaRange,b.startTime=a.presentationStartTime,b.duration=a.duration,b.timescale=c.timescale,b.availabilityStartTime=a.availabilityStartTime,b.availabilityEndTime=a.availabilityEndTime,b.wallStartTime=a.wallStartTime,b.quality=c.index,b.index=a.availabilityIdx,b.mediaInfo=h(),b.adaptationIndex=c.adaptation.index,b.representationId=c.id,v(b,f,c)?b:void 0}function M(a,b,c){var d=void 0,g=void 0,j=void 0;if(!a)return null;var l=e(),m=aa,n=!!c&&c.keepIdx,o=c?c.timeThreshold:null,p=!(!c||!c.ignoreIsFinished);return ba!==b&&(ba=b,_.debug("Getting the request for "+l+" time : "+b)),D(a),aa=K(b,a,o),aa<0&&(D(a),aa=K(b,a,o)),aa>0&&_.debug("Index for "+l+" time "+b+" is "+aa),j=!p&&A(a),j?(d=new k.default,d.action=k.default.ACTION_COMPLETE,d.index=aa,d.mediaType=l,d.mediaInfo=h(),_.debug("Signal complete in getSegmentRequestForTime -",l)):(g=(0,C.getSegmentByIndex)(aa,a),d=L(g)),n&&m>=0&&(aa=a.segmentInfoType===i.default.SEGMENT_TIMELINE&&f()?aa:m),d}function N(a){var b=void 0,c=void 0,d=void 0;if(!a||-1===aa)return null;var g=e(),i=f();return ba=null,aa++,_.debug("Getting the next request at index: "+aa+", type: "+g),!(0,C.getSegmentByIndex)(aa,a)&&i?(_.debug("No segment found at index: "+aa+". Wait for next loop"),D(a),aa--,null):(d=A(a),d?(b=new k.default,b.action=k.default.ACTION_COMPLETE,b.index=aa,b.mediaType=g,b.mediaInfo=h(),_.debug("Signal complete -",g)):(D(a),c=(0,C.getSegmentByIndex)(aa,a),b=L(c),!c&&i&&aa--),b)}function O(a){var b=a.representation;b.segments&&R.trigger(p.default.REPRESENTATION_UPDATED,{sender:this,representation:b})}function P(a){if(!a.error&&e()===a.mediaType){var b=a.segments,c=a.representation,d=[],g=0,h=void 0,i=void 0,j=void 0,k=void 0;for(h=0,i=b.length;h<i;h++)j=b[h],k=(0,C.getTimeBasedSegment)(U,f(),c,j.startTime,j.duration,j.timescale,j.media,j.mediaRange,g),d.push(k),k=null,g++;c.segmentAvailabilityRange={start:d[0].presentationStartTime,end:d[i-1].presentationStartTime},c.availableSegmentsNumber=i,F(c,d),B.default.hasInitialization(c)&&R.trigger(p.default.REPRESENTATION_UPDATED,{sender:this,representation:c})}}a=a||{};var Q=this.context,R=(0,r.default)(Q).getInstance(),S=(0,z.default)(Q).getInstance(),T=void 0,U=a.timelineConverter,V=a.dashMetrics,W=a.metricsModel,X=a.mediaPlayerModel,Y=a.errHandler,Z=a.baseURLController,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0;return $={initialize:d,getStreamProcessor:j,getInitRequest:y,getSegmentRequestForTime:M,getNextSegmentRequest:N,updateRepresentation:J,updateSegmentList:H,setCurrentTime:l,getCurrentTime:o,reset:u,resetIndex:q},b(),$}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(60),i=d(h),j=a(217),k=d(j),l=a(215),m=d(l),n=a(235),o=a(53),p=d(o),q=a(47),r=d(q),s=a(50),t=d(s),u=a(48),v=d(u),w=a(46),x=d(w),y=a(210),z=d(y),A=a(87),B=d(A),C=a(77),D=a(76),E=d(D),F=a(58),G=d(F),H=a(59),I=d(H);e.__dashjs_factory_name="DashHandler",c.default=v.default.getClassFactory(e),b.exports=c.default},{101:101,210:210,215:215,217:217,235:235,46:46,47:47,48:48,50:50,53:53,58:58,59:59,60:60,76:76,77:77,87:87}],57:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){var c=void 0;return c=w(A.getValue().Period_asArray[b],a),null===c?null:c.bandwidth}function c(a,b){return v(A.getValue().Period_asArray[b],a)}function d(a,b){var c=A.getValue();return c?y(c.Period_asArray[b],a):-1}function e(a){return n(a,j.default.TRACK_SWITCH)}function g(a){return n(a,j.default.BUFFER_LEVEL)}function h(a){var b=g(a);return b?l.default.round10(b.level/1e3,-3):0}function i(a){return a?a.RequestsQueue:null}function k(a){if(!a)return null;var b=a.HttpList,c=null,d=void 0,e=void 0;if(!b||b.length<=0)return null;for(d=b.length,e=d-1;e>=0;){if(b[e].responsecode){c=b[e];break}e--}return c}function m(a){return a&&a.HttpList?a.HttpList:[]}function n(a,b){if(!a)return null;var c=a[b];if(!c)return null;var d=c.length;return d<=0?null:c[d-1]}function o(a){return n(a,j.default.DROPPED_FRAMES)}function p(a){return n(a,j.default.SCHEDULING_INFO)}function q(a){return n(a,j.default.MANIFEST_UPDATE)}function r(a){return n(a,j.default.DVR_INFO)}function s(a,b){var c={},d=void 0,e=void 0,g=void 0;for(d=m(a),g=d.length-1;g>=0;g--)if(e=d[g],e.type===f.HTTPRequest.MPD_TYPE){c=u(e._responseHeaders);break}return void 0===c[b]?null:c[b]}function t(a,b){var c={},d=k(a);return d&&(c=u(d._responseHeaders)),void 0===c[b]?null:c[b]}function u(a){var b={};if(!a)return b;for(var c=a.trim().split("\r\n"),d=0,e=c.length;d<e;d++){var f=c[d],g=f.indexOf(": ");g>0&&(b[f.substring(0,g)]=f.substring(g+2))}return b}function v(a,b){var c=w(a,b,!0);return null!==c?c:-1}function w(a,b,c){var d=void 0,e=void 0,f=void 0,g=void 0,h=void 0,i=void 0;if(a)for(e=a.AdaptationSet_asArray,h=0;h<e.length;h+=1)for(d=e[h],g=d.Representation_asArray,i=0;i<g.length;i+=1)if(f=g[i],b===f.id)return c?i:f;return null}function x(a,b){return z.getIsTypeOf(a,b)}function y(a,b){var c=void 0,d=void 0,e=void 0,f=void 0;if(!a||!b)return-1;for(d=a.AdaptationSet_asArray,f=0;f<d.length;f+=1)if(c=d[f],e=c.Representation_asArray,x(c,b))return e.length;return-1}a=a||{};var z=a.dashManifestModel,A=a.manifestModel;return{getBandwidthForRepresentation:b,getIndexForRepresentation:c,getMaxIndexForBufferType:d,getCurrentRepresentationSwitch:e,getLatestBufferLevelVO:g,getCurrentBufferLevel:h,getCurrentHttpRequest:k,getHttpRequests:m,getCurrentDroppedFrames:o,getCurrentSchedulingInfo:p,getCurrentDVRInfo:r,getCurrentManifestUpdate:q,getLatestFragmentRequestHeaderValueByID:t,getLatestMPDRequestHeaderValueByID:s,getRequestsQueue:i}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(235),g=a(48),h=d(g),i=a(102),j=d(i),k=a(75),l=d(k);e.__dashjs_factory_name="DashMetrics",c.default=h.default.getSingletonFactory(e),b.exports=c.default},{102:102,235:235,48:48,75:75}],58:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){t=(0, +u.default)(p).getInstance().getLogger(s)}function b(){y=(0,q.default)(p).getInstance(),A=(0,g.default)(p).getInstance(),E=(0,z.default)(p).create({errHandler:w,metricsModel:C,mediaPlayerModel:D,requestModifier:A})}function c(a){a.baseURLController&&(F=a.baseURLController),a.metricsModel&&(C=a.metricsModel),a.mediaPlayerModel&&(D=a.mediaPlayerModel),a.errHandler&&(w=a.errHandler)}function d(){if(!F||!F.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function e(a,b){d();var c=null,f=F.resolve(a.path),g=b||{init:!0,url:f?f.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500};t.debug("Start searching for initialization.");var h=l(g),i=function(b){g.bytesLoaded=g.range.end,c=y.findInitRange(b),c?(a.range=c,r.trigger(m.default.INITIALIZATION_LOADED,{representation:a})):(g.range.end=g.bytesLoaded+g.bytesToLoad,e(a,g))},j=function(){r.trigger(m.default.INITIALIZATION_LOADED,{representation:a})};E.load({request:h,success:i,error:j}),t.debug("Perform init search: "+g.url)}function f(a,b,c,e,g){if(d(),c&&(void 0===c.start||void 0===c.end)){var h=c?c.toString().split("-"):null;c=h?{start:parseFloat(h[0]),end:parseFloat(h[1])}:null}g=g||n;var i=null,k=null,m=!!c,o=F.resolve(a.path),p={init:!1,url:o?o.url:void 0,range:m?c:{start:0,end:1500},searching:!m,bytesLoaded:e?e.bytesLoaded:0,bytesToLoad:1500},q=l(p),r=function(c){var d=p.bytesToLoad,e=c.byteLength;if(p.bytesLoaded=p.range.end-p.range.start,i=y.parse(c),(k=i.getBox("sidx"))&&k.isComplete){var h=k.references,l=void 0,m=void 0;null!==h&&void 0!==h&&h.length>0&&(l=1===h[0].reference_type),l?function(){t.debug("Initiate multiple SIDX load."),p.range.end=p.range.start+k.size;var c=void 0,d=void 0,e=void 0,i=void 0,j=void 0,l=[],m=0,n=(k.offset||p.range.start)+k.size,o=function(c){c?(l=l.concat(c),++m>=d&&g(l,a,b)):g(null,a,b)};for(c=0,d=h.length;c<d;c++)e=n,i=n+h[c].referenced_size-1,n+=h[c].referenced_size,j={start:e,end:i},f(a,null,j,p,o)}():(t.debug("Parsing segments from SIDX."),m=j(k,p),g(m,a,b))}else{if(k)p.range.start=k.offset||p.range.start,p.range.end=p.range.start+(k.size||d);else{if(e<p.bytesLoaded)return void g(null,a,b);var n=i.getLastBox();n&&n.size?(p.range.start=n.offset+n.size,p.range.end=p.range.start+d):p.range.end+=d}f(a,b,p.range,p,g)}},s=function(){g(null,a,b)};E.load({request:q,success:r,error:s}),t.debug("Perform SIDX load: "+p.url)}function h(){E.abort(),E=null,w=null,y=null,A=null}function j(a,b){for(var c=a.references,d=c.length,e=a.timescale,f=a.earliest_presentation_time,g=b.range.start+a.offset+a.first_offset+a.size,h=[],j=void 0,k=void 0,l=void 0,m=void 0,n=0;n<d;n++)l=c[n].subsegment_duration,m=c[n].referenced_size,j=new i.default,j.duration=l,j.startTime=f,j.timescale=e,k=g+m-1,j.mediaRange=g+"-"+k,h.push(j),f+=l,g+=m;return h}function l(a){if(a.url){var b=new x.default;return b.type=a.init?v.HTTPRequest.INIT_SEGMENT_TYPE:v.HTTPRequest.MEDIA_SEGMENT_TYPE,b.url=a.url,b.range=a.range.start+"-"+a.range.end,b}}function n(a,b,c){a?r.trigger(m.default.SEGMENTS_LOADED,{segments:a,representation:b,mediaType:c}):r.trigger(m.default.SEGMENTS_LOADED,{segments:null,representation:b,mediaType:c,error:new k.default(B.default.SEGMENT_BASE_LOADER_ERROR_CODE,B.default.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}var p=this.context,r=(0,o.default)(p).getInstance(),s=void 0,t=void 0,w=void 0,y=void 0,A=void 0,C=void 0,D=void 0,E=void 0,F=void 0;return s={setConfig:c,initialize:b,loadInitialization:e,loadSegments:f,reset:h},a(),s}Object.defineProperty(c,"__esModule",{value:!0});var f=a(207),g=d(f),h=a(88),i=d(h),j=a(215),k=d(j),l=a(53),m=d(l),n=a(47),o=d(n),p=a(197),q=d(p),r=a(48),s=d(r),t=a(46),u=d(t),v=a(235),w=a(217),x=d(w),y=a(148),z=d(y),A=a(50),B=d(A);e.__dashjs_factory_name="SegmentBaseLoader",c.default=s.default.getSingletonFactory(e),b.exports=c.default},{148:148,197:197,207:207,215:215,217:217,235:235,46:46,47:47,48:48,50:50,53:53,88:88}],59:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){y=(0,q.default)(r).getInstance().getLogger(w),A={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"}}}}},Void:{tag:236,required:!0}}}function b(){E=(0,s.default)(r).getInstance(),H=(0,z.default)(r).create({errHandler:C,metricsModel:F,mediaPlayerModel:G,requestModifier:E})}function c(a){if(!(a.baseURLController&&a.metricsModel&&a.mediaPlayerModel&&a.errHandler))throw new Error(m.default.MISSING_CONFIG_ERROR);I=a.baseURLController,F=a.metricsModel,G=a.mediaPlayerModel,C=a.errHandler}function d(a){var b=[],c=void 0,d=void 0,e=(0,k.default)(r).create({data:a});for(e.consumeTagAndSize(A.Segment.Cues);e.moreData()&&e.consumeTagAndSize(A.Segment.Cues.CuePoint,!0);){for(c={},c.CueTime=e.parseTag(A.Segment.Cues.CuePoint.CueTime),c.CueTracks=[];e.moreData()&&e.consumeTag(A.Segment.Cues.CuePoint.CueTrackPositions,!0);){var f=e.getMatroskaCodedNum(),g=e.getPos();if(d={},d.Track=e.parseTag(A.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),0===d.Track)throw new Error("Cue track cannot be 0");d.ClusterPosition=e.parseTag(A.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),c.CueTracks.push(d),e.setPos(g+f)}if(0===c.CueTracks.length)throw new Error("Mandatory cuetrack not found");b.push(c)}if(0===b.length)throw new Error("mandatory cuepoint not found");return b}function e(a,b,c,e){var f=void 0,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=void 0,m=void 0;for(g=d(a),h=[],j=0,k=g.length;j<k;j+=1)i=new u.default,f=0,f=j<g.length-1?g[j+1].CueTime-g[j].CueTime:e-g[j].CueTime,i.duration=f,i.startTime=g[j].CueTime,i.timescale=1e3,l=g[j].CueTracks[0].ClusterPosition+b,m=j<g.length-1?g[j+1].CueTracks[0].ClusterPosition+b-1:c-1,i.mediaRange=l+"-"+m,h.push(i);return y.debug("Parsed cues: "+h.length+" cues."),h}function f(a,b,c,d){var f=(0,k.default)(r).create({data:a}),g=void 0,h=void 0,i=c.split("-"),j=null,l={url:b,range:{start:parseFloat(i[0]),end:parseFloat(i[1])},request:j},m=void 0,n=void 0;for(y.debug("Parse EBML header: "+l.url),f.skipOverElement(A.EBML),f.consumeTag(A.Segment),m=f.getMatroskaCodedNum(),m+=f.getPos(),n=f.getPos();f.moreData()&&!f.consumeTagAndSize(A.Segment.Info,!0);)if(!(f.skipOverElement(A.Segment.SeekHead,!0)||f.skipOverElement(A.Segment.Tracks,!0)||f.skipOverElement(A.Segment.Cues,!0)||f.skipOverElement(A.Void,!0)))throw new Error("no valid top level element found");for(;void 0===g;){var p=f.getMatroskaCodedNum(!0),q=f.getMatroskaCodedNum();switch(p){case A.Segment.Info.Duration.tag:g=f[A.Segment.Info.Duration.parse](q);break;default:f.setPos(f.getPos()+q)}}j=o(l);var s=function(a){h=e(a,n,m,g),d(h)},t=function(){y.error("Download Error: Cues "+l.url),d(null)};H.load({request:j,success:s,error:t}),y.debug("Perform cues load: "+l.url+" bytes="+l.range.start+"-"+l.range.end)}function h(){if(!I||!I.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function j(a,b){h();var c=null,d=I.resolve(a.path),e=d?d.url:void 0,f=a.range.split("-"),i=b||{range:{start:parseFloat(f[0]),end:parseFloat(f[1])},request:c,url:e,init:!0};y.info("Start loading initialization."),c=o(i);var j=function(){t.trigger(g.default.INITIALIZATION_LOADED,{representation:a})},k=function(){t.trigger(g.default.INITIALIZATION_LOADED,{representation:a})};H.load({request:c,success:j,error:k}),y.debug("Perform init load: "+i.url)}function l(a,b,c,d){h();var e=null,g=I.resolve(a.path),i=g?g.url:void 0,j=8192,k={bytesLoaded:0,bytesToLoad:j,range:{start:0,end:j},request:e,url:i,init:!1};d=d||n,e=o(k),y.debug("Parsing ebml header");var l=function(e){f(e,i,c,function(c){d(c,a,b)})},m=function(){d(null,a,b)};H.load({request:e,success:l,error:m})}function n(a,b,c){a?t.trigger(g.default.SEGMENTS_LOADED,{segments:a,representation:b,mediaType:c}):t.trigger(g.default.SEGMENTS_LOADED,{segments:null,representation:b,mediaType:c,error:new B.default(D.default.SEGMENT_BASE_LOADER_ERROR_CODE,D.default.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}function o(a){var b=new x.default;return b.type=a.init?v.HTTPRequest.INIT_SEGMENT_TYPE:v.HTTPRequest.MEDIA_SEGMENT_TYPE,b.url=a.url,b.range=a.range.start+"-"+a.range.end,b}function p(){C=null,E=null}var r=this.context,t=(0,i.default)(r).getInstance(),w=void 0,y=void 0,A=void 0,C=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0;return w={setConfig:c,initialize:b,loadInitialization:j,loadSegments:l,reset:p},a(),w}Object.defineProperty(c,"__esModule",{value:!0});var f=a(53),g=d(f),h=a(47),i=d(h),j=a(201),k=d(j),l=a(101),m=d(l),n=a(48),o=d(n),p=a(46),q=d(p),r=a(207),s=d(r),t=a(88),u=d(t),v=a(235),w=a(217),x=d(w),y=a(148),z=d(y),A=a(215),B=d(A),C=a(50),D=d(C);e.__dashjs_factory_name="WebmSegmentBaseLoader",c.default=o.default.getSingletonFactory(e),b.exports=c.default},{101:101,148:148,201:201,207:207,215:215,217:217,235:235,46:46,47:47,48:48,50:50,53:53,88:88}],60:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a),this.init()}return e(a,[{key:"init",value:function(){this.BASE_URL="BaseURL",this.SEGMENT_BASE="SegmentBase",this.SEGMENT_TEMPLATE="SegmentTemplate",this.SEGMENT_LIST="SegmentList",this.SEGMENT_URL="SegmentURL",this.SEGMENT_TIMELINE="SegmentTimeline",this.SEGMENT_PROFILES="segmentProfiles",this.ADAPTATION_SET="AdaptationSet",this.REPRESENTATION="Representation",this.REPRESENTATION_INDEX="RepresentationIndex",this.SUB_REPRESENTATION="SubRepresentation",this.INITIALIZATION="Initialization",this.INITIALIZATION_MINUS="initialization",this.MPD="MPD",this.PERIOD="Period",this.ASSET_IDENTIFIER="AssetIdentifier",this.EVENT_STREAM="EventStream",this.ID="id",this.PROFILES="profiles",this.SERVICE_LOCATION="serviceLocation",this.RANGE="range",this.INDEX="index",this.MEDIA="media",this.BYTE_RANGE="byteRange",this.INDEX_RANGE="indexRange",this.MEDIA_RANGE="mediaRange",this.VALUE="value",this.CONTENT_TYPE="contentType",this.MIME_TYPE="mimeType",this.BITSTREAM_SWITCHING="BitstreamSwitching",this.BITSTREAM_SWITCHING_MINUS="bitstreamSwitching",this.CODECS="codecs",this.DEPENDENCY_ID="dependencyId",this.MEDIA_STREAM_STRUCTURE_ID="mediaStreamStructureId",this.METRICS="Metrics",this.METRICS_MINUS="metrics",this.REPORTING="Reporting",this.WIDTH="width",this.HEIGHT="height",this.SAR="sar",this.FRAMERATE="frameRate",this.AUDIO_SAMPLING_RATE="audioSamplingRate",this.MAXIMUM_SAP_PERIOD="maximumSAPPeriod",this.START_WITH_SAP="startWithSAP",this.MAX_PLAYOUT_RATE="maxPlayoutRate",this.CODING_DEPENDENCY="codingDependency",this.SCAN_TYPE="scanType",this.FRAME_PACKING="FramePacking",this.AUDIO_CHANNEL_CONFIGURATION="AudioChannelConfiguration",this.CONTENT_PROTECTION="ContentProtection",this.ESSENTIAL_PROPERTY="EssentialProperty",this.SUPPLEMENTAL_PROPERTY="SupplementalProperty",this.INBAND_EVENT_STREAM="InbandEventStream",this.ACCESSIBILITY="Accessibility",this.ROLE="Role",this.RATING="Rating",this.CONTENT_COMPONENT="ContentComponent",this.SUBSET="Subset",this.LANG="lang",this.VIEWPOINT="Viewpoint",this.ROLE_ASARRAY="Role_asArray",this.ACCESSIBILITY_ASARRAY="Accessibility_asArray",this.AUDIOCHANNELCONFIGURATION_ASARRAY="AudioChannelConfiguration_asArray",this.CONTENTPROTECTION_ASARRAY="ContentProtection_asArray",this.MAIN="main",this.DYNAMIC="dynamic",this.MEDIA_PRESENTATION_DURATION="mediaPresentationDuration",this.MINIMUM_UPDATE_PERIOD="minimumUpdatePeriod",this.CODEC_PRIVATE_DATA="codecPrivateData",this.BANDWITH="bandwidth",this.SOURCE_URL="sourceURL",this.TIMESCALE="timescale",this.DURATION="duration",this.START_NUMBER="startNumber",this.PRESENTATION_TIME_OFFSET="presentationTimeOffset",this.AVAILABILITY_START_TIME="availabilityStartTime",this.AVAILABILITY_END_TIME="availabilityEndTime",this.TIMESHIFT_BUFFER_DEPTH="timeShiftBufferDepth",this.MAX_SEGMENT_DURATION="maxSegmentDuration",this.PRESENTATION_TIME="presentationTime",this.MIN_BUFFER_TIME="minBufferTime",this.MAX_SUBSEGMENT_DURATION="maxSubsegmentDuration",this.START="start",this.AVAILABILITY_TIME_OFFSET="availabilityTimeOffset",this.AVAILABILITY_TIME_COMPLETE="availabilityTimeComplete",this.CENC_DEFAULT_KID="cenc:default_KID",this.DVB_PRIORITY="dvb:priority",this.DVB_WEIGHT="dvb:weight"}}]),a}(),g=new f;c.default=g,b.exports=c.default},{}],61:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){l(),H.on(q.default.QUALITY_CHANGE_REQUESTED,E,I),H.on(q.default.REPRESENTATION_UPDATED,B,I),H.on(q.default.WALLCLOCK_TIME_UPDATED,C,I),H.on(q.default.BUFFER_LEVEL_UPDATED,D,I),H.on(q.default.MANIFEST_VALIDITY_CHANGED,F,I)}function b(a){a.abrController&&(O=a.abrController),a.domStorage&&(S=a.domStorage),a.metricsModel&&(R=a.metricsModel),a.dashMetrics&&(V=a.dashMetrics),a.dashManifestModel&&(U=a.dashManifestModel),a.playbackController&&(Q=a.playbackController),a.timelineConverter&&(T=a.timelineConverter),a.manifestModel&&(X=a.manifestModel),a.streamProcessor&&(W=a.streamProcessor)}function c(){P=W.getIndexHandler()}function d(){return W}function e(){return J}function f(){return K}function h(){return L}function j(){return N}function l(){J=null,K=-1,L=!0,M=[],O=null,Q=null,R=null,S=null,T=null,U=null,V=null}function n(){H.off(q.default.QUALITY_CHANGE_REQUESTED,E,I),H.off(q.default.REPRESENTATION_UPDATED,B,I),H.off(q.default.WALLCLOCK_TIME_UPDATED,C,I),H.off(q.default.BUFFER_LEVEL_UPDATED,D,I),H.off(q.default.MANIFEST_VALIDITY_CHANGED,F,I),l()}function p(a,b,c){var d=W.getStreamInfo(),e=O.getTopQualityIndexFor(c,d.id),f=O.getMinAllowedIndexFor(c),h=void 0,i=void 0,j=null;if(L=!0,H.trigger(q.default.DATA_UPDATE_STARTED,{sender:this}),M=x(b),null!==J&&J.id==a.id||c===g.default.FRAGMENTED_TEXT?h=O.getQualityFor(c,d):(i=O.getThroughputHistory().getAverageThroughput(c),j=i||O.getInitialBitrateFor(c,d),h=O.getQualityForBitrate(W.getMediaInfo(),j)),void 0!==f&&h<f&&(h=f),h>e&&(h=e),N=t(h),J=a,c!==g.default.VIDEO&&c!==g.default.AUDIO&&c!==g.default.FRAGMENTED_TEXT)return L=!1,void H.trigger(q.default.DATA_UPDATE_COMPLETED,{sender:this,data:J,currentRepresentation:N});for(var k=0;k<M.length;k++)P.updateRepresentation(M[k],!0)}function r(){var a=new Date,b=j(),c=1e3*Q.getTime();R.addRepresentationSwitch(b.adaptation.type,a,c,b.id)}function s(){var a=W.getStreamInfo(),b=a?a.manifestInfo:null,c=b?b.isDynamic:null,d=T.calcSegmentAvailabilityRange(N,c);R.addDVRInfo(W.getType(),Q.getTime(),b,d)}function t(a){return null===a||void 0===a||a>=M.length?null:M[a]}function v(a){return M.indexOf(a)}function w(){for(var a=0,b=M.length;a<b;a++){var c=M[a].segmentInfoType;if(null===M[a].segmentAvailabilityRange||!u.default.hasInitialization(M[a])||(c===k.default.SEGMENT_BASE||c===k.default.BASE_URL)&&!M[a].segments)return!1}return!0}function x(a){return K=U.getIndexForAdaptation(J,a.period.mpd.manifest,a.period.index),U.getRepresentationsForAdaptation(a)}function y(a){for(var b=void 0,c=0,d=M.length;c<d;c++)b=M[c],b.segmentAvailabilityRange=T.calcSegmentAvailabilityRange(b,a)}function z(){M.forEach(function(a){a.segmentAvailabilityRange=null})}function A(a){var b=a,c=function(){if(!h()){L=!0,H.trigger(q.default.DATA_UPDATE_STARTED,{sender:I}),z();for(var a=0;a<M.length;a++)P.updateRepresentation(M[a],!0)}};L=!1,H.trigger(q.default.AST_IN_FUTURE,{delay:b}),setTimeout(c,b)}function B(a){if(a.sender.getStreamProcessor()===W&&h()){var b=a.representation,c=R.getMetricsFor(g.default.STREAM),d=R.getMetricsFor(j().adaptation.type),e=V.getCurrentManifestUpdate(c),f=!1,l=0,n=void 0,o=void 0,p=void 0;if(b.adaptation.period.mpd.manifest.type===k.default.DYNAMIC&&!b.adaptation.period.mpd.manifest.ignorePostponeTimePeriod){var t=b.segmentAvailabilityRange.end-b.segmentAvailabilityRange.start;l=1e3*(Q.computeLiveDelay(N.segmentDuration,W.getStreamInfo().manifestInfo.DVRWindowSize)-t)}if(l>0)return s(),A(l),o=new m.default(i.default.SEGMENTS_UPDATE_FAILED_ERROR_CODE,i.default.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE),void H.trigger(q.default.DATA_UPDATE_COMPLETED,{sender:this,data:J,currentRepresentation:N,error:o});if(e){for(var u=0;u<e.representationInfo.length;u++)if(n=e.representationInfo[u],n.index===b.index&&n.mediaType===W.getType()){f=!0;break}f||R.addManifestUpdateRepresentationInfo(e,b.id,b.index,b.adaptation.period.index,W.getType(),b.presentationTimeOffset,b.startNumber,b.segmentInfoType)}w()&&(L=!1,O.setPlaybackQuality(W.getType(),W.getStreamInfo(),v(N)),R.updateManifestUpdateInfo(e,{latency:N.segmentAvailabilityRange.end-Q.getTime()}),p=V.getCurrentRepresentationSwitch(d),p||r(),H.trigger(q.default.DATA_UPDATE_COMPLETED,{sender:this,data:J,currentRepresentation:N}))}}function C(a){a.isDynamic&&y(a.isDynamic)}function D(a){if(a.sender.getStreamProcessor()===W){X.getValue().doNotUpdateDVRWindowOnBufferUpdated||s()}}function E(a){if(a.mediaType===W.getType()&&W.getStreamInfo().id===a.streamInfo.id&&a.oldQuality!==a.newQuality){N=t(a.newQuality);var b=O.getThroughputHistory().getAverageThroughput(a.mediaType);isNaN(b)||S.setSavedBitrateSettings(a.mediaType,b),r()}}function F(a){if(a.newDuration){var b=j();if(b&&b.adaptation.period){b.adaptation.period.duration=a.newDuration}}}var G=this.context,H=(0,o.default)(G).getInstance(),I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0,V=void 0,W=void 0,X=void 0;return I={initialize:c,setConfig:b,getData:e,getDataIndex:f,isUpdating:h,updateData:p,getStreamProcessor:d,getCurrentRepresentation:j,getRepresentationForQuality:t,reset:n},a(),I}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(50),i=d(h),j=a(60),k=d(j),l=a(215),m=d(l),n=a(47),o=d(n),p=a(53),q=d(p),r=a(48),s=d(r),t=a(87),u=d(t);e.__dashjs_factory_name="RepresentationController",c.default=s.default.getClassFactory(e),b.exports=c.default},{101:101,215:215,47:47,48:48,50:50,53:53,60:60,87:87}],62:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){pa=(0,G.default)(qa).getInstance().getLogger(oa)}function c(a,b){var c=void 0,d=void 0,e=void 0,f=void 0,h=void 0,j=void 0,k=!1,l=!1;if(!a)throw new Error("adaptation is not defined");if(!b)throw new Error("type is not defined");if(a.hasOwnProperty("ContentComponent_asArray")&&(f=a.ContentComponent_asArray),h=b!==g.default.TEXT?new RegExp(b):new RegExp("(vtt|ttml)"),a.Representation_asArray&&a.Representation_asArray.length&&a.Representation_asArray.length>0&&a.Representation_asArray[0].hasOwnProperty(i.default.CODECS)&&(j=a.Representation_asArray[0].codecs,0===j.search(g.default.STPP)||0===j.search(g.default.WVTT)))return b===g.default.FRAGMENTED_TEXT;if(f){if(f.length>1)return b===g.default.MUXED;f[0]&&f[0].contentType===b&&(k=!0,l=!0)}if(a.hasOwnProperty(i.default.MIME_TYPE)&&(k=h.test(a.mimeType),l=!0),!l)for(c=0,d=a.Representation_asArray&&a.Representation_asArray.length?a.Representation_asArray.length:0;!l&&c<d;)e=a.Representation_asArray[c],e.hasOwnProperty(i.default.MIME_TYPE)&&(k=h.test(e.mimeType),l=!0),c++;return k}function d(a){return c(a,g.default.AUDIO)}function e(a){return c(a,g.default.VIDEO)}function f(a){return c(a,g.default.FRAGMENTED_TEXT)}function h(a){return c(a,g.default.MUXED)}function j(a){return c(a,g.default.IMAGE)}function l(a){return"text/vtt"===a||"application/ttml+xml"===a}function n(a){var b="";return a&&a.hasOwnProperty(i.default.LANG)&&(b=a.lang.replace(/[^A-Za-z0-9-]/g,"")),b}function p(a){return a&&a.hasOwnProperty(i.default.VIEWPOINT)?a.Viewpoint:null}function r(a){return a&&a.hasOwnProperty(i.default.ROLE_ASARRAY)?a.Role_asArray:[]}function t(a){return a&&a.hasOwnProperty(i.default.ACCESSIBILITY_ASARRAY)?a.Accessibility_asArray:[]}function v(a){return a&&a.hasOwnProperty(i.default.AUDIOCHANNELCONFIGURATION_ASARRAY)?a.AudioChannelConfiguration_asArray:[]}function x(a){return r(a).filter(function(a){return a.value===i.default.MAIN})[0]}function z(){return function(a,b){return a.bandwidth-b.bandwidth}}function B(a){return a&&void 0!==a.Representation_asArray&&null!==a.Representation_asArray&&a.Representation_asArray.sort(z()),a}function D(a,b){return a&&a.Period_asArray&&xa(b)&&a.Period_asArray[b]?a.Period_asArray[b].AdaptationSet_asArray:[]}function E(a,b,c){var d=D(b,c),e=void 0,f=void 0;for(e=0,f=d.length;e<f;e++)if(d[e].hasOwnProperty(i.default.ID)&&d[e].id===a)return d[e];return null}function F(a,b,c){var d=D(b,c);return d.length>0&&xa(a)?d[a]:null}function H(a,b,c){var d=D(b,c),e=d.length;if(a)for(var f=0;f<e;f++){var g=(0,A.default)(qa).getInstance();if(g.areEqual(d[f],a))return f}return-1}function J(a,b,d){var e=D(a,b),f=void 0,g=void 0,h=[];for(f=0,g=e.length;f<g;f++)c(e[f],d)&&h.push(B(e[f]));return h}function L(a,b,c,d){var e=J(a,b,c);if(!e||0===e.length)return null;if(e.length>1&&d){var f=sa.getCurrentTrackFor(c,d),g=ua.getAllMediaInfoForType(d,c);if(f)for(var h=0,i=e.length;h<i;h++)if(sa.isTracksEqual(f,g[h]))return e[h];for(var h=0,i=e.length;h<i;h++)if(x(e[h]))return e[h]}return e[0]}function M(a,b,c){var d=null;if(a&&a.Representation_asArray&&a.Representation_asArray.length>0){var e=xa(b)&&b>=0&&b<a.Representation_asArray.length?a.Representation_asArray[b]:a.Representation_asArray[0];e&&(d=e.mimeType+';codecs="'+e.codecs+'"',c&&void 0!==e.width&&(d+=';width="'+e.width+'";height="'+e.height+'"'))}return d}function N(a){return a&&a.Representation_asArray&&a.Representation_asArray.length>0?a.Representation_asArray[0].mimeType:null}function O(a){return a&&a.hasOwnProperty(i.default.CENC_DEFAULT_KID)?a[i.default.CENC_DEFAULT_KID]:null}function P(a){return a&&a.hasOwnProperty(i.default.CONTENTPROTECTION_ASARRAY)&&0!==a.ContentProtection_asArray.length?a.ContentProtection_asArray:null}function Q(a){var b=!1;return a&&a.hasOwnProperty("type")&&(b=a.type===i.default.DYNAMIC),b}function R(a,b){var c=!1;return a&&a.profiles&&a.profiles.length>0&&(c=-1!==a.profiles.indexOf(b)),c}function S(a){return R(a,wa)}function T(a){return a&&a.hasOwnProperty(i.default.MEDIA_PRESENTATION_DURATION)?a.mediaPresentationDuration:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE}function U(a){return a&&a.bandwidth?a.bandwidth:NaN}function V(a){var b=arguments.length<=1||void 0===arguments[1]?0:arguments[1],c=NaN;return a&&a.hasOwnProperty(i.default.MINIMUM_UPDATE_PERIOD)&&(c=a.minimumUpdatePeriod),isNaN(c)?c:Math.max(c-b,1)}function W(a){return a&&a.Representation_asArray&&a.Representation_asArray.length?a.Representation_asArray.length:0}function X(a){return a&&a.Representation_asArray&&a.Representation_asArray.length?B(a).Representation_asArray.map(function(a){return{bandwidth:a.bandwidth,width:a.width||0,height:a.height||0,scanType:a.scanType||null}}):null}function Y(a){return a&&a.EssentialProperty_asArray&&a.EssentialProperty_asArray.length?a.EssentialProperty_asArray.map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value}}):null}function Z(a,b){return b&&b.Representation_asArray&&b.Representation_asArray.length>0&&xa(a)?b.Representation_asArray[a]:null}function $(a){if(a&&a.period&&xa(a.period.index)){var b=a.period.mpd.manifest.Period_asArray[a.period.index];if(b&&b.AdaptationSet_asArray&&xa(a.index))return B(b.AdaptationSet_asArray[a.index])}}function _(a){var b=a.S_asArray[a.S_asArray.length-1];return!b.hasOwnProperty("r")||b.r>=0}function aa(a){var b=$(a).Representation_asArray[0],c=void 0;return b.hasOwnProperty(i.default.SEGMENT_LIST)?(c=b.SegmentList,!c.hasOwnProperty(i.default.SEGMENT_TIMELINE)||_(c.SegmentTimeline)):!(!b.hasOwnProperty(i.default.SEGMENT_TEMPLATE)||(c=b.SegmentTemplate,!c.hasOwnProperty(i.default.SEGMENT_TIMELINE)))&&_(c.SegmentTimeline)}function ba(a){var b=[],c=$(a),d=void 0,e=void 0;if(a&&a.period&&xa(a.period.index)){var f=ma(a.period.mpd.manifest);f&&(e=f[0])}if(c&&c.Representation_asArray)for(var g=0,h=c.Representation_asArray.length;g<h;++g){var j=c.Representation_asArray[g],m=new k.default;if(m.index=g,m.adaptation=a,j.hasOwnProperty(i.default.ID)&&(m.id=j.id),j.hasOwnProperty(i.default.CODECS)&&(m.codecs=j.codecs),j.hasOwnProperty(i.default.CODEC_PRIVATE_DATA)&&(m.codecPrivateData=j.codecPrivateData),j.hasOwnProperty(i.default.BANDWITH)&&(m.bandwidth=j.bandwidth),j.hasOwnProperty(i.default.WIDTH)&&(m.width=j.width),j.hasOwnProperty(i.default.HEIGHT)&&(m.height=j.height),j.hasOwnProperty(i.default.SCAN_TYPE)&&(m.scanType=j.scanType),j.hasOwnProperty(i.default.MAX_PLAYOUT_RATE)&&(m.maxPlayoutRate=j.maxPlayoutRate),j.hasOwnProperty(i.default.SEGMENT_BASE)?(d=j.SegmentBase,m.segmentInfoType=i.default.SEGMENT_BASE):j.hasOwnProperty(i.default.SEGMENT_LIST)?(d=j.SegmentList,d.hasOwnProperty(i.default.SEGMENT_TIMELINE)?(m.segmentInfoType=i.default.SEGMENT_TIMELINE,m.useCalculatedLiveEdgeTime=_(d.SegmentTimeline)):(m.segmentInfoType=i.default.SEGMENT_LIST,m.useCalculatedLiveEdgeTime=!0)):j.hasOwnProperty(i.default.SEGMENT_TEMPLATE)?(d=j.SegmentTemplate,d.hasOwnProperty(i.default.SEGMENT_TIMELINE)?(m.segmentInfoType=i.default.SEGMENT_TIMELINE,m.useCalculatedLiveEdgeTime=_(d.SegmentTimeline)):m.segmentInfoType=i.default.SEGMENT_TEMPLATE,d.hasOwnProperty(i.default.INITIALIZATION_MINUS)&&(m.initialization=d.initialization.split("$Bandwidth$").join(j.bandwidth).split("$RepresentationID$").join(j.id))):m.segmentInfoType=i.default.BASE_URL,m.essentialProperties=Y(j),d){if(d.hasOwnProperty(i.default.INITIALIZATION)){var n=d.Initialization;n.hasOwnProperty(i.default.SOURCE_URL)?m.initialization=n.sourceURL:n.hasOwnProperty(i.default.RANGE)&&(m.range=n.range)}else j.hasOwnProperty(i.default.MIME_TYPE)&&l(j.mimeType)&&(m.range=0);d.hasOwnProperty(i.default.TIMESCALE)&&(m.timescale=d.timescale),d.hasOwnProperty(i.default.DURATION)&&(m.segmentDuration=d.duration/m.timescale),d.hasOwnProperty(i.default.MEDIA)&&(m.media=d.media),d.hasOwnProperty(i.default.START_NUMBER)&&(m.startNumber=d.startNumber),d.hasOwnProperty(i.default.INDEX_RANGE)&&(m.indexRange=d.indexRange),d.hasOwnProperty(i.default.PRESENTATION_TIME_OFFSET)&&(m.presentationTimeOffset=d.presentationTimeOffset/m.timescale),d.hasOwnProperty(i.default.AVAILABILITY_TIME_OFFSET)?m.availabilityTimeOffset=d.availabilityTimeOffset:e&&void 0!==e.availabilityTimeOffset&&(m.availabilityTimeOffset=e.availabilityTimeOffset),d.hasOwnProperty(i.default.AVAILABILITY_TIME_COMPLETE)?m.availabilityTimeComplete="false"!==d.availabilityTimeComplete:e&&void 0!==e.availabilityTimeComplete&&(m.availabilityTimeComplete=e.availabilityTimeComplete)}m.MSETimeOffset=ta.calcMSETimeOffset(m),m.path=[a.period.index,a.index,g],b.push(m)}return b}function ca(a){var b=a&&xa(a.index)?a.mpd.manifest.Period_asArray[a.index]:null,c=[],k=void 0,l=void 0,n=void 0;if(b&&b.AdaptationSet_asArray)for(n=0;n<b.AdaptationSet_asArray.length;n++)l=b.AdaptationSet_asArray[n],k=new m.default,l.hasOwnProperty(i.default.ID)&&(k.id=l.id),k.index=n,k.period=a,h(l)?k.type=g.default.MUXED:d(l)?k.type=g.default.AUDIO:e(l)?k.type=g.default.VIDEO:f(l)?k.type=g.default.FRAGMENTED_TEXT:j(l)?k.type=g.default.IMAGE:k.type=g.default.TEXT,c.push(k);return c}function da(a){var b=!!a&&Q(a.manifest),c=[],d=null,e=null,f=null,g=null,h=void 0,j=void 0;for(j=0,h=a&&a.manifest&&a.manifest.Period_asArray?a.manifest.Period_asArray.length:0;j<h;j++)e=a.manifest.Period_asArray[j],e.hasOwnProperty(i.default.START)?(g=new o.default,g.start=e.start):null!==d&&d.hasOwnProperty(i.default.DURATION)&&null!==f?(g=new o.default,g.start=parseFloat((f.start+f.duration).toFixed(5))):0!==j||b||(g=new o.default,g.start=0),null!==f&&isNaN(f.duration)&&(null!==g?f.duration=parseFloat((g.start-f.start).toFixed(5)):pa.warn("First period duration could not be calculated because lack of start and duration period properties. This will cause timing issues during playback")),null!==g&&(g.id=ea(e,j),g.index=j,g.mpd=a,e.hasOwnProperty(i.default.DURATION)&&(g.duration=e.duration),c.push(g),d=e,f=g),e=null,g=null;return 0===c.length?c:(null!==f&&isNaN(f.duration)&&(f.duration=parseFloat((ga(f)-f.start).toFixed(5))),c)}function ea(a,b){if(!a)throw new Error("Period cannot be null or undefined");var c=o.default.DEFAULT_ID+"_"+b;return a.hasOwnProperty(i.default.ID)&&a.id.length>0&&"__proto__"!==a.id&&(c=a.id),c}function fa(a){var b=new q.default;return a&&(b.manifest=a,a.hasOwnProperty(i.default.AVAILABILITY_START_TIME)?b.availabilityStartTime=new Date(a.availabilityStartTime.getTime()):b.availabilityStartTime=new Date(a.loadedTime.getTime()),a.hasOwnProperty(i.default.AVAILABILITY_END_TIME)&&(b.availabilityEndTime=new Date(a.availabilityEndTime.getTime())),a.hasOwnProperty(i.default.MINIMUM_UPDATE_PERIOD)&&(b.minimumUpdatePeriod=a.minimumUpdatePeriod),a.hasOwnProperty(i.default.MEDIA_PRESENTATION_DURATION)&&(b.mediaPresentationDuration=a.mediaPresentationDuration),a.hasOwnProperty(g.default.SUGGESTED_PRESENTATION_DELAY)&&(b.suggestedPresentationDelay=a.suggestedPresentationDelay),a.hasOwnProperty(i.default.TIMESHIFT_BUFFER_DEPTH)&&(b.timeShiftBufferDepth=a.timeShiftBufferDepth),a.hasOwnProperty(i.default.MAX_SEGMENT_DURATION)&&(b.maxSegmentDuration=a.maxSegmentDuration)),b}function ga(a){var b=Q(a.mpd.manifest),c=void 0;return a.mpd.manifest.mediaPresentationDuration?c=a.mpd.manifest.mediaPresentationDuration:a.duration?c=a.duration:b?c=Number.POSITIVE_INFINITY:va.error(new I.default(K.default.MANIFEST_ERROR_ID_PARSE_CODE,"Must have @mediaPresentationDuration on MPD or an explicit @duration on the last period.",a)),c}function ha(a){var b=a&&a.mpd&&a.mpd.manifest?a.mpd.manifest:null,c=b?b.Period_asArray:null,d=c&&a&&xa(a.index)?c[a.index].EventStream_asArray:null,e=[],f=void 0,h=void 0;if(d)for(f=0;f<d.length;f++){var j=new y.default;if(j.period=a,j.timescale=1,!d[f].hasOwnProperty(g.default.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");for(j.schemeIdUri=d[f].schemeIdUri,d[f].hasOwnProperty(i.default.TIMESCALE)&&(j.timescale=d[f].timescale),d[f].hasOwnProperty(i.default.VALUE)&&(j.value=d[f].value),h=0;h<d[f].Event_asArray.length;h++){var k=new u.default;k.presentationTime=0,k.eventStream=j,d[f].Event_asArray[h].hasOwnProperty(i.default.PRESENTATION_TIME)&&(k.presentationTime=d[f].Event_asArray[h].presentationTime),d[f].Event_asArray[h].hasOwnProperty(i.default.DURATION)&&(k.duration=d[f].Event_asArray[h].duration),d[f].Event_asArray[h].hasOwnProperty(i.default.ID)&&(k.id=d[f].Event_asArray[h].id),k.messageData=d[f].Event_asArray[h].messageData||d[f].Event_asArray[h].__text,e.push(k)}}return e}function ia(a,b){var c=[],d=void 0;if(!a)return c;for(d=0;d<a.length;d++){var e=new y.default;if(e.timescale=1,e.representation=b,!a[d].hasOwnProperty(g.default.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");e.schemeIdUri=a[d].schemeIdUri,a[d].hasOwnProperty(i.default.TIMESCALE)&&(e.timescale=a[d].timescale),a[d].hasOwnProperty(i.default.VALUE)&&(e.value=a[d].value),c.push(e)}return c}function ja(a,b){var c=void 0,d=void 0,e=void 0;return a&&a.Period_asArray&&b&&b.period&&xa(b.period.index)&&(d=a.Period_asArray[b.period.index])&&d.AdaptationSet_asArray&&xa(b.index)&&(e=d.AdaptationSet_asArray[b.index])&&(c=e.InbandEventStream_asArray),ia(c,null)}function ka(a,b){var c=void 0,d=void 0,e=void 0,f=void 0 +;return a&&a.Period_asArray&&b&&b.adaptation&&b.adaptation.period&&xa(b.adaptation.period.index)&&(d=a.Period_asArray[b.adaptation.period.index])&&d.AdaptationSet_asArray&&xa(b.adaptation.index)&&(e=d.AdaptationSet_asArray[b.adaptation.index])&&e.Representation_asArray&&xa(b.index)&&(f=e.Representation_asArray[b.index])&&(c=f.InbandEventStream_asArray),ia(c,b)}function la(a){var b=Q(a),c=!!a&&a.hasOwnProperty(i.default.AVAILABILITY_START_TIME),d=a?a.UTCTiming_asArray:null,e=[];return(b||c)&&d&&d.forEach(function(a){var b=new s.default;a.hasOwnProperty(g.default.SCHEME_ID_URI)&&(b.schemeIdUri=a.schemeIdUri,a.hasOwnProperty(i.default.VALUE)&&(b.value=a.value.toString(),e.push(b)))}),e}function ma(a){var b=[],c=a.BaseURL_asArray||[a.baseUri],d=!1;return c.some(function(c){if(c){var e=new w.default,f=c.__text||c;return ra.isRelative(f)&&(d=!0,a.baseUri&&(f=ra.resolve(f,a.baseUri))),e.url=f,c.hasOwnProperty(i.default.SERVICE_LOCATION)&&c.serviceLocation.length?e.serviceLocation=c.serviceLocation:e.serviceLocation=f,c.hasOwnProperty(i.default.DVB_PRIORITY)&&(e.dvb_priority=c[i.default.DVB_PRIORITY]),c.hasOwnProperty(i.default.DVB_WEIGHT)&&(e.dvb_weight=c[i.default.DVB_WEIGHT]),c.hasOwnProperty(i.default.AVAILABILITY_TIME_OFFSET)&&(e.availabilityTimeOffset=c[i.default.AVAILABILITY_TIME_OFFSET]),c.hasOwnProperty(i.default.AVAILABILITY_TIME_COMPLETE)&&(e.availabilityTimeComplete="false"!==c[i.default.AVAILABILITY_TIME_COMPLETE]),b.push(e),d}}),b}function na(a){if(a&&a.hasOwnProperty(g.default.LOCATION))return a.Location=a.Location_asArray[0],a.Location}a=a||{};var oa=void 0,pa=void 0,qa=this.context,ra=(0,C.default)(qa).getInstance(),sa=a.mediaController,ta=a.timelineConverter,ua=a.adapter,va=a.errHandler,wa="urn:dvb:dash:profile:dvb-dash:2014",xa=Number.isInteger||function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a};return oa={getIsTypeOf:c,getIsTextTrack:l,getLanguageForAdaptation:n,getViewpointForAdaptation:p,getRolesForAdaptation:r,getAccessibilityForAdaptation:t,getAudioChannelConfigurationForAdaptation:v,getAdaptationForIndex:F,getIndexForAdaptation:H,getAdaptationForId:E,getAdaptationsForType:J,getAdaptationForType:L,getCodec:M,getMimeType:N,getKID:O,getContentProtectionData:P,getIsDynamic:Q,getIsDVB:S,getDuration:T,getBandwidth:U,getManifestUpdatePeriod:V,getRepresentationCount:W,getBitrateListForAdaptation:X,getRepresentationFor:Z,getRepresentationsForAdaptation:ba,getAdaptationsForPeriod:ca,getRegularPeriods:da,getMpd:fa,getEventsForPeriod:ha,getEventStreamForAdaptationSet:ja,getEventStreamForRepresentation:ka,getUTCTimingSources:la,getBaseURLsFromElement:ma,getRepresentationSortFunction:z,getLocation:na,getUseCalculatedLiveEdgeTimeForAdaptation:aa},b(),oa}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(60),i=d(h),j=a(87),k=d(j),l=a(81),m=d(l),n=a(86),o=d(n),p=a(85),q=d(p),r=a(89),s=d(r),t=a(83),u=d(t),v=a(82),w=d(v),x=a(84),y=d(x),z=a(206),A=d(z),B=a(210),C=d(B),D=a(48),E=d(D),F=a(46),G=d(F),H=a(215),I=d(H),J=a(50),K=d(J);e.__dashjs_factory_name="DashManifestModel",c.default=E.default.getSingletonFactory(e),b.exports=c.default},{101:101,206:206,210:210,215:215,46:46,48:48,50:50,60:60,81:81,82:82,83:83,84:84,85:85,86:86,87:87,89:89}],63:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){g=(0,i.default)(e).getInstance().getLogger(f),h=[new q.default,new s.default,new u.default,new o.default],j=new m.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:h}),l=(0,k.default)(e).create({adaptationset:new w.default,period:new y.default})}function b(){return h}function c(){return l}function d(a){var b=void 0,c=window.performance.now();if(!(b=j.xml_str2json(a)))throw new Error("parsing the manifest failed");var d=window.performance.now();l.run(b);var e=window.performance.now();return g.info("Parsing complete: ( xml2json: "+(d-c).toPrecision(3)+"ms, objectiron: "+(e-d).toPrecision(3)+"ms, total: "+((e-c)/1e3).toPrecision(3)+"s)"),b}var e=this.context,f=void 0,g=void 0,h=void 0,j=void 0,l=void 0;return f={parse:d,getMatchers:b,getIron:c},a(),f}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h),j=a(73),k=d(j),l=a(3),m=d(l),n=a(72),o=d(n),p=a(70),q=d(p),r=a(69),s=d(r),t=a(71),u=d(t),v=a(66),w=d(v),x=a(67),y=d(x);e.__dashjs_factory_name="DashParser",c.default=g.default.getClassFactory(e),b.exports=c.default},{3:3,46:46,48:48,66:66,67:67,69:69,70:70,71:71,72:72,73:73}],64:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b){d(this,a);var c=function(a){return a&&a.length&&a.charAt(0)===a.charAt(0).toUpperCase()};this._name=b,this._merge=c(b)}return e(a,[{key:"name",get:function(){return this._name}},{key:"merge",get:function(){return this._merge}}]),a}();c.default=f,b.exports=c.default},{}],65:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a(64),h=d(g),i=function(){function a(b,c,d){var f=this;e(this,a),this._name=b||"",this._properties=[],this._children=d||[],Array.isArray(c)&&c.forEach(function(a){f._properties.push(new h.default(a))})}return f(a,[{key:"name",get:function(){return this._name}},{key:"children",get:function(){return this._children}},{key:"properties",get:function(){return this._properties}}]),a}();c.default=i,b.exports=c.default},{64:64}],66:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(65),i=d(h),j=a(60),k=d(j),l=function(a){function b(){e(this,b);var a=[k.default.PROFILES,k.default.WIDTH,k.default.HEIGHT,k.default.SAR,k.default.FRAMERATE,k.default.AUDIO_SAMPLING_RATE,k.default.MIME_TYPE,k.default.SEGMENT_PROFILES,k.default.CODECS,k.default.MAXIMUM_SAP_PERIOD,k.default.START_WITH_SAP,k.default.MAX_PLAYOUT_RATE,k.default.CODING_DEPENDENCY,k.default.SCAN_TYPE,k.default.FRAME_PACKING,k.default.AUDIO_CHANNEL_CONFIGURATION,k.default.CONTENT_PROTECTION,k.default.ESSENTIAL_PROPERTY,k.default.SUPPLEMENTAL_PROPERTY,k.default.INBAND_EVENT_STREAM];g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,k.default.ADAPTATION_SET,a,[new i.default(k.default.REPRESENTATION,a,[new i.default(k.default.SUB_REPRESENTATION,a)])])}return f(b,a),b}(i.default);c.default=l,b.exports=c.default},{60:60,65:65}],67:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(65),i=d(h),j=a(60),k=d(j),l=function(a){function b(){e(this,b);var a=[k.default.SEGMENT_BASE,k.default.SEGMENT_TEMPLATE,k.default.SEGMENT_LIST];g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,k.default.PERIOD,a,[new i.default(k.default.ADAPTATION_SET,a,[new i.default(k.default.REPRESENTATION,a)])])}return f(b,a),b}(i.default);c.default=l,b.exports=c.default},{60:60,65:65}],68:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b,c){d(this,a),this._test=b,this._converter=c}return e(a,[{key:"test",get:function(){return this._test}},{key:"converter",get:function(){return this._converter}}]),a}();c.default=f,b.exports=c.default},{}],69:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(68),i=d(h),j=60,k=60,l=1e3,m=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/,n=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a){return m.test(a.value)},function(a){var b=m.exec(a),c=void 0;if(c=Date.UTC(parseInt(b[1],10),parseInt(b[2],10)-1,parseInt(b[3],10),parseInt(b[4],10),parseInt(b[5],10),b[6]&&parseInt(b[6],10)||0,b[7]&&parseFloat(b[7])*l||0),b[9]&&b[10]){var d=parseInt(b[9],10)*k+parseInt(b[10],10);c+=("+"===b[8]?-1:1)*d*j*l}return new Date(c)})}return f(b,a),b}(i.default);c.default=n,b.exports=c.default},{68:68}],70:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(68),i=d(h),j=a(101),k=d(j),l=a(60),m=d(l),n=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,o=31536e3,p=2592e3,q=86400,r=3600,s=60,t=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a){for(var b=[m.default.MIN_BUFFER_TIME,m.default.MEDIA_PRESENTATION_DURATION,m.default.MINIMUM_UPDATE_PERIOD,m.default.TIMESHIFT_BUFFER_DEPTH,m.default.MAX_SEGMENT_DURATION,m.default.MAX_SUBSEGMENT_DURATION,k.default.SUGGESTED_PRESENTATION_DELAY,m.default.START,k.default.START_TIME,m.default.DURATION],c=b.length,d=0;d<c;d++)if(a.nodeName===b[d])return n.test(a.value);return!1},function(a){var b=n.exec(a),c=parseFloat(b[2]||0)*o+parseFloat(b[4]||0)*p+parseFloat(b[6]||0)*q+parseFloat(b[8]||0)*r+parseFloat(b[10]||0)*s+parseFloat(b[12]||0);return void 0!==b[1]&&(c=-c),c})}return f(b,a),b}(i.default);c.default=t,b.exports=c.default},{101:101,60:60,68:68}],71:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(68),i=d(h),j=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,k=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a){return j.test(a.value)},function(a){return parseFloat(a)})}return f(b,a),b}(i.default);c.default=k,b.exports=c.default},{68:68}],72:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var h=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},i=a(68),j=d(i),k=a(60),l=d(k),m=function(a){function b(){f(this,b),h(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,function(a,b){var c,d=(c={},e(c,l.default.MPD,[l.default.ID,l.default.PROFILES]),e(c,l.default.PERIOD,[l.default.ID]),e(c,l.default.BASE_URL,[l.default.SERVICE_LOCATION,l.default.BYTE_RANGE]),e(c,l.default.SEGMENT_BASE,[l.default.INDEX_RANGE]),e(c,l.default.INITIALIZATION,[l.default.RANGE]),e(c,l.default.REPRESENTATION_INDEX,[l.default.RANGE]),e(c,l.default.SEGMENT_LIST,[l.default.INDEX_RANGE]),e(c,l.default.BITSTREAM_SWITCHING,[l.default.RANGE]),e(c,l.default.SEGMENT_URL,[l.default.MEDIA_RANGE,l.default.INDEX_RANGE]),e(c,l.default.SEGMENT_TEMPLATE,[l.default.INDEX_RANGE,l.default.MEDIA,l.default.INDEX,l.default.INITIALIZATION_MINUS,l.default.BITSTREAM_SWITCHING_MINUS]),e(c,l.default.ASSET_IDENTIFIER,[l.default.VALUE,l.default.ID]),e(c,l.default.EVENT_STREAM,[l.default.VALUE]),e(c,l.default.ADAPTATION_SET,[l.default.PROFILES,l.default.MIME_TYPE,l.default.SEGMENT_PROFILES,l.default.CODECS,l.default.CONTENT_TYPE]),e(c,l.default.FRAME_PACKING,[l.default.VALUE,l.default.ID]),e(c,l.default.AUDIO_CHANNEL_CONFIGURATION,[l.default.VALUE,l.default.ID]),e(c,l.default.CONTENT_PROTECTION,[l.default.VALUE,l.default.ID]),e(c,l.default.ESSENTIAL_PROPERTY,[l.default.VALUE,l.default.ID]),e(c,l.default.SUPPLEMENTAL_PROPERTY,[l.default.VALUE,l.default.ID]),e(c,l.default.INBAND_EVENT_STREAM,[l.default.VALUE,l.default.ID]),e(c,l.default.ACCESSIBILITY,[l.default.VALUE,l.default.ID]),e(c,l.default.ROLE,[l.default.VALUE,l.default.ID]),e(c,l.default.RATING,[l.default.VALUE,l.default.ID]),e(c,l.default.VIEWPOINT,[l.default.VALUE,l.default.ID]),e(c,l.default.CONTENT_COMPONENT,[l.default.CONTENT_TYPE]),e(c,l.default.REPRESENTATION,[l.default.ID,l.default.DEPENDENCY_ID,l.default.MEDIA_STREAM_STRUCTURE_ID]),e(c,l.default.SUBSET,[l.default.ID]),e(c,l.default.METRICS,[l.default.METRICS_MINUS]),e(c,l.default.REPORTING,[l.default.VALUE,l.default.ID]),c);if(d.hasOwnProperty(b)){var f=d[b];return void 0!==f&&f.indexOf(a.name)>=0}return!1},function(a){return String(a)})}return g(b,a),b}(j.default);c.default=m,b.exports=c.default},{60:60,68:68}],73:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){for(var c in a)b.hasOwnProperty(c)||(b[c]=a[c])}function c(a,c,d){for(var e=0,f=a.length;e<f;++e){var g=a[e];if(c[g.name])if(d[g.name]){if(g.merge){var h=c[g.name],i=d[g.name];"object"==typeof h&&"object"==typeof i?b(h,i):d[g.name]=h+i}}else d[g.name]=c[g.name]}}function d(a,b){for(var e=0,f=a.children.length;e<f;++e){var g=a.children[e],h=b[g.name+"_asArray"];if(h)for(var i=0,j=h.length;i<j;++i){var k=h[i];c(a.properties,b,k),d(g,k)}}}function e(b){if(null===b||"object"!=typeof b)return b;if("period"in a)for(var c=a.period,e=b.Period_asArray,f=0,g=e.length;f<g;++f){var h=e[f];if(d(c,h),"adaptationset"in a){var i=h.AdaptationSet_asArray;if(i)for(var j=a.adaptationset,k=0,l=i.length;k<l;++k)d(j,i[k])}}return b}return{run:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="ObjectIron";var h=g.default.getClassFactory(e);c.default=h,b.exports=c.default},{48:48}],74:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(a,c,e,f){var g=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentList,i=g.SegmentURL_asArray.length,j=[],k=void 0,l=void 0,m=void 0,n=void 0,o=void 0,p=void 0,q=void 0;for(q=a.startNumber,n=(0,h.decideSegmentListRangeForTemplate)(d,b,a,c,e,f),o=Math.max(n.start,0),p=Math.min(n.end,g.SegmentURL_asArray.length-1),k=o;k<=p;k++)m=g.SegmentURL_asArray[k],l=(0,h.getIndexBasedSegment)(d,b,a,k),l.replacementTime=(q+k-1)*a.segmentDuration,l.media=m.media?m.media:"",l.mediaRange=m.mediaRange,l.index=m.index,l.indexRange=m.indexRange,j.push(l),l=null;return a.availableSegmentsNumber=i,j}a=a||{};var d=a.timelineConverter;return{getSegments:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(77);e.__dashjs_factory_name="ListSegmentsGetter";var i=g.default.getClassFactory(e);c.default=i,b.exports=c.default},{48:48,77:77}],75:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){return void 0===c||0==+c?Math[a](b):(b=+b,c=+c,null===b||isNaN(b)||"number"!=typeof c||c%1!=0?NaN:(b=b.toString().split("e"),b=Math[a](+(b[0]+"e"+(b[1]?+b[1]-c:-c))),b=b.toString().split("e"),+(b[0]+"e"+(b[1]?+b[1]+c:c))))}Object.defineProperty(c,"__esModule",{value:!0});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=function(){function a(){d(this,a)}return f(a,null,[{key:"round10",value:function(a,b){return e("round",a,b)}}]),a}();c.default=g,b.exports=c.default},{}],76:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(){i=(0,k.default)(f).create(a,b),j=(0,m.default)(f).create(a,b),l=(0,o.default)(f).create(a,b)}function d(a,b,c,d,f){var h=void 0,k=a.segmentInfoType;k!==g.default.SEGMENT_BASE&&k!==g.default.BASE_URL&&e(a,c)?(k===g.default.SEGMENT_TIMELINE?h=i.getSegments(a,b,c,f):k===g.default.SEGMENT_TEMPLATE?h=j.getSegments(a,b,c,f):k===g.default.SEGMENT_LIST&&(h=l.getSegments(a,b,c,f)),d&&d(a,h)):h=a.segments}function e(a,b){var c=a.segments,d=!1,e=void 0,f=void 0;return c&&0!==c.length?(f=c[0].availabilityIdx,e=c[c.length-1].availabilityIdx,d=b<f||b>e):d=!0,d}var f=this.context,h=void 0,i=void 0,j=void 0,l=void 0;return h={getSegments:d},c(),h}Object.defineProperty(c,"__esModule",{value:!0});var f=a(60),g=d(f),h=a(48),i=d(h),j=a(80),k=d(j),l=a(78),m=d(l),n=a(74),o=d(n);e.__dashjs_factory_name="SegmentsGetter";var p=i.default.getClassFactory(e);c.default=p,b.exports=c.default},{48:48,60:60,74:74,78:78,80:80}],77:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){for(;a.length<b;)a="0"+a;return a}function f(a,b){return a.representation.startNumber+b}function g(a){return a?a.split("$$").join("$"):a}function h(a,b){if(!b||!a||-1===a.indexOf("$RepresentationID$"))return a;var c=b.toString();return a.split("$RepresentationID$").join(c)}function i(a,b,c){var d="%0",f=void 0,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=b.length,m=d.length;if(!a)return a;for(;;){if((f=a.indexOf("$"+b))<0)return a;if((g=a.indexOf("$",f+l))<0)return a;if((h=a.indexOf(d,f+l))>f&&h<g)switch(i=a.charAt(g-1),j=parseInt(a.substring(h+m,g-1),10),i){case"d":case"i":case"u":k=e(c.toString(),j);break;case"x":k=e(c.toString(16),j);break;case"X":k=e(c.toString(16),j).toUpperCase();break;case"o":k=e(c.toString(8),j);break;default:return a}else k=c;a=a.substring(0,f)+k+a.substring(g+1)}}function j(a,b,c,d){var e=void 0,g=void 0,h=void 0,i=void 0;return g=c.segmentDuration,isNaN(g)&&(g=c.adaptation.period.duration),h=parseFloat((c.adaptation.period.start+d*g).toFixed(5)),i=parseFloat((h+g).toFixed(5)),e=new o.default,e.representation=c,e.duration=g,e.presentationStartTime=h,e.mediaStartTime=a.calcMediaTimeFromPresentationTime(e.presentationStartTime,c),e.availabilityStartTime=a.calcAvailabilityStartTimeFromPresentationTime(e.presentationStartTime,c.adaptation.period.mpd,b),e.availabilityEndTime=a.calcAvailabilityEndTimeFromPresentationTime(i,c.adaptation.period.mpd,b),e.wallStartTime=a.calcWallTimeForSegment(e,b),e.replacementNumber=f(e,d),e.availabilityIdx=d,e}function k(a,b,c,d,e,g,h,j,k,l){var m=d/g,n=Math.min(e/g,c.adaptation.period.mpd.maxSegmentDuration),p=void 0,q=void 0,r=void 0;return p=a.calcPresentationTimeFromMediaTime(m,c),q=p+n,r=new o.default,r.representation=c,r.duration=n,r.mediaStartTime=m,r.presentationStartTime=p,r.availabilityStartTime=c.adaptation.period.mpd.manifest.loadedTime,r.availabilityEndTime=a.calcAvailabilityEndTimeFromPresentationTime(q,c.adaptation.period.mpd,b),r.wallStartTime=a.calcWallTimeForSegment(r,b),r.replacementTime=l||d,r.replacementNumber=f(r,k),h=i(h,"Number",r.replacementNumber),h=i(h,"Time",r.replacementTime),r.media=h,r.mediaRange=j,r.availabilityIdx=k,r}function l(a,b){if(!b||!b.segments)return null;var c=b.segments.length,d=void 0,e=void 0;if(a<c&&(d=b.segments[a])&&d.availabilityIdx===a)return d;for(e=0;e<c;e++)if((d=b.segments[e])&&d.availabilityIdx===a)return d;return null}function m(a,b,c,d,e,f){var g=c.segmentDuration,h=c.adaptation.period.mpd.manifest.minBufferTime,i=c.segmentAvailabilityRange,j={start:a.calcPeriodRelativeTimeFromMpdRelativeTime(c,i?i.start:NaN),end:a.calcPeriodRelativeTimeFromMpdRelativeTime(c,i?i.end:NaN)},k=c.segments,m=2*g,n=f||Math.max(2*h,10*g),o=NaN,p=null,q=void 0,r=void 0;return j.start=Math.max(j.start,0),b&&!a.isTimeSyncCompleted()?(q=Math.floor(j.start/g),r=Math.floor(j.end/g),{start:q,end:r}):(k&&k.length>0?(p=l(e,c),o=p?a.calcPeriodRelativeTimeFromMpdRelativeTime(c,p.presentationStartTime):e>0?e*g:a.calcPeriodRelativeTimeFromMpdRelativeTime(c,d)):o=e>0?e*g:b?j.end:j.start,q=Math.floor(Math.max(o-m,j.start)/g),r=Math.floor(Math.min(q+n/g,j.end/g)),{start:q,end:r})}Object.defineProperty(c,"__esModule",{value:!0}),c.unescapeDollarsInTemplate=g,c.replaceIDForTemplate=h,c.replaceTokenForTemplate=i,c.getIndexBasedSegment=j,c.getTimeBasedSegment=k,c.getSegmentByIndex=l,c.decideSegmentListRangeForTemplate=m;var n=a(88),o=d(n)},{88:88}],78:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(a,c,e,f){var g=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentTemplate,i=a.segmentDuration,j=a.segmentAvailabilityRange,k=[],l=null,m=null,n=void 0,o=void 0,p=void 0,q=void 0,r=void 0;for(r=a.startNumber,n=isNaN(i)&&!b?{start:r,end:r}:(0,h.decideSegmentListRangeForTemplate)(d,b,a,c,e,f),p=n.start,q=n.end,o=p;o<=q;o++)m=(0,h.getIndexBasedSegment)(d,b,a,o),m.replacementTime=(r+o-1)*a.segmentDuration,l=g.media,l=(0,h.replaceTokenForTemplate)(l,"Number",m.replacementNumber),l=(0,h.replaceTokenForTemplate)(l,"Time",m.replacementTime),m.media=l,k.push(m),m=null;return isNaN(i)?a.availableSegmentsNumber=1:a.availableSegmentsNumber=Math.ceil((j.end-j.start)/i),k}var d=a.timelineConverter;return{getSegments:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(77);e.__dashjs_factory_name="TemplateSegmentsGetter";var i=g.default.getClassFactory(e);c.default=i,b.exports=c.default},{48:48,77:77}],79:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){u(),x.on(i.default.TIME_SYNCHRONIZATION_COMPLETED,s,this)}function b(){return z}function c(a){z=a}function d(){return y}function e(a){y=a}function f(){return A}function h(a){A=a}function j(a,b,c,d){return d?c&&b.timeShiftBufferDepth!=Number.POSITIVE_INFINITY?new Date(b.availabilityStartTime.getTime()+1e3*(a+b.timeShiftBufferDepth)):b.availabilityEndTime:c?new Date(b.availabilityStartTime.getTime()+1e3*(a-y)):b.availabilityStartTime}function k(a,b,c){return j.call(this,a,b,c)}function l(a,b,c){return j.call(this,a,b,c,!0)}function m(a,b){return(a.getTime()-b.mpd.availabilityStartTime.getTime()+1e3*y)/1e3}function n(a,b){return a+(b.adaptation.period.start-b.presentationTimeOffset)}function o(a,b){return a-b.adaptation.period.start+b.presentationTimeOffset}function p(a,b){var c=void 0,d=void 0,e=void 0;return b&&(c=a.representation.adaptation.period.mpd.suggestedPresentationDelay,d=a.presentationStartTime+c,e=new Date(a.availabilityStartTime.getTime()+1e3*d)),e}function q(a,b){var c=a.adaptation.period,d={start:c.start,end:c.start+c.duration};if(!b)return d;if(!z&&a.segmentAvailabilityRange)return a.segmentAvailabilityRange;var e=a.segmentDuration||(a.segments&&a.segments.length?a.segments[a.segments.length-1].duration:0),f=m(new Date,c),g=c.start+c.duration;d.start=Math.max(f-c.mpd.timeShiftBufferDepth,c.start);var h=void 0!==a.availabilityTimeOffset&&a.availabilityTimeOffset<e?e-a.availabilityTimeOffset:e;return d.end=f>=g&&f-h<g?g:f-h,d}function r(a,b){return b-a.adaptation.period.start}function s(a){z||void 0!==a.offset&&(e(a.offset/1e3),z=!0)}function t(a){var b=a.presentationTimeOffset;return a.adaptation.period.start-b}function u(){y=0,z=!1,A=NaN}function v(){x.off(i.default.TIME_SYNCHRONIZATION_COMPLETED,s,this),u()}var w=this.context,x=(0,g.default)(w).getInstance(),y=void 0,z=void 0,A=void 0;return{initialize:a,isTimeSyncCompleted:b,setTimeSyncCompleted:c,getClientTimeOffset:d,setClientTimeOffset:e,getExpectedLiveEdge:f,setExpectedLiveEdge:h,calcAvailabilityStartTimeFromPresentationTime:k,calcAvailabilityEndTimeFromPresentationTime:l,calcPresentationTimeFromWallTime:m,calcPresentationTimeFromMediaTime:n,calcPeriodRelativeTimeFromMpdRelativeTime:r,calcMediaTimeFromPresentationTime:o,calcSegmentAvailabilityRange:q,calcWallTimeForSegment:p,calcMSETimeOffset:t,reset:v}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(47),g=d(f),h=a(53),i=d(h),j=a(48),k=d(j);e.__dashjs_factory_name="TimelineConverter",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{47:47,48:48,53:53}],80:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(){if(!e||!e.hasOwnProperty("calcMediaTimeFromPresentationTime")||!e.hasOwnProperty("calcSegmentAvailabilityRange"))throw new Error(i.default.MISSING_CONFIG_ERROR)}function d(a,d,f,g){if(c(),!a)throw new Error("no representation");void 0===d&&(d=null);var h=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentTemplate||a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentList,i=h.SegmentTimeline,k=h.SegmentURL_asArray,l=a.availableSegmentsNumber>0,m=void 0;m=g||(f>-1||null!==d?10:1/0);var n=0,o=0,p=-1,q=[],r=null,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,y=void 0,z=void 0,A=void 0,B=void 0,C=void 0,D=function(c,d){var f=h.media,g=c.mediaRange;return k&&(f=k[d].media||"",g=k[d].mediaRange),(0,j.getTimeBasedSegment)(e,b,a,n,c.d,C,f,g,p,c.tManifest)};for(C=a.timescale,s=i.S_asArray,B=f,null!==d&&(r=e.calcMediaTimeFromPresentationTime(d,a)),u=0,v=s.length;u<v;u++){if(t=s[u],x=0,t.hasOwnProperty("r")&&(x=t.r),t.hasOwnProperty("t")&&(n=t.t,o=n/C),x<0){if((z=s[u+1])&&z.hasOwnProperty("t"))y=z.t/C;else{var E=a.segmentAvailabilityRange?a.segmentAvailabilityRange.end:e.calcSegmentAvailabilityRange(a,b).end;y=e.calcMediaTimeFromPresentationTime(E,a),a.segmentDuration=t.d/C}x=Math.ceil((y-o)/(t.d/C))-1}if(A){if(l)break;p+=x+1}else for(w=0;w<=x;w++)if(p++,q.length>m){if(A=!0,l)break}else null!==r?o>=r-t.d/C*1.5&&q.push(D(t,p)):p>=B&&q.push(D(t,p)),n+=t.d,o=n/C}return l||(a.availableSegmentsNumber=p+1),q}a=a||{};var e=a.timelineConverter;return{getSegments:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(101),i=d(h),j=a(77);e.__dashjs_factory_name="TimelineSegmentsGetter";var k=g.default.getClassFactory(e);c.default=k,b.exports=c.default},{101:101,48:48,77:77}],81:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.period=null,this.index=-1,this.type=null};c.default=e,b.exports=c.default},{}],82:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=1,f=1,g=function a(b,c,g,h){d(this,a),this.url=b||"",this.serviceLocation=c||b||"",this.dvb_priority=g||e,this.dvb_weight=h||f,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0};g.DEFAULT_DVB_PRIORITY=e,g.DEFAULT_DVB_WEIGHT=f,c.default=g,b.exports=c.default},{}],83:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN};c.default=e,b.exports=c.default},{}],84:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.adaptionSet=null, +this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri=""};c.default=e,b.exports=c.default},{}],85:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.minimumUpdatePeriod=NaN,this.mediaPresentationDuration=NaN};c.default=e,b.exports=c.default},{}],86:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null};e.DEFAULT_ID="defaultId",c.default=e,b.exports=c.default},{}],87:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a(60),h=d(g),i=function(){function a(){e(this,a),this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.codecs=null,this.codecPrivateData=null,this.segmentDuration=NaN,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=NaN,this.segmentAvailabilityRange=null,this.availableSegmentsNumber=0,this.bandwidth=NaN,this.width=NaN,this.height=NaN,this.scanType=null,this.maxPlayoutRate=NaN,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0}return f(a,null,[{key:"hasInitialization",value:function(a){return null!==a.initialization||null!==a.range}},{key:"hasSegments",value:function(a){return a.segmentInfoType!==h.default.BASE_URL&&a.segmentInfoType!==h.default.SEGMENT_BASE&&!a.indexRange}}]),a}();c.default=i,b.exports=c.default},{60:60}],88:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.replacementTime=null,this.replacementNumber=NaN,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.availabilityStartTime=NaN,this.availabilityEndTime=NaN,this.availabilityIdx=NaN,this.wallStartTime=NaN,this.representation=null};c.default=e,b.exports=c.default},{}],89:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.schemeIdUri="",this.value=""};c.default=e,b.exports=c.default},{}],90:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){var b=(0,o.default)(h).getInstance();n=(0,g.default)(h).create({errHandler:a.errHandler,metricsModel:a.metricsModel,mediaPlayerModel:a.mediaPlayerModel,requestModifier:a.requestModifier,boxParser:b,useFetch:a.mediaPlayerModel.getLowLatencyEnabled()})}function c(a){var b=function(b){j.trigger(q.default.CHECK_FOR_EXISTENCE_COMPLETED,{request:a,exists:b})};if(a){var c=new i.default(a.url);n.load({request:c,success:function(){b(!0)},error:function(){b(!1)}})}else b(!1)}function d(a){var b=function(b,c){j.trigger(q.default.LOADING_COMPLETED,{request:a,response:b||null,error:c||null,sender:l})};a?n.load({request:a,progress:function(b){j.trigger(q.default.LOADING_PROGRESS,{request:a,stream:b.stream}),b.data&&j.trigger(q.default.LOADING_DATA_PROGRESS,{request:a,response:b.data||null,error:null,sender:l})},success:function(a){b(a)},error:function(a,c,d){b(void 0,new k.default(s.default.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,d,c))},abort:function(a){a&&j.trigger(q.default.LOADING_ABANDONED,{request:a,mediaType:a.mediaType,sender:l})}}):b(void 0,new k.default(s.default.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,s.default.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))}function e(){n&&n.abort()}function f(){n&&(n.abort(),n=null)}a=a||{};var h=this.context,j=(0,m.default)(h).getInstance(),l=void 0,n=void 0;return l={checkForExistence:c,load:d,abort:e,reset:f},b(),l}Object.defineProperty(c,"__esModule",{value:!0});var f=a(148),g=d(f),h=a(218),i=d(h),j=a(215),k=d(j),l=a(47),m=d(l),n=a(197),o=d(n),p=a(53),q=d(p),r=a(50),s=d(r),t=a(48),u=d(t);e.__dashjs_factory_name="FragmentLoader",c.default=u.default.getClassFactory(e),b.exports=c.default},{148:148,197:197,215:215,218:218,47:47,48:48,50:50,53:53}],91:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){p=(0,D.default)(h).getInstance().getLogger(n),j.on(v.default.XLINK_READY,c,n),s=(0,k.default)(h).create({errHandler:z,metricsModel:a.metricsModel,mediaPlayerModel:a.mediaPlayerModel,requestModifier:a.requestModifier}),u=(0,i.default)(h).create({errHandler:z,metricsModel:a.metricsModel,mediaPlayerModel:a.mediaPlayerModel,requestModifier:a.requestModifier}),w=null}function c(a){j.trigger(v.default.INTERNAL_MANIFEST_LOADED,{manifest:a.manifest})}function d(a){var b=null;return a.indexOf("SmoothStreamingMedia")>-1?(y&&(b=y.createMssParser(),y.registerEvents()),b):a.indexOf("MPD")>-1?(0,B.default)(h).create():b}function e(a){var b=new o.default(a,r.HTTPRequest.MPD_TYPE);s.load({request:b,success:function(b,c,e){if(u){var f=void 0,h=void 0,i=void 0;if(e&&e!==a?(h=l.parseBaseUrl(e),f=e):(l.isRelative(a)&&(a=l.resolve(a,window.location.href)),h=l.parseBaseUrl(a)),null===w&&(w=d(b)),null===w)return void j.trigger(v.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new q.default(x.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,x.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+a)});u.setMatchers(w.getMatchers()),u.setIron(w.getIron());try{i=w.parse(b)}catch(k){return void j.trigger(v.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new q.default(x.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,x.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+a)})}i?(i.url=f||a,i.originalUrl||(i.originalUrl=i.url),i.hasOwnProperty(g.default.LOCATION)&&(h=l.parseBaseUrl(i.Location_asArray[0]),p.debug("BaseURI set by Location to: "+h)),i.baseUri=h,i.loadedTime=new Date,u.resolveManifestOnLoad(i)):j.trigger(v.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new q.default(x.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,x.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+a)})}},error:function(b,c,d){j.trigger(v.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new q.default(x.default.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,x.default.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+(a+", ")+d)})}})}function f(){j.off(v.default.XLINK_READY,c,n),u&&(u.reset(),u=null),s&&(s.abort(),s=null),y&&y.reset()}a=a||{};var h=this.context,j=(0,t.default)(h).getInstance(),l=(0,m.default)(h).getInstance(),n=void 0,p=void 0,s=void 0,u=void 0,w=void 0,y=a.mssHandler,z=a.errHandler;return n={load:e,reset:f},b(),n}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(116),i=d(h),j=a(148),k=d(j),l=a(210),m=d(l),n=a(226),o=d(n),p=a(215),q=d(p),r=a(235),s=a(47),t=d(s),u=a(53),v=d(u),w=a(50),x=d(w),y=a(48),z=d(y),A=a(63),B=d(A),C=a(46),D=d(C);e.__dashjs_factory_name="ManifestLoader";var E=z.default.getClassFactory(e);c.default=E,b.exports=c.default},{101:101,116:116,148:148,210:210,215:215,226:226,235:235,46:46,47:47,48:48,50:50,53:53,63:63}],92:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){w=(0,m.default)(t).getInstance().getLogger(v)}function b(a){a&&(a.manifestModel&&(C=a.manifestModel),a.dashManifestModel&&(D=a.dashManifestModel),a.mediaPlayerModel&&(F=a.mediaPlayerModel),a.manifestLoader&&(B=a.manifestLoader),a.errHandler&&(E=a.errHandler))}function c(){e(),u.on(i.default.STREAMS_COMPOSED,s,this),u.on(i.default.PLAYBACK_STARTED,q,this),u.on(i.default.PLAYBACK_PAUSED,r,this),u.on(i.default.INTERNAL_MANIFEST_LOADED,p,this)}function d(a){l(a)}function e(){x=NaN,A=!1,z=!0,h()}function f(){u.off(i.default.PLAYBACK_STARTED,q,this),u.off(i.default.PLAYBACK_PAUSED,r,this),u.off(i.default.STREAMS_COMPOSED,s,this),u.off(i.default.INTERNAL_MANIFEST_LOADED,p,this),e()}function h(){null!==y&&(clearInterval(y),y=null)}function j(a){h(),isNaN(a)&&!isNaN(x)&&(a=1e3*x),isNaN(a)||(w.debug("Refresh manifest in "+a+" milliseconds."),y=setTimeout(n,a))}function k(){A=!0;var a=C.getValue(),b=a.url,c=D.getLocation(a);c&&(b=c),B.load(b)}function l(a){C.setValue(a);var b=new Date,c=(b.getTime()-a.loadedTime.getTime())/1e3;x=D.getManifestUpdatePeriod(a,c),1e3*x>2147483647&&(x=2147483.647),u.trigger(i.default.MANIFEST_UPDATED,{manifest:a}),w.info("Manifest has been refreshed at "+b+"["+b.getTime()/1e3+"] "),z||j()}function n(){if(!z||F.getScheduleWhilePaused())return A?void j(F.getManifestUpdateRetryInterval()):void k()}function p(a){a.error?a.error.code===o.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&E.error(a.error):l(a.manifest)}function q(){z=!1,j()}function r(){z=!0,h()}function s(){A=!1}var t=this.context,u=(0,g.default)(t).getInstance(),v=void 0,w=void 0,x=void 0,y=void 0,z=void 0,A=void 0,B=void 0,C=void 0,D=void 0,E=void 0,F=void 0;return v={initialize:c,setManifest:d,refreshManifest:k,setConfig:b,reset:f},a(),v}Object.defineProperty(c,"__esModule",{value:!0});var f=a(47),g=d(f),h=a(53),i=d(h),j=a(48),k=d(j),l=a(46),m=d(l),n=a(50),o=d(n);e.__dashjs_factory_name="ManifestUpdater",c.default=k.default.getClassFactory(e),b.exports=c.default},{46:46,47:47,48:48,50:50,53:53}],93:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){Wc=Uc.getLogger(Vc),Zc=!1,_c=!1,$c=!1,ad=!0,ed=null,Yc=null,hd=null,Y.default.extend($.default),jd=(0,I.default)(Sc).getInstance(),rd=(0,O.default)(Sc).getInstance(),td=(0,E.default)(Sc).getInstance()}function b(a){a&&(a.capabilities&&(ld=a.capabilities),a.streamController&&(md=a.streamController),a.playbackController&&(nd=a.playbackController),a.mediaPlayerModel&&(jd=a.mediaPlayerModel),a.abrController&&(bd=a.abrController),a.mediaController&&(dd=a.mediaController))}function c(a,b,c){if(ld||(ld=(0,w.default)(Sc).getInstance()),kd=(0,u.default)(Sc).getInstance(),!ld.supportsMediaSource())return kd.capabilityError("mediasource"),void kd.error(new qa.default(U.default.CAPABILITY_MEDIASOURCE_ERROR_CODE,U.default.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE));Zc||(Zc=!0,cd=(0,ja.default)(Sc).getInstance(),bd||(bd=(0,M.default)(Sc).getInstance()),nd||(nd=(0,k.default)(Sc).getInstance()),dd||(dd=(0,o.default)(Sc).getInstance()),hd=(0,da.default)(Sc).getInstance(),pd=(0,fa.default)(Sc).getInstance({mediaController:dd,timelineConverter:cd,adapter:hd,errHandler:kd}),qd=(0,G.default)(Sc).getInstance(),od=(0,ha.default)(Sc).getInstance({manifestModel:qd,dashManifestModel:pd}),id=(0,K.default)(Sc).getInstance(),sd=(0,C.default)(Sc).getInstance(),ud=(0,Q.default)(Sc).getInstance({mediaPlayerModel:jd}),hd.setConfig({dashManifestModel:pd}),id.setConfig({adapter:hd}),kb(),Ma(void 0===c||c),a&&bc(a),b&&xc(b),Wc.info("[dash.js "+j()+"] MediaPlayer has been initialized"))}function d(){xc(null),bc(null),Yc=null,ed&&(ed.reset(),ed=null),fd&&(fd.reset(),fd=null)}function e(){return!!Xc&&!!rd.getElement()}function f(a,b,c){Tc.on(a,b,c)}function h(a,b,c){Tc.off(a,b,c)}function j(){return(0,ba.getVersionString)()}function l(){return Uc}function n(){if(rd.getElement()||$c)return!1;if(!Xc)throw Oc;Kc()}function p(){if(!_c)throw Mc;(!ad||t()&&_c)&&nd.play()}function r(){if(!_c)throw Mc;nd.pause()}function t(){if(!_c)throw Mc;return nd.isPaused()}function v(a){if(!_c)throw Mc;if((0,ra.checkParameterType)(a,"number"),isNaN(a))throw g.default.BAD_ARGUMENT_ERROR;var b=nd.getIsDynamic()?ca(a):a;nd.seek(b)}function x(){if(!_c)throw Mc;return nd.isSeeking()}function z(){if(!_c)throw Mc;return nd.getIsDynamic()}function B(a){$b().playbackRate=a}function D(){return $b().playbackRate}function F(a){jd.setCatchUpPlaybackRate(a)}function H(){return jd.getCatchUpPlaybackRate()}function J(a){if("number"!=typeof a||isNaN(a)||a<0||a>.5)throw Qc;jd.setLowLatencyMinDrift(a)}function L(){return jd.getLowLatencyMinDrift()}function N(a){if("number"!=typeof a||isNaN(a)||a<0)throw Rc;jd.setLowLatencyMaxDriftBeforeSeeking(a)}function P(){return jd.getLowLatencyMaxDriftBeforeSeeking()}function R(a){(0,ra.checkParameterType)(a,"boolean"),$b().muted=a}function T(){return $b().muted}function V(a){if("number"!=typeof a||isNaN(a)||a<0||a>1)throw g.default.BAD_ARGUMENT_ERROR;$b().volume=a}function X(){return $b().volume}function Z(a){var b=[g.default.VIDEO,g.default.AUDIO,g.default.FRAGMENTED_TEXT];if(a){if(-1!==b.indexOf(a)){var c=Ob().getCurrentBufferLevel(Pb(a));return c||NaN}return Wc.warn("getBufferLength requested for invalid type"),NaN}var c=b.map(function(a){return gc(a).length>0?Ob().getCurrentBufferLevel(Pb(a)):Number.MAX_VALUE}).reduce(function(a,b){return Math.min(a,b)});return c===Number.MAX_VALUE?NaN:c}function _(){var a=Ic();return a?a.manifestInfo.DVRWindowSize:0}function ca(a){var b=Ic();if(!b)return 0;var c=nd.getLiveDelay(),d=b.range.start+a;return d>b.range.end-c&&(d=b.range.end-c),d}function ea(a){if(!_c)throw Mc;var b=$b().currentTime;if(void 0!==a)b=md.getTimeRelativeToStreamId(b,a);else if(nd.getIsDynamic()){var c=Ic();b=null===c?0:ga()-(c.range.end-c.time)}return b}function ga(){if(!_c)throw Mc;var a=$b().duration;if(nd.getIsDynamic()){var b=Ic(),c=void 0;if(!b)return 0;c=b.range.end-b.range.start,a=c<b.manifestInfo.DVRWindowSize?c:b.manifestInfo.DVRWindowSize}return a}function ia(){if(!_c)throw Mc;return ea()<0?NaN:Jc(ea())}function la(){if(!_c)throw Mc;return Jc(ga())}function na(a,b){bd.setMaxAllowedBitrateFor(a,b)}function pa(a,b){bd.setMinAllowedBitrateFor(a,b)}function sa(a){return bd.getMaxAllowedBitrateFor(a)}function ta(a){if(!$c)throw Lc;return bd.getTopBitrateInfoFor(a)}function ua(a){return bd.getMinAllowedBitrateFor(a)}function va(a,b){bd.setMaxAllowedRepresentationRatioFor(a,b)}function wa(a){return bd.getMaxAllowedRepresentationRatioFor(a)}function xa(a){if(!$c)throw Lc;if(a===g.default.IMAGE){var b=Bc();if(!b)return-1;var c=b.getThumbnailController();return c?c.getCurrentTrackIndex():-1}return bd.getQualityFor(a,md.getActiveStreamInfo())}function ya(a,b){if(!$c)throw Lc;if(a===g.default.IMAGE){var c=Bc();if(!c)return;var d=c.getThumbnailController();d&&d.setTrackByIndex(b)}bd.setPlaybackQuality(a,md.getActiveStreamInfo(),b)}function za(){bd.setElementSize(),bd.setWindowResizeEventCalled(!0)}function Aa(){return bd.getLimitBitrateByPortal()}function Ba(a){bd.setLimitBitrateByPortal(a)}function Ca(){return bd.getUsePixelRatioInLimitBitrateByPortal()}function Da(a){bd.setUsePixelRatioInLimitBitrateByPortal(a)}function Ea(a,b){bd.setInitialBitrateFor(a,b)}function Fa(a){if(!$c)throw Lc;return bd.getInitialBitrateFor(a)}function Ga(a,b){bd.setInitialRepresentationRatioFor(a,b)}function Ha(a){return bd.getInitialRepresentationRatioFor(a)}function Ia(a){return bd.getAutoSwitchBitrateFor(a)}function Ja(a,b){bd.setAutoSwitchBitrateFor(a,b)}function Ka(){return bd.getUseDeadTimeLatency()}function La(a){bd.setUseDeadTimeLatency(a)}function Ma(a){(0,ra.checkParameterType)(a,"boolean"),ad=a}function Na(){return ad}function Oa(a){jd.setLiveDelayFragmentCount(a)}function Pa(a){jd.setLiveDelay(a)}function Qa(){return jd.getLiveDelay()}function Ra(){if(!Zc)throw Pc;return _c?nd.getCurrentLiveLatency():NaN}function Sa(a){jd.setUseSuggestedPresentationDelay(a)}function Ta(a,b){jd.setLastBitrateCachingInfo(a,b)}function Ua(a,b){jd.setLastMediaSettingsCachingInfo(a,b)}function Va(a){jd.setScheduleWhilePaused(a)}function Wa(){return jd.getScheduleWhilePaused()}function Xa(a){jd.setFastSwitchEnabled(a)}function Ya(){return jd.getFastSwitchEnabled()}function Za(a){jd.setABRStrategy(a)}function $a(){return jd.getABRStrategy()}function _a(a){jd.setUseDefaultABRRules(a)}function ab(a,b,c){jd.addABRCustomRule(a,b,c)}function bb(a){jd.removeABRCustomRule(a)}function cb(){jd.removeABRCustomRule()}function db(a){jd.setMovingAverageMethod(a)}function eb(){return jd.getMovingAverageMethod()}function fb(){return jd.getLowLatencyEnabled()}function gb(a){jd.setLowLatencyEnabled(a)}function hb(a,b){jd.addUTCTimingSource(a,b)}function ib(a,b){jd.removeUTCTimingSource(a,b)}function jb(){jd.clearDefaultUTCTimingSources()}function kb(){jd.restoreDefaultUTCTimingSources()}function lb(a){jd.setUseManifestDateHeaderTimeSource(a)}function mb(a){jd.setBufferToKeep(a)}function nb(a){jd.setBufferAheadToKeep(a)}function ob(a){jd.setBufferPruningInterval(a)}function pb(a){jd.setStableBufferTime(a)}function qb(){return jd.getStableBufferTime()}function rb(a){jd.setBufferTimeAtTopQuality(a)}function sb(){return jd.getBufferTimeAtTopQuality()}function tb(a){jd.setBufferTimeAtTopQualityLongForm(a)}function ub(){return jd.getBufferTimeAtTopQualityLongForm()}function vb(a){jd.setLongFormContentDurationThreshold(a)}function wb(a){jd.setSegmentOverlapToleranceTime(a)}function xb(a,b){jd.setCacheLoadThresholdForType(a,b)}function yb(a){jd.setBandwidthSafetyFactor(a)}function zb(){return jd.getBandwidthSafetyFactor()}function Ab(a){var b=bd.getThroughputHistory();return b?b.getAverageThroughput(a):0}function Bb(a){jd.setAbandonLoadTimeout(a)}function Cb(a){jd.setRetryAttemptsForType(ka.HTTPRequest.MEDIA_SEGMENT_TYPE,a)}function Db(a){jd.setRetryIntervalForType(ka.HTTPRequest.MEDIA_SEGMENT_TYPE,a)}function Eb(a){jd.setRetryAttemptsForType(ka.HTTPRequest.MPD_TYPE,a)}function Fb(a){jd.setRetryIntervalForType(ka.HTTPRequest.MPD_TYPE,a)}function Gb(a,b){jd.setXHRWithCredentialsForType(a,b)}function Hb(a){return jd.getXHRWithCredentialsForType(a)}function Ib(a){jd.setJumpGaps(a)}function Jb(){return jd.getJumpGaps()}function Kb(a){jd.setSmallGapLimit(a)}function Lb(){return jd.getSmallGapLimit()}function Mb(a){jd.setManifestUpdateRetryInterval(a)}function Nb(){return jd.getManifestUpdateRetryInterval()}function Ob(){return od}function Pb(a){return id.getReadOnlyMetricsFor(a)}function Qb(a){void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.setTextDefaultLanguage(a)}function Rb(){return void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.getTextDefaultLanguage()}function Sb(a){void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.setTextDefaultEnabled(a)}function Tb(){return void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.getTextDefaultEnabled()}function Ub(a){void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.enableText(a)}function Vb(a){void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.enableForcedTextStreaming(a)}function Wb(){return void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.isTextEnabled()}function Xb(a){if(!_c)throw Mc;void 0===sd&&(sd=(0,C.default)(Sc).getInstance()),sd.setTextTrack(a)}function Yb(){var a=NaN;return sd&&(a=sd.getCurrentTrackIdx()),a}function Zb(a){var b=(0,y.default)(Sc).getInstance();b.setConfig({videoModel:rd}),b.initialize(),b.displayCConTop(a)}function $b(){if(!rd.getElement())throw Nc;return rd.getElement()}function _b(){return rd?rd.getVideoContainer():null}function ac(a){if(!rd.getElement())throw Nc;rd.setVideoContainer(a)}function bc(a){if(!Zc)throw Pc;rd.setElement(a),a&&(Fc(),Gc(),Hc(),md&&md.switchToVideoElement()),_c&&Cc(),Kc()}function cc(){return rd?rd.getTTMLRenderingDiv():null}function dc(a){if(!rd.getElement())throw Nc;rd.setTTMLRenderingDiv(a)}function ec(a){if(!$c)throw Lc;var b=Bc();return b?b.getBitrateListFor(a):[]}function fc(a){if(!$c)throw Lc;return hd.getStreamsInfo(a)}function gc(a){if(!$c)throw Lc;var b=md.getActiveStreamInfo();return dd.getTracksFor(a,b)}function hc(a,b,c){if(!$c)throw Lc;return c=c||hd.getStreamsInfo(b,1)[0],c?hd.getAllMediaInfoForType(c,a,b):[]}function ic(a){if(!$c)throw Lc;var b=md.getActiveStreamInfo();return dd.getCurrentTrackFor(a,b)}function jc(a,b){if(!Zc)throw Pc;dd.setInitialSettings(a,b)}function kc(a){if(!Zc)throw Pc;return dd.getInitialSettings(a)}function lc(a){if(!$c)throw Lc;dd.setTrack(a)}function mc(a){if(!Zc)throw Pc;return dd.getSwitchMode(a)}function nc(a,b){if(!Zc)throw Pc;dd.setSwitchMode(a,b)}function oc(a){if(!Zc)throw Pc;dd.setSelectionModeForInitialTrack(a)}function pc(){if(!Zc)throw Pc;return dd.getSelectionModeForInitialTrack()}function qc(){return Fc()}function rc(a){ed=a}function sc(a){Yc=a,md&&md.setProtectionData(Yc)}function tc(a,b){if(a<0)return null;var c=nd.getIsDynamic()?ca(a):a,d=md.getStreamForTime(c);if(null===d)return null;var e=d.getThumbnailController();if(!e)return null;var f=md.getTimeRelativeToStreamId(c,d.getId());return e.get(f,b)}function uc(a){jd.setKeepProtectionMediaKeys(a)}function vc(a,b){var c=Ec(),d=this,e=function a(e){e.error?b(null,e.error):b(e.manifest),Tc.off(Y.default.INTERNAL_MANIFEST_LOADED,a,d),c.reset()};Tc.on(Y.default.INTERNAL_MANIFEST_LOADED,e,d),td.initialize(a),c.load(a)}function wc(){if(!Xc)throw Oc;return Xc}function xc(a){if(!Zc)throw Pc;"string"==typeof a&&td.initialize(a),Xc=a,($c||_c)&&Cc(),e()&&Kc()}function yc(a,b,c){var d=!(arguments.length<=3||void 0===arguments[3])&&arguments[3],e=new Date(1e3*a),f=e.toLocaleDateString(b),g=e.toLocaleTimeString(b,{hour12:c});return d?g+" "+f:g}function zc(a){a=Math.max(a,0);var b=Math.floor(a/3600),c=Math.floor(a%3600/60),d=Math.floor(a%3600%60);return(0===b?"":b<10?"0"+b.toString()+":":b.toString()+":")+(c<10?"0"+c.toString():c.toString())+":"+(d<10?"0"+d.toString():d.toString())}function Ac(a,b,c){aa.default.extend(a,b,c,Sc)}function Bc(){if(!$c)throw Lc;var a=md.getActiveStreamInfo();return a?md.getStreamById(a.id):null}function Cc(){_c=!1,$c=!1,hd.reset(),md.reset(),nd.reset(),bd.reset(),dd.reset(),sd.reset(),ed&&(jd.getKeepProtectionMediaKeys()?ed.stop():(ed.reset(),ed=null,Fc()))}function Dc(){var a=Ec();md||(md=(0,m.default)(Sc).getInstance()),dd.setConfig({domStorage:ud}),md.setConfig({capabilities:ld,manifestLoader:a,manifestModel:qd,dashManifestModel:pd,mediaPlayerModel:jd,protectionController:ed,adapter:hd,metricsModel:id,dashMetrics:od,errHandler:kd,timelineConverter:cd,videoModel:rd,playbackController:nd,domStorage:ud,abrController:bd,mediaController:dd,textController:sd}),nd.setConfig({streamController:md,metricsModel:id,dashMetrics:od,manifestModel:qd,mediaPlayerModel:jd,dashManifestModel:pd,adapter:hd,videoModel:rd,timelineConverter:cd,uriFragmentModel:td}),bd.setConfig({streamController:md,domStorage:ud,mediaPlayerModel:jd,metricsModel:id,dashMetrics:od,dashManifestModel:pd,manifestModel:qd,videoModel:rd,adapter:hd}),bd.createAbrRulesCollection(),sd.setConfig({errHandler:kd,manifestModel:qd,dashManifestModel:pd,mediaController:dd,streamController:md,videoModel:rd}),md.initialize(ad,Yc)}function Ec(){return(0,s.default)(Sc).create({errHandler:kd,metricsModel:id,mediaPlayerModel:jd,requestModifier:(0,A.default)(Sc).getInstance(),mssHandler:gd})}function Fc(){if(ed)return ed;var a=dashjs.Protection;if("function"==typeof a){var b=a(Sc).create();return Y.default.extend(a.events),$.default.extend(a.events,{publicOnly:!0}),U.default.extend(a.errors),ld||(ld=(0,w.default)(Sc).getInstance()),ed=b.createProtectionSystem({debug:Uc,errHandler:kd,videoModel:rd,capabilities:ld,eventBus:Tc,events:Y.default,BASE64:ma.default,constants:g.default})}return null}function Gc(){if(!fd){var a=dashjs.MetricsReporting;if("function"==typeof a){var b=a(Sc).create();fd=b.createMetricsReporting({debug:Uc,eventBus:Tc,mediaElement:$b(),dashManifestModel:pd,metricsModel:id,events:Y.default,constants:g.default,metricsConstants:i.default})}}}function Hc(){if(!gd){var a=dashjs.MssHandler;"function"==typeof a&&(U.default.extend(a.errors),gd=a(Sc).create({eventBus:Tc,mediaPlayerModel:jd,metricsModel:id,playbackController:nd,protectionController:ed,baseURLController:(0,q.default)(Sc).getInstance(),errHandler:kd,events:Y.default,constants:g.default,debug:Uc,initSegmentType:ka.HTTPRequest.INIT_SEGMENT_TYPE,BASE64:ma.default,ISOBoxer:oa.default}))}}function Ic(){var a=id.getReadOnlyMetricsFor(g.default.VIDEO)||id.getReadOnlyMetricsFor(g.default.AUDIO);return od.getCurrentDVRInfo(a)}function Jc(a){var b=Ic(),c=void 0;return b?(c=b.manifestInfo.availableFrom.getTime()/1e3,a+(c+b.range.start)):0}function Kc(){!$c&&Xc&&($c=!0,Wc.info("Streaming Initialized"),Dc(),"string"==typeof Xc?md.load(Xc):md.loadWithManifest(Xc)),!_c&&e()&&(_c=!0,Wc.info("Playback Initialized"))}var Lc="You must first call initialize() and set a source before calling this method",Mc="You must first call initialize() and set a valid source and view before calling this method",Nc="You must first call attachView() to set the video element before calling this method",Oc="You must first call attachSource() with a valid source before calling this method",Pc="MediaPlayer not initialized!",Qc="Playback minimum drift has an invalid value! Use a number from 0 to 0.5",Rc="Playback maximum drift has an invalid value! Use a number greater or equal to 0",Sc=this.context,Tc=(0,W.default)(Sc).getInstance(),Uc=(0,S.default)(Sc).getInstance(),Vc=void 0,Wc=void 0,Xc=void 0,Yc=void 0,Zc=void 0,$c=void 0,_c=void 0,ad=void 0,bd=void 0,cd=void 0,dd=void 0,ed=void 0,fd=void 0,gd=void 0,hd=void 0,id=void 0,jd=void 0,kd=void 0,ld=void 0,md=void 0,nd=void 0,od=void 0,pd=void 0,qd=void 0,rd=void 0,sd=void 0,td=void 0,ud=void 0;return Vc={initialize:c,setConfig:b,on:f,off:h,extend:Ac,attachView:bc,attachSource:xc,isReady:e,preload:n,play:p,isPaused:t,pause:r,isSeeking:x,isDynamic:z,seek:v,setPlaybackRate:B,getPlaybackRate:D,setMute:R,isMuted:T,setVolume:V,getVolume:X,time:ea,duration:ga,timeAsUTC:ia,durationAsUTC:la,getActiveStream:Bc,getDVRWindowSize:_,getDVRSeekOffset:ca,convertToTimeCode:zc,formatUTC:yc,getVersion:j,getDebug:l,getBufferLength:Z,getVideoContainer:_b,getTTMLRenderingDiv:cc,getVideoElement:$b,getSource:wc,setLiveDelayFragmentCount:Oa,setLiveDelay:Pa,getLiveDelay:Qa,getCurrentLiveLatency:Ra,useSuggestedPresentationDelay:Sa,enableLastBitrateCaching:Ta,enableLastMediaSettingsCaching:Ua,setMaxAllowedBitrateFor:na,getMaxAllowedBitrateFor:sa,getTopBitrateInfoFor:ta,setMinAllowedBitrateFor:pa,getMinAllowedBitrateFor:ua,setMaxAllowedRepresentationRatioFor:va,getMaxAllowedRepresentationRatioFor:wa,setAutoPlay:Ma,getAutoPlay:Na,setScheduleWhilePaused:Va,getScheduleWhilePaused:Wa,getDashMetrics:Ob,getMetricsFor:Pb,getQualityFor:xa,setQualityFor:ya,updatePortalSize:za,getLimitBitrateByPortal:Aa,setLimitBitrateByPortal:Ba,getUsePixelRatioInLimitBitrateByPortal:Ca,setUsePixelRatioInLimitBitrateByPortal:Da,setTextDefaultLanguage:Qb,getTextDefaultLanguage:Rb,setTextDefaultEnabled:Sb,getTextDefaultEnabled:Tb,enableText:Ub,enableForcedTextStreaming:Vb,isTextEnabled:Wb,setTextTrack:Xb,getBitrateInfoListFor:ec,setInitialBitrateFor:Ea,getInitialBitrateFor:Fa,setInitialRepresentationRatioFor:Ga,getInitialRepresentationRatioFor:Ha,getStreamsFromManifest:fc,getTracksFor:gc,getTracksForTypeFromManifest:hc,getCurrentTrackFor:ic,setInitialMediaSettingsFor:jc,getInitialMediaSettingsFor:kc,setCurrentTrack:lc,getTrackSwitchModeFor:mc,setTrackSwitchModeFor:nc,setSelectionModeForInitialTrack:oc,getSelectionModeForInitialTrack:pc,setFastSwitchEnabled:Xa,getFastSwitchEnabled:Ya,setMovingAverageMethod:db,getMovingAverageMethod:eb,getAutoSwitchQualityFor:Ia,setAutoSwitchQualityFor:Ja,setABRStrategy:Za,getABRStrategy:$a,useDefaultABRRules:_a,addABRCustomRule:ab,removeABRCustomRule:bb,removeAllABRCustomRule:cb,setBandwidthSafetyFactor:yb,getBandwidthSafetyFactor:zb,getAverageThroughput:Ab,setAbandonLoadTimeout:Bb,retrieveManifest:vc,addUTCTimingSource:hb,removeUTCTimingSource:ib,clearDefaultUTCTimingSources:jb,restoreDefaultUTCTimingSources:kb,setBufferToKeep:mb,setBufferAheadToKeep:nb,setBufferPruningInterval:ob,setStableBufferTime:pb,getStableBufferTime:qb,setBufferTimeAtTopQuality:rb,getBufferTimeAtTopQuality:sb,setBufferTimeAtTopQualityLongForm:tb,getBufferTimeAtTopQualityLongForm:ub,setFragmentLoaderRetryAttempts:Cb,setFragmentLoaderRetryInterval:Db,setManifestLoaderRetryAttempts:Eb,setManifestLoaderRetryInterval:Fb,setXHRWithCredentialsForType:Gb,getXHRWithCredentialsForType:Hb,setJumpGaps:Ib,getJumpGaps:Jb,setSmallGapLimit:Kb,getSmallGapLimit:Lb,setLowLatencyEnabled:gb,getLowLatencyEnabled:fb,setCatchUpPlaybackRate:F,getCatchUpPlaybackRate:H,setLowLatencyMinDrift:J,getLowLatencyMinDrift:L,setLowLatencyMaxDriftBeforeSeeking:N,getLowLatencyMaxDriftBeforeSeeking:P,setManifestUpdateRetryInterval:Mb,getManifestUpdateRetryInterval:Nb,setLongFormContentDurationThreshold:vb,setSegmentOverlapToleranceTime:wb,setCacheLoadThresholdForType:xb,getProtectionController:qc,attachProtectionController:rc,setProtectionData:sc,enableManifestDateHeaderTimeSource:lb,displayCaptionsOnTop:Zb,attachVideoContainer:ac,attachTTMLRenderingDiv:dc,getCurrentTextTrackIndex:Yb,getUseDeadTimeLatencyForAbr:Ka,setUseDeadTimeLatencyForAbr:La,getThumbnail:tc,keepProtectionMediaKeys:uc,reset:d},a(),Vc}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(102),i=d(h),j=a(112),k=d(j),l=a(114),m=d(l),n=a(110),o=d(n),p=a(105),q=d(p),r=a(91),s=d(r),t=a(202),u=d(t),v=a(198),w=d(v),x=a(193),y=d(x),z=a(207),A=d(z),B=a(191),C=d(B),D=a(145),E=d(D),F=a(142),G=d(F),H=a(143),I=d(H),J=a(144),K=d(J),L=a(104),M=d(L),N=a(146),O=d(N),P=a(200),Q=d(P),R=a(46),S=d(R),T=a(50),U=d(T),V=a(47),W=d(V),X=a(53),Y=d(X),Z=a(94),$=d(Z),_=a(48),aa=d(_),ba=a(49),ca=a(55),da=d(ca),ea=a(62),fa=d(ea),ga=a(57),ha=d(ga),ia=a(79),ja=d(ia),ka=a(235),la=a(1),ma=d(la),na=a(6),oa=d(na),pa=a(215),qa=d(pa),ra=a(208);e.__dashjs_factory_name="MediaPlayer";var sa=aa.default.getClassFactory(e);sa.events=$.default,sa.errors=U.default,aa.default.updateClassFactory(e.__dashjs_factory_name,sa),c.default=sa,b.exports=c.default},{1:1,101:101,102:102,104:104,105:105,110:110,112:112,114:114,142:142,143:143,144:144,145:145,146:146,191:191,193:193,198:198,200:200,202:202,207:207,208:208,215:215,235:235,46:46,47:47,48:48,49:49,50:50,53:53,55:55,57:57,6:6,62:62,79:79,91:91,94:94}],94:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(54),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.AST_IN_FUTURE="astInFuture",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_LOADED="bufferLoaded",this.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",this.ERROR="error",this.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",this.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",this.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",this.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",this.LOG="log",this.MANIFEST_LOADED="manifestLoaded",this.METRICS_CHANGED="metricsChanged",this.METRIC_CHANGED="metricChanged",this.METRIC_ADDED="metricAdded",this.METRIC_UPDATED="metricUpdated", +this.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",this.PERIOD_SWITCH_STARTED="periodSwitchStarted",this.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",this.QUALITY_CHANGE_RENDERED="qualityChangeRendered",this.TRACK_CHANGE_RENDERED="trackChangeRendered",this.SOURCE_INITIALIZED="sourceInitialized",this.STREAM_INITIALIZED="streamInitialized",this.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",this.TEXT_TRACKS_ADDED="allTextTracksAdded",this.TEXT_TRACK_ADDED="textTrackAdded",this.TTML_PARSED="ttmlParsed",this.TTML_TO_PARSE="ttmlToParse",this.CAPTION_RENDERED="captionRendered",this.CAPTION_CONTAINER_RESIZE="captionContainerResize",this.CAN_PLAY="canPlay",this.PLAYBACK_ENDED="playbackEnded",this.PLAYBACK_ERROR="playbackError",this.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",this.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",this.PLAYBACK_PAUSED="playbackPaused",this.PLAYBACK_PLAYING="playbackPlaying",this.PLAYBACK_PROGRESS="playbackProgress",this.PLAYBACK_RATE_CHANGED="playbackRateChanged",this.PLAYBACK_SEEKED="playbackSeeked",this.PLAYBACK_SEEKING="playbackSeeking",this.PLAYBACK_SEEK_ASKED="playbackSeekAsked",this.PLAYBACK_STALLED="playbackStalled",this.PLAYBACK_STARTED="playbackStarted",this.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",this.PLAYBACK_WAITING="playbackWaiting",this.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{54:54}],95:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b,c){if(!a||!/^VIDEO$/i.test(a.nodeName))return null;if(a._dashjs_player)return a._dashjs_player;var f=void 0,g=a.id||a.name||"video element";if(!(b=b||[].slice.call(a.querySelectorAll("source")).filter(function(a){return a.type==d})[0])&&a.src)b=document.createElement("source"),b.src=a.src;else if(!b&&!a.src)return null;return c=c||{},f=(0,i.default)(c).create(),f.initialize(a,b.src,a.autoplay),e||(e=f.getDebug().getLogger()),e.debug("Converted "+g+" to dash.js player and added content: "+b.src),a._dashjs_player=f,f}function b(b,e){var f=[];b=b||"[data-dashjs-player]",e=e||document;for(var g=e.querySelectorAll(b),h=0;h<g.length;h++){var i=a(g[h],null);f.push(i)}for(var j=e.querySelectorAll('source[type="'+d+'"]'),h=0;h<j.length;h++){var k=c(j[h]),i=a(k,null);f.push(i)}return f}function c(a){for(var b=!0;b;){var c=a;if(b=!1,/^VIDEO$/i.test(c.nodeName))return c;a=c.parentNode,b=!0}}var d="application/dash+xml",e=void 0;return{create:a,createAll:b}}function f(){window.removeEventListener("load",f),j.createAll()}function g(){window.dashjs&&(window.clearInterval(k),j.createAll())}Object.defineProperty(c,"__esModule",{value:!0});var h=a(93),i=d(h),j=e(),k=void 0;!("undefined"!=typeof window&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&"undefined"!=typeof window&&window&&window.addEventListener&&("complete"===window.document.readyState?window.dashjs?j.createAll():k=window.setInterval(g,500):window.addEventListener("load",f)),c.default=j,b.exports=c.default},{93:93}],96:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){n=(0,g.default)(l).getInstance().getLogger(m)}function c(){p=[],o=null,q=null}function d(a){"InitializationSegment"!==a.segmentType?(p.push(a),p.sort(function(a,b){return a.start-b.start}),o=null):o=a,n.debug("PreBufferSink appended chunk s: "+a.start+"; e: "+a.end),q&&q({chunk:a})}function e(a,b){p=p.filter(function(c){return!((isNaN(b)||c.start<b)&&(isNaN(a)||c.end>a))})}function f(){}function h(){for(var a=[],b=0;b<p.length;b++){var c=p[b];0===a.length||c.start>a[a.length-1].end?a.push({start:c.start,end:c.end}):a[a.length-1].end=c.end}var d={start:function(b){return a[b].start},end:function(b){return a[b].end}};return Object.defineProperty(d,"length",{get:function(){return a.length}}),d}function i(){}function j(a,b){var c=k(a,b);return o&&(c.push(o),o=null),e(a,b),c}function k(a,b){return p.filter(function(c){return(isNaN(b)||c.start<b)&&(isNaN(a)||c.end>a)})}var l=this.context,m=void 0,n=void 0,o=void 0,p=[],q=a;return m={getAllBufferRanges:h,append:d,remove:e,abort:f,discharge:j,reset:c,updateTimestampOffset:i},b(),m}Object.defineProperty(c,"__esModule",{value:!0});var f=a(46),g=d(f),h=a(48),i=d(h);e.__dashjs_factory_name="PreBufferSink";var j=i.default.getClassFactory(e);c.default=j,b.exports=c.default},{46:46,48:48}],97:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c,d){function e(){D=(0,g.default)(A).getInstance().getLogger(C),F=!1;var c=b.codec;try{if(c.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))throw new Error("not really supported");E=d||a.addSourceBuffer(c);var e=50;if("function"==typeof E.addEventListener)try{E.addEventListener("updateend",x,!1),E.addEventListener("error",y,!1),E.addEventListener("abort",y,!1)}catch(h){G=setInterval(w,e)}else G=setInterval(w,e)}catch(i){if(!b.isText&&-1===c.indexOf('codecs="stpp')&&-1===c.indexOf('codecs="wvtt'))throw i;var f=(0,q.default)(A).getInstance();E=f.getTextSourceBuffer()}}function f(b){if(E){if("function"==typeof E.removeEventListener&&(E.removeEventListener("updateend",x,!1),E.removeEventListener("error",y,!1),E.removeEventListener("abort",y,!1)),clearInterval(G),!b){try{E.getClassName&&"TextSourceBuffer"===E.getClassName()||a.removeSourceBuffer(E)}catch(c){D.error("Failed to remove source buffer from media source.")}E=null}F=!1}I=[],J=null}function h(){return E}function j(){try{return E.buffered}catch(a){return D.error("getAllBufferRanges exception: "+a.message),null}}function l(a){if(!a)return void J({chunk:a,error:new i.default(s.default.APPEND_ERROR_CODE,s.default.APPEND_ERROR_MESSAGE)});I.push(a),F||z(E,p.bind(this))}function n(a){E.timestampOffset===a||isNaN(a)||z(E,function(){E.timestampOffset=a})}function o(b,c,d){var e=this;z(E,function(){try{b>=0&&c>b&&(d||"ended"!==a.readyState)&&E.remove(b,c),z(E,function(){B.trigger(m.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:e,from:b,to:c,unintended:!1})})}catch(f){B.trigger(m.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:e,from:b,to:c,unintended:!1,error:new i.default(f.code,f.message)})}})}function p(){var a=this,b=this;I.length>0&&function(){F=!0;var c=I[0];I.splice(0,1);var d=[],e=function(){var a=j();r(b,d,a,c),I.length>0?p.call(this):(F=!1,J&&J({chunk:c}))};try{0===c.bytes.length?e.call(a):(d=j(),E.appendBuffer?E.appendBuffer(c.bytes):E.append(c.bytes,c),z(E,e.bind(a)))}catch(f){D.fatal('SourceBuffer append failed "'+f+'"'),I.length>0?p():F=!1,J&&J({chunk:c,error:new i.default(f.code,f.message)})}}()}function r(a,b,c,d){b&&b.length>0&&b.length<c.length&&t(b,d)&&B.trigger(m.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:a,from:c.end(c.length-2),to:c.start(c.length-1),unintended:!0})}function t(a,b){for(var c=0;c<a.length;c++){var d=Math.round(a.start(c)),e=Math.round(a.end(c));if(e===b.start||d===b.end||b.start>=d&&b.end<=e)return!0}return!1}function u(){try{"open"===a.readyState?E.abort():E.setTextTrack&&"ended"===a.readyState&&E.abort()}catch(b){D.error('SourceBuffer append abort failed: "'+b+'"')}I=[]}function v(){if(H.length>0){var a=H.shift();E.updating?z(E,a):(a(),v())}}function w(){E.updating||v()}function x(){E.updating||v()}function y(){D.error("SourceBufferSink error",b.type)}function z(a,b){H.push(b),a.updating||v()}var A=this.context,B=(0,k.default)(A).getInstance(),C=void 0,D=void 0,E=void 0,F=void 0,G=void 0,H=[],I=[],J=c;return C={getAllBufferRanges:j,getBuffer:h,append:l,remove:o,abort:u,reset:f,updateTimestampOffset:n},e(),C}Object.defineProperty(c,"__esModule",{value:!0});var f=a(46),g=d(f),h=a(215),i=d(h),j=a(47),k=d(j),l=a(53),m=d(l),n=a(48),o=d(n),p=a(191),q=d(p),r=a(50),s=d(r);e.__dashjs_factory_name="SourceBufferSink";var t=o.default.getClassFactory(e);c.default=t,b.exports=c.default},{191:191,215:215,46:46,47:47,48:48,50:50,53:53}],98:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){va=(0,u.default)(ea).getInstance().getLogger(ua),r(),Da=(0,m.default)(ea).create({mediaPlayerModel:ia,metricsModel:oa,errHandler:ma}),c()}function c(){fa.on(s.default.BUFFERING_COMPLETED,V,ua),fa.on(s.default.DATA_UPDATE_COMPLETED,W,ua)}function d(){fa.off(s.default.DATA_UPDATE_COMPLETED,W,ua),fa.off(s.default.BUFFERING_COMPLETED,V,ua)}function e(){Ca&&(fa.on(s.default.KEY_ERROR,H,ua),fa.on(s.default.SERVER_CERTIFICATE_UPDATED,H,ua),fa.on(s.default.LICENSE_REQUEST_COMPLETE,H,ua),fa.on(s.default.KEY_SYSTEM_SELECTED,H,ua),fa.on(s.default.KEY_SESSION_CREATED,H,ua),fa.on(s.default.KEY_STATUSES_CHANGED,H,ua))}function f(){Ca&&(fa.off(s.default.KEY_ERROR,H,ua),fa.off(s.default.SERVER_CERTIFICATE_UPDATED,H,ua),fa.off(s.default.LICENSE_REQUEST_COMPLETE,H,ua),fa.off(s.default.KEY_SYSTEM_SELECTED,H,ua),fa.off(s.default.KEY_SESSION_CREATED,H,ua),fa.off(s.default.KEY_STATUSES_CHANGED,H,ua))}function h(a,b){za=a,Ca=b,e()}function j(a,b){if(!xa){var c=void 0;return fa.on(s.default.CURRENT_TRACK_CHANGED,J,ua),ca()?(Q(),c=b):c=P(a,b),xa=!0,c}return b}function l(a){for(var b=wa?wa.length:0,c=!1,d=0;d<b;d++){wa[d].getFragmentModel().removeExecutedRequestsBeforeTime(x()+v()),wa[d].reset(c,a)}wa=[],xa=!1,ya=!1,ba(!1),fa.off(s.default.CURRENT_TRACK_CHANGED,J,ua)}function n(){return xa}function p(a){for(var b=0;b<wa.length;)I(wa[b].getMediaInfo())?(wa[b].setMediaSource(a),b++):(wa[b].reset(),wa.splice(b,1));for(var b=0;b<wa.length;b++)wa[b].dischargePreBuffer();if(0===wa.length){var c="No streams to play.";ma.manifestError(c,"nostreams",ga.getValue()),ma.error(new A.default(w.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,c+"nostreams",ga.getValue())),va.fatal(c)}}function r(){l(),za=null,Aa={},Ba=!1}function t(){qa&&qa.pause(),Da&&(Da.reset(),Da=null),r(),d(),f(),ba(!1)}function v(){return za?za.duration:NaN}function x(){return za?za.start:NaN}function y(){return za?za.id:null}function z(){return za}function B(){return Da}function C(){return Ea}function D(){if(!(pa&&pa.hasOwnProperty("getBitrateList")&&ka&&ka.hasOwnProperty("getAllMediaInfoForType")&&ka.hasOwnProperty("getEventsFor")))throw new Error(g.default.MISSING_CONFIG_ERROR)}function E(a){if(D(),a===g.default.IMAGE)return Ea?Ea.getBitrateList():[];var b=T(a);return pa.getBitrateList(b)}function F(){Fa&&Fa.start()}function G(){Fa&&Fa.stop()}function H(a){a.error&&(ma.mediaKeySessionError(a.error.message),ma.error(a.error),va.fatal(a.error.message),t())}function I(a){var b=a.type,c=void 0,d=void 0;if(b===g.default.MUXED&&a)return d="Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines",va.fatal(d),ma.manifestError(d,"multiplexedrep",ga.getValue()),ma.error(new A.default(w.default.MANIFEST_ERROR_ID_MULTIPLEXED_CODE,d,ga.getValue())),!1;if(b===g.default.TEXT||b===g.default.FRAGMENTED_TEXT||b===g.default.EMBEDDED_TEXT||b===g.default.IMAGE)return!0;if(c=a.codec,va.debug(b+" codec: "+c),a.contentProtection&&!la.supportsEncryptedMedia())ma.capabilityError("encryptedmedia"),ma.error(new A.default(w.default.CAPABILITY_MEDIAKEYS_ERROR_CODE,w.default.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE));else if(!la.supportsCodec(c))return d=b+"Codec ("+c+") is not supported.",va.error(d),!1;return!0}function J(a){if(a.newMediaInfo.streamInfo.id===za.id){var b=X(a.newMediaInfo);if(b){var c=qa.getTime();va.info("Stream - Process track changed at current time "+c);var d=a.newMediaInfo,e=ga.getValue();va.debug("Stream - Update stream controller"),e.refreshManifestOnSwitchTrack?(va.debug("Stream - Refreshing manifest for switch track"),Ha=a,ja.refreshManifest()):(b.selectMediaInfo(d),d.type!==g.default.FRAGMENTED_TEXT?(pa.updateTopQualityIndex(d),b.switchTrackAsked(),b.getFragmentModel().abortRequests()):(b.getScheduleController().setSeekTarget(NaN),ka.setIndexHandlerTime(b,c),ka.resetIndexHandler(b)))}}}function K(b,c,d,e){var f=(0,i.default)(ea).create({type:b.type,mimeType:b.mimeType,timelineConverter:na,adapter:ka,manifestModel:ga,dashManifestModel:ha,mediaPlayerModel:ia,metricsModel:oa,dashMetrics:a.dashMetrics,baseURLController:a.baseURLController,stream:ua,abrController:pa,domStorage:a.domStorage,playbackController:qa,mediaController:ra,streamController:a.streamController,textController:sa,errHandler:ma});if(f.initialize(d),pa.updateTopQualityIndex(b),e?(f.setBuffer(e.buffer),f.getIndexHandler().setCurrentTime(e.currentTime),wa[e.replaceIdx]=f):wa.push(f),!e||!e.ignoreMediaInfo)if(b.type===g.default.TEXT||b.type===g.default.FRAGMENTED_TEXT){for(var h=void 0,j=0;j<c.length;j++)c[j].index===b.index&&(h=j),f.addMediaInfo(c[j]);f.selectMediaInfo(c[h])}else f.addMediaInfo(b,!0)}function L(b,c){var d=ka.getAllMediaInfoForType(za,b),e=null,f=void 0;if(!d||0===d.length)return void va.info("No "+b+" data.");for(var h=0,i=d.length;h<i;h++)if(e=d[h],b===g.default.EMBEDDED_TEXT)sa.addEmbeddedTrack(e);else{if(!I(e))continue;ra.addTrack(e)}if(b!==g.default.EMBEDDED_TEXT&&0!==ra.getTracksFor(b,za).length){if(b===g.default.IMAGE)return void(Ea=(0,o.default)(ea).create({dashManifestModel:ha,adapter:ka,baseURLController:a.baseURLController,stream:ua,timelineConverter:a.timelineConverter}));(b!==g.default.FRAGMENTED_TEXT||b===g.default.FRAGMENTED_TEXT&&sa.getTextDefaultEnabled())&&(ra.checkInitialMediaSettingsForType(b,za),f=ra.getCurrentTrackFor(b,za)),b!==g.default.FRAGMENTED_TEXT||sa.getTextDefaultEnabled()||(f=ra.getTracksFor(b,za)[0]),K(f,d,c)}}function M(){Fa||(Fa=(0,k.default)(ea).create(),Fa.setConfig({manifestUpdater:ja,playbackController:qa}),N())}function N(){var a=ka.getEventsFor(za);Fa.addInlineEvents(a)}function O(a){Fa&&Fa.addInbandEvents(a)}function P(a,b){D();var c=ta.getElement();M(),Ba=!0,R(g.default.VIDEO),R(g.default.AUDIO),(null===c||c&&/^VIDEO$/i.test(c.nodeName))&&L(g.default.VIDEO,a),L(g.default.AUDIO,a),L(g.default.TEXT,a),L(g.default.FRAGMENTED_TEXT,a),L(g.default.EMBEDDED_TEXT,a),L(g.default.MUXED,a),L(g.default.IMAGE,a);var d=U(b);if(ya=!0,Ba=!1,0===wa.length){var e="No streams to play.";ma.manifestError(e,"nostreams",ga.getValue()),ma.error(new A.default(w.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,ga.getValue())),va.fatal(e)}else S();return d}function Q(){if(Ba=!0,D(),R(g.default.VIDEO),R(g.default.AUDIO),ya=!0,Ba=!1,0===wa.length){var a="No streams to play.";ma.manifestError(a,"nostreams",ga.getValue()),va.debug(a)}else S()}function R(a){var b=ha.getAdaptationForType(ga.getValue(),za.index,a,za);b&&Array.isArray(b.Representation_asArray)&&(b.Representation_asArray=b.Representation_asArray.filter(function(a,c){if(0===c)return!0;var d=ha.getCodec(b,c,!0);return!!la.supportsCodec(d)||(va.error("[Stream] codec not supported: "+d),!1)}))}function S(){for(var a=wa.length,b=!!Aa.audio||!!Aa.video,c=b?new A.default(w.default.DATA_UPDATE_FAILED_ERROR_CODE,w.default.DATA_UPDATE_FAILED_ERROR_MESSAGE):null,d=0;d<a;d++)if(wa[d].isUpdating()||Ba)return;if(ya){if(Ca)for(var d=0;d<a&&wa[d];d++)wa[d].getType()!==g.default.AUDIO&&wa[d].getType()!==g.default.VIDEO&&wa[d].getType()!==g.default.FRAGMENTED_TEXT||Ca.initializeForMedia(wa[d].getMediaInfo());fa.trigger(s.default.STREAM_INITIALIZED,{streamInfo:za,error:c})}}function T(a){for(var b=wa.length,c=null,d=0;d<b;d++)if(c=wa[d],c.getType()===a)return c.getMediaInfo();return null}function U(a){for(var b={},c=0,d=wa.length;c<d;c++)b[wa[c].getType()]=wa[c].createBuffer(a).getBuffer();return b}function V(a){if(a.streamInfo===za){var b=Y(),c=b.length;if(0===c)return void va.warn("onBufferingCompleted - can't trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined");for(var d=0;d<c;d++)if(!b[d].isBufferingCompleted()&&(b[d].getType()===g.default.AUDIO||b[d].getType()===g.default.VIDEO))return void va.warn("onBufferingCompleted - can't trigger STREAM_BUFFERING_COMPLETED because streamProcessor "+b[d].getType()+" is not buffering completed");va.debug("onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED"),fa.trigger(s.default.STREAM_BUFFERING_COMPLETED,{streamInfo:za})}}function W(a){var b=a.sender.getStreamProcessor();b.getStreamInfo()===za&&(Aa[b.getType()]=a.error,S())}function X(a){return a?Y().filter(function(b){return b.getType()===a.type})[0]:null}function Y(){for(var a=wa.length,b=[],c=void 0,d=void 0,e=0;e<a;e++)d=wa[e],(c=d.getType())!==g.default.AUDIO&&c!==g.default.VIDEO&&c!==g.default.FRAGMENTED_TEXT&&c!==g.default.TEXT||b.push(d);return b}function Z(a){va.info("Manifest updated... updating data system wide."),xa=!1,Ba=!0,za=a,Fa&&N(),R(g.default.VIDEO),R(g.default.AUDIO);for(var b=0,c=wa.length;b<c;b++){var d=wa[b],e=ka.getMediaInfoForType(za,d.getType());pa.updateTopQualityIndex(e),d.addMediaInfo(e,!0)}if(Ha){var e=Ha.newMediaInfo;if("fragmentedText"!==e.type){var f=X(Ha.oldMediaInfo);if(!f)return;f.switchTrackAsked(),Ha=void 0}}Ba=!1,S()}function $(a){return _(a,g.default.VIDEO)&&_(a,g.default.AUDIO)}function _(a,b){if(!a)return!1;var c=a.getStreamInfo(),d=z();if(!c||!d)return!1;var e=ha.getAdaptationForType(ga.getValue(),c.index,b,c),f=ha.getAdaptationForType(ga.getValue(),d.index,b,d);if(!e||!f)return!e&&!f;if(e.ContentProtection&&!f.ContentProtection||!e.ContentProtection&&f.ContentProtection)return!1;var g=e&&f&&e.mimeType===f.mimeType,h=f.Representation_asArray.map(function(a){return a.codecs}),i=e.Representation_asArray.map(function(a){return a.codecs}),j=i.some(function(a){return h.indexOf(a)>-1}),k=i.some(function(a){return h.some(function(b){return aa(b,a)})});return j||k&&g}function aa(a,b){var c=a.split(".")[0],d=Ia.find(function(a){return a.codec===c}),e=0===b.indexOf(c);return d?e||d.compatibleCodecs.some(function(a){return 0===b.indexOf(a)}):e}function ba(a){Ga=a}function ca(){return Ga}function da(a,b){M(),L(g.default.VIDEO,a),L(g.default.AUDIO,a),L(g.default.TEXT,a),L(g.default.FRAGMENTED_TEXT,a),L(g.default.EMBEDDED_TEXT,a),L(g.default.MUXED,a),L(g.default.IMAGE,a),U(b),fa.on(s.default.CURRENT_TRACK_CHANGED,J,ua);for(var c=0;c<wa.length&&wa[c];c++)wa[c].getScheduleController().start();ba(!0)}a=a||{};var ea=this.context,fa=(0,q.default)(ea).getInstance(),ga=a.manifestModel,ha=a.dashManifestModel,ia=a.mediaPlayerModel,ja=a.manifestUpdater,ka=a.adapter,la=a.capabilities,ma=a.errHandler,na=a.timelineConverter,oa=a.metricsModel,pa=a.abrController,qa=a.playbackController,ra=a.mediaController,sa=a.textController,ta=a.videoModel,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];return ua={initialize:h,activate:j,deactivate:l,isActive:n,getDuration:v,getStartTime:x,getId:y,getStreamInfo:z,preload:da,getFragmentController:B,getThumbnailController:C,getBitrateListFor:E,startEventController:F,stopEventController:G,updateData:Z,reset:t,getProcessors:Y,setMediaSource:p,isCompatibleWithStream:$,getPreloaded:ca,addInbandEvents:O},b(),ua}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(99),i=d(h),j=a(108),k=d(j),l=a(109),m=d(l),n=a(194),o=d(n),p=a(47),q=d(p),r=a(53),s=d(r),t=a(46),u=d(t),v=a(50),w=d(v),x=a(48),y=d(x),z=a(215),A=d(z);e.__dashjs_factory_name="Stream",c.default=y.default.getClassFactory(e),b.exports=c.default},{101:101,108:108,109:109,194:194,215:215,46:46,47:47,48:48,50:50,53:53,99:99}],99:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){ca&&ca.getIsDynamic()&&(pa=(0,i.default)(T).create({timelineConverter:Y,streamProcessor:ka})),j()}function c(b){U=(0,u.default)(T).create({mimeType:X,timelineConverter:Y,dashMetrics:ia,metricsModel:ha,mediaPlayerModel:_,baseURLController:a.baseURLController,errHandler:W}),U.initialize(ka),ba.registerStreamType(V,ka),ra=aa.getFragmentController().getModel(V),ra.setStreamProcessor(ka),na=R(V),oa=(0,o.default)(T).create({type:V,mimeType:X,metricsModel:ha,adapter:Z,dashMetrics:ia,dashManifestModel:ja,timelineConverter:Y,mediaPlayerModel:_,abrController:ba,playbackController:ca,streamController:da,textController:fa,streamProcessor:ka,mediaController:ea}),qa=(0,q.default)(T).create(),qa.setConfig({abrController:ba,domStorage:ga,metricsModel:ha,dashMetrics:ia,dashManifestModel:ja,manifestModel:$,playbackController:ca,timelineConverter:Y,streamProcessor:ka}),na.initialize(b),oa.initialize(),qa.initialize()}function d(a){sa.push(a)}function e(a){var b=sa.indexOf(a);-1!==b&&sa.splice(b,1)}function f(){return sa}function h(){sa=[]}function j(){ma=[],la=null,h()}function l(a,b){U.reset(),na&&(na.reset(a,b),na=null),oa&&(oa.reset(),oa=null),qa&&(qa.reset(),qa=null),ba&&ba.unRegisterStreamType(V),sa.forEach(function(a){a.reset()}),j(),V=null,aa=null,pa&&(pa.reset(),pa=null)}function n(){return!!qa&&qa.isUpdating()}function p(){return V}function r(){return qa}function s(){return U}function t(){return aa?aa.getFragmentController():null}function v(){return na.getBuffer()}function w(a){na.setBuffer(a)}function x(){return na}function y(){return ra}function z(){return pa}function A(){return aa?aa.getStreamInfo():null}function B(a){aa&&aa.addInbandEvents(a)}function C(a){a===la||a&&la&&a.type!==la.type||(la=a),Z.updateData(this)}function D(a,b){-1===ma.indexOf(a)&&ma.push(a),b&&this.selectMediaInfo(a)}function E(){return ma}function F(){return la}function G(){return na.getMediaSource()}function H(a){na.setMediaSource(a,F())}function I(){na.dischargePreBuffer()}function J(){return oa}function K(a){return Z.getRepresentationInfo(qa,a)}function L(){return!!na&&na.getIsBufferingCompleted()}function M(a){return!!na&&null!==na.getRangeAt(a,0)}function N(){return na.getBufferLevel()}function O(a,b){na&&na.switchInitData(A().id,a,b)}function P(a){return na.getBuffer()||na.createBuffer(la,a)}function Q(){oa.switchTrackAsked()}function R(a){return a===g.default.VIDEO||a===g.default.AUDIO?(0,k.default)(T).create({type:a,metricsModel:ha,mediaPlayerModel:_,manifestModel:$,errHandler:W,streamController:da,mediaController:ea,adapter:Z,textController:fa,abrController:ba,playbackController:ca,streamProcessor:ka}):(0,m.default)(T).create({type:a,mimeType:X,metricsModel:ha,mediaPlayerModel:_,manifestModel:$,errHandler:W,streamController:da,mediaController:ea,adapter:Z,textController:fa,abrController:ba,playbackController:ca,streamProcessor:ka})}function S(){return ca}a=a||{};var T=this.context,U=void 0,V=a.type,W=a.errHandler,X=a.mimeType,Y=a.timelineConverter,Z=a.adapter,$=a.manifestModel,_=a.mediaPlayerModel,aa=a.stream,ba=a.abrController,ca=a.playbackController,da=a.streamController,ea=a.mediaController,fa=a.textController,ga=a.domStorage,ha=a.metricsModel,ia=a.dashMetrics,ja=a.dashManifestModel,ka=void 0,la=void 0,ma=void 0,na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0;return ka={initialize:c,isUpdating:n,getType:p,getBufferController:x,getFragmentModel:y,getScheduleController:J,getLiveEdgeFinder:z,getFragmentController:t,getRepresentationController:r,getIndexHandler:s,getPlaybackController:S,getRepresentationInfo:K,getBufferLevel:N,switchInitData:O,isBufferingCompleted:L,timeIsBuffered:M,createBuffer:P,getStreamInfo:A,selectMediaInfo:C,addMediaInfo:D,switchTrackAsked:Q,getMediaInfoArr:E,getMediaInfo:F,getMediaSource:G,setMediaSource:H,dischargePreBuffer:I,getBuffer:v,setBuffer:w,registerExternalController:d,unregisterExternalController:e,getExternalControllers:f,unregisterAllExternalController:h,addInbandEvents:B,reset:l},b(),ka}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(205),i=d(h),j=a(107),k=d(j),l=a(190),m=d(l),n=a(113),o=d(n),p=a(61),q=d(p),r=a(48),s=d(r),t=a(56),u=d(t);e.__dashjs_factory_name="StreamProcessor",c.default=s.default.getClassFactory(e),b.exports=c.default},{101:101,107:107,113:113,190:190,205:205,48:48,56:56,61:61}],100:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b,c){var e=function(d,e){b.resolved=!0,b.resolvedContent=d||null,f.trigger(p.default.XLINK_ELEMENT_LOADED,{element:b,resolveObject:c,error:d||e?null:new g.default(t.default.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,t.default.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+a)})};if(a===d)e(null,!0);else{var i=new l.default(a,j.HTTPRequest.XLINK_EXPANSION_TYPE);h.load({request:i,success:function(a){e(a)},error:function(){e(null)}})}}function c(){h&&(h.abort(),h=null)}a=a||{};var d="urn:mpeg:dash:resolve-to-zero:2013",e=this.context,f=(0,n.default)(e).getInstance(),h=(0,i.default)(e).create({errHandler:a.errHandler,metricsModel:a.metricsModel,mediaPlayerModel:a.mediaPlayerModel,requestModifier:a.requestModifier});return{load:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(215),g=d(f),h=a(148),i=d(h),j=a(235),k=a(226),l=d(k),m=a(47),n=d(m),o=a(53),p=d(o),q=a(48),r=d(q),s=a(50),t=d(s);e.__dashjs_factory_name="XlinkLoader",c.default=r.default.getClassFactory(e),b.exports=c.default},{148:148,215:215,226:226,235:235,47:47,48:48,50:50,53:53}],101:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a),this.init()}return e(a,[{key:"init",value:function(){this.STREAM="stream",this.VIDEO="video",this.AUDIO="audio",this.TEXT="text",this.FRAGMENTED_TEXT="fragmentedText",this.EMBEDDED_TEXT="embeddedText",this.MUXED="muxed",this.IMAGE="image",this.LOCATION="Location",this.INITIALIZE="initialize",this.TEXT_SHOWING="showing",this.TEXT_HIDDEN="hidden",this.CC1="CC1",this.CC3="CC3",this.STPP="stpp",this.TTML="ttml",this.VTT="vtt",this.WVTT="wvtt",this.UTF8="utf-8",this.SUGGESTED_PRESENTATION_DELAY="suggestedPresentationDelay",this.SCHEME_ID_URI="schemeIdUri",this.START_TIME="starttime",this.ABR_STRATEGY_DYNAMIC="abrDynamic",this.ABR_STRATEGY_BOLA="abrBola",this.ABR_STRATEGY_THROUGHPUT="abrThroughput",this.MOVING_AVERAGE_SLIDING_WINDOW="slidingWindow",this.MOVING_AVERAGE_EWMA="ewma",this.BAD_ARGUMENT_ERROR="Invalid Arguments",this.MISSING_CONFIG_ERROR="Missing config parameter(s)"}}]),a}(),g=new f;c.default=g,b.exports=c.default},{}],102:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a),this.init()}return e(a,[{key:"init",value:function(){this.TCP_CONNECTION="TcpList",this.HTTP_REQUEST="HttpList",this.TRACK_SWITCH="RepSwitchList",this.BUFFER_LEVEL="BufferLevel",this.BUFFER_STATE="BufferState",this.DVR_INFO="DVRInfo",this.DROPPED_FRAMES="DroppedFrames",this.SCHEDULING_INFO="SchedulingInfo",this.REQUESTS_QUEUE="RequestsQueue",this.MANIFEST_UPDATE="ManifestUpdate",this.MANIFEST_UPDATE_STREAM_INFO="ManifestUpdatePeriodInfo",this.MANIFEST_UPDATE_TRACK_INFO="ManifestUpdateRepresentationInfo",this.PLAY_LIST="PlayList",this.DVB_ERRORS="DVBErrors"}}]),a}(),g=new f;c.default=g,b.exports=c.default},{}],103:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a),this.init()}return e(a,[{key:"init",value:function(){this.CLEARKEY_KEYSTEM_STRING="org.w3.clearkey",this.WIDEVINE_KEYSTEM_STRING="com.widevine.alpha",this.PLAYREADY_KEYSTEM_STRING="com.microsoft.playready"}}]),a}(),g=new f;c.default=g,b.exports=c.default},{}],104:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){xa=ua.getLogger(wa),e()}function b(a,b){Ua[a]=(0,A.default)(ta).create(),Fa[a]=b,Ga[a]=Ga[a]||{},Ga[a].state=K,Xa[a]=!1,va.on(s.default.LOADING_PROGRESS,sa,this),a==i.default.VIDEO&&(va.on(s.default.QUALITY_CHANGE_RENDERED,l,this),Va=(0,C.default)(ta).create(),qa()),va.on(s.default.METRIC_ADDED,n,this),va.on(s.default.PERIOD_SWITCH_COMPLETED,d,this),Wa=(0,E.default)(ta).create({mediaPlayerModel:Ra})}function c(a){delete Fa[a]}function d(){ya=(0,g.default)(ta).create({metricsModel:Ya,dashMetrics:Za,mediaPlayerModel:Ra,adapter:Pa}),ya.initialize()}function e(){Aa={video:!0,audio:!0},Ba={},Ca={},Da={},Ea={},Ga={},Fa={},Ua={},Xa={},Ia=!1,$a=!0,Ja=!1,void 0===Ka&&(Ka=!1),Ta=void 0,Va=void 0,Wa=void 0,clearTimeout(Ha),Ha=null}function f(){e(),va.off(s.default.LOADING_PROGRESS,sa,this),va.off(s.default.QUALITY_CHANGE_RENDERED,l,this),va.off(s.default.METRIC_ADDED,n,this),va.off(s.default.PERIOD_SWITCH_COMPLETED,d,this),ya&&ya.reset()}function h(a){a&&(a.streamController&&(za=a.streamController),a.domStorage&&(Sa=a.domStorage),a.mediaPlayerModel&&(Ra=a.mediaPlayerModel),a.metricsModel&&(Ya=a.metricsModel),a.dashMetrics&&(Za=a.dashMetrics),a.dashManifestModel&&(Oa=a.dashManifestModel),a.adapter&&(Pa=a.adapter),a.manifestModel&&(Na=a.manifestModel),a.videoModel&&(Qa=a.videoModel))}function j(){if(!Sa||!Sa.hasOwnProperty("getSavedBitrateSettings"))throw new Error(i.default.MISSING_CONFIG_ERROR)}function l(a){a.mediaType===i.default.VIDEO&&(Ta=a.oldQuality,Va.push(Ta,Qa.getPlaybackQuality()))}function n(a){a.metric!==k.default.HTTP_REQUEST||!a.value||a.value.type!==F.HTTPRequest.MEDIA_SEGMENT_TYPE||a.mediaType!==i.default.AUDIO&&a.mediaType!==i.default.VIDEO||Wa.push(a.mediaType,a.value,$a),a.metric!==k.default.BUFFER_LEVEL||a.mediaType!==i.default.AUDIO&&a.mediaType!==i.default.VIDEO||fa(a.mediaType,.001*a.value.level)}function p(a,b){var c=void 0;return Ba[b]=Ba[b]||{},Ba[b].hasOwnProperty(a)||(Ba[b][a]=0),c=na(Ba[b][a],a),c=oa(c,a,Ba[b][a]),c=ra(c,a)}function r(a){if(a&&Fa&&Fa[a]){var b=Fa[a].getStreamInfo();if(b&&b.id){var c=p(a,b.id),d=ea(Fa[a].getMediaInfo());return d[c]?d[c]:null}}return null}function t(a){j();var b=Sa.getSavedBitrateSettings(a);if(!Da.hasOwnProperty(a))if(Ea.hasOwnProperty(a)){var c=Na.getValue(),d=Oa.getAdaptationForType(c,0,a).Representation;if(Array.isArray(d)){var e=Math.max(Math.round(d.length*Ea[a])-1,0);Da[a]=d[e].bandwidth}else Da[a]=0}else isNaN(b)?Da[a]=a===i.default.VIDEO?L:M:Da[a]=b;return Da[a]}function u(a,b){(0,I.checkIsVideoOrAudioType)(a),(0,I.checkParameterType)(b,"number"),Da[a]=b}function v(a){return Ea.hasOwnProperty(a)?Ea[a]:null}function x(a,b){Ea[a]=b}function z(a){return Da.hasOwnProperty("max")&&Da.max.hasOwnProperty(a)?Da.max[a]:NaN}function B(a){return Da.hasOwnProperty("min")&&Da.min.hasOwnProperty(a)?Da.min[a]:NaN}function D(a,b){(0,I.checkParameterType)(b,"number"),(0,I.checkIsVideoOrAudioType)(a),Da.max=Da.max||{},Da.max[a]=b}function G(a,b){(0,I.checkParameterType)(b,"number"),(0,I.checkIsVideoOrAudioType)(a),Da.min=Da.min||{},Da.min[a]=b}function O(a){var b=z(a);return b?da(Fa[a].getMediaInfo(),b):void 0}function P(a){var b=B(a);if(b){var c=Fa[a].getMediaInfo(),d=ea(c),e=da(c,b);return d[e]&&e<d.length-1&&d[e].bitrate<1e3*b&&e++,e}}function Q(a){return Ea.hasOwnProperty("max")&&Ea.max.hasOwnProperty(a)?Ea.max[a]:1}function R(a,b){Ea.max=Ea.max||{},Ea.max[a]=b}function S(a){return Aa[a]}function T(a,b){(0,I.checkParameterType)(b,"boolean"),(0,I.checkIsVideoOrAudioType)(a),Aa[a]=b}function U(){return Ia}function V(a){(0,I.checkParameterType)(a,"boolean"),Ia=a}function W(){return Ja}function X(a){(0,I.checkParameterType)(a,"boolean"),Ja=a}function Y(){return $a}function Z(a){(0,I.checkParameterType)(a,"boolean"),$a=a}function $(a){if(a&&Fa&&Fa[a]){var b=Fa[a].getStreamInfo(),c=b?b.id:null,d=ka(a),e=(0, +w.default)(ta).create({abrController:wa,streamProcessor:Fa[a],currentValue:d,switchHistory:Ua[a],droppedFramesHistory:Va,useBufferOccupancyABR:ga(a)});if(Va){var f=Qa.getPlaybackQuality();f&&Va.push(Ta,f)}if(S(a)){var g=P(a),h=p(a,c),i=ya.getMaxQuality(e),j=i.quality;if(void 0!==g&&j<g&&(j=g),j>h&&(j=h),Ua[a].push({oldValue:d,newValue:j}),j>y.default.NO_CHANGE&&j!=d)(Ga[a].state===K||j>d)&&aa(a,d,j,h,i.reason);else if(ua.getLogToBrowserConsole()){var k=Za.getCurrentBufferLevel(Ya.getReadOnlyMetricsFor(a));xa.debug("AbrController ("+a+") stay on "+d+"/"+h+" (buffer: "+k+")")}}}}function _(a,b,c,d){var e=b.id,f=ka(a);(0,I.checkInteger)(c);var g=p(a,e);c!==f&&c>=0&&c<=g&&aa(a,f,c,g,d)}function aa(a,b,c,d,e){if(a&&Fa[a]){var f=Fa[a].getStreamInfo(),g=f?f.id:null;if(ua.getLogToBrowserConsole()){var h=Za.getCurrentBufferLevel(Ya.getReadOnlyMetricsFor(a));xa.info("AbrController ("+a+") switch from "+b+" to "+c+"/"+d+" (buffer: "+h+") "+(e?JSON.stringify(e):"."))}la(a,g,c),va.trigger(s.default.QUALITY_CHANGE_REQUESTED,{mediaType:a,streamInfo:f,oldQuality:b,newQuality:c,reason:e})}}function ba(a,b){Ga[a].state=b}function ca(a){return Ga[a]?Ga[a].state:null}function da(a,b,c){var d=a&&a.type?Fa[a.type].getRepresentationInfo():null;if($a&&c&&d&&d.fragmentDuration){c/=1e3;var e=d.fragmentDuration;if(c>e)return 0;b*=1-c/e}for(var f=ea(a),g=f.length-1;g>=0;g--){if(1e3*b>=f[g].bitrate)return g}return N}function ea(a){var b=[];if(!a||!a.bitrateList)return b;for(var c=a.bitrateList,d=a.type,e=void 0,f=0,g=c.length;f<g;f++)e=new m.default,e.mediaType=d,e.qualityIndex=f,e.bitrate=c[f].bandwidth,e.width=c[f].width,e.height=c[f].height,e.scanType=c[f].scanType,b.push(e);return b}function fa(a,b){var c=Ra.getABRStrategy();if(c===i.default.ABR_STRATEGY_BOLA)return void(Xa[a]=!0);if(c===i.default.ABR_STRATEGY_THROUGHPUT)return void(Xa[a]=!1);var d=Ra.getStableBufferTime(),e=d,f=.5*d,g=Xa[a],h=b>(g?f:e);Xa[a]=h,h!==g&&(h?xa.info("AbrController ("+a+") switching from throughput to buffer occupancy ABR rule (buffer: "+b.toFixed(3)+")."):xa.info("AbrController ("+a+") switching from buffer occupancy to throughput ABR rule (buffer: "+b.toFixed(3)+")."))}function ga(a){return Xa[a]}function ha(){return Wa}function ia(a){var b=a.type,c=a.streamInfo.id,d=a.representationCount-1;return ma(b,c,d),d}function ja(a){var b=a.id,c=ka(i.default.AUDIO),d=ka(i.default.VIDEO);return c===p(i.default.AUDIO,b)&&d===p(i.default.VIDEO,b)}function ka(a){if(a&&Fa[a]){var b=Fa[a].getStreamInfo(),c=b?b.id:null;if(c)return Ca[c]=Ca[c]||{},Ca[c].hasOwnProperty(a)||(Ca[c][a]=N),Ca[c][a]}return N}function la(a,b,c){Ca[b]=Ca[b]||{},Ca[b][a]=c}function ma(a,b,c){Ba[b]=Ba[b]||{},Ba[b][a]=c}function na(a,b){var c=a;if(!Fa[b])return c;var d=P(b);void 0!==d&&(c=Math.max(a,d));var e=O(b);return void 0!==e&&(c=Math.min(c,e)),c}function oa(a,b,c){var d=Q(b);return isNaN(d)||d>=1||d<0?a:Math.min(a,Math.round(c*d))}function pa(a){Ka=a}function qa(){if(Qa){var a=Ja&&window.hasOwnProperty("devicePixelRatio"),b=a?window.devicePixelRatio:1;La=Qa.getClientWidth()*b,Ma=Qa.getClientHeight()*b}}function ra(a,b){if(b!==i.default.VIDEO||!Ia||!Fa[b])return a;Ka||qa();var c=Na.getValue(),d=Oa.getAdaptationForType(c,0,b).Representation,e=a;if(La>0&&Ma>0){for(;e>0&&d[e]&&La<d[e].width&&La-d[e-1].width<d[e].width-La;)e-=1;d.length-2>=e&&d[e].width===d[e+1].width&&(e=Math.min(a,e+1))}return e}function sa(a){var b=a.request.mediaType;if(S(b)){var c=Fa[b];if(!c)return;var d=(0,w.default)(ta).create({abrController:wa,streamProcessor:c,currentRequest:a.request,useBufferOccupancyABR:ga(b)}),e=ya.shouldAbandonFragment(d);if(e.quality>y.default.NO_CHANGE){var f=c.getFragmentModel();f.getRequests({state:o.default.FRAGMENT_MODEL_LOADING,index:a.request.index})[0]&&(f.abortRequests(),ba(b,J),Ua[b].reset(),Ua[b].push({oldValue:ka(b,za.getActiveStreamInfo()),newValue:e.quality,confidence:1,reason:e.reason}),_(b,za.getActiveStreamInfo(),e.quality,e.reason),clearTimeout(Ha),Ha=setTimeout(function(){ba(b,K),Ha=null},Ra.getAbandonLoadTimeout()))}}}var ta=this.context,ua=(0,H.default)(ta).getInstance(),va=(0,q.default)(ta).getInstance(),wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0,Pa=void 0,Qa=void 0,Ra=void 0,Sa=void 0,Ta=void 0,Ua=void 0,Va=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Za=void 0,$a=void 0;return wa={isPlayingAtTopQuality:ja,updateTopQualityIndex:ia,getThroughputHistory:ha,getBitrateList:ea,getQualityForBitrate:da,getMaxAllowedBitrateFor:z,getTopBitrateInfoFor:r,getMinAllowedBitrateFor:B,setMaxAllowedBitrateFor:D,setMinAllowedBitrateFor:G,getMaxAllowedIndexFor:O,getMinAllowedIndexFor:P,getMaxAllowedRepresentationRatioFor:Q,setMaxAllowedRepresentationRatioFor:R,getInitialBitrateFor:t,setInitialBitrateFor:u,getInitialRepresentationRatioFor:v,setInitialRepresentationRatioFor:x,setAutoSwitchBitrateFor:T,getAutoSwitchBitrateFor:S,getUseDeadTimeLatency:Y,setUseDeadTimeLatency:Z,setLimitBitrateByPortal:V,getLimitBitrateByPortal:U,getUsePixelRatioInLimitBitrateByPortal:W,setUsePixelRatioInLimitBitrateByPortal:X,getQualityFor:ka,getAbandonmentStateFor:ca,setPlaybackQuality:_,checkPlaybackQuality:$,getTopQualityIndexFor:p,setElementSize:qa,setWindowResizeEventCalled:pa,createAbrRulesCollection:d,registerStreamType:b,unRegisterStreamType:c,setConfig:h,reset:f},a(),wa}Object.defineProperty(c,"__esModule",{value:!0});var f=a(179),g=d(f),h=a(101),i=d(h),j=a(102),k=d(j),l=a(214),m=d(l),n=a(141),o=d(n),p=a(47),q=d(p),r=a(53),s=d(r),t=a(48),u=d(t),v=a(175),w=d(v),x=a(176),y=d(x),z=a(177),A=d(z),B=a(174),C=d(B),D=a(178),E=d(D),F=a(235),G=a(46),H=d(G),I=a(208),J="abandonload",K="allowload",L=1e3,M=100,N=0;e.__dashjs_factory_name="AbrController";var O=u.default.getSingletonFactory(e);O.ABANDON_LOAD=J,O.QUALITY_DEFAULT=N,u.default.updateSingletonFactory(e.__dashjs_factory_name,O),c.default=O,b.exports=c.default},{101:101,102:102,141:141,174:174,175:175,176:176,177:177,178:178,179:179,208:208,214:214,235:235,46:46,47:47,48:48,53:53}],105:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){r.invalidateSelectedIndexes(a.entry)}function b(){r=(0,g.default)(n).create(),t=(0,i.default)(n).create(),o.on(s.default.SERVICE_LOCATION_BLACKLIST_CHANGED,a,j)}function c(a){a.baseURLTreeModel&&(r=a.baseURLTreeModel),a.baseURLSelector&&(t=a.baseURLSelector),a.dashManifestModel&&(l=a.dashManifestModel)}function d(a){r.update(a),t.chooseSelectorFromManifest(a)}function e(a){var b=r.getForPath(a),c=b.reduce(function(a,b){var c=t.select(b);return c?(p.isRelative(c.url)?a.url=p.resolve(c.url,a.url):(a.url=c.url,a.serviceLocation=c.serviceLocation),a.availabilityTimeOffset=c.availabilityTimeOffset,a.availabilityTimeComplete=c.availabilityTimeComplete,a):new m.default},new m.default);if(!p.isRelative(c.url))return c}function f(){r.reset(),t.reset()}function h(a){r.setConfig({dashManifestModel:l}),t.setConfig({dashManifestModel:l}),d(a)}var j=void 0,l=void 0,n=this.context,o=(0,q.default)(n).getInstance(),p=(0,k.default)(n).getInstance(),r=void 0,t=void 0;return j={reset:f,initialize:h,resolve:e,setConfig:c},b(),j}Object.defineProperty(c,"__esModule",{value:!0});var f=a(140),g=d(f),h=a(196),i=d(h),j=a(210),k=d(j),l=a(82),m=d(l),n=a(48),o=d(n),p=a(47),q=d(p),r=a(53),s=d(r);e.__dashjs_factory_name="BaseURLController",c.default=o.default.getSingletonFactory(e),b.exports=c.default},{140:140,196:196,210:210,47:47,48:48,53:53,82:82}],106:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){return!!(g.length&&a&&a.length)&&-1!==g.indexOf(a)}function c(a){-1===g.indexOf(a)&&(g.push(a),h.trigger(j,{entry:a}))}function d(a){c(a.entry)}function e(){k&&h.on(k,d,this)}function f(){g=[]}a=a||{};var g=[],h=(0,i.default)(this.context).getInstance(),j=a.updateEventName,k=a.addBlacklistEventName;return e(),{add:c,contains:b,reset:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(47),i=d(h);e.__dashjs_factory_name="BlackListController",c.default=g.default.getClassFactory(e),b.exports=c.default},{47:47,48:48}],107:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){Ka=(0,A.default)(wa).getInstance().getLogger(Ja),Ya=(0,C.default)(wa).getInstance(),ua()}function c(){return O}function d(a){oa(a),La=Fa.getQualityFor(Ha,Ia.getStreamInfo()),xa.on(u.default.DATA_UPDATE_COMPLETED,da,this),xa.on(u.default.INIT_FRAGMENT_LOADED,j,this),xa.on(u.default.MEDIA_FRAGMENT_LOADED,n,this),xa.on(u.default.QUALITY_CHANGE_REQUESTED,v,this),xa.on(u.default.STREAM_COMPLETED,ea,this),xa.on(u.default.PLAYBACK_PLAYING,Q,this),xa.on(u.default.PLAYBACK_PROGRESS,F,this),xa.on(u.default.PLAYBACK_TIME_UPDATED,F,this),xa.on(u.default.PLAYBACK_RATE_CHANGED,ha,this),xa.on(u.default.PLAYBACK_SEEKING,x,this),xa.on(u.default.PLAYBACK_SEEKED,y,this),xa.on(u.default.PLAYBACK_STALLED,P,this),xa.on(u.default.WALLCLOCK_TIME_UPDATED,ga,this),xa.on(u.default.CURRENT_TRACK_CHANGED,fa,this,s.default.EVENT_PRIORITY_HIGH),xa.on(u.default.SOURCEBUFFER_REMOVE_COMPLETED,ba,this)}function e(a,b){if(!Ya||!a||!Ia)return null;if(Pa)try{Sa=b&&b[Ha]?(0,k.default)(wa).create(Pa,a,t.bind(this),b[Ha]):(0,k.default)(wa).create(Pa,a,t.bind(this)),"function"==typeof Sa.getBuffer().initialize&&Sa.getBuffer().initialize(Ha,Ia)}catch(c){Ka.fatal("Caught error on create SourceBuffer: "+c),Aa.mediaSourceError("Error creating "+Ha+" source buffer."),Aa.error(new E.default(G.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,G.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+Ha))}else Sa=(0,m.default)(wa).create(t.bind(this));return ca(Ia.getRepresentationInfo(La).MSETimeOffset),Sa}function f(){if(Sa&&Ta&&"function"==typeof Ta.discharge){var a=Ta.getAllBufferRanges();if(a.length>0){for(var b="Beginning "+Ha+"PreBuffer discharge, adding buffer for:",c=0;c<a.length;c++)b+=" start: "+a.start(c)+", end: "+a.end(c)+";";Ka.debug(b)}else Ka.debug("PreBuffer discharge requested, but there were no media segments in the PreBuffer.");for(var d=Ta.discharge(),e=null,f=0;f<d.length;f++){var g=d[f],h=Ya.extract(g.streamId,g.representationId);h&&(e!==h&&(Sa.append(h),e=h),Sa.append(g))}Ta.reset(),Ta=null}}function h(){return Ia&&Ba&&Ia.getStreamInfo()}function j(a){a.fragmentModel===Ia.getFragmentModel()&&(Ka.info("Init fragment finished loading saving to",Ha+"'s init cache"),Ya.save(a.chunk),Ka.debug("Append Init fragment",Ha," with representationId:",a.chunk.representationId," and quality:",a.chunk.quality),p(a.chunk))}function l(a,b,c){var d=Ya.extract(a,b);ab=!0===c&&c,d?(Ka.info("Append Init fragment",Ha," with representationId:",d.representationId," and quality:",d.quality),p(d)):xa.trigger(u.default.INIT_REQUESTED,{sender:Ja})}function n(a){if(a.fragmentModel===Ia.getFragmentModel()){var b=a.chunk,c=b.bytes,d=b.quality,e=Ia.getRepresentationInfo(d),f=Da.getEventsFor(e.mediaInfo,Ia),g=Da.getEventsFor(e,Ia);if(f&&f.length>0||g&&g.length>0){var h=Ia.getFragmentModel().getRequests({state:i.default.FRAGMENT_MODEL_EXECUTED,quality:d,index:b.index})[0],j=Y(c,h,f,g);Ia.addInbandEvents(j)}if(ab){bb=b;var k=Sa&&Sa.getAllBufferRanges();k&&k.length>0&&Ga.getTimeToStreamEnd()>K&&(Ka.debug("Clearing buffer because track changed - "+(k.end(k.length-1)+L)),_([{start:0,end:k.end(k.length-1)+L,force:!0}]))}else p(b)}}function p(a){Sa.append(a),a.mediaInfo.type===g.default.VIDEO&&xa.trigger(u.default.VIDEO_CHUNK_RECEIVED,{chunk:a})}function r(a){if(a&&a.length>0)for(var b=0,c=a.length;b<c;b++)Ka.debug("Buffered Range for type:",Ha,":",a.start(b)," - ",a.end(b)," currentTime = ",Ga.getTime())}function t(a){if(a.error){if(a.error.code===N&&(Oa=.8*sa(),Ka.warn("Quota exceeded for type: "+Ha+", Critical Buffer: "+Oa),Oa>0)){var b=Math.max(.2*Oa,1),c=Oa-b;za.setBufferToKeep(parseFloat(b).toFixed(5)),za.setBufferAheadToKeep(parseFloat(c).toFixed(5))}return void(a.error.code!==N&&ta()||(Ka.warn("Clearing playback buffer to overcome quota exceed situation for type: "+Ha),xa.trigger(u.default.QUOTA_EXCEEDED,{sender:Ja,criticalBufferLevel:Oa}),z()))}(Va=a.chunk)&&!isNaN(Va.index)&&(Qa=Math.max(Va.index,Qa),V());var d=Sa.getAllBufferRanges();if(Va.segmentType===H.HTTPRequest.MEDIA_SEGMENT_TYPE)r(d),F();else if(ab){var e=Ga.getTime();Ka.debug("AppendToBuffer seek target should be "+e),Ia.getScheduleController().setSeekTarget(e),Da.setIndexHandlerTime(Ia,e)}var f={sender:Ja,quality:Va.quality,startTime:Va.start,index:Va.index,bufferedRanges:d};Va&&!Va.endFragment?xa.trigger(u.default.BYTES_APPENDED,f):Va&&xa.trigger(u.default.BYTES_APPENDED_END_FRAGMENT,f)}function v(a){La!==a.newQuality&&Ha===a.mediaType&&Ia.getStreamInfo().id===a.streamInfo.id&&(ca(Ia.getRepresentationInfo(a.newQuality).MSETimeOffset),La=a.newQuality)}function x(){Ma&&($a=!0,Ma=!1,Ra=Number.POSITIVE_INFINITY),Ha!==g.default.FRAGMENTED_TEXT?z():F()}function y(){Za=void 0}function z(){var a=B();a&&0!==a.length||F(),_(a)}function B(){var a=[],b=Sa.getAllBufferRanges();if(!b||0===b.length)return a;var c=Ga.getTime(),d=b.end(b.length-1)+L,e=Ia.getFragmentModel().getRequests({state:i.default.FRAGMENT_MODEL_EXECUTED,time:c,threshold:M})[0];if(e){var f={start:0,end:e.startTime-K},g=Ia.getFragmentModel().getRequests({state:i.default.FRAGMENT_MODEL_EXECUTED,time:e.startTime-e.duration/2,threshold:M})[0];g&&g.startTime!=e.startTime&&(f.end=g.startTime),f.start<f.end&&f.end>b.start(0)&&a.push(f);var h={start:e.startTime+e.duration+K,end:d},j=Ia.getFragmentModel().getRequests({state:i.default.FRAGMENT_MODEL_EXECUTED,time:e.startTime+e.duration+K,threshold:M})[0];j&&j.startTime!==e.startTime&&(h.start=j.startTime+j.duration+K),h.start<h.end&&h.start<d&&a.push(h)}else Ka.debug("getAllRangesWithSafetyFactor for",Ha,"- No request found in current time position, removing full buffer 0 -",d),a.push({start:0,end:d});return a}function D(){var a=Ga.getTime();if(Za){var b=Sa.getAllBufferRanges();b&&b.length&&(a=Math.max(b.start(0),Za))}return a}function F(){(!ab||Ha===g.default.FRAGMENTED_TEXT&&Ea.isTextEnabled())&&(T(),U())}function P(){W()}function Q(){W()}function R(a,b){var c=Sa.getAllBufferRanges(),d=0,e=0,f=null,g=null,h=0,i=void 0,j=void 0,k=b||.15;if(null!==c&&void 0!==c){for(j=0,i=c.length;j<i;j++)if(d=c.start(j),e=c.end(j),null===f)h=Math.abs(d-a),a>=d&&a<e?(f=d,g=e):h<=k&&(f=d,g=e);else{if(!((h=d-g)<=k))break;g=e}if(null!==f)return{start:f,end:g}}return null}function S(a,b){var c=void 0;return c=R(a,b),null===c?0:c.end-a}function T(){Ga&&(Na=S(D()||0),xa.trigger(u.default.BUFFER_LEVEL_UPDATED,{sender:Ja,bufferLevel:Na}),W())}function U(){h()&&(ya.addBufferState(Ha,Ua,Ia.getScheduleController().getBufferTarget()),ya.addBufferLevel(Ha,new Date,1e3*Na))}function V(){Qa>=Ra-1&&!Ma&&void 0===Sa.discharge&&(Ma=!0,Ka.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED"),xa.trigger(u.default.BUFFERING_COMPLETED,{sender:Ja,streamInfo:Ia.getStreamInfo()}))}function W(){"audio"!==Ha&&"video"!==Ha||($a&&!Ma&&Ga&&Ga.getTimeToStreamEnd()-Na<K&&($a=!1,Ma=!0,Ka.debug("checkIfSufficientBuffer trigger BUFFERING_COMPLETED"),xa.trigger(u.default.BUFFERING_COMPLETED,{sender:Ja,streamInfo:Ia.getStreamInfo()})),(!za.getLowLatencyEnabled()&&Na<K||0===Na)&&!Ma?X(J):(Ma||Na>=za.getStableBufferTime())&&X(I))}function X(a){Ua===a||a===J&&0===Ga.getTime()||Ha===g.default.FRAGMENTED_TEXT&&!Ea.isTextEnabled()||(Ua=a,U(),xa.trigger(u.default.BUFFER_LEVEL_STATE_CHANGED,{sender:Ja,state:a,mediaType:Ha,streamInfo:Ia.getStreamInfo()}),xa.trigger(a===I?u.default.BUFFER_LOADED:u.default.BUFFER_EMPTY,{mediaType:Ha}),Ka.debug(a===I?"Got enough buffer to start for "+Ha:"Waiting for more buffer before starting playback for "+Ha))}function Y(a,b,c,d){for(var e=Math.max(!b||isNaN(b.startTime)?0:b.startTime,0),f=[],g=[],h=c.concat(d),i=0,j=h.length;i<j;i++)f[h[i].schemeIdUri]=h[i];for(var k=(0,w.default)(wa).getInstance().parse(a),l=k.getBoxes("emsg"),i=0,j=l.length;i<j;i++){var m=Da.getEvent(l[i],f,e);m&&g.push(m)}return g}function Z(){Sa&&Ha!==g.default.FRAGMENTED_TEXT&&(Ma||_($()))}function $(){var a=[],b=Sa.getAllBufferRanges();if(!b||0===b.length)return a;var c=Ga.getTime(),d={start:Math.max(0,c-za.getBufferToKeep()),end:c+za.getBufferAheadToKeep()},e=Ia.getFragmentModel().getRequests({state:i.default.FRAGMENT_MODEL_EXECUTED,time:c,threshold:M})[0];if(e)d.start=Math.min(e.startTime,d.start),d.end=Math.max(e.startTime+e.duration,d.end);else if(0===c&&Ga.getIsDynamic())return[];if(b.start(0)<=d.start){for(var f={start:0,end:d.start},g=0;g<b.length&&b.end(g)<=d.start;g++)f.end=b.end(g);f.start<f.end&&a.push(f)}if(b.end(b.length-1)>=d.end){var h={start:d.end,end:b.end(b.length-1)+M};h.start<h.end&&a.push(h)}return a}function _(a){a&&Sa&&0!==a.length&&(_a.push.apply(_a,a),Xa||aa())}function aa(){if(0===_a.length||!Sa)return Ka.debug("Nothing to prune, halt pruning"),_a=[],void(Xa=!1);var a=Sa.getBuffer();if(!a||!a.buffered||0===a.buffered.length)return Ka.debug("SourceBuffer is empty (or does not exist), halt pruning"),_a=[],void(Xa=!1);var b=_a.shift();Ka.debug("Removing",Ha,"buffer from:",b.start,"to",b.end),Xa=!0;var c=Ga.getTime();c<b.end&&(Ma=!1,Qa=0,ab||(Ia.getScheduleController().setSeekTarget(c),Da.setIndexHandlerTime(Ia,c))),Sa.remove(b.start,b.end,b.force)}function ba(a){if(Sa===a.buffer){Ka.debug("onRemoved buffer from:",a.from,"to",a.to);r(Sa.getAllBufferRanges()),0===_a.length&&(Xa=!1),a.unintended&&(Ka.warn("Detected unintended removal from:",a.from,"to",a.to,"setting index handler time to",a.from),Da.setIndexHandlerTime(Ia,a.from)),Xa?aa():(ab?(ab=!1,bb&&p(bb)):(Ka.debug("onRemoved : call updateBufferLevel"),T()),xa.trigger(u.default.BUFFER_CLEARED,{sender:Ja,from:a.from,to:a.to,unintended:a.unintended,hasEnoughSpaceToAppend:ta()}))}}function ca(a){Sa&&Sa.updateTimestampOffset&&Sa.updateTimestampOffset(a)}function da(a){a.sender.getStreamProcessor()!==Ia||a.error||ca(a.currentRepresentation.MSETimeOffset)}function ea(a){a.fragmentModel===Ia.getFragmentModel()&&(Ra=a.request.index,V())}function fa(a){var b=Sa&&Sa.getAllBufferRanges();b&&a.newMediaInfo.type===Ha&&a.newMediaInfo.streamInfo.id===Ia.getStreamInfo().id&&(Ka.info("Track change asked"),Ca.getSwitchMode(Ha)===q.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&b&&b.length>0&&Ga.getTimeToStreamEnd()>K&&(Ma=!1,Ra=Number.POSITIVE_INFINITY))}function ga(){++Wa*(za.getWallclockTimeUpdateInterval()/1e3)>=za.getBufferPruningInterval()&&(Wa=0,Z())}function ha(){W()}function ia(){return Ha}function ja(){return Ia}function ka(a){Za=a}function la(){return Sa}function ma(a){Sa=a}function na(){return Na}function oa(a,b){Pa=a,Sa&&b&&"function"==typeof Sa.discharge&&(Ta=Sa,e(b))}function pa(){return Pa}function qa(){return Ma}function ra(){return Xa}function sa(){var a=Sa.getAllBufferRanges(),b=0,c=void 0,d=void 0;if(!a)return b;for(d=0,c=a.length;d<c;d++)b+=a.end(d)-a.start(d);return b}function ta(){return sa()<Oa}function ua(a,b){Oa=Number.POSITIVE_INFINITY,Ua=void 0,La=o.default.QUALITY_DEFAULT,Ra=Number.POSITIVE_INFINITY,Qa=0,Va=null,Ma=!1,Xa=!1,$a=!1,Na=0,Wa=0,_a=[],Sa&&(a||Sa.abort(),Sa.reset(b),Sa=null),ab=!1}function va(a,b){xa.off(u.default.DATA_UPDATE_COMPLETED,da,this),xa.off(u.default.QUALITY_CHANGE_REQUESTED,v,this),xa.off(u.default.INIT_FRAGMENT_LOADED,j,this),xa.off(u.default.MEDIA_FRAGMENT_LOADED,n,this),xa.off(u.default.STREAM_COMPLETED,ea,this),xa.off(u.default.CURRENT_TRACK_CHANGED,fa,this),xa.off(u.default.PLAYBACK_PLAYING,Q,this),xa.off(u.default.PLAYBACK_PROGRESS,F,this),xa.off(u.default.PLAYBACK_TIME_UPDATED,F,this),xa.off(u.default.PLAYBACK_RATE_CHANGED,ha,this),xa.off(u.default.PLAYBACK_SEEKING,x,this),xa.off(u.default.PLAYBACK_SEEKED,y,this),xa.off(u.default.PLAYBACK_STALLED,P,this),xa.off(u.default.WALLCLOCK_TIME_UPDATED,ga,this),xa.off(u.default.SOURCEBUFFER_REMOVE_COMPLETED,ba,this),ua(a,b)}a=a||{};var wa=this.context,xa=(0,s.default)(wa).getInstance(),ya=a.metricsModel,za=a.mediaPlayerModel,Aa=a.errHandler,Ba=a.streamController,Ca=a.mediaController,Da=a.adapter,Ea=a.textController,Fa=a.abrController,Ga=a.playbackController,Ha=a.type,Ia=a.streamProcessor,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0,Pa=void 0,Qa=void 0,Ra=void 0,Sa=void 0,Ta=void 0,Ua=void 0,Va=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Za=void 0,$a=void 0,_a=void 0,ab=void 0,bb=void 0;return Ja={getBufferControllerType:c,initialize:d,createBuffer:e,dischargePreBuffer:f,getType:ia,getStreamProcessor:ja,setSeekStartTime:ka,getBuffer:la,setBuffer:ma,getBufferLevel:na,getRangeAt:R,setMediaSource:oa,getMediaSource:pa,getIsBufferingCompleted:qa,switchInitData:l,getIsPruningInProgress:ra,reset:va},b(),Ja}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(141),i=d(h),j=a(97),k=d(j),l=a(96),m=d(l),n=a(104),o=d(n),p=a(110),q=d(p),r=a(47),s=d(r),t=a(53),u=d(t),v=a(197),w=d(v),x=a(48),y=d(x),z=a(46),A=d(z),B=a(203),C=d(B),D=a(215),E=d(D),F=a(50),G=d(F),H=a(235),I="bufferLoaded",J="bufferStalled",K=.5,L=.5,M=.01,N=22,O="BufferController";e.__dashjs_factory_name=O;var P=y.default.getClassFactory(e);P.BUFFER_LOADED=I,P.BUFFER_EMPTY=J,y.default.updateClassFactory(e.__dashjs_factory_name,P),c.default=P,b.exports=c.default},{101:101,104:104,110:110,141:141,197:197,203:203,215:215,235:235,46:46,47:47,48:48,50:50,53:53,96:96,97:97}],108:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){w=(0,i.default)(t).getInstance().getLogger(v),b()}function b(){F=!1,x={},y={},z={},A=null,B=100,C=B/1e3}function c(){if(!D||!E)throw new Error("setConfig function has to be called previously")}function d(){null!==A&&F&&(clearInterval(A),A=null,F=!1)}function e(){c(),w.debug("Start Event Controller"),F||isNaN(B)||(F=!0,A=setInterval(l,B))}function f(a){if(c(),x={},a)for(var b=0;b<a.length;b++){var d=a[b];x[d.id]=d,w.debug("Add inline event with id "+d.id)}w.debug("Added "+a.length+" inline events")}function g(a){c();for(var b=0;b<a.length;b++){var d=a[b];d.id in y?w.debug("Repeated event with id "+d.id):(d.eventStream.schemeIdUri===r&&void 0===y[d.id]&&h(d),y[d.id]=d,w.debug("Add inband event with id "+d.id))}}function h(a){if(a.eventStream.value==s){var b=a.eventStream.timescale||1,c=a.presentationTime/b,d=void 0;d=4294967295==a.presentationTime?NaN:(a.presentationTime+a.duration)/b,w.info("Manifest validity changed: Valid until: "+c+"; remaining duration: "+d),u.trigger(m.default.MANIFEST_VALIDITY_CHANGED,{id:a.id,validUntil:c,newDuration:d,newManifestValidAfter:NaN})}}function j(){if(z)for(var a=E.getTime(),b=Object.keys(z),c=0;c<b.length;c++){var d=b[c],e=z[d];null!==e&&(e.duration+e.presentationTime)/e.eventStream.timescale<a&&(w.debug("Remove Event "+d+" at time "+a),e=null,delete z[d])}}function l(){o(y),o(x),j()}function n(){c(),D.refreshManifest()}function o(a){var b,c=E.getTime();if(a)for(var d=Object.keys(a),e=0;e<d.length;e++){var f=d[e],g=a[f];void 0!==g&&(0===(b=g.presentationTime/g.eventStream.timescale)||b<=c&&b+C>c)&&(w.debug("Start Event "+f+" at "+c),g.duration>0&&(z[f]=g),g.eventStream.schemeIdUri==r&&g.eventStream.value==s?0===g.duration&&0===g.presentationTimeDelta||n():u.trigger(g.eventStream.schemeIdUri,{event:g}),delete a[f])}}function p(a){a&&(a.manifestUpdater&&(D=a.manifestUpdater),a.playbackController&&(E=a.playbackController))}function q(){d(),b()}var r="urn:mpeg:dash:event:2012",s=1,t=this.context,u=(0,k.default)(t).getInstance(),v=void 0,w=void 0,x=void 0,y=void 0,z=void 0,A=void 0,B=void 0,C=void 0,D=void 0,E=void 0,F=void 0;return v={addInlineEvents:f,addInbandEvents:g,stop:d,start:e,setConfig:p,reset:q},a(),v}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h),j=a(47),k=d(j),l=a(53),m=d(l);e.__dashjs_factory_name="EventController",c.default=g.default.getClassFactory(e),b.exports=c.default},{46:46,47:47,48:48,53:53}],109:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){w=(0,x.default)(m).getInstance().getLogger(v),e(),o.on(t.default.FRAGMENT_LOADING_COMPLETED,k,v),o.on(t.default.FRAGMENT_LOADING_PROGRESS,k,v)}function c(a){var b=y[a];return b||(b=(0,l.default)(m).create({metricsModel:u,fragmentLoader:(0,n.default)(m).create({metricsModel:u,mediaPlayerModel:s,errHandler:q,requestModifier:(0,p.default)(m).getInstance()})}),y[a]=b),b}function d(a){return a&&a.type&&a.type===h.HTTPRequest.INIT_SEGMENT_TYPE}function e(){for(var a in y)y[a].reset();y={}}function f(){o.off(t.default.FRAGMENT_LOADING_COMPLETED,k,this),o.off(t.default.FRAGMENT_LOADING_PROGRESS,k,this),e()}function i(a,b,c,d){var e=new j.default;return e.streamId=c,e.mediaInfo=b.mediaInfo,e.segmentType=b.type,e.start=b.startTime,e.duration=b.duration,e.end=e.start+e.duration,e.bytes=a,e.index=b.index,e.quality=b.quality,e.representationId=b.representationId,e.endFragment=d,e}function k(a){if(y[a.request.mediaType]===a.sender){var b=a.request,c=a.response,e=d(b),f=b.mediaInfo.streamInfo;if(a.error&&(a.request.mediaType!==g.default.AUDIO&&a.request.mediaType!==g.default.VIDEO&&a.request.mediaType!==g.default.FRAGMENTED_TEXT||o.trigger(t.default.SERVICE_LOCATION_BLACKLIST_ADD,{entry:a.request.serviceLocation})),!c||!f)return void w.warn("No "+b.mediaType+" bytes to push or stream is inactive.");var h=i(c,b,f.id,a.type!==t.default.FRAGMENT_LOADING_PROGRESS);o.trigger(e?t.default.INIT_FRAGMENT_LOADED:t.default.MEDIA_FRAGMENT_LOADED,{chunk:h,fragmentModel:a.sender})}}a=a||{};var m=this.context,o=(0,r.default)(m).getInstance(),q=a.errHandler,s=a.mediaPlayerModel,u=a.metricsModel,v=void 0,w=void 0,y=void 0;return v={getModel:c,isInitializationRequest:d,reset:f},b(),v}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(235),i=a(216),j=d(i),k=a(141),l=d(k),m=a(90),n=d(m),o=a(207),p=d(o),q=a(47),r=d(q),s=a(53),t=d(s),u=a(48),v=d(u),w=a(46),x=d(w);e.__dashjs_factory_name="FragmentController",c.default=v.default.getClassFactory(e),b.exports=c.default},{101:101,141:141,207:207,216:216,235:235,46:46,47:47,48:48,53:53,90:90}],110:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){J=(0,o.default)(G).getInstance().getLogger(I),z()}function b(a,b){var c=l(a),e=d(a,b),f=[];if(a===g.default.FRAGMENTED_TEXT)return void h(e[0]);c||(c=O.getSavedMediaSettings(a),j(a,c)),e&&0!==e.length&&(c&&e.forEach(function(a){B(c,a)&&f.push(a)}),h(0===f.length?E(e):f.length>1?E(f):f[0]))}function c(a){if(a){var b=a.type;if(w(b)){var c=a.streamInfo.id;K[c]||(K[c]=F());for(var d=K[c][b].list,f=0,g=d.length;f<g;++f)if(x(d[f],a))return;d.push(a);var i=l(b);i&&B(i,a)&&!e(b,a.streamInfo)&&h(a)}}}function d(a,b){if(!a||!b)return[];var c=b.id;return K[c]&&K[c][a]?K[c][a].list:[]}function e(a,b){return!a||!b||b&&!K[b.id]?null:K[b.id][a].current}function f(a){if(!a)return!1;var b=a.type,c=a.streamInfo.id;return K[c]&&K[c][b]&&x(K[c][b].current,a)}function h(a){if(a){var b=a.type,c=a.streamInfo,d=c.id,f=e(b,c);if(K[d]&&K[d][b]&&!x(a,f)){K[d][b].current=a,K[d][b].current&&H.trigger(i.default.CURRENT_TRACK_CHANGED,{oldMediaInfo:f,newMediaInfo:a,switchMode:N[b]});var g=A(a);g&&K[d][b].storeLastSettings&&(g.roles&&(g.role=g.roles[0],delete g.roles),g.accessibility&&(g.accessibility=g.accessibility[0]),g.audioChannelConfiguration&&(g.audioChannelConfiguration=g.audioChannelConfiguration[0]),O.setSavedMediaSettings(b,g))}}}function j(a,b){a&&b&&(L[a]=b)}function l(a){return a?L[a]:null}function m(a,b){if(-1===P.indexOf(b))return void J.warn("Track switch mode is not supported: "+b);N[a]=b}function n(a){return N[a]}function u(a){if(-1===Q.indexOf(a))return void J.warn("Track selection mode is not supported: "+a);M=a}function v(){return M||t}function w(a){return a===g.default.AUDIO||a===g.default.VIDEO||a===g.default.TEXT||a===g.default.FRAGMENTED_TEXT||a===g.default.IMAGE}function x(a,b){if(!a&&!b)return!0;if(!a||!b)return!1;var c=a.id===b.id,d=a.viewpoint===b.viewpoint,e=a.lang===b.lang,f=a.roles.toString()===b.roles.toString(),g=a.accessibility.toString()===b.accessibility.toString(),h=a.audioChannelConfiguration.toString()===b.audioChannelConfiguration.toString();return c&&d&&e&&f&&g&&h}function y(a){a&&a.domStorage&&(O=a.domStorage)}function z(){K={},D(),C()}function A(a){var b={lang:a.lang,viewpoint:a.viewpoint,roles:a.roles,accessibility:a.accessibility,audioChannelConfiguration:a.audioChannelConfiguration};return b.lang||b.viewpoint||b.role&&b.role.length>0||b.accessibility&&b.accessibility.length>0||b.audioChannelConfiguration&&b.audioChannelConfiguration.length>0?b:null}function B(a,b){var c=!a.lang||a.lang===b.lang,d=!a.viewpoint||a.viewpoint===b.viewpoint,e=!a.role||!!b.roles.filter(function(b){return b===a.role})[0],f=!a.accessibility||!!b.accessibility.filter(function(b){return b===a.accessibility})[0],g=!a.audioChannelConfiguration||!!b.audioChannelConfiguration.filter(function(b){return b===a.audioChannelConfiguration})[0];return c&&d&&e&&f&&g}function C(){N={audio:q,video:p}}function D(){L={audio:null,video:null}}function E(a){var b=v(),c=[],d=function(a){var b=0,c=[],d=void 0;return a.forEach(function(a){d=Math.max.apply(Math,a.bitrateList.map(function(a){return a.bandwidth})),d>b?(b=d,c=[a]):d===b&&c.push(a)}),c},e=function(a){var b=0,c=[],d=void 0;return a.forEach(function(a){d=a.representationCount,d>b?(b=d,c=[a]):d===b&&c.push(a)}),c};switch(b){case r:c=d(a),c.length>1&&(c=e(c));break;case s:c=e(a),c.length>1&&(c=d(a));break;default:J.warn("Track selection mode is not supported: "+b)}return c[0]}function F(){return{audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},fragmentedText:{list:[],storeLastSettings:!0,current:null},image:{list:[],storeLastSettings:!0,current:null}}}var G=this.context,H=(0,k.default)(G).getInstance(),I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=[q,p],Q=[r,s];return I={checkInitialMediaSettingsForType:b,addTrack:c,getTracksFor:d,getCurrentTrackFor:e,isCurrentTrack:f,setTrack:h,setInitialSettings:j,getInitialSettings:l,setSwitchMode:m,getSwitchMode:n,setSelectionModeForInitialTrack:u,getSelectionModeForInitialTrack:v,isMultiTrackSupportedByType:w,isTracksEqual:x,setConfig:y,reset:z},a(),I}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(53),i=d(h),j=a(47),k=d(j),l=a(48),m=d(l),n=a(46),o=d(n),p="neverReplace",q="alwaysReplace",r="highestBitrate",s="widestRange",t=r;e.__dashjs_factory_name="MediaController";var u=m.default.getSingletonFactory(e);u.TRACK_SWITCH_MODE_NEVER_REPLACE=p,u.TRACK_SWITCH_MODE_ALWAYS_REPLACE=q,u.TRACK_SELECTION_MODE_HIGHEST_BITRATE=r,u.TRACK_SELECTION_MODE_WIDEST_RANGE=s,u.DEFAULT_INIT_TRACK_SELECTION_MODE=t,m.default.updateSingletonFactory(e.__dashjs_factory_name,u),c.default=u,b.exports=c.default},{101:101,46:46,47:47,48:48,53:53}],111:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){j=(0,i.default)(k).getInstance().getLogger(h)}function b(){var a="WebKitMediaSource"in window;return"MediaSource"in window?new MediaSource:a?new WebKitMediaSource:null}function c(a,b){var c=window.URL.createObjectURL(a);return b.setSource(c),c}function d(a){a.setSource(null)}function e(a,b){return a.duration!=b&&(a.duration=b),a.duration}function f(a,b,c){a&&"function"==typeof a.setLiveSeekableRange&&"function"==typeof a.clearLiveSeekableRange&&"open"===a.readyState&&b>=0&&b<c&&(a.clearLiveSeekableRange(),a.setLiveSeekableRange(b,c))}function g(a){var b=a.sourceBuffers,c=b.length;if("open"===a.readyState){for(var d=0;d<c;d++){if(b[d].updating)return;if(0===b[d].buffered.length)return}j.info("call to mediaSource endOfStream"),a.endOfStream()}}var h=void 0,j=void 0,k=this.context;return h={createMediaSource:b,attachMediaSource:c,detachMediaSource:d,setDuration:e,setSeekable:f,signalEndOfStream:g},a(),h}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h);e.__dashjs_factory_name="MediaSourceController", +c.default=g.default.getSingletonFactory(e),b.exports=c.default},{46:46,48:48}],112:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){pa=(0,q.default)(ma).getInstance().getLogger(oa),D()}function b(a,b){Da=a,ka(),Ea=Da.manifestInfo.isDynamic,Ka=!1,La=!1,ya=Da.start,Ja=b;var d="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",e=/safari/.test(d)&&!/chrome/.test(d);Ma=e?.25:.02,na.on(m.default.DATA_UPDATE_COMPLETED,L,this),na.on(m.default.BYTES_APPENDED_END_FRAGMENT,ga,this),na.on(m.default.LOADING_PROGRESS,ha,this),na.on(m.default.BUFFER_LEVEL_STATE_CHANGED,ia,this),na.on(m.default.PERIOD_SWITCH_STARTED,c,this),na.on(m.default.PLAYBACK_PROGRESS,ba,this),na.on(m.default.PLAYBACK_TIME_UPDATED,ba,this),na.on(m.default.PLAYBACK_ENDED,Z,this),Ga&&(Ga=!1,f())}function c(a){!Ea&&a.fromStreamInfo&&void 0!==Aa[a.fromStreamInfo.id]&&(delete Ca[a.fromStreamInfo.id],delete Aa[a.fromStreamInfo.id])}function d(){return parseFloat((e()-p()).toFixed(5))}function e(){var a=G(!0),b=Ea?a-Da.start:0;return a+(Da.duration-b)}function f(){Da&&wa&&wa.getElement()?wa.play():Ga=!0}function h(){return Da&&wa?wa.isPaused():null}function j(){Da&&wa&&wa.pause()}function l(){return Da&&wa?wa.isSeeking():null}function n(a,b,c){Da&&wa&&(!0===c?a!==wa.getTime()&&(wa.removeEventListener("seeking",R),pa.info("Requesting seek to time: "+a),wa.setCurrentTime(a,b)):(na.trigger(m.default.PLAYBACK_SEEK_ASKED),pa.info("Requesting seek to time: "+a),wa.setCurrentTime(a,b)))}function o(){var a=ra.getReadOnlyMetricsFor(g.default.VIDEO)||ra.getReadOnlyMetricsFor(g.default.AUDIO),b=sa.getCurrentDVRInfo(a);n((b?b.range:null).end-Fa.getLiveDelay(),!0,!1)}function p(){return Da&&wa?wa.getTime():null}function s(){var a=p();if(Ea&&!isNaN(Ia)){var b=Ia/1e3;a>b&&(a-=b)}return a}function t(){return Da&&wa?wa.getPlaybackRate():null}function u(){return Da&&wa?wa.getPlayedRanges():null}function v(){return Da&&wa?wa.getEnded():null}function w(){return Ea}function x(){return qa}function y(a){ya=a}function z(){return ya}function A(a,b){var c=ua.getMpd(ta.getValue()),d=void 0,e=void 0;if(d=Fa.getUseSuggestedPresentationDelay()&&c.hasOwnProperty(g.default.SUGGESTED_PRESENTATION_DELAY)?c.suggestedPresentationDelay:Fa.getLowLatencyEnabled()?0:Fa.getLiveDelay()?Fa.getLiveDelay():isNaN(a)?2*Da.manifestInfo.minBufferTime:a*Fa.getLiveDelayFragmentCount(),c.availabilityStartTime&&(Ia=c.availabilityStartTime.getTime()),b>0){var f=Math.max(b-10,b/2);e=Math.min(d,f)}else e=d;return Ba=e,e}function B(){return Ba}function C(){if(!Ea||isNaN(Ia))return NaN;var a=s();if(isNaN(a)||0===a)return 0;var b=(new Date).getTime()+1e3*xa.getClientTimeOffset();return Math.max(((b-Ia-1e3*a)/1e3).toFixed(3),0)}function D(){ya=NaN,Ga=!1,Aa={},Ba=0,Ia=0,Ca={},wa&&(na.off(m.default.DATA_UPDATE_COMPLETED,L,this),na.off(m.default.BUFFER_LEVEL_STATE_CHANGED,ia,this),na.off(m.default.BYTES_APPENDED_END_FRAGMENT,ga,this),na.off(m.default.LOADING_PROGRESS,ha,this),na.off(m.default.PERIOD_SWITCH_STARTED,c,this),na.off(m.default.PLAYBACK_PROGRESS,ba,this),na.off(m.default.PLAYBACK_TIME_UPDATED,ba,this),na.off(m.default.PLAYBACK_ENDED,Z,this),J(),la()),za=null,wa=null,Da=null,Ea=null}function E(a){a&&(a.streamController&&(qa=a.streamController),a.metricsModel&&(ra=a.metricsModel),a.dashMetrics&&(sa=a.dashMetrics),a.manifestModel&&(ta=a.manifestModel),a.dashManifestModel&&(ua=a.dashManifestModel),a.mediaPlayerModel&&(Fa=a.mediaPlayerModel),a.adapter&&(va=a.adapter),a.videoModel&&(wa=a.videoModel),a.timelineConverter&&(xa=a.timelineConverter),a.uriFragmentModel&&(Na=a.uriFragmentModel))}function F(){var a=Na.getURIFragmentData(),b=void 0;if(a){b={};var c=parseInt(a.r,10);c>=0&&Da&&c<Da.manifestInfo.DVRWindowSize&&null===a.t&&(a.t=Math.floor(Date.now()/1e3)-Da.manifestInfo.DVRWindowSize+c),b.fragS=parseFloat(a.s),b.fragT=parseFloat(a.t)}return b}function G(a,b){var c=void 0,d=NaN;if(a)d=Da.start;else{var e=F();d=e?isNaN(e.fragS)?e.fragT:e.fragS:0}if(Ea)isNaN(d)||((c=d-Da.manifestInfo.availableFrom.getTime()/1e3)>ya||c<(isNaN(b)?NaN:b-Da.manifestInfo.DVRWindowSize))&&(c=null),c=c||ya;else if(!isNaN(d)&&d<Math.max(Da.manifestInfo.duration,Da.duration)&&d>=0)c=d;else{var f=Aa[Da.id];c=void 0!==f?Math.max(void 0!==f.audio?f.audio:0,void 0!==f.video?f.video:0,Da.start):Da.start}return c}function H(a){var b=ra.getReadOnlyMetricsFor(g.default.VIDEO)||ra.getReadOnlyMetricsFor(g.default.AUDIO),c=sa.getCurrentDVRInfo(b),d=c?c.range:null,e=void 0;if(!d)return NaN;if(a>d.end)e=Math.max(d.end-2*Da.manifestInfo.minBufferTime,d.start);else{if(!(a+.25<d.start))return a;e=d.start}return e}function I(){if(null===za){var a=function(){_()};za=setInterval(a,Fa.getWallclockTimeUpdateInterval())}}function J(){clearInterval(za),za=null}function K(){if(!h()&&Ea&&0!==wa.getReadyState()){var a=s(),b=H(a);!isNaN(b)&&b!==a&&n(b)}}function L(a){if(!a.error){var b=va.convertDataToRepresentationInfo(a.currentRepresentation),c=b.mediaInfo.streamInfo;Da.id===c.id&&(Da=c,K())}}function M(){na.trigger(m.default.CAN_PLAY)}function N(){pa.info("Native video element event: play"),K(),I(),na.trigger(m.default.PLAYBACK_STARTED,{startTime:p()})}function O(){pa.info("Native video element event: waiting"),na.trigger(m.default.PLAYBACK_WAITING,{playingTime:p()})}function P(){pa.info("Native video element event: playing"),na.trigger(m.default.PLAYBACK_PLAYING,{playingTime:p()})}function Q(){pa.info("Native video element event: pause"),na.trigger(m.default.PLAYBACK_PAUSED,{ended:v()})}function R(){var a=p();pa.info("Seeking to: "+a),I(),na.trigger(m.default.PLAYBACK_SEEKING,{seekTime:a})}function S(){pa.info("Native video element event: seeked"),na.trigger(m.default.PLAYBACK_SEEKED),wa.addEventListener("seeking",R)}function T(){na.trigger(m.default.PLAYBACK_TIME_UPDATED,{timeToEnd:d(),time:p()})}function U(){var a=Date.now();(!Ha||a>Ha+r)&&(Ha=a,T())}function V(){na.trigger(m.default.PLAYBACK_PROGRESS)}function W(){var a=t();pa.info("Native video element event: ratechange: ",a),na.trigger(m.default.PLAYBACK_RATE_CHANGED,{playbackRate:a})}function X(){pa.info("Native video element event: loadedmetadata"),na.trigger(m.default.PLAYBACK_METADATA_LOADED),I()}function Y(){pa.info("Native video element event: ended"),j(),J(),na.trigger(m.default.PLAYBACK_ENDED,{isLast:qa.getActiveStreamInfo().isLast})}function Z(a){za&&a.isLast&&(pa.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended"),wa.setCurrentTime(e()),j(),J())}function $(a){var b=a.target||a.srcElement;na.trigger(m.default.PLAYBACK_ERROR,{error:b.error})}function _(){na.trigger(m.default.WALLCLOCK_TIME_UPDATED,{isDynamic:Ea,time:new Date}),w()&&h()&&U()}function aa(a,b){if(b&&b.length>0)for(var c=0,d=b.length;c<d;c++)if(a>=b.start(c)&&a<b.end(c))return!0;return!1}function ba(){Ea&&Fa.getLowLatencyEnabled()&&!h()&&!l()&&(da()?ea():fa())}function ca(){var a=null;return qa.getActiveStreamProcessors().forEach(function(b){var c=b.getBufferLevel();a=null===a?c:Math.min(a,c)}),a}function da(){return Fa.getCatchUpPlaybackRate()>0&&p()>0&&Math.abs(C()-Fa.getLiveDelay())>Fa.getLowLatencyMinDrift()}function ea(){if(wa){var a=Fa.getCatchUpPlaybackRate(),b=Fa.getLiveDelay(),c=C()-b,d=5*c,e=2*a/(1+Math.pow(Math.E,-d)),f=1-a+e;if(La){ca()>b/2?La=!1:c>0&&(f=1)}Math.abs(wa.getPlaybackRate()-f)>Ma&&wa.setPlaybackRate(f),Fa.getLowLatencyMaxDriftBeforeSeeking()>0&&!Ka&&c>Fa.getLowLatencyMaxDriftBeforeSeeking()?(pa.info("Low Latency catchup mechanism. Latency too high, doing a seek to live point"),Ka=!0,o()):Ka=!1}}function fa(){wa&&wa.setPlaybackRate(1)}function ga(a){var b=void 0,c=void 0,d=a.bufferedRanges;if(d&&d.length&&(!Aa[Da.id]||!0!==Aa[Da.id].started)){var e=a.sender.getType();void 0===Ca[Da.id]&&(Ca[Da.id]=[]),Ca[Da.id][e]=d,void 0===Aa[Da.id]&&(Aa[Da.id]=[],Aa[Da.id].started=!1),void 0===Aa[Da.id][e]&&(Aa[Da.id][e]=Math.max(d.start(0),Da.start));var f=qa.isTrackTypePresent(g.default.VIDEO),h=qa.isTrackTypePresent(g.default.AUDIO);c=G(!1),h&&f?isNaN(Aa[Da.id].audio)||isNaN(Aa[Da.id].video)||(Aa[Da.id].audio<Aa[Da.id].video?(b=Aa[Da.id].video>c?Aa[Da.id].video:c,d=Ca[Da.id].audio):(b=Aa[Da.id].audio>c?Aa[Da.id].audio:c,d=Ca[Da.id].video),aa(b,d)&&(l()||Ja||0===b||n(b,!0,!0),Aa[Da.id].started=!0)):Aa[Da.id][e]&&(b=Aa[Da.id][e]>c?Aa[Da.id][e]:c,l()||Ja||n(b,!1,!0),Aa[Da.id].started=!0)}}function ha(a){if(!1===a.stream&&Fa.getLowLatencyEnabled()&&!isNaN(a.request.duration)){var b=1.2*a.request.duration;b>Fa.getLiveDelay()&&(pa.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",b.toFixed(2)),Fa.setLiveDelay(b))}}function ia(a){a.streamInfo.id===Da.id&&(a.state!==i.default.BUFFER_EMPTY||l()||La||(La=!0,Fa.getLowLatencyEnabled()||fa()))}function ja(a){na.trigger(m.default.PLAYBACK_STALLED,{e:a})}function ka(){wa.addEventListener("canplay",M),wa.addEventListener("play",N),wa.addEventListener("waiting",O),wa.addEventListener("playing",P),wa.addEventListener("pause",Q),wa.addEventListener("error",$),wa.addEventListener("seeking",R),wa.addEventListener("seeked",S),wa.addEventListener("timeupdate",T),wa.addEventListener("progress",V),wa.addEventListener("ratechange",W),wa.addEventListener("loadedmetadata",X),wa.addEventListener("stalled",ja),wa.addEventListener("ended",Y)}function la(){wa.removeEventListener("canplay",M),wa.removeEventListener("play",N),wa.removeEventListener("waiting",O),wa.removeEventListener("playing",P),wa.removeEventListener("pause",Q),wa.removeEventListener("error",$),wa.removeEventListener("seeking",R),wa.removeEventListener("seeked",S),wa.removeEventListener("timeupdate",T),wa.removeEventListener("progress",V),wa.removeEventListener("ratechange",W),wa.removeEventListener("loadedmetadata",X),wa.removeEventListener("stalled",ja),wa.removeEventListener("ended",Y)}var ma=this.context,na=(0,k.default)(ma).getInstance(),oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0;return oa={initialize:b,setConfig:E,getStartTimeFromUriParameters:F,getStreamStartTime:G,getTimeToStreamEnd:d,getTime:p,getNormalizedTime:s,getPlaybackRate:t,getPlayedRanges:u,getEnded:v,getIsDynamic:w,getStreamController:x,setLiveStartTime:y,getLiveStartTime:z,computeLiveDelay:A,getLiveDelay:B,getCurrentLiveLatency:C,play:f,isPaused:h,pause:j,isSeeking:l,seek:n,reset:D},a(),oa}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(107),i=d(h),j=a(47),k=d(j),l=a(53),m=d(l),n=a(48),o=d(n),p=a(46),q=d(p),r=500;e.__dashjs_factory_name="PlaybackController",c.default=o.default.getSingletonFactory(e),b.exports=c.default},{101:101,107:107,46:46,47:47,48:48,53:53}],113:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){ua=(0,z.default)(ea).getInstance().getLogger(ta),ca()}function c(){va=ra.getFragmentModel(),Ga=(0,n.default)(ea).create({abrController:ma,dashMetrics:ia,metricsModel:ga,mediaPlayerModel:la,textController:pa}),Ha=(0,p.default)(ea).create({adapter:ha,textController:pa}),ja.getIsTextTrack(a.mimeType)&&fa.on(v.default.TIMED_TEXT_REQUESTED,Q,this),fa.on(v.default.QUALITY_CHANGE_REQUESTED,y,this),fa.on(v.default.DATA_UPDATE_STARTED,L,this),fa.on(v.default.DATA_UPDATE_COMPLETED,D,this),fa.on(v.default.FRAGMENT_LOADING_COMPLETED,H,this),fa.on(v.default.STREAM_COMPLETED,G,this),fa.on(v.default.STREAM_INITIALIZED,E,this),fa.on(v.default.BUFFER_LEVEL_STATE_CHANGED,N,this),fa.on(v.default.BUFFER_CLEARED,M,this),fa.on(v.default.BYTES_APPENDED_END_FRAGMENT,J,this),fa.on(v.default.INIT_REQUESTED,q,this),fa.on(v.default.QUOTA_EXCEEDED,O,this),fa.on(v.default.PLAYBACK_SEEKING,S,this),fa.on(v.default.PLAYBACK_STARTED,R,this),fa.on(v.default.PLAYBACK_RATE_CHANGED,T,this),fa.on(v.default.PLAYBACK_TIME_UPDATED,I,this),fa.on(v.default.URL_RESOLUTION_FAILED,P,this),fa.on(v.default.FRAGMENT_LOADING_ABANDONED,K,this)}function d(){return!1===ya}function e(){if(!wa||ra.isBufferingCompleted())return void ua.warn("Start denied to Schedule Controller");ua.debug("Schedule Controller starts"),ba(),ya=!1,xa&&(xa=!1),o(0)}function f(){ya||(ua.debug("Schedule Controller stops"),ya=!0,clearTimeout(Ea))}function i(a,b){Ja[b]=Ja[b]||{};var c=ma.getTopQualityIndexFor(a,b);return Ja[b][a]!=c&&(ua.info("Top quality "+a+" index has changed from "+Ja[b][a]+" to "+c),Ja[b][a]=c,!0)}function k(){var a=ra.getBufferController();if(ya||Ca||!a||na.isPaused()&&!la.getScheduleWhilePaused()||(qa===g.default.FRAGMENTED_TEXT||qa===g.default.TEXT)&&!pa.isTextEnabled())return void ua.debug("Schedule stop!");if(a.getIsBufferingCompleted())return void ua.debug("Schedule stop because buffering is completed!");m();var b=La.length>0,c=ra.getStreamInfo();if(Na||isNaN(Ka)||Ma||b||i(wa.mediaInfo.type,c.id)||Ga.execute(ra,oa.isTrackTypePresent(g.default.VIDEO))){var d=function(){var a=ra.getFragmentController();if(wa.quality!==Ka)ua.debug("Quality has changed, get init request for representationid = "+wa.id),Ka=wa.quality,ra.switchInitData(wa.id);else if(Ma)ua.debug("Switch track has been asked, get init request for "+qa+" with representationid = "+wa.id),Na=sa.getSwitchMode(qa)===B.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE,ra.switchInitData(wa.id,Na),Ka=wa.quality,Ma=!1;else{var b=La.shift();if(a.isInitializationRequest(b))ra.switchInitData(b.representationId);else{var d=void 0;ra.getBufferController().getIsPruningInProgress()||!(d=Ha.execute(ra,b))&&c.manifestInfo&&c.manifestInfo.isDynamic&&ua.debug("Next fragment seems to be at the bleeding live edge and is not available yet. Rescheduling."),d?(ua.debug("Next fragment request url is "+d.url),va.executeRequest(d)):(s(!1),o(la.getLowLatencyEnabled()?100:500))}}};s(!0),b||Ma||ma.checkPlaybackQuality(qa),d()}else o(500)}function m(){var a=1.5*wa.fragmentDuration,b=va.getRequests({state:r.default.FRAGMENT_MODEL_EXECUTED,time:na.getTime()+a,threshold:0})[0];if(b&&-1===La.indexOf(b)&&!ja.getIsTextTrack(qa)){var c=la.getFastSwitchEnabled(),d=ra.getBufferLevel(),e=ma.getAbandonmentStateFor(qa),f=!sa.isCurrentTrack(b.mediaInfo)&&sa.getSwitchMode(b.mediaInfo.type)===B.default.TRACK_SWITCH_MODE_NEVER_REPLACE,g=b.quality<wa.quality;c&&(f||g)&&d>=a&&e!==j.default.ABANDON_LOAD?(x(b),ua.debug("Reloading outdated fragment at index: ",b.index)):b.quality>wa.quality&&V(na.getTime()+ra.getBufferLevel())}}function o(a){clearTimeout(Ea),Ea=setTimeout(k,a)}function q(a){a.sender&&a.sender.getStreamProcessor()===ra&&u(wa.quality)}function s(a){Ca!==a?Ca=a:ua.debug("isFragmentProcessingInProgress is already equal to",a)}function u(a){var b=ha.getInitRequest(ra,a);b&&(s(!0),b.url=(0,C.replaceTokenForTemplate)(b.url,"Bandwidth",wa?wa.bandwidth:null),va.executeRequest(b))}function w(){Ma=!0}function x(a){La.push(a)}function y(a){if(qa===a.mediaType&&ra.getStreamInfo().id===a.streamInfo.id){if(null===(wa=ra.getRepresentationInfo(a.newQuality))||void 0===wa)throw new Error("Unexpected error! - currentRepresentationInfo is null or undefined");aa(new Date,h.PlayListTrace.REPRESENTATION_SWITCH_STOP_REASON),ba()}}function A(a){if(na&&va){var b=va.getRequests({state:r.default.FRAGMENT_MODEL_EXECUTED,time:na.getTime(),threshold:0})[0];b&&na.getTime()>=b.startTime&&((!Ia.mediaInfo||b.mediaInfo.type===Ia.mediaInfo.type&&b.mediaInfo.id!==Ia.mediaInfo.id)&&a&&fa.trigger(v.default.TRACK_CHANGE_RENDERED,{mediaType:qa,oldMediaInfo:Ia.mediaInfo,newMediaInfo:b.mediaInfo}),b.quality===Ia.quality&&b.adaptationIndex===Ia.adaptationIndex||!a||fa.trigger(v.default.QUALITY_CHANGE_RENDERED,{mediaType:qa,oldQuality:Ia.quality,newQuality:b.quality}),Ia={mediaInfo:b.mediaInfo,quality:b.quality,adaptationIndex:b.adaptationIndex})}}function D(a){a.error||a.sender.getStreamProcessor()!==ra||(wa=ha.convertDataToRepresentationInfo(a.currentRepresentation))}function E(a){a.error||ra.getStreamInfo().id!==a.streamInfo.id||(wa=ra.getRepresentationInfo(),xa&&(na.getIsDynamic()?(ka.setTimeSyncCompleted(!0),F()):(Fa=na.getStreamStartTime(!1),ra.getBufferController().setSeekStartTime(Fa))),ya&&e())}function F(){var a=ra.getLiveEdgeFinder();if(a){var b=a.getLiveEdge(),c=wa.mediaInfo.streamInfo.manifestInfo.DVRWindowSize/2,d=b-na.computeLiveDelay(wa.fragmentDuration,c),e=ha.getFragmentRequest(ra,wa,d,{ignoreIsFinished:!0});if(e)if(la.getLowLatencyEnabled()){var f=e.duration<la.getLiveDelay()?e.startTime:e.startTime+e.duration-la.getLiveDelay();na.setLiveStartTime(f)}else na.setLiveStartTime(e.startTime);else ua.debug("setLiveEdgeSeekTarget : getFragmentRequest returned undefined request object");Fa=na.getStreamStartTime(!1,b),ra.getBufferController().setSeekStartTime(Fa),Fa>wa.mediaInfo.streamInfo.start+wa.mediaInfo.streamInfo.duration&&na.seek(Fa);var h=ia.getCurrentManifestUpdate(ga.getMetricsFor(g.default.STREAM));ga.updateManifestUpdateInfo(h,{currentTime:Fa,presentationStartTime:b,latency:b-Fa,clientTimeOffset:ka.getClientTimeOffset()})}}function G(a){a.fragmentModel===va&&(f(),s(!1),ua.info("Stream is complete"))}function H(a){a.sender===va&&(ua.info("OnFragmentLoadingCompleted - Url:",a.request?a.request.url:"undefined",", Range:",a.request.range?a.request.range:"undefined"),ja.getIsTextTrack(qa)&&s(!1),a.error&&a.request.serviceLocation&&!ya&&(x(a.request),s(!1),o(0)),Na&&(Oa=a.request))}function I(){A(!0)}function J(a){a.sender.getStreamProcessor()===ra&&(Na&&!isNaN(a.startTime)&&(Na=!1,va.addExecutedRequest(Oa)),s(!1),o(0))}function K(a){a.streamProcessor===ra&&(ua.info("onFragmentLoadingAbandoned for "+qa+", request: "+a.request.url+" has been aborted"),na.isSeeking()||Ma||(ua.info("onFragmentLoadingAbandoned for "+qa+", request: "+a.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),x(a.request)),s(!1),o(0))}function L(a){a.sender.getStreamProcessor()===ra&&f()}function M(a){a.sender.getStreamProcessor()===ra&&(a.unintended?ra.getFragmentModel().removeExecutedRequestsAfterTime(a.from,ra.getStreamInfo().duration):ra.getFragmentModel().syncExecutedRequestsWithBufferedRange(ra.getBufferController().getBuffer().getAllBufferRanges(),ra.getStreamInfo().duration),a.hasEnoughSpaceToAppend&&ya&&e())}function N(a){a.sender.getStreamProcessor()!==ra||a.state!==l.default.BUFFER_EMPTY||na.isSeeking()||(ua.info("Buffer is empty! Stalling!"),aa(new Date,h.PlayListTrace.REBUFFERING_REASON))}function O(a){a.sender.getStreamProcessor()===ra&&(f(),s(!1))}function P(){va.abortRequests(),f()}function Q(a){a.sender.getStreamProcessor()===ra&&pa.isTextEnabled()&&u(a.index)}function R(){!ya&&la.getScheduleWhilePaused()||e()}function S(a){Fa=a.seekTime,W(0),ya&&e();var b=ia.getCurrentManifestUpdate(ga.getMetricsFor(g.default.STREAM)),c=wa.DVRWindow&&na?wa.DVRWindow.end-na.getTime():NaN;ga.updateManifestUpdateInfo(b,{latency:c}),Ca?(ua.debug("onPlaybackSeeking for "+qa+", call fragmentModel.abortRequests in order to seek quicker"),va.abortRequests()):o(0)}function T(a){Aa&&(Aa.playbackspeed=a.playbackRate.toString())}function U(){return Fa}function V(a){Fa=a}function W(a){Da=a}function X(){return Da}function Y(){return Ga.getBufferTarget(ra,oa.isTrackTypePresent(g.default.VIDEO))}function Z(){return qa}function $(a){za=a}function _(a,b){aa(a,b),za=null}function aa(a,b){if(za&&!1===Ba){var c=Aa.start,d=a.getTime()-c.getTime();Aa.duration=d,Aa.stopreason=b,za.trace.push(Aa),Ba=!0}}function ba(){za&&!0===Ba&&wa&&(Ba=!1,Aa=new h.PlayListTrace,Aa.representationid=wa.id,Aa.start=new Date,Aa.mstart=1e3*na.getTime(),Aa.playbackspeed=na.getPlaybackRate().toString())}function ca(){Ca=!1,Da=0,Fa=NaN,za=null,Aa=null,Ba=!0,xa=!0,Ka=NaN,Ia={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},Ja={},La=[],ya=!0,Ma=!1,Na=!1,Oa=null}function da(){fa.off(v.default.DATA_UPDATE_STARTED,L,this),fa.off(v.default.DATA_UPDATE_COMPLETED,D,this),fa.off(v.default.BUFFER_LEVEL_STATE_CHANGED,N,this),fa.off(v.default.QUALITY_CHANGE_REQUESTED,y,this),fa.off(v.default.FRAGMENT_LOADING_COMPLETED,H,this),fa.off(v.default.STREAM_COMPLETED,G,this),fa.off(v.default.STREAM_INITIALIZED,E,this),fa.off(v.default.QUOTA_EXCEEDED,O,this),fa.off(v.default.BYTES_APPENDED_END_FRAGMENT,J,this),fa.off(v.default.BUFFER_CLEARED,M,this),fa.off(v.default.INIT_REQUESTED,q,this),fa.off(v.default.PLAYBACK_RATE_CHANGED,T,this),fa.off(v.default.PLAYBACK_SEEKING,S,this),fa.off(v.default.PLAYBACK_STARTED,R,this),fa.off(v.default.PLAYBACK_TIME_UPDATED,I,this),fa.off(v.default.URL_RESOLUTION_FAILED,P,this),fa.off(v.default.FRAGMENT_LOADING_ABANDONED,K,this),ja.getIsTextTrack(qa)&&fa.off(v.default.TIMED_TEXT_REQUESTED,Q,this),f(),A(!1),ca()}a=a||{};var ea=this.context,fa=(0,t.default)(ea).getInstance(),ga=a.metricsModel,ha=a.adapter,ia=a.dashMetrics,ja=a.dashManifestModel,ka=a.timelineConverter,la=a.mediaPlayerModel,ma=a.abrController,na=a.playbackController,oa=a.streamController,pa=a.textController,qa=a.type,ra=a.streamProcessor,sa=a.mediaController,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0;return ta={initialize:c,getType:Z,getSeekTarget:U,setSeekTarget:V,setTimeToLoadDelay:W,getTimeToLoadDelay:X,replaceRequest:x,switchTrackAsked:w,isStarted:d,start:e,stop:f,reset:da,setPlayList:$,getBufferTarget:Y,finalisePlayList:_},b(),ta}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(237),i=a(104),j=d(i),k=a(107),l=d(k),m=a(186),n=d(m),o=a(187),p=d(o),q=a(141),r=d(q),s=a(47),t=d(s),u=a(53),v=d(u),w=a(48),x=d(w),y=a(46),z=d(y),A=a(110),B=d(A),C=a(77);e.__dashjs_factory_name="ScheduleController",c.default=x.default.getClassFactory(e),b.exports=c.default},{101:101,104:104,107:107,110:110,141:141,186:186,187:187,237:237,46:46,47:47,48:48,53:53,77:77}],114:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){na=(0,v.default)(ka).getInstance().getLogger(ma),xa=(0,D.default)(ka).getInstance(),ya=(0,F.default)(ka).getInstance(),wa=(0,H.default)(ka).getInstance(),Da=(0,x.default)(ka).getInstance(),Ea=(0,z.default)(ka).getInstance(),ga()}function b(a,b){_(),La=a,Ka=b,Ga.initialize(),pa=(0,m.default)(ka).create(),pa.setConfig({manifestModel:ra,dashManifestModel:sa,mediaPlayerModel:Sa,manifestLoader:qa,errHandler:Fa}),pa.initialize(),ya.setConfig({dashManifestModel:sa}),c()}function c(){la.on(q.default.PLAYBACK_TIME_UPDATED,e,this),la.on(q.default.PLAYBACK_SEEKING,j,this),la.on(q.default.PLAYBACK_ERROR,Y,this),la.on(q.default.PLAYBACK_STARTED,l,this),la.on(q.default.PLAYBACK_PAUSED,n,this),la.on(q.default.PLAYBACK_ENDED,E,this),la.on(q.default.MANIFEST_UPDATED,T,this),la.on(q.default.STREAM_BUFFERING_COMPLETED,u,this),la.on(q.default.MANIFEST_VALIDITY_CHANGED,da,this),la.on(q.default.TIME_SYNCHRONIZATION_COMPLETED,S,this),la.on(q.default.WALLCLOCK_TIME_UPDATED,f,this),la.on(B.default.METRIC_ADDED,ia,this)}function d(){la.off(q.default.PLAYBACK_TIME_UPDATED,e,this),la.off(q.default.PLAYBACK_SEEKING,j,this),la.off(q.default.PLAYBACK_ERROR,Y,this),la.off(q.default.PLAYBACK_STARTED,l,this),la.off(q.default.PLAYBACK_PAUSED,n,this),la.off(q.default.PLAYBACK_ENDED,E,this),la.off(q.default.MANIFEST_UPDATED,T,this),la.off(q.default.STREAM_BUFFERING_COMPLETED,u,this),la.off(q.default.MANIFEST_VALIDITY_CHANGED,da,this),la.off(q.default.TIME_SYNCHRONIZATION_COMPLETED,S,this),la.off(q.default.WALLCLOCK_TIME_UPDATED,f,this),la.off(B.default.METRIC_ADDED,ia,this)}function e(){if(U(g.default.VIDEO)){var a=Qa.getPlaybackQuality();a&&ua.addDroppedFrames(g.default.VIDEO,a)}}function f(){if(!(!Sa.getJumpGaps()||!Ia||0===Ia.getProcessors().length||Ra.isSeeking()||Ta||Ma||Na||Oa)&&++_a>=ja){var a=Ra.getTime();db===a?h(a):db=a,_a=0}}function h(a){for(var b=Ia.getProcessors(),c=Sa.getSmallGapLimit(),d=void 0,e=0;e<b.length;e++){var f=b[e].getBuffer(),g=f.getAllBufferRanges(),h=void 0;if(g&&!(g.length<=1)){for(var i=0;i<g.length;i++)if(a<g.start(i)){h=g.start(i);break}if(h>0){var j=h-a;j>0&&j<=c&&(void 0===d||h>d)&&(d=h)}}}var k=Ra.getTimeToStreamEnd();void 0===d&&!isNaN(k)&&k<c&&(d=a+k),d>0&&(!isNaN(k)&&d>=a+k?(na.info("Jumping media gap (discontinuity) at time ",a,". Jumping to end of the stream"),la.trigger(q.default.PLAYBACK_ENDED,{isLast:Z().isLast})):(na.info("Jumping media gap (discontinuity) at time ",a,". Jumping to time position",d),Ra.seek(d)))}function j(a){var b=y(a.seekTime);Za&&(p(),Ya=!1),$a&&r(),b===Ia&&cb&&cb.deactivate(!0),b&&(b!==Ia||cb&&!Ia.isActive())?(W(t.PlayListTrace.END_OF_PERIOD_STOP_REASON),I(Ia,b,a.seekTime)):W(t.PlayListTrace.USER_REQUEST_STOP_REASON),X(t.PlayList.SEEK_START_REASON)}function l(){na.debug("[onPlaybackStarted]"),Ua?(Ua=!1,X(t.PlayList.INITIAL_PLAYOUT_START_REASON)):Ta&&(Ta=!1,X(t.PlayList.RESUME_FROM_PAUSE_START_REASON),s())}function n(a){na.debug("[onPlaybackPaused]"),a.ended||(Ta=!0,W(t.PlayListTrace.USER_REQUEST_STOP_REASON),s())}function p(){na.debug("[toggleEndPeriodTimer] stop end period timer."),clearTimeout(Za),Za=void 0}function r(){na.debug("[PreloadTimer] stop period preload timer."),clearTimeout($a),$a=void 0}function s(){if(Ya)if(Za)p();else{var a=Ra.getTimeToStreamEnd(),b=a>0?1e3*a:0;na.debug("[toggleEndPeriodTimer] start-up of timer to notify PLAYBACK_ENDED event. It will be triggered in "+b+" milliseconds"),Za=setTimeout(function(){la.trigger(q.default.PLAYBACK_ENDED,{isLast:Z().isLast})},b);var c=b<2e3?b/4:b-2e3;na.info("[StreamController][toggleEndPeriodTimer] Going to fire preload in "+c),$a=setTimeout(w,c)}}function u(){var a=Z().isLast;Pa&&a?(na.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),wa.signalEndOfStream(Pa)):Pa&&void 0===Za&&(na.info("[StreamController][onStreamBufferingCompleted] end of period detected"),Ya=!0,!1===Ta&&s())}function w(){var a=Z().isLast;Pa&&!a&&function(){var a=G();(bb=Ia.isCompatibleWithStream(a))&&(na.info("[StreamController][onStreamCanLoadNext] Preloading next stream"),Ia.stopEventController(),Ia.deactivate(!0),a.preload(Pa,ab),cb=a,a.getProcessors().forEach(function(b){ta.setIndexHandlerTime(b,a.getStartTime())}))}()}function y(a){var b=0,c=null,d=Ha.length;d>0&&(b+=Ha[0].getStartTime());for(var e=0;e<d;e++)if(c=Ha[e],b=parseFloat((b+c.getDuration()).toFixed(5)),a<b)return c;return null}function A(a,b){for(var c=null,d=0,e=0,f=null,g=Ha.length,h=0;h<g;h++){if(c=Ha[h],e=c.getStartTime(),f=c.getDuration(),Number.isFinite(e)&&(d=e),c.getId()===b)return a-d;Number.isFinite(f)&&(d+=f)}return null}function C(){return Ia?Ia.getProcessors():[]}function E(){var a=G();a?(Xa=void 0,Wa=void 0,I(Ia,a,NaN)):na.debug("StreamController no next stream found"),W(a?t.PlayListTrace.END_OF_PERIOD_STOP_REASON:t.PlayListTrace.END_OF_CONTENT_STOP_REASON),Za=void 0,Ya=!1}function G(){if(Ia){var a=function(){var a=Z().start,b=Z().duration;return{v:Ha.filter(function(c){return c.getStreamInfo().start===parseFloat((a+b).toFixed(5))})[0]}}();if("object"==typeof a)return a.v}}function I(a,b,c){Ma||!b||a===b&&b.isActive()||(Ma=!0,la.trigger(q.default.PERIOD_SWITCH_STARTED,{fromStreamInfo:a?a.getStreamInfo():null,toStreamInfo:b.getStreamInfo()}),bb=!1,a&&(a.stopEventController(),bb=Ia.isCompatibleWithStream(b)&&!c||b.getPreloaded(),a.deactivate(bb)),Ia=b,cb=!1,Ra.initialize(Z(),bb),Qa.getElement()?N(c,a,!1,bb):K(c))}function K(a){O(a,bb)}function M(a){Ia&&(Ra.initialize(Z()),N(a,null,!0,!1))}function N(a,b,c,d){function e(){Pa&&(na.debug("MediaSource is open!"),window.URL.revokeObjectURL(f),Pa.removeEventListener("sourceopen",e),Pa.removeEventListener("webkitsourceopen",e),P(),b||la.trigger(q.default.SOURCE_INITIALIZED),c?Ia.setMediaSource(Pa):O(a,d))}var f=void 0;Pa?d?(O(a,d),b||la.trigger(q.default.SOURCE_INITIALIZED)):(wa.detachMediaSource(Qa),Pa.addEventListener("sourceopen",e,!1),Pa.addEventListener("webkitsourceopen",e,!1),f=wa.attachMediaSource(Pa,Qa),na.debug("MediaSource attached to element. Waiting on open...")):(Pa=wa.createMediaSource(),Pa.addEventListener("sourceopen",e,!1),Pa.addEventListener("webkitsourceopen",e,!1),f=wa.attachMediaSource(Pa,Qa),na.debug("MediaSource attached to element. Waiting on open..."))}function O(a,b){ab=Ia.activate(Pa,b?ab:void 0),Xa=V(g.default.AUDIO),Wa=V(g.default.VIDEO),Ua||(isNaN(a)?function(){var a=Ra.getStreamStartTime(!0);b||Ia.getProcessors().forEach(function(b){ta.setIndexHandlerTime(b,a)})}():Ra.seek(a)),Ia.startEventController(),!La&&Ua||Ra.play(),Ma=!1,la.trigger(q.default.PERIOD_SWITCH_COMPLETED,{toStreamInfo:Z()})}function P(a){var b=a||Z().manifestInfo.duration,c=wa.setDuration(Pa,b);na.debug("Duration successfully set to: "+c)}function Q(a){for(var b=0,c=Ha.length;b<c;b++)if(Ha[b].getId()===a.id)return Ha[b];return null}function R(){try{var a=ta.getStreamsInfo();if(0===a.length)throw new Error("There are no streams");var b=va.getCurrentManifestUpdate(ua.getMetricsFor(g.default.STREAM));ua.updateManifestUpdateInfo(b,{currentTime:Ra.getTime(),buffered:Qa.getBufferRange(),presentationStartTime:a[0].start,clientTimeOffset:Ga.getClientTimeOffset()});for(var c=0,d=a.length;c<d;c++){var e=a[c],f=Q(e);f?f.updateData(e):(f=(0,k.default)(ka).create({manifestModel:ra,dashManifestModel:sa,mediaPlayerModel:Sa,metricsModel:ua,dashMetrics:va,manifestUpdater:pa,adapter:ta,timelineConverter:Ga,capabilities:oa,errHandler:Fa,baseURLController:ya,domStorage:za,abrController:Aa,playbackController:Ra,mediaController:Ba,textController:Ca,videoModel:Qa,streamController:ma}),Ha.push(f),f.initialize(e,Ja)),ua.addManifestUpdateStreamInfo(b,e.id,e.index,e.start,e.duration)}if(!Ia){var h=Ra.getStartTimeFromUriParameters(),i=null;if(h){i=y(isNaN(h.fragS)?h.fragT:h.fragS)}I(null,null!==i?i:Ha[0],NaN)}la.trigger(q.default.STREAMS_COMPOSED)}catch(j){Fa.manifestError(j.message,"nostreamscomposed",ra.getValue()),Fa.error(new J.default(L.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,j.message+"nostreamscomposed",ra.getValue())),Oa=!0,ha()}}function S(){var a=ra.getValue();Ja&&(la.trigger(q.default.PROTECTION_CREATED,{controller:Ja,manifest:a}),Ja.setMediaElement(Qa.getElement()),Ka&&Ja.setProtectionData(Ka)),R()}function T(a){a.error?(Oa=!0,ha()):function(){var b=a.manifest;ta.updatePeriods(b);var c=ta.getStreamsInfo(void 0,1)[0],d=ta.getMediaInfoForType(c,g.default.VIDEO)||ta.getMediaInfoForType(c,g.default.AUDIO),e=void 0;d&&(e=sa.getUseCalculatedLiveEdgeTimeForAdaptation(ta.getDataForMedia(d)))&&(na.debug("SegmentTimeline detected using calculated Live Edge Time"),Sa.setUseManifestDateHeaderTimeSource(!1));var f=sa.getUTCTimingSources(a.manifest),h=!sa.getIsDynamic(b)||e?f:f.concat(Sa.getUTCTimingSources()),i=Ea.isHTTPS(a.manifest.url);h.forEach(function(a){a.value.replace(/.*?:\/\//g,"")===Sa.getDefaultUtcTimingSource().value.replace(/.*?:\/\//g,"")&&(a.value=a.value.replace(i?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),i?"https://":"http://"),na.debug("Matching default timing source protocol to manifest protocol: ",a.value))}),ya.initialize(b),xa.setConfig({metricsModel:ua,dashMetrics:va,baseURLController:ya}),xa.initialize(h,Sa.getUseManifestDateHeaderTimeSource())}()}function U(a){var b=void 0;if(!a)return b;switch(a){case g.default.VIDEO:b=Wa;break;case g.default.AUDIO:b=Xa}return b}function V(a){var b=!1;return Ia&&Ia.getProcessors().forEach(function(c){c.getMediaInfo().type===a&&(b=!0)}),b}function W(a,b){b=b||new Date,Va&&(Ia&&Ia.getProcessors().forEach(function(c){var d=c.getScheduleController();d&&d.finalisePlayList(b,a)}),ua.addPlayList(Va),Va=null)}function X(a){Va=new t.PlayList,Va.start=new Date,Va.mstart=1e3*Ra.getTime(),Va.starttype=a,Ia&&Ia.getProcessors().forEach(function(a){var b=a.getScheduleController();b&&b.setPlayList(Va)})}function Y(a){if(a.error){var b="";switch(a.error.code){case 1:b="MEDIA_ERR_ABORTED";break;case 2:b="MEDIA_ERR_NETWORK";break;case 3:b="MEDIA_ERR_DECODE";break;case 4:b="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:b="MEDIA_ERR_ENCRYPTED";break;default:b="UNKNOWN"}Na=!0, +a.error.message&&(b+=" ("+a.error.message+")"),a.error.msExtendedCode&&(b+=" (0x"+(a.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),na.fatal("Video Element Error: "+b),a.error&&na.fatal(a.error),Fa.mediaSourceError(b),Fa.error(new J.default(a.error.code,b)),ha()}}function Z(){return Ia?Ia.getStreamInfo():null}function $(a){return Ha.filter(function(b){return b.getId()===a})[0]}function _(){if(!(qa&&qa.hasOwnProperty("load")&&Ga&&Ga.hasOwnProperty("initialize")&&Ga.hasOwnProperty("reset")&&Ga.hasOwnProperty("getClientTimeOffset")&&ra&&Fa&&ua&&Ra))throw new Error("setConfig function has to be called previously")}function aa(){if(!pa||!pa.hasOwnProperty("setManifest"))throw new Error("initialize function has to be called previously")}function ba(a){_(),qa.load(a)}function ca(a){aa(),pa.setManifest(a)}function da(a){isNaN(a.newDuration)||P(a.newDuration)}function ea(a){a&&(a.capabilities&&(oa=a.capabilities),a.manifestLoader&&(qa=a.manifestLoader),a.manifestModel&&(ra=a.manifestModel),a.dashManifestModel&&(sa=a.dashManifestModel),a.mediaPlayerModel&&(Sa=a.mediaPlayerModel),a.protectionController&&(Ja=a.protectionController),a.adapter&&(ta=a.adapter),a.metricsModel&&(ua=a.metricsModel),a.dashMetrics&&(va=a.dashMetrics),a.errHandler&&(Fa=a.errHandler),a.timelineConverter&&(Ga=a.timelineConverter),a.videoModel&&(Qa=a.videoModel),a.playbackController&&(Ra=a.playbackController),a.domStorage&&(za=a.domStorage),a.abrController&&(Aa=a.abrController),a.mediaController&&(Ba=a.mediaController),a.textController&&(Ca=a.textController))}function fa(a){Ka=a}function ga(){Ha=[],Ja=null,Ma=!1,Ia=null,Na=!1,Oa=!1,Wa=void 0,Xa=void 0,Ua=!0,Ta=!1,La=!0,Va=null,Za=void 0,Ya=!1,_a=0}function ha(){_(),xa.reset(),W(Na||Oa?t.PlayListTrace.FAILURE_STOP_REASON:t.PlayListTrace.USER_REQUEST_STOP_REASON);for(var a=0,b=Ha?Ha.length:0;a<b;a++){Ha[a].reset(Na)}d(),ya.reset(),pa.reset(),ua.clearAllCurrentMetrics(),ra.setValue(null),qa.reset(),Ga.reset(),Da.reset(),Pa&&(wa.detachMediaSource(Qa),Pa=null),Qa=null,Ja&&(Ja.setMediaElement(null),Ja=null,Ka=null,ra.getValue()&&la.trigger(q.default.PROTECTION_DESTROYED,{data:ra.getValue().url})),la.trigger(q.default.STREAM_TEARDOWN_COMPLETE),ga()}function ia(a){a.metric===i.default.DVR_INFO&&a.mediaType===g.default.AUDIO&&wa.setSeekable(Pa,a.value.range.start,a.value.range.end)}var ja=40,ka=this.context,la=(0,o.default)(ka).getInstance(),ma=void 0,na=void 0,oa=void 0,pa=void 0,qa=void 0,ra=void 0,sa=void 0,ta=void 0,ua=void 0,va=void 0,wa=void 0,xa=void 0,ya=void 0,za=void 0,Aa=void 0,Ba=void 0,Ca=void 0,Da=void 0,Ea=void 0,Fa=void 0,Ga=void 0,Ha=void 0,Ia=void 0,Ja=void 0,Ka=void 0,La=void 0,Ma=void 0,Na=void 0,Oa=void 0,Pa=void 0,Qa=void 0,Ra=void 0,Sa=void 0,Ta=void 0,Ua=void 0,Va=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Za=void 0,$a=void 0,_a=void 0,ab=void 0,bb=void 0,cb=void 0,db=void 0;return ma={initialize:b,getActiveStreamInfo:Z,isTrackTypePresent:U,switchToVideoElement:M,getStreamById:$,getStreamForTime:y,getTimeRelativeToStreamId:A,load:ba,loadWithManifest:ca,getActiveStreamProcessors:C,setConfig:ea,setProtectionData:fa,reset:ha},a(),ma}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(102),i=d(h),j=a(98),k=d(j),l=a(92),m=d(l),n=a(47),o=d(n),p=a(53),q=d(p),r=a(48),s=d(r),t=a(237),u=a(46),v=d(u),w=a(203),x=d(w),y=a(210),z=d(y),A=a(94),B=d(A),C=a(115),D=d(C),E=a(105),F=d(E),G=a(111),H=d(G),I=a(215),J=d(I),K=a(50),L=d(K);e.__dashjs_factory_name="StreamController",c.default=s.default.getSingletonFactory(e),b.exports=c.default},{101:101,102:102,105:105,111:111,115:115,203:203,210:210,215:215,237:237,46:46,47:47,48:48,50:50,53:53,92:92,94:94,98:98}],115:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){J=(0,t.default)(F).getInstance().getLogger(I)}function b(a,b){N=b,K=0,L=!1,M=!1,O={"urn:mpeg:dash:utc:http-head:2014":z,"urn:mpeg:dash:utc:http-xsdate:2014":y.bind(null,q),"urn:mpeg:dash:utc:http-iso:2014":y.bind(null,r),"urn:mpeg:dash:utc:direct:2014":x,"urn:mpeg:dash:utc:http-head:2012":z,"urn:mpeg:dash:utc:http-xsdate:2012":y.bind(null,q),"urn:mpeg:dash:utc:http-iso:2012":y.bind(null,r),"urn:mpeg:dash:utc:direct:2012":x,"urn:mpeg:dash:utc:http-ntp:2014":u,"urn:mpeg:dash:utc:ntp:2014":u,"urn:mpeg:dash:utc:sntp:2014":u},f()||(D(a),h(!0))}function c(a){a&&(a.metricsModel&&(P=a.metricsModel),a.dashMetrics&&(Q=a.dashMetrics),a.baseURLController&&(R=a.baseURLController))}function d(){return m()}function e(a){L=a}function f(){return L}function h(a){M=a}function k(a){K=a}function m(){return K}function o(a){var b=1e3,c=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/,d=void 0,e=void 0,f=c.exec(a);return d=Date.UTC(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10),f[6]&&(parseInt(f[6],10)||0),f[7]&&parseFloat(f[7])*b||0),f[9]&&f[10]&&(e=60*parseInt(f[9],10)+parseInt(f[10],10),d+=("+"===f[8]?-1:1)*e*60*b),new Date(d).getTime()}function q(a){var b=Date.parse(a);return isNaN(b)&&(b=o(a)),b}function r(a){return Date.parse(a)}function s(a){return Date.parse(a)}function u(a,b,c){c()}function x(a,b,c){var d=q(a);if(!isNaN(d))return void b(d);c()}function y(a,b,c,d,e){var f=void 0,g=void 0,h=!1,i=new XMLHttpRequest,k=e?j.HTTPRequest.HEAD:j.HTTPRequest.GET,l=b.match(/\S+/g);if(b=l.shift(),f=function(){h||(h=!0,l.length?y(a,l.join(" "),c,d,e):d())},g=function(){var b=void 0,d=void 0;200===i.status&&(b=e?i.getResponseHeader("Date"):i.response,d=a(b),isNaN(d)||(c(d),h=!0))},H.isRelative(b)){var m=R.resolve();m&&(b=H.resolve(b,m.url))}i.open(k,b),i.timeout=w||0,i.onload=g,i.onloadend=f,i.send()}function z(a,b,c){y(s,a,b,c,!0)}function A(){var a=P.getReadOnlyMetricsFor(g.default.STREAM),b=Q.getLatestMPDRequestHeaderValueByID(a,"Date"),c=null!==b?new Date(b).getTime():Number.NaN;isNaN(c)?B(!0):(k(c-(new Date).getTime()),B(!1,c/1e3,K))}function B(a,b,c){e(!1),G.trigger(n.default.TIME_SYNCHRONIZATION_COMPLETED,{time:b,offset:c,error:a?new i.default(p.default.TIME_SYNC_FAILED_ERROR_CODE,p.default.TIME_SYNC_FAILED_ERROR_MESSAGE):null})}function C(a,b){return a-b}function D(a,b){var c=b||0,d=a[c],f=function(a,b){var c=!a||!b;c&&N?A():B(c,a,b)};e(!0),d?O.hasOwnProperty(d.schemeIdUri)?O[d.schemeIdUri](d.value,function(a){var b=(new Date).getTime(),c=C(a,b);k(c),J.info("Local time: "+new Date(b)),J.info("Server time: "+new Date(a)),J.info("Server Time - Local Time (ms): "+c),f(a,c)},function(){D(a,c+1)}):D(a,c+1):(k(0),f())}function E(){h(!1),e(!1)}var F=this.context,G=(0,l.default)(F).getInstance(),H=(0,v.default)(F).getInstance(),I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0;return I={initialize:b,getOffsetToDeviceTimeMs:d,setConfig:c,reset:E},a(),I}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(215),i=d(h),j=a(235),k=a(47),l=d(k),m=a(53),n=d(m),o=a(50),p=d(o),q=a(48),r=d(q),s=a(46),t=d(s),u=a(210),v=d(u),w=5e3;e.__dashjs_factory_name="TimeSyncController";var x=r.default.getSingletonFactory(e);x.HTTP_TIMEOUT_MS=w,r.default.updateSingletonFactory(e.__dashjs_factory_name,x),c.default=x,b.exports=c.default},{101:101,210:210,215:215,235:235,46:46,47:47,48:48,50:50,53:53}],116:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){y.on(k.default.XLINK_ELEMENT_LOADED,j,A),F=(0,g.default)(x).create({errHandler:a.errHandler,metricsModel:a.metricsModel,mediaPlayerModel:a.mediaPlayerModel,requestModifier:a.requestModifier})}function c(a){a&&(B=a)}function d(a){a&&(C=a)}function e(a){var b=void 0;E=new o.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:B}),D=a,b=m(D.Period_asArray,D,s.default.PERIOD,t),h(b,s.default.PERIOD,t)}function f(){y.off(k.default.XLINK_ELEMENT_LOADED,j,A),F&&(F.reset(),F=null)}function h(a,b,c){var d={},e=void 0,f=void 0;d.elements=a,d.type=b,d.resolveType=c,0===d.elements.length&&l(d);for(var g=0;g<d.elements.length;g++)e=d.elements[g],f=z.isHTTPURL(e.url)?e.url:e.originalContent.BaseURL+e.url,F.load(f,e,d)}function j(a){var b=void 0,c=void 0,d="";if(b=a.element,c=a.resolveObject,b.resolvedContent){var e=0;0===b.resolvedContent.indexOf("<?xml")&&(e=b.resolvedContent.indexOf("?>")+2),d=b.resolvedContent.substr(0,e)+"<response>"+b.resolvedContent.substr(e)+"</response>",b.resolvedContent=E.xml_str2json(d)}r(c)&&l(c)}function l(a){var b=[],c=void 0,d=void 0;if(n(a),a.resolveType===u&&y.trigger(k.default.XLINK_READY,{manifest:D}),a.resolveType===t)switch(a.type){case s.default.PERIOD:for(c=0;c<D[s.default.PERIOD+"_asArray"].length;c++)d=D[s.default.PERIOD+"_asArray"][c],d.hasOwnProperty(s.default.ADAPTATION_SET+"_asArray")&&(b=b.concat(m(d[s.default.ADAPTATION_SET+"_asArray"],d,s.default.ADAPTATION_SET,t))),d.hasOwnProperty(s.default.EVENT_STREAM+"_asArray")&&(b=b.concat(m(d[s.default.EVENT_STREAM+"_asArray"],d,s.default.EVENT_STREAM,t)));h(b,s.default.ADAPTATION_SET,t);break;case s.default.ADAPTATION_SET:y.trigger(k.default.XLINK_READY,{manifest:D})}}function m(a,b,c,d){var e=[],f=void 0,g=void 0,h=void 0;for(g=a.length-1;g>=0;g--)f=a[g],f.hasOwnProperty("xlink:href")&&f["xlink:href"]===v&&a.splice(g,1);for(g=0;g<a.length;g++)f=a[g],f.hasOwnProperty("xlink:href")&&f.hasOwnProperty("xlink:actuate")&&f["xlink:actuate"]===d&&(h=p(f["xlink:href"],b,c,g,d,f),e.push(h));return e}function n(a){var b=[],c=void 0,d=void 0,e=void 0,f=void 0,g=void 0,h=void 0;for(f=a.elements.length-1;f>=0;f--){if(c=a.elements[f],d=c.type+"_asArray",!c.resolvedContent||w())delete c.originalContent["xlink:actuate"],delete c.originalContent["xlink:href"],b.push(c.originalContent);else if(c.resolvedContent)for(g=0;g<c.resolvedContent[d].length;g++)e=c.resolvedContent[d][g],b.push(e);for(c.parentElement[d].splice(c.index,1),h=0;h<b.length;h++)c.parentElement[d].splice(c.index+h,0,b[h]);b=[]}a.elements.length>0&&C.run(D)}function p(a,b,c,d,e,f){return{url:a,parentElement:b,type:c,index:d,resolveType:e,originalContent:f,resolvedContent:null,resolved:!1}}function r(a){var b=void 0,c=void 0;for(b=0;b<a.elements.length;b++)if(c=a.elements[b],!1===c.resolved)return!1;return!0}function w(){return!1}a=a||{};var x=this.context,y=(0,i.default)(x).getInstance(),z=(0,q.default)(x).getInstance(),A=void 0,B=void 0,C=void 0,D=void 0,E=void 0,F=void 0;return A={resolveManifestOnLoad:e,setMatchers:c,setIron:d,reset:f},b(),A}Object.defineProperty(c,"__esModule",{value:!0});var f=a(100),g=d(f),h=a(47),i=d(h),j=a(53),k=d(j),l=a(48),m=d(l),n=a(3),o=d(n),p=a(210),q=d(p),r=a(60),s=d(r),t="onLoad",u="onActuate",v="urn:mpeg:dash:resolve-to-zero:2013";e.__dashjs_factory_name="XlinkController",c.default=m.default.getClassFactory(e),b.exports=c.default},{100:100,210:210,3:3,47:47,48:48,53:53,60:60}],117:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return e=(0,g.default)(d).getInstance({eventBus:a.eventBus,metricsModel:a.metricsModel,metricsConstants:a.metricsConstants,events:a.events}),(0,k.default)(d).create(a)}function b(){return(0,o.default)(d).getInstance()}function c(){return(0,m.default)(d).getInstance()}var d=this.context,e=void 0;return{createMetricsReporting:a,getReportingFactory:b,getMetricsHandlerFactory:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(131),g=d(f),h=a(118),i=d(h),j=a(119),k=d(j),l=a(124),m=d(l),n=a(129),o=d(n);e.__dashjs_factory_name="MetricsReporting";var p=dashjs.FactoryMaker.getClassFactory(e);p.events=i.default,dashjs.FactoryMaker.updateClassFactory(e.__dashjs_factory_name,p),c.default=p,b.exports=c.default},{118:118,119:119,124:124,129:129,131:131}],118:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(54),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.METRICS_INITIALISATION_COMPLETE="internal_metricsReportingInitialized",this.BECAME_REPORTING_PLAYER="internal_becameReportingPlayer"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{54:54}],119:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(b){if(!b.error){var c=Object.keys(f);(0,i.default)(h).getInstance({dashManifestModel:a.dashManifestModel,constants:a.constants}).getMetrics(b.manifest).forEach(function(b){var d=JSON.stringify(b);if(f.hasOwnProperty(d))c.splice(d,1);else try{var e=(0,g.default)(h).create(a);e.initialize(b),f[d]=e}catch(b){}}),c.forEach(function(a){f[a].reset(),delete f[a]}),j.trigger(k.default.METRICS_INITIALISATION_COMPLETE)}}function c(){Object.keys(f).forEach(function(a){f[a].reset()}),f={}}function d(){j.on(l.MANIFEST_UPDATED,b),j.on(l.STREAM_TEARDOWN_COMPLETE,c)}function e(){j.off(l.MANIFEST_UPDATED,b),j.off(l.STREAM_TEARDOWN_COMPLETE,c)}a=a||{};var f={},h=this.context,j=a.eventBus,l=a.events;return d(),{reset:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(120),g=d(f),h=a(133),i=d(h),j=a(118),k=d(j);e.__dashjs_factory_name="MetricsCollectionController",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{118:118,120:120,133:133}],120:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(b){try{f=(0,g.default)(h).create({mediaElement:a.mediaElement}),f.initialize(b.Range),e=(0,i.default)(h).create({debug:a.debug,metricsConstants:a.metricsConstants}),e.initialize(b.Reporting,f),d=(0,k.default)(h).create({debug:a.debug,eventBus:a.eventBus,metricsConstants:a.metricsConstants,events:a.events}),d.initialize(b.metrics,e)}catch(j){throw c(),j}}function c(){d&&d.reset(),e&&e.reset(),f&&f.reset()}a=a||{};var d=void 0,e=void 0,f=void 0,h=this.context;return{initialize:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(122),g=d(f),h=a(123),i=d(h),j=a(121),k=d(j);e.__dashjs_factory_name="MetricsController",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{121:121,122:122,123:123}],121:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){e.forEach(function(b){b.handleNewMetric(a.metric,a.value,a.mediaType)})}function c(a,c){a.split(",").forEach(function(a,b,d){var f=void 0;if(-1!==a.indexOf("(")&&-1===a.indexOf(")")){var g=d[b+1];g&&-1===g.indexOf("(")&&-1!==g.indexOf(")")&&(a+=","+g,delete d[b+1])}(f=k.create(a,c))&&e.push(f)}),i.on(j.METRIC_ADDED,b,f),i.on(j.METRIC_UPDATED,b,f)}function d(){i.off(j.METRIC_ADDED,b,f),i.off(j.METRIC_UPDATED,b,f),e.forEach(function(a){return a.reset()}),e=[]}a=a||{};var e=[],f=void 0,h=this.context,i=a.eventBus,j=a.events,k=(0,g.default)(h).getInstance({debug:a.debug,eventBus:a.eventBus,metricsConstants:a.metricsConstants});return f={initialize:c,reset:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(124),g=d(f);e.__dashjs_factory_name="MetricsHandlersController",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{124:124}],122:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){a&&a.length&&(a.forEach(function(a){var b=a.starttime,c=b+a.duration;j.add(b,c)}),f=!!a[0]._useWallClockTime)}function c(){j.clear()}function d(){j=(0,g.default)(h).create()}function e(){var a=j.length,b=void 0;if(!a)return!0;b=f?(new Date).getTime()/1e3:k.currentTime;for(var c=0;c<a;c+=1){var d=j.start(c),e=j.end(c);if(d<=b&&b<e)return!0}return!1}a=a||{};var f=!1,h=this.context,i=void 0,j=void 0,k=a.mediaElement;return i={initialize:b,reset:c,isEnabled:e},d(),i}Object.defineProperty(c,"__esModule",{value:!0});var f=a(199),g=d(f);e.__dashjs_factory_name="RangeController",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{199:199}],123:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){a.some(function(a){var c=f.create(a,b);if(c)return e.push(c),!0})}function c(){e.forEach(function(a){return a.reset()}),e=[]}function d(a,b){e.forEach(function(c){return c.report(a,b)})}var e=[],f=(0,g.default)(this.context).getInstance(a);return{initialize:b,reset:c,report:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(129),g=d(f);e.__dashjs_factory_name="ReportingController",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{129:129}],124:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(b,c){var d,g=b.match(f);if(g){try{d=j[g[1]](h).create({eventBus:a.eventBus,metricsConstants:a.metricsConstants}),d.initialize(g[1],c,g[3],g[5])}catch(i){d=null,e.error("MetricsHandlerFactory: Could not create handler for type "+g[1]+" with args "+g[3]+", "+g[5]+" ("+i.message+")")}return d}}function c(a,b){j[a]=b}function d(a){delete j[a]}a=a||{};var e=a.debug,f=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/,h=this.context,j={BufferLevel:g.default,DVBErrors:i.default,HttpList:k.default,PlayList:m.default,RepSwitchList:m.default,TcpList:m.default};return{create:b,register:c,unregister:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(125),g=d(f),h=a(126),i=d(h),j=a(128),k=d(j),l=a(127),m=d(l);e.__dashjs_factory_name="MetricsHandlerFactory",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{125:125,126:126,127:127,128:128}],125:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){try{return Object.keys(o).map(function(a){return o[a]}).reduce(function(a,b){return a.level<b.level?a:b})}catch(a){return}}function c(){var a=b();a&&l!==a.t&&(l=a.t,h.report(j,a))}function d(a,b,d){b&&(i=n.validateN(d),h=b,j=n.reconstructFullMetricName(a,d),k=setInterval(c,i))}function e(){clearInterval(k),k=null,i=0,h=null,l=null}function f(a,b,c){a===p.BUFFER_LEVEL&&(o[c]=b)}a=a||{};var h=void 0,i=void 0,j=void 0,k=void 0,l=void 0,m=this.context,n=(0,g.default)(m).getInstance(),o=[],p=a.metricsConstants;return{initialize:d,reset:e,handleNewMetric:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(132),g=d(f);e.__dashjs_factory_name="BufferLevelHandler",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{132:132}],126:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){h.off(g.default.METRICS_INITIALISATION_COMPLETE,b,this),h.trigger(g.default.BECAME_REPORTING_PLAYER)}function c(a,c){c&&(f=c,h.on(g.default.METRICS_INITIALISATION_COMPLETE,b,this))}function d(){f=null}function e(a,b){a===i.DVB_ERRORS&&f&&f.report(a,b)}a=a||{};var f=void 0,h=a.eventBus,i=a.metricsConstants;return{initialize:c,reset:d,handleNewMetric:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(118),g=d(f);c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{118:118}],127:[function(a,b,c){"use strict";function d(){function a(a,b){d=a,e=b}function b(){e=null,d=void 0}function c(a,b){a===d&&e&&e.report(d,b)}var d=void 0,e=void 0;return{initialize:a,reset:b,handleNewMetric:c}}Object.defineProperty(c,"__esModule",{value:!0}),d.__dashjs_factory_name="GenericMetricHandler",c.default=dashjs.FactoryMaker.getClassFactory(d),b.exports=c.default},{}],128:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){var a=l;a.length&&f&&f.report(j,a),l=[]}function c(a,c,d,e){c&&(h=m.validateN(d),f=c,e&&e.length&&(i=e),j=m.reconstructFullMetricName(a,d,e),k=setInterval(b,h))}function d(){clearInterval(k),k=null,h=null,i=null,l=[],f=null}function e(a,b){a===n.HTTP_REQUEST&&(i&&i!==b.type||l.push(b))}a=a||{};var f=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=[],m=(0,g.default)(this.context).getInstance(),n=a.metricsConstants;return{initialize:c,reset:d,handleNewMetric:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(132),g=d(f);e.__dashjs_factory_name="HttpListHandler",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{132:132}],129:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){var c=void 0;try{c=e[a.schemeIdUri](f).create({metricsConstants:i}),c.initialize(a,b)}catch(d){c=null,h.error("ReportingFactory: could not create Reporting with schemeIdUri "+a.schemeIdUri+" ("+d.message+")")}return c}function c(a,b){e[a]=b}function d(a){delete e[a]}a=a||{};var e={"urn:dvb:dash:reporting:2014":g.default},f=this.context,h=a.debug,i=a.metricsConstants;return{create:b,register:c,unregister:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(130),g=d(f);e.__dashjs_factory_name="ReportingFactory",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{130:130}],130:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b,c){var d=new XMLHttpRequest,e=function(){var a=q.indexOf(d);-1!==a&&(q.splice(a,1),d.status>=200&&d.status<300?b&&b():c&&c())};q.push(d);try{d.open("GET",a),d.onloadend=e,d.onerror=e,d.send()}catch(f){d.onerror()}}function c(a,c){Array.isArray(c)||(c=[c]),l&&o.isEnabled()&&c.forEach(function(c){var d=h.serialise(c);k&&a!==r.DVB_ERRORS&&(d="metricname="+a+"&"+d),d=n+"?"+d,b(d,null,function(){l=!1})})}function d(a,b){var c=void 0;if(o=b,!(n=a["dvb:reportingUrl"]))throw new Error("required parameter missing (dvb:reportingUrl)");m||(c=a["dvb:probability"]||a["dvb:priority"]||0,c&&(1e3===c||c/1e3>=j.random())&&(l=!0),m=!0)}function e(){p||(q.forEach(function(a){return a.abort()}),q=[]),m=!1,l=!1,n=null,o=null}a=a||{};var f=this.context,h=(0,g.default)(f).getInstance(),j=(0,i.default)(f).getInstance(),k=!0,l=!1,m=!1,n=null,o=null,p=!0,q=[],r=a.metricsConstants;return{report:c,initialize:d,reset:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(134),g=d(f),h=a(135),i=d(h);e.__dashjs_factory_name="DVBReporting",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{134:134,135:135}],131:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=new g.default;if(p){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);b.mpdurl||(b.mpdurl=p.originalUrl||p.url),b.terror||(b.terror=new Date),o.addDVBErrors(b)}}function c(a){a.error||(p=a.manifest)}function d(a){b({errorcode:g.default.BASE_URL_CHANGED,servicelocation:a.entry})}function e(){b({errorcode:g.default.BECAME_REPORTER})}function f(a){(0===a.responsecode||a.responsecode>=400||a.responsecode<100||a.responsecode>=600)&&b({errorcode:a.responsecode||g.default.CONNECTION_ERROR,url:a.url,terror:a.tresponse,servicelocation:a._serviceLocation})}function h(a){switch(a.metric){case q.HTTP_REQUEST:f(a.value)}}function j(a){var c=a.error?a.error.code:0,d=void 0;switch(c){case MediaError.MEDIA_ERR_NETWORK:d=g.default.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:d=g.default.CORRUPT_MEDIA_OTHER;break;default:return}b({errorcode:d})}function k(){n.on(r.MANIFEST_UPDATED,c,m),n.on(r.SERVICE_LOCATION_BLACKLIST_CHANGED,d,m),n.on(r.METRIC_ADDED,h,m),n.on(r.METRIC_UPDATED,h,m),n.on(r.PLAYBACK_ERROR,j,m),n.on(i.default.BECAME_REPORTING_PLAYER,e,m)}function l(){n.off(r.MANIFEST_UPDATED,c,m),n.off(r.SERVICE_LOCATION_BLACKLIST_CHANGED,d,m),n.off(r.METRIC_ADDED,h,m),n.off(r.METRIC_UPDATED,h,m),n.off(r.PLAYBACK_ERROR,j,m),n.off(i.default.BECAME_REPORTING_PLAYER,e,m)}a=a||{};var m=void 0,n=a.eventBus,o=a.metricsModel,p=void 0,q=a.metricsConstants,r=a.events;return m={initialise:k,reset:l},k(),m}Object.defineProperty(c,"__esModule",{value:!0});var f=a(136),g=d(f),h=a(118),i=d(h);e.__dashjs_factory_name="DVBErrorsTranslator",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{118:118,136:136}],132:[function(a,b,c){"use strict";function d(){return{reconstructFullMetricName:function(a,b,c){var d=a;return b&&(d+="("+b,c&&c.length&&(d+=","+c),d+=")"),d},validateN:function(a){if(!a)throw new Error("missing n");if(isNaN(a))throw new Error("n is NaN");if(a<0)throw new Error("n must be positive");return a}}}Object.defineProperty(c,"__esModule",{value:!0}),d.__dashjs_factory_name="HandlerHelpers",c.default=dashjs.FactoryMaker.getSingletonFactory(d),b.exports=c.default},{}],133:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b,c){var f,g,h=d.getMpd(a),i=0;return b?i=h.availabilityStartTime.getTime()/1e3:(f=this.getRegularPeriods(h),f.length&&(i=f[0].start)),g=i,c&&c.hasOwnProperty(e.START_TIME)&&(g+=c.starttime),g}function c(a){var c=[];return a.Metrics_asArray&&a.Metrics_asArray.forEach(function(f){var h=new g.default,j=d.getIsDynamic(a);f.hasOwnProperty("metrics")&&(h.metrics=f.metrics,f.Range_asArray&&f.Range_asArray.forEach(function(c){var e=new i.default;e.starttime=b(a,j,c),c.hasOwnProperty("duration")?e.duration=c.duration:e.duration=d.getDuration(a),e._useWallClockTime=j,h.Range.push(e)}),f.Reporting_asArray&&(f.Reporting_asArray.forEach(function(a){var b=new k.default;if(a.hasOwnProperty(e.SCHEME_ID_URI)){b.schemeIdUri=a.schemeIdUri;for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);h.Reporting.push(b)}}),c.push(h)))}),c}a=a||{};var d=a.dashManifestModel,e=a.constants;return{getMetrics:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(137),g=d(f),h=a(138),i=d(h),j=a(139),k=d(j);e.__dashjs_factory_name="ManifestParsing",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{137:137,138:138,139:139}],134:[function(a,b,c){"use strict";function d(){function a(b){var c=[],d=[],e=void 0,f=void 0;for(e in b)if(b.hasOwnProperty(e)&&0!==e.indexOf("_")){if(f=b[e],void 0!==f&&null!==f||(f=""),Array.isArray(f)){if(!f.length)continue;d=[],f.forEach(function(b){var c="Object"!==Object.prototype.toString.call(b).slice(8,-1);d.push(c?b:a(b))}),f=d.map(encodeURIComponent).join(",")}else"string"==typeof f?f=encodeURIComponent(f):f instanceof Date?f=f.toISOString():"number"==typeof f&&(f=Math.round(f));c.push(e+"="+f)}return c.join("&")}return{serialise:a}}Object.defineProperty(c,"__esModule",{value:!0}),d.__dashjs_factory_name="MetricSerialiser",c.default=dashjs.FactoryMaker.getSingletonFactory(d),b.exports=c.default},{}],135:[function(a,b,c){"use strict";function d(){function a(){c&&(g||(g=new d(f)),c.getRandomValues(g),h=0)}function b(b,d){var f=void 0;return b||(b=0),d||(d=1),c?(h===g.length&&a(),f=g[h]/e,h+=1):f=Math.random(),f*(d-b)+b}var c=window.crypto||window.msCrypto,d=Uint32Array,e=Math.pow(2,8*d.BYTES_PER_ELEMENT)-1,f=10,g=void 0,h=void 0,i=void 0;return i={random:b},a(),i}Object.defineProperty(c,"__esModule",{value:!0}),d.__dashjs_factory_name="RNG",c.default=dashjs.FactoryMaker.getSingletonFactory(d),b.exports=c.default},{}],136:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null};e.SSL_CONNECTION_FAILED_PREFIX="SSL",e.DNS_RESOLUTION_FAILED="C00",e.HOST_UNREACHABLE="C01",e.CONNECTION_REFUSED="C02",e.CONNECTION_ERROR="C03",e.CORRUPT_MEDIA_ISOBMFF="M00",e.CORRUPT_MEDIA_OTHER="M01",e.BASE_URL_CHANGED="F00",e.BECAME_REPORTER="S00",c.default=e,b.exports=c.default},{}],137:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.metrics="",this.Range=[],this.Reporting=[]};c.default=e,b.exports=c.default},{}],138:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.starttime=0,this.duration=1/0,this._useWallClockTime=!1};c.default=e,b.exports=c.default},{}],139:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.schemeIdUri="",this.value=""};c.default=e,b.exports=c.default},{}],140:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(){function a(){j()}function b(a){a.dashManifestModel&&(p=a.dashManifestModel)}function c(){if(!p||!p.hasOwnProperty("getBaseURLsFromElement")||!p.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}function d(a,b,c){var d=p.getBaseURLsFromElement(c);a[b]?r.areEqual(d,a[b].data.baseUrls)||(a[b].data.baseUrls=d,a[b].data.selectedIdx=k):a[b]=new l(d)}function e(a){c();var b=p.getBaseURLsFromElement(a);r.areEqual(b,o.data.baseUrls)||(o.data.baseUrls=b,o.data.selectedIdx=k),a&&a.Period_asArray&&a.Period_asArray.forEach(function(a,b){d(o.children,b,a),a.AdaptationSet_asArray&&a.AdaptationSet_asArray.forEach(function(a,c){d(o.children[b].children,c,a),a.Representation_asArray&&a.Representation_asArray.sort(p.getRepresentationSortFunction()).forEach(function(a,e){d(o.children[b].children[c].children,e,a)})})})}function f(a,b){var c=b||o;a(c.data),c.children&&c.children.forEach(function(b){return f(a,b)})}function g(a){f(function(b){isNaN(b.selectedIdx)||a===b.baseUrls[b.selectedIdx].serviceLocation&&(b.selectedIdx=k)})}function i(a){e(a)}function j(){o=new l}function m(a){var b=o,c=[b.data];return a&&a.forEach(function(a){(b=b.children[a])&&c.push(b.data)}),c.filter(function(a){return a.baseUrls.length})}var n=void 0,o=void 0,p=void 0,q=this.context,r=(0,h.default)(q).getInstance();return n={reset:j,update:i,getForPath:m,invalidateSelectedIndexes:g,setConfig:b},a(),n}Object.defineProperty(c,"__esModule",{value:!0});var g=a(206),h=d(g),i=a(48),j=d(i),k=NaN,l=function a(b,c){e(this,a),this.data={baseUrls:b||null,selectedIdx:c||k},this.children=[]};f.__dashjs_factory_name="BaseURLTreeModel",c.default=j.default.getClassFactory(f),b.exports=c.default},{206:206,48:48}],141:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){L=(0,o.default)(G).getInstance().getLogger(K),D(),H.on(i.default.LOADING_COMPLETED,A,K),H.on(i.default.LOADING_DATA_PROGRESS,B,K),H.on(i.default.LOADING_ABANDONED,C,K)}function c(a){M=a}function d(){return M}function e(a){var b=function(a,b){return a.action===m.default.ACTION_COMPLETE&&a.action===b.action},c=function(a,b){return!isNaN(a.index)&&a.startTime===b.startTime&&a.adaptationIndex===b.adaptationIndex&&a.type===b.type},d=function(a,b){return isNaN(a.index)&&isNaN(b.index)&&a.quality===b.quality},e=function(e){var f=!1;return e.some(function(e){if(c(a,e)||d(a,e)||b(a,e))return f=!0}),f};return!!a&&e(N)}function f(a){var b=!1,c=0,d=void 0;if(!(b=e(a)))for(c=0;c<O.length;c++)d=O[c],a.url===d.url&&a.startTime===d.startTime&&(b=!0);return b}function h(a){var b=a?a.state instanceof Array?a.state:[a.state]:[],c=[];return b.forEach(function(b){var d=y(b);c=c.concat(x(d,a))}),c}function j(a){return isNaN(a.duration)?.25:Math.min(a.duration/8,.5)}function k(a){N=N.filter(function(b){var c=j(b) +;return isNaN(b.startTime)||void 0!==a&&b.startTime>=a-c})}function l(a){N=N.filter(function(b){var c=j(b);return isNaN(b.startTime)||void 0!==a&&b.startTime+b.duration<a+c})}function n(a,b){b<=a+.5||(N=N.filter(function(c){var d=j(c);return isNaN(c.startTime)||c.startTime>=b-d||isNaN(c.duration)||c.startTime+c.duration<=a+d}))}function r(a,b){if(!a||0===a.length)return void k();for(var c=0,d=0,e=a.length;d<e;d++)n(c,a.start(d)),c=a.end(d);b>0&&n(c,b)}function t(){J.abort(),O=[]}function u(a){switch(a.action){case m.default.ACTION_COMPLETE:N.push(a),z(a,q),L.debug("executeRequest trigger STREAM_COMPLETED"),H.trigger(i.default.STREAM_COMPLETED,{request:a,fragmentModel:this});break;case m.default.ACTION_DOWNLOAD:z(a,p),O.push(a),v(a);break;default:L.warn("Unknown request action.")}}function v(a){H.trigger(i.default.FRAGMENT_LOADING_STARTED,{sender:K,request:a}),J.load(a)}function w(a,b,c){for(var d=a.length-1,e=d;e>=0;e--){var f=a[e],g=f.startTime,h=g+f.duration;if(c=isNaN(c)?j(f):c,!isNaN(g)&&!isNaN(h)&&b+c>=g&&b-c<h||isNaN(g)&&isNaN(b))return f}return null}function x(a,b){return b.hasOwnProperty("time")?[w(a,b.time,b.threshold)]:a.filter(function(a){for(var c in b)if("state"!==c&&b.hasOwnProperty(c)&&a[c]!=b[c])return!1;return!0})}function y(a){var b=void 0;switch(a){case p:b=O;break;case q:b=N;break;default:b=[]}return b}function z(a,b){I.addSchedulingInfo(a.mediaType,new Date,a.type,a.startTime,a.availabilityStartTime,a.duration,a.quality,a.range,b),I.addRequestsQueue(a.mediaType,O,N)}function A(a){a.sender===J&&(O.splice(O.indexOf(a.request),1),a.response&&!a.error&&N.push(a.request),z(a.request,a.error?s:q),H.trigger(i.default.FRAGMENT_LOADING_COMPLETED,{request:a.request,response:a.response,error:a.error,sender:this}))}function B(a){a.sender===J&&H.trigger(i.default.FRAGMENT_LOADING_PROGRESS,{request:a.request,response:a.response,error:a.error,sender:this})}function C(a){a.sender===J&&H.trigger(i.default.FRAGMENT_LOADING_ABANDONED,{streamProcessor:this.getStreamProcessor(),request:a.request,mediaType:a.mediaType})}function D(){N=[],O=[]}function E(){H.off(i.default.LOADING_COMPLETED,A,this),H.off(i.default.LOADING_DATA_PROGRESS,B,this),H.off(i.default.LOADING_ABANDONED,C,this),J&&J.reset(),D()}function F(a){N.push(a)}a=a||{};var G=this.context,H=(0,g.default)(G).getInstance(),I=a.metricsModel,J=a.fragmentLoader,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0;return K={setStreamProcessor:c,getStreamProcessor:d,getRequests:h,isFragmentLoaded:e,isFragmentLoadedOrPending:f,removeExecutedRequestsBeforeTime:k,removeExecutedRequestsAfterTime:l,syncExecutedRequestsWithBufferedRange:r,abortRequests:t,executeRequest:u,reset:E,addExecutedRequest:F},b(),K}Object.defineProperty(c,"__esModule",{value:!0});var f=a(47),g=d(f),h=a(53),i=d(h),j=a(48),k=d(j),l=a(217),m=d(l),n=a(46),o=d(n),p="loading",q="executed",r="canceled",s="failed";e.__dashjs_factory_name="FragmentModel";var t=k.default.getClassFactory(e);t.FRAGMENT_MODEL_LOADING=p,t.FRAGMENT_MODEL_EXECUTED=q,t.FRAGMENT_MODEL_CANCELED=r,t.FRAGMENT_MODEL_FAILED=s,k.default.updateClassFactory(e.__dashjs_factory_name,t),c.default=t,b.exports=c.default},{217:217,46:46,47:47,48:48,53:53}],142:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){return e}function b(a){e=a,a&&d.trigger(i.default.MANIFEST_LOADED,{data:a})}var c=this.context,d=(0,g.default)(c).getInstance(),e=void 0;return{getValue:a,setValue:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(47),g=d(f),h=a(53),i=d(h),j=a(48),k=d(j);e.__dashjs_factory_name="ManifestModel",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{47:47,48:48,53:53}],143:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(){function a(){var a,b;nb=[],mb=!1,lb=!0,qb=!0,Gb=m.default.ABR_STRATEGY_DYNAMIC,Hb=!0,Jb=!1,ub={enabled:!0,ttl:r},vb={enabled:!0,ttl:s},ob=q,pb=void 0,rb=v,sb=w,tb=x,wb=NaN,xb=A,yb=B,zb=C,Ab=D,Bb=t,Cb=u,Fb=U,Nb=!1,Ob=E,Qb=F,Ib={default:V},Kb=[],Lb=m.default.MOVING_AVERAGE_SLIDING_WINDOW,Pb=!1,Sb=R,Tb=S,Ub=T,a={},e(a,k.HTTPRequest.MPD_TYPE,K),e(a,k.HTTPRequest.XLINK_EXPANSION_TYPE,M),e(a,k.HTTPRequest.MEDIA_SEGMENT_TYPE,I),e(a,k.HTTPRequest.INIT_SEGMENT_TYPE,I),e(a,k.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,I),e(a,k.HTTPRequest.INDEX_SEGMENT_TYPE,I),e(a,k.HTTPRequest.OTHER_TYPE,I),Db=a,b={},e(b,k.HTTPRequest.MPD_TYPE,L),e(b,k.HTTPRequest.XLINK_EXPANSION_TYPE,N),e(b,k.HTTPRequest.MEDIA_SEGMENT_TYPE,J),e(b,k.HTTPRequest.INIT_SEGMENT_TYPE,J),e(b,k.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,J),e(b,k.HTTPRequest.INDEX_SEGMENT_TYPE,J),e(b,k.HTTPRequest.OTHER_TYPE,J),Eb=b,Mb={},Mb[m.default.VIDEO]=G,Mb[m.default.AUDIO]=H,Rb=!1}function b(a){if(a!==m.default.ABR_STRATEGY_DYNAMIC&&a!==m.default.ABR_STRATEGY_BOLA&&a!==m.default.ABR_STRATEGY_THROUGHPUT)throw m.default.BAD_ARGUMENT_ERROR;Gb=a}function c(){return Gb}function d(a){(0,p.checkParameterType)(a,"boolean"),Hb=a}function f(){return Hb}function g(a){var b=void 0;for(b=0;b<Kb.length;b++)if(Kb[b].rulename===a)return b;return-1}function i(){return Kb}function j(a,b,c){if("string"!=typeof a||a!==o.default.ABANDON_FRAGMENT_RULES&&a!==o.default.QUALITY_SWITCH_RULES||"string"!=typeof b)throw m.default.BAD_ARGUMENT_ERROR;var d=g(b);-1===d?Kb.push({type:a,rulename:b,rule:c}):(Kb[d].type=a,Kb[d].rule=c)}function l(a){if(a){var b=g(a);-1!==b&&Kb.splice(b,1)}else Kb=[]}function n(a){(0,p.checkParameterType)(a,"number"),Bb=a}function W(){return Bb}function X(a){(0,p.checkParameterType)(a,"number"),Cb=a}function Y(){return Cb}function Z(a){(0,p.checkParameterType)(a,"number"),wb=a}function $(){return Ya()?.6*Ea():isNaN(wb)?Jb?z:y:wb}function _(a){(0,p.checkParameterType)(a,"number"),xb=a}function aa(){return xb}function ba(a){(0,p.checkParameterType)(a,"number"),yb=a}function ca(){return yb}function da(a){(0,p.checkParameterType)(a,"number"),zb=a}function ea(){return zb}function fa(a){(0,p.checkParameterType)(a,"number"),Ab=a}function ga(){return Ab}function ha(a,b){(0,p.checkParameterType)(b,"number"),(0,p.checkIsVideoOrAudioType)(a),Mb[a]=b}function ia(a){return Mb[a]}function ja(a){(0,p.checkParameterType)(a,"number"),rb=a}function ka(){return rb}function la(a){(0,p.checkParameterType)(a,"number"),sb=a}function ma(){return sb}function na(a,b){if("boolean"!=typeof a||void 0!==b&&("number"!=typeof b||isNaN(b)))throw m.default.BAD_ARGUMENT_ERROR;ub.enabled=a,void 0!==b&&(ub.ttl=b)}function oa(){return ub}function pa(a,b){if("boolean"!=typeof a||void 0!==b&&("number"!=typeof b||isNaN(b)))throw m.default.BAD_ARGUMENT_ERROR;vb.enabled=a,void 0!==b&&(vb.ttl=b)}function qa(){return vb}function ra(a){(0,p.checkParameterType)(a,"number"),tb=a}function sa(){return tb}function ta(a,b){if("number"!=typeof b||"string"!=typeof a||a!==k.HTTPRequest.MPD_TYPE&&a!==k.HTTPRequest.MEDIA_SEGMENT_TYPE)throw m.default.BAD_ARGUMENT_ERROR;Db[a]=b}function ua(a){return Ya()?Db[a]*Q:Db[a]}function va(a,b){(0,p.checkParameterType)(b,"number"),Eb[a]=b}function wa(a){return Ya()?Eb[a]/P:Eb[a]}function xa(a){(0,p.checkParameterType)(a,"number"),Fb=a}function ya(){return Fb}function za(a){(0,p.checkParameterType)(a,"boolean"),qb=a}function Aa(){return qb}function Ba(a){(0,p.checkParameterType)(a,"number"),ob=a}function Ca(){return ob}function Da(a){void 0!==a&&(0,p.checkParameterType)(a,"number"),pb=a}function Ea(){return Pb?pb||O:pb}function Fa(a){(0,p.checkParameterType)(a,"boolean"),lb=a}function Ga(){return lb}function Ha(a){(0,p.checkParameterType)(a,"boolean"),mb=a}function Ia(){return mb}function Ja(a,b){La(a,b);var c=new h.default;c.schemeIdUri=a,c.value=b,nb.push(c)}function Ka(){return nb}function La(a,b){(0,p.checkParameterType)(a,"string"),(0,p.checkParameterType)(b,"string"),nb.forEach(function(c,d){c.schemeIdUri===a&&c.value===b&&nb.splice(d,1)})}function Ma(){nb=[]}function Na(){Ja(Vb.scheme,Vb.value)}function Oa(a,b){a?Ib[a]=!!b:Object.keys(Ib).forEach(function(a){Oa(a,b)})}function Pa(a){var b=Ib[a];return void 0===b?Ib.default:b}function Qa(){return Jb}function Ra(a){(0,p.checkParameterType)(a,"boolean"),Jb=a}function Sa(a){if(a!==m.default.MOVING_AVERAGE_SLIDING_WINDOW&&a!==m.default.MOVING_AVERAGE_EWMA)throw m.default.BAD_ARGUMENT_ERROR;Lb=a}function Ta(){return Lb}function Ua(a){(0,p.checkParameterType)(a,"boolean"),Nb=a}function Va(){return Nb}function Wa(a){(0,p.checkParameterType)(a,"number"),Ob=a}function Xa(){return Ob}function Ya(){return Pb}function Za(a){(0,p.checkParameterType)(a,"boolean"),Pb=a}function $a(a){(0,p.checkParameterType)(a,"number"),(0,p.checkRange)(a,0,.5),Ub=a}function _a(){return Ub}function ab(a){(0,p.checkParameterType)(a,"number"),Sb=a}function bb(){return Sb}function cb(a){(0,p.checkParameterType)(a,"number"),Tb=a}function db(){return Tb}function eb(a){(0,p.checkParameterType)(a,"number"),Qb=a}function fb(){return Qb}function gb(a){(0,p.checkParameterType)(a,"boolean"),Rb=a}function hb(){return Rb}function ib(){return Vb}function jb(){}var kb=void 0,lb=void 0,mb=void 0,nb=void 0,ob=void 0,pb=void 0,qb=void 0,rb=void 0,sb=void 0,tb=void 0,ub=void 0,vb=void 0,wb=void 0,xb=void 0,yb=void 0,zb=void 0,Ab=void 0,Bb=void 0,Cb=void 0,Db=void 0,Eb=void 0,Fb=void 0,Gb=void 0,Hb=void 0,Ib=void 0,Jb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,Nb=void 0,Ob=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Vb={scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"http://time.akamai.com/?iso&ms"};return kb={setABRStrategy:b,getABRStrategy:c,setUseDefaultABRRules:d,getUseDefaultABRRules:f,getABRCustomRules:i,addABRCustomRule:j,removeABRCustomRule:l,setBandwidthSafetyFactor:n,getBandwidthSafetyFactor:W,setAbandonLoadTimeout:X,getAbandonLoadTimeout:Y,setLastBitrateCachingInfo:na,getLastBitrateCachingInfo:oa,setLastMediaSettingsCachingInfo:pa,getLastMediaSettingsCachingInfo:qa,setStableBufferTime:Z,getStableBufferTime:$,setBufferTimeAtTopQuality:_,getBufferTimeAtTopQuality:aa,setBufferTimeAtTopQualityLongForm:ba,getBufferTimeAtTopQualityLongForm:ca,setLongFormContentDurationThreshold:da,getLongFormContentDurationThreshold:ea,setSegmentOverlapToleranceTime:fa,getSegmentOverlapToleranceTime:ga,getCacheLoadThresholdForType:ia,setCacheLoadThresholdForType:ha,setBufferToKeep:ja,getBufferToKeep:ka,setBufferAheadToKeep:la,getBufferAheadToKeep:ma,setBufferPruningInterval:ra,getBufferPruningInterval:sa,setRetryAttemptsForType:ta,getRetryAttemptsForType:ua,setRetryIntervalForType:va,getRetryIntervalForType:wa,setWallclockTimeUpdateInterval:xa,getWallclockTimeUpdateInterval:ya,setScheduleWhilePaused:za,getScheduleWhilePaused:Aa,getUseSuggestedPresentationDelay:Ia,setUseSuggestedPresentationDelay:Ha,setLiveDelayFragmentCount:Ba,getLiveDelayFragmentCount:Ca,getLiveDelay:Ea,setLiveDelay:Da,setUseManifestDateHeaderTimeSource:Fa,getUseManifestDateHeaderTimeSource:Ga,addUTCTimingSource:Ja,removeUTCTimingSource:La,getUTCTimingSources:Ka,clearDefaultUTCTimingSources:Ma,restoreDefaultUTCTimingSources:Na,setXHRWithCredentialsForType:Oa,getXHRWithCredentialsForType:Pa,setFastSwitchEnabled:Ra,getFastSwitchEnabled:Qa,setMovingAverageMethod:Sa,getMovingAverageMethod:Ta,setJumpGaps:Ua,getJumpGaps:Va,setSmallGapLimit:Wa,getSmallGapLimit:Xa,getLowLatencyEnabled:Ya,setLowLatencyEnabled:Za,setCatchUpPlaybackRate:$a,getCatchUpPlaybackRate:_a,setLowLatencyMinDrift:ab,getLowLatencyMinDrift:bb,setLowLatencyMaxDriftBeforeSeeking:cb,getLowLatencyMaxDriftBeforeSeeking:db,setManifestUpdateRetryInterval:eb,getManifestUpdateRetryInterval:fb,setKeepProtectionMediaKeys:gb,getKeepProtectionMediaKeys:hb,getDefaultUtcTimingSource:ib,reset:jb},a(),kb}Object.defineProperty(c,"__esModule",{value:!0});var g=a(89),h=d(g),i=a(48),j=d(i),k=a(235),l=a(101),m=d(l),n=a(179),o=d(n),p=a(208),q=4,r=36e4,s=36e4,t=.9,u=1e4,v=20,w=80,x=10,y=12,z=20,A=30,B=60,C=600,D=.2,E=.8,F=100,G=50,H=5,I=3,J=1e3,K=3,L=500,M=1,N=500,O=3,P=10,Q=5,R=.02,S=0,T=.5,U=50,V=!1;f.__dashjs_factory_name="MediaPlayerModel",c.default=j.default.getSingletonFactory(f),b.exports=c.default},{101:101,179:179,208:208,235:235,48:48,89:89}],144:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){V={}}function b(a){}function c(){T.trigger(G.default.METRICS_CHANGED)}function d(a){T.trigger(G.default.METRIC_CHANGED,{mediaType:a}),c()}function e(a,b,c){T.trigger(G.default.METRIC_UPDATED,{mediaType:a,metric:b,value:c}),d(a)}function f(a,b,c){T.trigger(G.default.METRIC_ADDED,{mediaType:a,metric:b,value:c}),d(a)}function h(a){delete V[a],d(a)}function j(){V={},c()}function l(a){return V.hasOwnProperty(a)?V[a]:null}function o(a){var b=void 0;return V.hasOwnProperty(a)?b=V[a]:(b=new k.default,V[a]=b),b}function q(a,b,c){var d=o(a);d[b].push(c),d[b].length>R&&d[b].shift()}function s(a,b,c,d,e,f){var g=new m.default;return g.tcpid=b,g.dest=c,g.topen=d,g.tclose=e,g.tconnect=f,B(a,i.default.TCP_CONNECTION,g),g}function u(a,b,c,d){var e=new n.HTTPRequestTrace;return e.s=b,e.d=c,e.b=d,a.trace.push(e),a.interval||(a.interval=0),a.interval+=c,e}function w(a,b,c,d,e,f,g,h,j,k,l,m,o,p){var q=new n.HTTPRequest;return e&&e!==d&&(w(a,null,c,d,null,null,g,h,null,null,null,m,null,null),q.actualurl=e),q.tcpid=b,q.type=c,q.url=d,q.range=g,q.trequest=h,q.tresponse=j,q.responsecode=l,q._tfinish=k,q._stream=a,q._mediaduration=m,q._responseHeaders=o,q._serviceLocation=f,p?p.forEach(function(a){u(q,a.s,a.d,a.b)}):(delete q.interval,delete q.trace),B(a,i.default.HTTP_REQUEST,q),q}function z(a,b,c,d,e){var f=new p.default;return f.t=b,f.mt=c,f.to=d,e?f.lto=e:delete f.lto,B(a,i.default.TRACK_SWITCH,f),f}function B(a,b,c){q(a,b,c),f(a,b,c)}function D(a,b,c){var d=new r.default;return d.t=b,d.level=c,B(a,i.default.BUFFER_LEVEL,d),d}function F(a,b,c){var d=new t.default;return d.target=c,d.state=b,B(a,i.default.BUFFER_STATE,d),d}function H(a,b,c,d){var e=new v.default;return e.time=b,e.range=d,e.manifestInfo=c,B(a,i.default.DVR_INFO,e),e}function I(a,b){var c=new x.default,d=o(a).DroppedFrames;return c.time=b.creationTime,c.droppedFrames=b.droppedVideoFrames,d.length>0&&d[d.length-1]==c?d[d.length-1]:(B(a,i.default.DROPPED_FRAMES,c),c)}function J(a,b,c,d,e,f,g,h,j){var k=new A.default;return k.mediaType=a,k.t=b,k.type=c,k.startTime=d,k.availabilityStartTime=e,k.duration=f,k.quality=g,k.range=h,k.state=j,B(a,i.default.SCHEDULING_INFO,k),k}function K(a,b,c){var d=new E.default;d.loadingRequests=b,d.executedRequests=c,o(a).RequestsQueue=d,f(a,i.default.REQUESTS_QUEUE,d)}function L(a,b,c,d,e,h,j,k,l,m){var n=new y.ManifestUpdate;return n.mediaType=a,n.type=b,n.requestTime=c,n.fetchTime=d,n.availabilityStartTime=e,n.presentationStartTime=h,n.clientTimeOffset=j,n.currentTime=k,n.buffered=l,n.latency=m,q(g.default.STREAM,i.default.MANIFEST_UPDATE,n),f(a,i.default.MANIFEST_UPDATE,n),n}function M(a,b){if(a){for(var c in b)a[c]=b[c];e(a.mediaType,i.default.MANIFEST_UPDATE,a)}}function N(a,b,c,d,f){if(a){var g=new y.ManifestUpdateStreamInfo;return g.id=b,g.index=c,g.start=d,g.duration=f,a.streamInfo.push(g),e(a.mediaType,i.default.MANIFEST_UPDATE_STREAM_INFO,a),g}return null}function O(a,b,c,d,f,g,h,j){if(a){var k=new y.ManifestUpdateRepresentationInfo;return k.id=b,k.index=c,k.streamIndex=d,k.mediaType=f,k.startNumber=h,k.fragmentInfoType=j,k.presentationTimeOffset=g,a.representationInfo.push(k),e(a.mediaType,i.default.MANIFEST_UPDATE_TRACK_INFO,a),k}return null}function P(a){var b=g.default.STREAM;return a.trace&&Array.isArray(a.trace)?a.trace.forEach(function(a){a.hasOwnProperty("subreplevel")&&!a.subreplevel&&delete a.subreplevel}):delete a.trace,B(b,i.default.PLAY_LIST,a),a}function Q(a){return B(g.default.STREAM,i.default.DVB_ERRORS,a),a}var R=1e3,S=this.context,T=(0,C.default)(S).getInstance(),U=void 0,V=void 0;return U={clearCurrentMetricsForType:h,clearAllCurrentMetrics:j,getReadOnlyMetricsFor:l,getMetricsFor:o,addTcpConnection:s,addHttpRequest:w,addRepresentationSwitch:z,addBufferLevel:D,addBufferState:F,addDVRInfo:H,addDroppedFrames:I,addSchedulingInfo:J,addRequestsQueue:K,addManifestUpdate:L,updateManifestUpdateInfo:M,addManifestUpdateStreamInfo:N,addManifestUpdateRepresentationInfo:O,addPlayList:P,addDVBErrors:Q,setConfig:b},a(),U}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(102),i=d(h),j=a(223),k=d(j),l=a(241),m=d(l),n=a(235),o=a(238),p=d(o),q=a(231),r=d(q),s=a(232),t=d(s),u=a(233),v=d(u),w=a(234),x=d(w),y=a(236),z=a(240),A=d(z),B=a(47),C=d(B),D=a(239),E=d(D),F=a(53),G=d(F),H=a(48),I=d(H);e.__dashjs_factory_name="MetricsModel",c.default=I.default.getSingletonFactory(e),b.exports=c.default},{101:101,102:102,223:223,231:231,232:232,233:233,234:234,235:235,236:236,238:238,239:239,240:240,241:241,47:47,48:48,53:53}],145:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){if(c=new g.default,!a)return null;var b=a.indexOf("#");if(-1!==b)for(var d=a.substr(b+1).split("&"),e=0,f=d.length;e<f;++e){var h=d[e],i=h.indexOf("=");if(-1!==i){var j=h.substring(0,i);c.hasOwnProperty(j)&&(c[j]=h.substr(i+1))}}}function b(){return c}var c=void 0;return{initialize:a,getURIFragmentData:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(230),g=d(f),h=a(48),i=d(h);e.__dashjs_factory_name="URIFragmentModel",c.default=i.default.getSingletonFactory(e),b.exports=c.default},{230:230,48:48}],146:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){X=(0,m.default)(ba).getInstance().getLogger(W)}function b(){ca.on(k.default.PLAYBACK_PLAYING,x,this)}function c(){ca.off(k.default.PLAYBACK_PLAYING,x,this)}function d(){Y&&(Y.playbackRate=_||1,Y.removeEventListener("canplay",d))}function e(a){Y&&(Y.readyState<=2&&a>0?Y.addEventListener("canplay",d):Y.playbackRate=a)}function f(a,b){if(Y){if(Y.currentTime==a)return;try{a=b?g(a):a,Y.currentTime=a}catch(c){0===Y.readyState&&c.code===c.INVALID_STATE_ERR&&setTimeout(function(){Y.currentTime=a},400)}}}function g(a){var b=K(),c=a,d=9999999999;if(b)for(var e=0;e<b.length;e++){var f=b.start(e),g=b.end(e),h=Math.abs(f-a),i=Math.abs(g-a);if(a>=f&&a<=g)return a;h<d&&(d=h,c=f),i<d&&(d=i,c=g)}return c}function h(){return Y}function j(a){if(!(null===a||void 0===a||a&&/^(VIDEO|AUDIO)$/i.test(a.nodeName)))throw aa;(Y=a)&&(Y.preload="auto")}function l(a){Y&&(a?Y.src=a:(Y.removeAttribute("src"),Y.load()))}function n(){return Y?Y.src:null}function o(){return $}function p(a){$=a}function q(){return Z}function r(a){Z=a,Z.style.position="absolute",Z.style.display="flex",Z.style.overflow="hidden",Z.style.pointerEvents="none",Z.style.top=0,Z.style.left=0}function s(a,b){w(a,b)}function t(){return da.length>0}function u(a){var b=void 0;null===a||Y.seeking||-1!==da.indexOf(a)||(da.push(a),Y&&1===da.length&&(b=document.createEvent("Event"),b.initEvent("waiting",!0,!1),_=Y.playbackRate,e(0),Y.dispatchEvent(b)))}function v(a){var b=da.indexOf(a),c=void 0;null!==a&&(-1!==b&&da.splice(b,1),Y&&!1===t()&&0===Y.playbackRate&&(e(_||1),Y.paused||(c=document.createEvent("Event"),c.initEvent("playing",!0,!1),Y.dispatchEvent(c))))}function w(a,b){b?u(a):v(a)}function x(){if(Y&&t()&&0===Y.playbackRate){var a=document.createEvent("Event");a.initEvent("waiting",!0,!1),Y.dispatchEvent(a)}}function y(){if(!Y)return null;var a="webkitDroppedFrameCount"in Y&&"webkitDecodedFrameCount"in Y,b="getVideoPlaybackQuality"in Y,c=null;return b?c=Y.getVideoPlaybackQuality():a&&(c={droppedVideoFrames:Y.webkitDroppedFrameCount,totalVideoFrames:Y.webkitDroppedFrameCount+Y.webkitDecodedFrameCount,creationTime:new Date}),c}function z(){if(Y){Y.autoplay=!0;var a=Y.play();a&&"undefined"!=typeof Promise&&a instanceof Promise&&a.catch(function(a){"NotAllowedError"===a.name&&ca.trigger(k.default.PLAYBACK_NOT_ALLOWED),X.warn("Caught pending play exception - continuing ("+a+")")})}}function A(){return Y?Y.paused:null}function B(){Y&&(Y.pause(),Y.autoplay=!1)}function C(){return Y?Y.seeking:null}function D(){return Y?Y.currentTime:null}function E(){return Y?Y.playbackRate:null}function F(){return Y?Y.played:null}function G(){return Y?Y.ended:null}function H(a,b){Y&&Y.addEventListener(a,b)}function I(a,b){Y&&Y.removeEventListener(a,b)}function J(){return Y?Y.readyState:NaN}function K(){return Y?Y.buffered:null}function L(){return Y?Y.clientWidth:NaN}function M(){return Y?Y.clientHeight:NaN}function N(){return Y?Y.videoWidth:NaN}function O(){return Y?Y.videoHeight:NaN}function P(){return Y&&Y.parentNode?Y.getBoundingClientRect().top-Y.parentNode.getBoundingClientRect().top:NaN}function Q(){return Y&&Y.parentNode?Y.getBoundingClientRect().left-Y.parentNode.getBoundingClientRect().left:NaN}function R(){return Y?Y.textTracks:[]}function S(a,b,c,d,e){if(Y)for(var f=0;f<Y.textTracks.length;f++)if(Y.textTracks[f].kind===a&&(!b||Y.textTracks[f].label==b)&&Y.textTracks[f].language===c&&Y.textTracks[f].isTTML===d&&Y.textTracks[f].isEmbedded===e)return Y.textTracks[f];return null}function T(a,b,c){return Y?Y.addTextTrack(a,b,c):null}function U(a){Y&&(Y.appendChild(a),void 0!==a.isTTML&&(Y.textTracks[Y.textTracks.length-1].isTTML=a.isTTML,Y.textTracks[Y.textTracks.length-1].isEmbedded=a.isEmbedded))}function V(a){Y&&Y.removeChild(a)}var W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa="element is not video or audio DOM type!",ba=this.context,ca=(0,i.default)(ba).getInstance(),da=[];return W={initialize:b,setCurrentTime:f,play:z,isPaused:A,pause:B,isSeeking:C,getTime:D,getPlaybackRate:E,setPlaybackRate:e,getPlayedRanges:F,getEnded:G,setStallState:s,getElement:h,setElement:j,setSource:l,getSource:n,getVideoContainer:o,setVideoContainer:p,getTTMLRenderingDiv:q,setTTMLRenderingDiv:r,getPlaybackQuality:y,addEventListener:H,removeEventListener:I,getReadyState:J,getBufferRange:K,getClientWidth:L,getClientHeight:M,getTextTracks:R,getTextTrack:S,addTextTrack:T,appendChild:U,removeChild:V,getVideoWidth:N,getVideoHeight:O,getVideoRelativeOffsetTop:P,getVideoRelativeOffsetLeft:Q,reset:c},a(),W}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(47),i=d(h),j=a(53),k=d(j),l=a(46),m=d(l);e.__dashjs_factory_name="VideoModel",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{46:46,47:47,48:48,53:53}],147:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=new Date,e=a.request,i=new Headers;e.range&&i.append("Range","bytes="+e.range),e.requestStartDate||(e.requestStartDate=b),g&&g.modifyRequestHeader({setRequestHeader:function(a,b){i.append(a,b)}});var j=void 0;"function"==typeof window.AbortController&&(j=new AbortController,a.abortController=j);var k={method:a.method,headers:i,credentials:a.withCredentials?"include":void 0,signal:j?j.signal:void 0};fetch(a.url,k).then(function(b){a.response||(a.response={}),a.response.status=b.status,a.response.statusText=b.statusText,a.response.responseURL=b.url,b.ok||a.onerror();var e="",g=!0,i=!1,j=void 0;try{for(var k,l=b.headers.keys()[Symbol.iterator]();!(g=(k=l.next()).done);g=!0){var m=k.value;e+=m+": "+b.headers.get(m)+"\n"}}catch(t){i=!0,j=t}finally{try{!g&&l.return&&l.return()}finally{if(i)throw j}}if(a.response.responseHeaders=e,!b.body)return b.arrayBuffer().then(function(b){a.response.response=b;var c={loaded:b.byteLength,total:b.byteLength,stream:!1};a.progress(c),a.onload(),a.onend()});var n=parseInt(b.headers.get("Content-Length"),10),o=0,p=!1,q=new Uint8Array,r=0;a.reader=b.body.getReader();var s=[];c(a,function b(e){var g=e.value;if(e.done)return q&&(a.progress({loaded:o,total:isNaN(n)?o:n,lengthComputable:!0,time:f(s,o),stream:!0}),a.response.response=q.buffer),a.onload(),void a.onend();if(g&&g.length>0){q=d(q,g),o+=g.length,s.push({ts:Date.now(),bytes:g.length});var i=h.findLastTopIsoBoxCompleted(["moov","mdat"],q,r);if(i.found){var j=i.lastCompletedOffset+i.size,k=void 0;j===q.length?(k=q,q=new Uint8Array):(k=new Uint8Array(q.subarray(0,j)),q=q.subarray(j)),a.progress({data:k.buffer,lengthComputable:!1,noTrace:!0}),r=0}else r=i.lastCompletedOffset,p||(a.progress({lengthComputable:!1,noTrace:!0}),p=!0)}c(a,b)})}).catch(function(b){a.onerror&&a.onerror(b)})}function c(a,b){a.reader.read().then(b).catch(function(b){a.onerror&&200===a.response.status&&a.onerror(b)})}function d(a,b){if(0===a.length)return b;var c=new Uint8Array(a.length+b.length);return c.set(a),c.set(b,a.length),c}function e(a){if(a.abortController)a.abortController.abort();else if(a.reader)try{a.reader.cancel()}catch(b){}}function f(a,b){if(a=a.filter(function(c){return c.bytes>b/4/a.length}),a.length>1){var c=function(){var b=0,c=(a[a.length-1].ts-a[0].ts)/a.length;return a.forEach(function(d,e){var f=a[e+1];if(f){var g=f.ts-d.ts;b+=g<c?g:0}}),{v:b}}();if("object"==typeof c)return c.v}return null}a=a||{};var g=a.requestModifier,h=a.boxParser;return{load:b,abort:e,calculateDownloadedTime:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="FetchLoader";var h=g.default.getClassFactory(e);c.default=h,b.exports=c.default},{48:48}],148:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(a){function b(){var a,b;t=[],u=[],v=[],a={},e(a,k.HTTPRequest.MPD_TYPE,o.default.DOWNLOAD_ERROR_ID_MANIFEST),e(a,k.HTTPRequest.XLINK_EXPANSION_TYPE,o.default.DOWNLOAD_ERROR_ID_XLINK),e(a,k.HTTPRequest.INIT_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_INITIALIZATION),e(a,k.HTTPRequest.MEDIA_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT),e(a,k.HTTPRequest.INDEX_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT),e(a,k.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT),e(a,k.HTTPRequest.OTHER_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT),w=a,b={},e(b,k.HTTPRequest.MPD_TYPE,o.default.DOWNLOAD_ERROR_ID_MANIFEST_CODE),e(b,k.HTTPRequest.XLINK_EXPANSION_TYPE,o.default.DOWNLOAD_ERROR_ID_XLINK_CODE),e(b,k.HTTPRequest.INIT_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE),e(b,k.HTTPRequest.MEDIA_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT_CODE),e(b,k.HTTPRequest.INDEX_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT_CODE),e(b,k.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT_CODE),e(b,k.HTTPRequest.OTHER_TYPE,o.default.DOWNLOAD_ERROR_ID_CONTENT_CODE),x=b}function c(a,b){var d=a.request,e=[],f=!0,o=!0,s=new Date,y=s,z=0,A=void 0;if(!n||!l||!i)throw new Error("config object is not correct or missing");var B=function(a){o=!1,d.requestStartDate=s,d.requestEndDate=new Date,d.firstByteDate=d.firstByteDate||s,d.checkExistenceOnly||l.addHttpRequest(d.mediaType,null,d.type,d.url,A.response?A.response.responseURL:null,d.serviceLocation||null,d.range||null,d.requestStartDate,d.firstByteDate,d.requestEndDate,A.response?A.response.status:null,d.duration,A.response&&A.response.getAllResponseHeaders?A.response.getAllResponseHeaders():A.response?A.response.responseHeaders:[],a?e:null)},C=function(){-1!==t.indexOf(A)&&(t.splice(t.indexOf(A),1),o&&(B(!1),b>0?(b--,v.push(setTimeout(function(){c(a,b)},m.getRetryIntervalForType(d.type)))):(i.downloadError(w[d.type],d.url,d),i.error(new q.default(x[d.type],d.url+" is not available",{request:d,response:A.response})),a.error&&a.error(d,"error",A.response.statusText),a.complete&&a.complete(d,A.response.statusText))))},D=function(b){var c=new Date;f&&(f=!1,(!b.lengthComputable||b.lengthComputable&&b.total!==b.loaded)&&(d.firstByteDate=c)),b.lengthComputable&&(d.bytesLoaded=b.loaded,d.bytesTotal=b.total),b.noTrace||(e.push({s:y,d:b.time?b.time:c.getTime()-y.getTime(),b:[b.loaded?b.loaded-z:0]}),y=c,z=b.loaded),a.progress&&b&&a.progress(b)},E=function(){A.response.status>=200&&A.response.status<=299&&(B(!0),a.success&&a.success(A.response.response,A.response.statusText,A.response.responseURL),a.complete&&a.complete(d,A.response.statusText))},F=function(){a.abort&&a.abort(d)},G=void 0;G=r&&window.fetch&&"arraybuffer"===d.responseType?(0,j.default)(g).create({requestModifier:n,boxParser:p}):(0,h.default)(g).create({requestModifier:n,boxParser:p});var H=n.modifyRequestURL(d.url),I=d.checkExistenceOnly?k.HTTPRequest.HEAD:k.HTTPRequest.GET,J=m.getXHRWithCredentialsForType(d.type);A={url:H,method:I,withCredentials:J,request:d,onload:E,onend:C,onerror:C,progress:D,onabort:F,loader:G};var K=(new Date).getTime();isNaN(d.delayLoadingTime)||K>=d.delayLoadingTime?(t.push(A),G.load(A)):function(){var a={httpRequest:A};u.push(a),a.delayTimeout=setTimeout(function(){if(-1!==u.indexOf(a)){u.splice(u.indexOf(a),1);try{s=new Date,y=s,t.push(a.httpRequest),G.load(a.httpRequest)}catch(b){a.httpRequest.onerror()}}},d.delayLoadingTime-K)}()}function d(a){a.request&&c(a,m.getRetryAttemptsForType(a.request.type))}function f(){v.forEach(function(a){return clearTimeout(a)}),v=[],u.forEach(function(a){return clearTimeout(a.delayTimeout)}),u=[],t.forEach(function(a){a.onloadend=a.onerror=a.onprogress=void 0,a.loader.abort(a),a.onabort()}),t=[]}a=a||{};var g=this.context,i=a.errHandler,l=a.metricsModel,m=a.mediaPlayerModel,n=a.requestModifier,p=a.boxParser,r=a.useFetch||!1,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0;return s={load:d,abort:f},b(),s}Object.defineProperty(c,"__esModule",{value:!0});var g=a(149),h=d(g),i=a(147),j=d(i),k=a(235),l=a(48),m=d(l),n=a(50),o=d(n),p=a(215),q=d(p);f.__dashjs_factory_name="HTTPLoader";var r=m.default.getClassFactory(f);c.default=r,b.exports=c.default},{147:147,149:149,215:215,235:235,48:48,50:50}],149:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=new Date,c=a.request,e=new XMLHttpRequest;e.open(a.method,a.url,!0),c.responseType&&(e.responseType=c.responseType),c.range&&e.setRequestHeader("Range","bytes="+c.range),c.requestStartDate||(c.requestStartDate=b),d&&(e=d.modifyRequestHeader(e)),e.withCredentials=a.withCredentials,e.onload=a.onload,e.onloadend=a.onend,e.onerror=a.onerror,e.onprogress=a.progress,e.onabort=a.onabort,e.send(),a.response=e}function c(a){var b=a.response;b.onloadend=b.onerror=b.onprogress=void 0,b.abort()}a=a||{};var d=a.requestModifier;return{load:b,abort:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="XHRLoader";var h=g.default.getClassFactory(e);c.default=h,b.exports=c.default},{48:48}],150:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a)}return e(a,null,[{key:"findCencContentProtection",value:function(a){for(var b=null,c=0;c<a.length;++c){var d=a[c];"urn:mpeg:dash:mp4protection:2011"===d.schemeIdUri.toLowerCase()&&"cenc"===d.value.toLowerCase()&&(b=d)}return b}},{key:"getPSSHData",value:function(a){var b=8,c=new DataView(a),d=c.getUint8(b);return b+=20,d>0&&(b+=4+16*c.getUint32(b)),b+=4,a.slice(b)}},{key:"getPSSHForKeySystem",value:function(b,c){var d=a.parsePSSHList(c);return d.hasOwnProperty(b.uuid.toLowerCase())?d[b.uuid.toLowerCase()]:null}},{key:"parseInitDataFromContentProtection",value:function(a,b){return"pssh"in a?b.decodeArray(a.pssh.__text).buffer:null}},{key:"parsePSSHList",value:function(a){if(null===a)return[];for(var b=new DataView(a.buffer||a),c=!1,d={},e=0;!c;){var f=void 0,g=void 0,h=void 0,i=void 0,j=e;if(e>=b.buffer.byteLength)break;if(f=b.getUint32(e),g=e+f,e+=4,1886614376===b.getUint32(e))if(e+=4,0===(h=b.getUint8(e))||1===h){e++,e+=3,i="";var k=void 0,l=void 0;for(k=0;k<4;k++)l=b.getUint8(e+k).toString(16),i+=1===l.length?"0"+l:l;for(e+=4,i+="-",k=0;k<2;k++)l=b.getUint8(e+k).toString(16),i+=1===l.length?"0"+l:l;for(e+=2,i+="-", +k=0;k<2;k++)l=b.getUint8(e+k).toString(16),i+=1===l.length?"0"+l:l;for(e+=2,i+="-",k=0;k<2;k++)l=b.getUint8(e+k).toString(16),i+=1===l.length?"0"+l:l;for(e+=2,i+="-",k=0;k<6;k++)l=b.getUint8(e+k).toString(16),i+=1===l.length?"0"+l:l;e+=6,i=i.toLowerCase(),b.getUint32(e),e+=4,d[i]=b.buffer.slice(j,g),e=g}else e=g;else e=g}return d}}]),a}();c.default=f,b.exports=c.default},{}],151:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){var c=null,d=(0,i.default)(e).getInstance();d.setConfig({debug:a.debug,BASE64:a.BASE64}),d.initialize();var f=b(a);return!c&&f&&(c=(0,g.default)(e).create({protectionModel:f,protectionKeyController:d,eventBus:a.eventBus,debug:a.debug,events:a.events,BASE64:a.BASE64,constants:a.constants}),a.capabilities.setEncryptedMediaSupported(!0)),c}function b(a){var b=a.debug,f=b.getLogger(d),g=a.eventBus,h=a.errHandler,i=a.videoModel?a.videoModel.getElement():null;return i&&void 0===i.onencrypted||i&&void 0===i.mediaKeys?c(i,u)?(f.info("EME detected on this user agent! (ProtectionModel_3Feb2014)"),(0,q.default)(e).create({debug:b,eventBus:g,events:a.events,api:c(i,u)})):c(i,t)?(f.info("EME detected on this user agent! (ProtectionModel_01b)"),(0,s.default)(e).create({debug:b,eventBus:g,errHandler:h,events:a.events,api:c(i,t)})):(f.warn("No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!"),null):(f.info("EME detected on this user agent! (ProtectionModel_21Jan2015)"),(0,o.default)(e).create({debug:b,eventBus:g,events:a.events}))}function c(a,b){for(var c=0;c<b.length;c++){var d=b[c];if("function"==typeof a[d[Object.keys(d)[0]]])return d}return null}var d=void 0,e=this.context;return d={createProtectionSystem:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(153),g=d(f),h=a(154),i=d(h),j=a(152),k=d(j),l=a(159),m=d(l),n=a(161),o=d(n),p=a(162),q=d(p),r=a(160),s=d(r),t=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],u=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];e.__dashjs_factory_name="Protection";var v=dashjs.FactoryMaker.getClassFactory(e);v.events=k.default,v.errors=m.default,dashjs.FactoryMaker.updateClassFactory(e.__dashjs_factory_name,v),c.default=v,b.exports=c.default},{152:152,153:153,154:154,159:159,160:160,161:161,162:162}],152:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(54),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.INTERNAL_KEY_MESSAGE="internalKeyMessage",this.INTERNAL_KEY_SYSTEM_SELECTED="internalKeySystemSelected",this.INTERNAL_KEY_STATUS_CHANGED="internalkeyStatusChanged",this.KEY_ADDED="public_keyAdded",this.KEY_ERROR="public_keyError",this.KEY_MESSAGE="public_keyMessage",this.KEY_SESSION_CLOSED="public_keySessionClosed",this.KEY_SESSION_CREATED="public_keySessionCreated",this.KEY_SESSION_REMOVED="public_keySessionRemoved",this.KEY_STATUSES_CHANGED="public_keyStatusesChanged",this.KEY_SYSTEM_ACCESS_COMPLETE="public_keySystemAccessComplete",this.KEY_SYSTEM_SELECTED="public_keySystemSelected",this.LICENSE_REQUEST_COMPLETE="public_licenseRequestComplete",this.NEED_KEY="needkey",this.PROTECTION_CREATED="public_protectioncreated",this.PROTECTION_DESTROYED="public_protectiondestroyed",this.SERVER_CERTIFICATE_UPDATED="serverCertificateUpdated",this.TEARDOWN_COMPLETE="protectionTeardownComplete",this.VIDEO_ELEMENT_SELECTED="videoElementSelected"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{54:54}],153:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){T=O.getLogger(S),U=[],V=[],X="temporary",Y=""}function c(){if(!(M&&M.hasOwnProperty("on")&&K&&K.hasOwnProperty("getSupportedKeySystemsFromContentProtection")))throw new Error("Missing config parameter(s)")}function d(a){if(!a)throw new Error("mediaInfo can not be null or undefined");c(),M.on(N.INTERNAL_KEY_MESSAGE,G,this),M.on(N.INTERNAL_KEY_STATUS_CHANGED,F,this),V.push(a);var b=K.getSupportedKeySystemsFromContentProtection(a.contentProtection);b&&b.length>0&&D(b,!0)}function e(a){return K.getSupportedKeySystemsFromContentProtection(a)}function f(a,b){var c=g.default.getPSSHForKeySystem(Z,a),d=A(Z);if(c){for(var e=L.getAllInitData(),f=0;f<e.length;f++)if(K.initDataEquals(c,e[f]))return void T.warn("DRM: Ignoring initData because we have already seen it!");try{L.createKeySession(c,d,C(Z),b)}catch(h){M.trigger(N.KEY_SESSION_CREATED,{data:null,error:new o.default(m.default.KEY_SESSION_CREATED_ERROR_CODE,m.default.KEY_SESSION_CREATED_ERROR_MESSAGE+h.message)})}}else a?L.createKeySession(a,d,C(Z),b):M.trigger(N.KEY_SESSION_CREATED,{data:null,error:new o.default(m.default.KEY_SESSION_CREATED_ERROR_CODE,m.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Selected key system is "+Z.systemString+". needkey/encrypted event contains no initData corresponding to that key system!")})}function h(a,b){L.loadKeySession(a,b,C(Z))}function j(a){L.removeKeySession(a)}function l(a){L.closeKeySession(a)}function n(a){L.setServerCertificate(a)}function u(a){a?(L.setMediaElement(a),M.on(N.NEED_KEY,I,this)):null===a&&(L.setMediaElement(a),M.off(N.NEED_KEY,I,this))}function v(a){X=a}function w(a){Y=a}function x(a){W=a,K.setProtectionData(a)}function y(){L&&L.stop()}function z(){M.off(N.INTERNAL_KEY_MESSAGE,G,this),M.off(N.INTERNAL_KEY_STATUS_CHANGED,F,this),u(null),Z=void 0,L&&(L.reset(),L=null),R.forEach(function(a){return clearTimeout(a)}),R=[],V=[]}function A(a){var b=null;if(a){var c=a.systemString;W&&(b=c in W?W[c]:null)}return b}function B(a){var b=A(a),c=[],d=[],e=b&&b.audioRobustness&&b.audioRobustness.length>0?b.audioRobustness:Y,f=b&&b.videoRobustness&&b.videoRobustness.length>0?b.videoRobustness:Y,g=C(a),h=b&&b.distinctiveIdentifier?b.distinctiveIdentifier:"optional",j=b&&b.persistentState?b.persistentState:"temporary"===g?"optional":"required";return V.forEach(function(a){a.type===Q.AUDIO?c.push(new i.default(a.codec,e)):a.type===Q.VIDEO&&d.push(new i.default(a.codec,f))}),new k.default(c,d,h,j,[g])}function C(a){var b=A(a);return b&&b.sessionType?b.sessionType:X}function D(a,b){var c=this,d=[],e=void 0;if(Z){for(e=0;e<a.length;e++)if(Z===a[e].ks){var g=function(){d.push({ks:a[e].ks,configs:[B(Z)]});var g=function d(g){M.off(N.KEY_SYSTEM_ACCESS_COMPLETE,d,c),g.error?b||M.trigger(N.KEY_SYSTEM_SELECTED,{error:new o.default(m.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,m.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+g.error)}):(T.info("DRM: KeySystem Access Granted"),M.trigger(N.KEY_SYSTEM_SELECTED,{data:g.data}),a[e].sessionId?h(a[e].sessionId,a[e].initData):a[e].initData&&f(a[e].initData,a[e].cdmData))};return M.on(N.KEY_SYSTEM_ACCESS_COMPLETE,g,c),L.requestKeySystemAccess(d),"break"}();if("break"===g)break}}else if(void 0===Z){var i;!function(){Z=null,U.push(a);for(var g=0;g<a.length;g++)d.push({ks:a[g].ks,configs:[B(a[g].ks)]});var j=void 0,k=function a(d){M.off(N.KEY_SYSTEM_ACCESS_COMPLETE,a,c),d.error?(Z=void 0,M.off(N.INTERNAL_KEY_SYSTEM_SELECTED,i,c),b||M.trigger(N.KEY_SYSTEM_SELECTED,{data:null,error:new o.default(m.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,m.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+d.error)})):(j=d.data,T.info("DRM: KeySystem Access Granted ("+j.keySystem.systemString+")! Selecting key system..."),L.selectKeySystem(j))};i=function a(d){if(M.off(N.INTERNAL_KEY_SYSTEM_SELECTED,a,c),M.off(N.KEY_SYSTEM_ACCESS_COMPLETE,k,c),d.error)Z=void 0,b||M.trigger(N.KEY_SYSTEM_SELECTED,{data:null,error:new o.default(m.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,m.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+d.error)});else{if(!L)return;Z=L.getKeySystem(),M.trigger(N.KEY_SYSTEM_SELECTED,{data:j});var g=A(Z);g&&g.serverCertificate&&g.serverCertificate.length>0&&L.setServerCertificate(P.decodeArray(g.serverCertificate).buffer);for(var i=0;i<U.length;i++)for(e=0;e<U[i].length;e++)if(Z===U[i][e].ks){if(K.isClearKey(Z)&&g&&g.hasOwnProperty("clearkeys")){var l={kids:Object.keys(g.clearkeys)};U[i][e].initData=(new TextEncoder).encode(JSON.stringify(l))}U[i][e].sessionId?h(U[i][e].sessionId,U[i][e].initData):null!==U[i][e].initData&&f(U[i][e].initData,U[i][e].cdmData);break}}},M.on(N.INTERNAL_KEY_SYSTEM_SELECTED,i,c),M.on(N.KEY_SYSTEM_ACCESS_COMPLETE,k,c),L.requestKeySystemAccess(d)}()}else U.push(a)}function E(a,b){M.trigger(N.LICENSE_REQUEST_COMPLETE,{data:a,error:b})}function F(a){a.error?M.trigger(N.KEY_STATUSES_CHANGED,{data:null,error:a.error}):T.debug("DRM: key status = "+a.status)}function G(a){T.debug("DRM: onKeyMessage");var b=a.data;M.trigger(N.KEY_MESSAGE,{data:b});var c=b.messageType?b.messageType:"license-request",d=b.message,e=b.sessionToken,f=A(Z),h=Z?Z.systemString:null,i=K.getLicenseServer(Z,f,c),j={sessionToken:e,messageType:c};if(!d||0===d.byteLength)return void E(j,new o.default(m.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,m.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE));if(!i)return T.debug("DRM: License server request not required for this message (type = "+a.data.messageType+"). Session ID = "+e.getSessionID()),void E(j);if(K.isClearKey(Z)){var k=K.processClearKeyLicenseRequest(Z,f,d);if(k)return T.debug("DRM: ClearKey license request handled by application!"),E(j),void L.updateKeySession(e,k)}var l=null;if(f&&f.serverURL){var n=f.serverURL;"string"==typeof n&&""!==n?l=n:"object"==typeof n&&n.hasOwnProperty(c)&&(l=n[c])}else f&&f.laURL&&""!==f.laURL?l=f.laURL:(l=Z.getLicenseServerURLFromInitData(g.default.getPSSHData(e.initData)))||(l=a.data.laURL);if(!(l=i.getServerURLFromMessage(l,d,c)))return void E(j,new o.default(m.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,m.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));var p={},q=!1,s=function(a){if(a)for(var b in a)"authorization"===b.toLowerCase()&&(q=!0),p[b]=a[b]};f&&s(f.httpRequestHeaders),s(Z.getRequestHeadersFromMessage(d)),f&&"boolean"==typeof f.withCredentials&&(q=f.withCredentials);var u=function(a,b,c,d){var e=a.response?i.getErrorResponse(a.response,c,d):"NONE";E(b,new o.default(m.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,m.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+c+' update, XHR complete. status is "'+a.statusText+'" ('+a.status+"), readyState is "+a.readyState+". Response is "+e))},v=function(a){if(L)if(200===a.status){var b=i.getLicenseMessage(a.response,h,c);null!==b?(E(j),L.updateKeySession(e,b)):u(a,j,h,c)}else u(a,j,h,c)},w=function(a){E(j,new o.default(m.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,m.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+h+' update, XHR aborted. status is "'+a.statusText+'" ('+a.status+"), readyState is "+a.readyState))},x=function(a){E(j,new o.default(m.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,m.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+h+' update, XHR error. status is "'+a.statusText+'" ('+a.status+"), readyState is "+a.readyState))},y=Z.getLicenseRequestFromMessage(d),z=i.getHTTPMethod(c),B=i.getResponseType(h,c),C=f&&!isNaN(f.httpTimeout)?f.httpTimeout:t;H(l,p,z,B,q,y,r,C,v,w,x)}function H(a,b,c,d,e,f,g,h,i,j,k){var l=new XMLHttpRequest;l.open(c,a,!0),l.responseType=d,l.withCredentials=e,h>0&&(l.timeout=h);for(var m in b)l.setRequestHeader(m,b[m]);var n=function(){g--,setTimeout(function(){H(a,b,c,d,e,f,g,h,i,j,k)},s)};l.onload=function(){200===this.status||g<=0?i(this):(T.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+g),n())},l.onerror=function(){g<=0?k(this):(T.warn("License request network request failed . Retrying it... Pending retries: "+g),n())},l.onabort=function(){j(this)},l.send(f)}function I(a,b){if(T.debug("DRM: onNeedKey"),"cenc"!==a.key.initDataType)return void T.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+a.key.initDataType);if(0===V.length&&(T.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(b=void 0===b?1:b+1)<p))return void R.push(setTimeout(function(){I(a,b)},q));var c=a.key.initData;if(ArrayBuffer.isView(c)&&(c=c.buffer),Z){var d=g.default.getPSSHForKeySystem(Z,c);if(d)for(var e=L.getAllInitData(),f=0;f<e.length;f++)if(K.initDataEquals(d,e[f]))return void T.warn("DRM: Ignoring initData because we have already seen it!")}T.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(c)));var h=K.getSupportedKeySystems(c,W);if(0===h.length)return void T.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!");D(h,!1)}function J(){return K?K.getKeySystems():[]}a=a||{};var K=a.protectionKeyController,L=a.protectionModel,M=a.eventBus,N=a.events,O=a.debug,P=a.BASE64,Q=a.constants,R=[],S=void 0,T=void 0,U=void 0,V=void 0,W=void 0,X=void 0,Y=void 0,Z=void 0;return S={initializeForMedia:d,createKeySession:f,loadKeySession:h,removeKeySession:j,closeKeySession:l,setServerCertificate:n,setMediaElement:u,setSessionType:v,setRobustnessLevel:w,setProtectionData:x,getSupportedKeySystemsFromContentProtection:e,getKeySystems:J,stop:y,reset:z},b(),S}Object.defineProperty(c,"__esModule",{value:!0});var f=a(150),g=d(f),h=a(172),i=d(h),j=a(171),k=d(j),l=a(159),m=d(l),n=a(215),o=d(n),p=5,q=500,r=3,s=1e3,t=8e3;e.__dashjs_factory_name="ProtectionController",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{150:150,159:159,171:171,172:172,215:215}],154:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){a&&(a.debug&&(v=a.debug,x=v.getLogger(t)),a.BASE64&&(A=a.BASE64))}function b(){z=[];var a=void 0;a=(0,o.default)(r).getInstance({BASE64:A}),z.push(a),a=(0,m.default)(r).getInstance({BASE64:A}),z.push(a),a=(0,i.default)(r).getInstance({BASE64:A}),z.push(a),B=a,a=(0,k.default)(r).getInstance({BASE64:A,debug:v}),z.push(a),C=a}function c(){return z}function d(a){for(var b=0;b<z.length;b++)if(z[b].systemString===a)return z[b];return null}function e(a){return a===B||a===C}function f(a,b){if(a.byteLength===b.byteLength){for(var c=new Uint8Array(a),d=new Uint8Array(b),e=0;e<c.length;e++)if(c[e]!==d[e])return!1;return!0}return!1}function h(a){var b=void 0,c=void 0,d=void 0,e=void 0,f=[];if(a)for(d=0;d<z.length;++d)for(c=z[d],e=0;e<a.length;++e)if(b=a[e],b.schemeIdUri.toLowerCase()===c.schemeIdURI){var g=c.getInitData(b);g?f.push({ks:z[d],initData:g,cdmData:c.getCDMData(),sessionId:c.getSessionId(b)}):this.isClearKey(c)&&f.push({ks:c,initData:null})}return f}function j(a,b){for(var c=[],d=g.default.parsePSSHList(a),e=void 0,f=void 0,h=void 0,i=0;i<z.length;++i)e=z[i],f=e.systemString,h=!b||f in b,e.uuid in d&&h&&c.push({ks:e,initData:d[e.uuid],cdmData:e.getCDMData(),sessionId:e.getSessionId()});return c}function l(a,b,c){if("license-release"===c||"individualization-request"===c)return null;var d=null;return b&&b.hasOwnProperty("drmtoday")?d=(0,q.default)(r).getInstance({BASE64:A}):a.systemString===y.default.WIDEVINE_KEYSTEM_STRING?d=(0,u.default)(r).getInstance():a.systemString===y.default.PLAYREADY_KEYSTEM_STRING?d=(0,s.default)(r).getInstance():a.systemString===y.default.CLEARKEY_KEYSTEM_STRING&&(d=(0,w.default)(r).getInstance()),d}function n(a,b,c){try{return a.getClearKeysFromProtectionData(b,c)}catch(d){return x.error("Failed to retrieve clearkeys from ProtectionData"),null}}function p(a){for(var b=(function(b){var c=null;return a&&(c=b in a?a[b]:null),c}),c=0;c<z.length;c++){var d=z[c];d.hasOwnProperty("init")&&d.init(b(d.systemString))}}var r=this.context,t=void 0,v=void 0,x=void 0,z=void 0,A=void 0,B=void 0,C=void 0;return t={initialize:b,setProtectionData:p,isClearKey:e,initDataEquals:f,getKeySystems:c,getKeySystemBySystemString:d,getSupportedKeySystemsFromContentProtection:h,getSupportedKeySystems:j,getLicenseServer:l,processClearKeyLicenseRequest:n,setConfig:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(150),g=d(f),h=a(155),i=d(h),j=a(157),k=d(j),l=a(158),m=d(l),n=a(156),o=d(n),p=a(164),q=d(p),r=a(165),s=d(r),t=a(166),u=d(t),v=a(163),w=d(v),x=a(103),y=d(x);e.__dashjs_factory_name="ProtectionKeyController",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{103:103,150:150,155:155,156:156,157:157,158:158,163:163,164:164,165:165,166:166}],155:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){var c=null;if(a){for(var d=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(b))),e=[],f=0;f<d.kids.length;f++){var h=d.kids[f],j=a.clearkeys&&a.clearkeys.hasOwnProperty(h)?a.clearkeys[h]:null;if(!j)throw new Error("DRM: ClearKey keyID ("+h+") is not known!");e.push(new g.default(h,j))}c=new i.default(e)}return c}function c(a){return k.default.parseInitDataFromContentProtection(a,l)}function d(){return null}function e(a){return new Uint8Array(a)}function f(){return null}function h(){return null}function j(){return null}a=a||{};var l=a.BASE64;return{uuid:n,schemeIdURI:p,systemString:o,getInitData:c,getRequestHeadersFromMessage:d,getLicenseRequestFromMessage:e,getLicenseServerURLFromInitData:f,getCDMData:h,getSessionId:j,getClearKeysFromProtectionData:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(169),g=d(f),h=a(167),i=d(h),j=a(150),k=d(j),l=a(103),m=d(l),n="e2719d58-a985-b3c9-781a-b030af78d30e",o=m.default.CLEARKEY_KEYSTEM_STRING,p="urn:uuid:"+n;e.__dashjs_factory_name="KeySystemClearKey",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{103:103,150:150,167:167,169:169}],156:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){if(!r||!r.hasOwnProperty("decodeArray")||!r.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}function c(a){var b=void 0,c=void 0,d={},e=new DOMParser,f="utf16"===q?new Uint16Array(a):new Uint8Array(a);b=String.fromCharCode.apply(null,f),c=e.parseFromString(b,"application/xml");for(var g=c.getElementsByTagName("name"),h=c.getElementsByTagName("value"),i=0;i<g.length;i++)d[g[i].childNodes[0].nodeValue]=h[i].childNodes[0].nodeValue;return d.hasOwnProperty("Content")&&(d["Content-Type"]=d.Content,delete d.Content),d.hasOwnProperty("Content-Type")||(d["Content-Type"]="text/xml; charset="+q),d}function d(a){var c=null,d=new DOMParser,e="utf16"===q?new Uint16Array(a):new Uint8Array(a);b();var f=String.fromCharCode.apply(null,e),g=d.parseFromString(f,"application/xml");if(g.getElementsByTagName("Challenge")[0]){var h=g.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;h&&(c=r.decode(h))}else if(g.getElementsByTagName("parsererror").length)return a;return c}function e(a){if(a)for(var b=new DataView(a),c=b.getUint16(4,!0),d=6,e=new DOMParser,f=0;f<c;f++){var g=b.getUint16(d,!0);d+=2;var h=b.getUint16(d,!0);if(d+=2,1===g){var i=a.slice(d,d+h),j=String.fromCharCode.apply(null,new Uint16Array(i)),k=e.parseFromString(j,"application/xml");if(k.getElementsByTagName("LA_URL")[0]){var l=k.getElementsByTagName("LA_URL")[0].childNodes[0].nodeValue;if(l)return l}if(k.getElementsByTagName("LUI_URL")[0]){var m=k.getElementsByTagName("LUI_URL")[0].childNodes[0].nodeValue;if(m)return m}}else d+=h}return null}function f(a){var c=new Uint8Array([112,115,115,104,0,0,0,0]),d=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),e=0,f=null,h=void 0,i=void 0,j=void 0,k=void 0,l=void 0;if(b(),"pssh"in a)return g.default.parseInitDataFromContentProtection(a,r);if("pro"in a)f=r.decodeArray(a.pro.__text);else{if(!("prheader"in a))return null;f=r.decodeArray(a.prheader.__text)}return h=f.length,i=4+c.length+d.length+4+h,j=new ArrayBuffer(i),k=new Uint8Array(j),l=new DataView(j),l.setUint32(e,i),e+=4,k.set(c,e),e+=c.length,k.set(d,e),e+=d.length,l.setUint32(e,h),e+=4,k.set(f,e),e+=h,k.buffer}function h(a){if("utf8"!==a&&"utf16"!==a)throw new Error("Illegal PlayReady message format! -- "+a);q=a}function i(a){a&&(n=a)}function o(){var a=void 0,c=void 0,d=void 0,e=void 0;if(b(),n&&n.cdmData){for(a=[],e=0;e<n.cdmData.length;++e)a.push(n.cdmData.charCodeAt(e)),a.push(0);for(a=String.fromCharCode.apply(null,a),a=r.encode(a),c=m.replace("%CUSTOMDATA%",a),d=[],e=0;e<c.length;++e)d.push(c.charCodeAt(e)),d.push(0);return new Uint8Array(d).buffer}return null}function p(){return null}a=a||{};var q="utf16",r=a.BASE64;return{uuid:j,schemeIdURI:l,systemString:k,getInitData:f,getRequestHeadersFromMessage:c,getLicenseRequestFromMessage:d,getLicenseServerURLFromInitData:e,getCDMData:o,getSessionId:p,setPlayReadyMessageFormat:h,init:i}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(150),g=d(f),h=a(103),i=d(h),j="9a04f079-9840-4286-ab92-e65be0885f95",k=i.default.PLAYREADY_KEYSTEM_STRING,l="urn:uuid:"+j,m='<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>',n=void 0;e.__dashjs_factory_name="KeySystemPlayReady",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{103:103,150:150}],157:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a,b){var c=null;if(a){for(var d=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(b))),e=[],f=0;f<d.kids.length;f++){var h=d.kids[f],j=a.clearkeys&&a.clearkeys.hasOwnProperty(h)?a.clearkeys[h]:null;if(!j)throw new Error("DRM: ClearKey keyID ("+h+") is not known!");e.push(new g.default(h,j))}c=new i.default(e),q.warn("ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4")}return c}function c(a){return k.default.parseInitDataFromContentProtection(a,m)}function d(){return null}function e(a){return new Uint8Array(a)}function f(){return null}function h(){return null}function j(){return null}var l=void 0,m=a.BASE64,q=a.debug.getLogger(l);return l={uuid:n,schemeIdURI:p,systemString:o,getInitData:c,getRequestHeadersFromMessage:d,getLicenseRequestFromMessage:e,getLicenseServerURLFromInitData:f,getCDMData:h,getSessionId:j,getClearKeysFromProtectionData:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(169),g=d(f),h=a(167),i=d(h),j=a(150),k=d(j),l=a(103),m=d(l),n="1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",o=m.default.CLEARKEY_KEYSTEM_STRING,p="urn:uuid:"+n;e.__dashjs_factory_name="KeySystemW3CClearKey",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{103:103,150:150,167:167,169:169}],158:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){a&&(m=a)}function c(a){return g.default.parseInitDataFromContentProtection(a,n)}function d(){return null}function e(a){return new Uint8Array(a)}function f(){return null}function h(){return null}function i(a){return m&&m.sessionId?m.sessionId:a&&a.sessionId?a.sessionId:null}a=a||{};var m=null,n=a.BASE64;return{uuid:j,schemeIdURI:l,systemString:k,init:b,getInitData:c,getRequestHeadersFromMessage:d,getLicenseRequestFromMessage:e,getLicenseServerURLFromInitData:f,getCDMData:h,getSessionId:i}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(150),g=d(f),h=a(103),i=d(h),j="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",k=i.default.WIDEVINE_KEYSTEM_STRING,l="urn:uuid:"+j;e.__dashjs_factory_name="KeySystemWidevine",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{103:103,150:150}],159:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(51),i=d(h),j=function(a){function b(){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.MEDIA_KEYERR_CODE=100,this.MEDIA_KEYERR_UNKNOWN_CODE=101,this.MEDIA_KEYERR_CLIENT_CODE=102,this.MEDIA_KEYERR_SERVICE_CODE=103,this.MEDIA_KEYERR_OUTPUT_CODE=104,this.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,this.MEDIA_KEYERR_DOMAIN_CODE=106,this.MEDIA_KEY_MESSAGE_ERROR_CODE=107,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,this.KEY_SESSION_CREATED_ERROR_CODE=113,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,this.MEDIA_KEYERR_UNKNOWN_MESSAGE="An unspecified error occurred. This value is used for errors that don't match any of the other codes.",this.MEDIA_KEYERR_CLIENT_MESSAGE="The Key System could not be installed or updated.",this.MEDIA_KEYERR_SERVICE_MESSAGE="The message passed into update indicated an error from the license service.",this.MEDIA_KEYERR_OUTPUT_MESSAGE="There is no available output device with the required characteristics for the content protection system.",this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE="A hardware configuration change caused a content protection error.",this.MEDIA_KEYERR_DOMAIN_MESSAGE="An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.",this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE="Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!",this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE="DRM: Empty key message from CDM",this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE="Error updating server certificate -- ",this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE="DRM: KeyStatusChange error! -- License has expired",this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE="DRM: No license server URL specified!",this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE="DRM: KeySystem Access Denied! -- ",this.KEY_SESSION_CREATED_ERROR_MESSAGE="DRM: unable to create session! --",this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE="DRM: licenser error! --"}return f(b,a),b}(i.default),k=new j;c.default=k,b.exports=c.default},{51:51}],160:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){F=B.getLogger(E),G=null,H=null,J=[],K=[],I=(0,g.default)(y).getInstance(),M=v()}function c(){G&&x();for(var a=0;a<K.length;a++)p(K[a]);z.trigger(A.TEARDOWN_COMPLETE)}function d(){return H}function e(){for(var a=[],b=0;b<J.length;b++)a.push(J[b].initData);for(var b=0;b<K.length;b++)a.push(K[b].initData);return a}function f(a){var b=G;b||(b=document.createElement("video"));for(var c=!1,d=0;d<a.length;d++)for(var e=a[d].ks.systemString,f=a[d].configs,g=null,h=null,i=0;i<f.length;i++){var j=f[i].videoCapabilities;if(j&&0!==j.length){h=[];for(var k=0;k<j.length;k++)""!==b.canPlayType(j[k].contentType,e)&&h.push(j[k])}if(!(!g&&!h||g&&0===g.length||h&&0===h.length)){c=!0;var l=new o.default(g,h),m=I.getKeySystemBySystemString(e);z.trigger(A.KEY_SYSTEM_ACCESS_COMPLETE,{data:new q.default(m,l)});break}}c||z.trigger(A.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})}function h(a){H=a.keySystem,z.trigger(A.INTERNAL_KEY_SYSTEM_SELECTED)}function j(a){if(G!==a){if(G){x();for(var b=0;b<K.length;b++)p(K[b]);K=[]}G=a,G&&(G.addEventListener(C.keyerror,M),G.addEventListener(C.needkey,M),G.addEventListener(C.keymessage,M),G.addEventListener(C.keyadded,M),z.trigger(A.VIDEO_ELEMENT_SELECTED))}}function l(a){if(!H)throw new Error("Can not create sessions until you have selected a key system");if(L||0===K.length){var b={sessionID:null,initData:a,getSessionID:function(){return this.sessionID},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"}};return J.push(b),G[C.generateKeyRequest](H.systemString,new Uint8Array(a)),b}throw new Error("Multiple sessions not allowed!")}function n(a,b){var c=a.sessionID;if(I.isClearKey(H))for(var d=0;d<b.keyPairs.length;d++)G[C.addKey](H.systemString,b.keyPairs[d].key,b.keyPairs[d].keyID,c);else G[C.addKey](H.systemString,new Uint8Array(b),new Uint8Array(a.initData),c)}function p(a){try{G[C.cancelKeyRequest](H.systemString,a.sessionID)}catch(b){z.trigger(A.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+a.sessionID+") "+b.message})}}function r(){}function t(){}function u(){}function v(){return{handleEvent:function(a){var b=null;switch(a.type){case C.needkey:var c=ArrayBuffer.isView(a.initData)?a.initData.buffer:a.initData;z.trigger(A.NEED_KEY,{key:new i.default(c,"cenc")});break;case C.keyerror:if(b=w(K,a.sessionId),b||(b=w(J,a.sessionId)),b){var d=s.default.MEDIA_KEYERR_CODE,e="";switch(a.errorCode.code){case 1:d=s.default.MEDIA_KEYERR_UNKNOWN_CODE,e+="MEDIA_KEYERR_UNKNOWN - "+s.default.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:d=s.default.MEDIA_KEYERR_CLIENT_CODE,e+="MEDIA_KEYERR_CLIENT - "+s.default.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:d=s.default.MEDIA_KEYERR_SERVICE_CODE,e+="MEDIA_KEYERR_SERVICE - "+s.default.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:d=s.default.MEDIA_KEYERR_OUTPUT_CODE,e+="MEDIA_KEYERR_OUTPUT - "+s.default.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:d=s.default.MEDIA_KEYERR_HARDWARECHANGE_CODE,e+="MEDIA_KEYERR_HARDWARECHANGE - "+s.default.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:d=s.default.MEDIA_KEYERR_DOMAIN_CODE,e+="MEDIA_KEYERR_DOMAIN - "+s.default.MEDIA_KEYERR_DOMAIN_MESSAGE}e+=" System Code = "+a.systemCode,z.trigger(A.KEY_ERROR,{data:new k.default(d,e,b)})}else F.error("No session token found for key error");break;case C.keyadded:b=w(K,a.sessionId),b||(b=w(J,a.sessionId)),b?(F.debug("DRM: Key added."),z.trigger(A.KEY_ADDED,{data:b})):F.debug("No session token found for key added");break;case C.keymessage:if(L=null!==a.sessionId&&void 0!==a.sessionId,L?!(b=w(K,a.sessionId))&&J.length>0&&(b=J.shift(),K.push(b),b.sessionID=a.sessionId,z.trigger(A.KEY_SESSION_CREATED,{data:b})):J.length>0&&(b=J.shift(),K.push(b),0!==J.length&&(D.mediaKeyMessageError(s.default.MEDIA_KEY_MESSAGE_ERROR_MESSAGE),D.error(new k.default(s.default.MEDIA_KEY_MESSAGE_ERROR_CODE,s.default.MEDIA_KEY_MESSAGE_ERROR_MESSAGE)))),b){ +var f=ArrayBuffer.isView(a.message)?a.message.buffer:a.message;b.keyMessage=f,z.trigger(A.INTERNAL_KEY_MESSAGE,{data:new m.default(b,f,a.defaultURL)})}else F.warn("No session token found for key message")}}}}function w(a,b){if(b&&a){for(var c=a.length,d=0;d<c;d++)if(a[d].sessionID==b)return a[d];return null}return null}function x(){G.removeEventListener(C.keyerror,M),G.removeEventListener(C.needkey,M),G.removeEventListener(C.keymessage,M),G.removeEventListener(C.keyadded,M)}a=a||{};var y=this.context,z=a.eventBus,A=a.events,B=a.debug,C=a.api,D=a.errHandler,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0;return E={getAllInitData:e,requestKeySystemAccess:f,getKeySystem:d,selectKeySystem:h,setMediaElement:j,createKeySession:l,updateKeySession:n,closeKeySession:p,setServerCertificate:r,loadKeySession:t,removeKeySession:u,stop:c,reset:c},b(),E}Object.defineProperty(c,"__esModule",{value:!0});var f=a(154),g=d(f),h=a(173),i=d(h),j=a(215),k=d(j),l=a(168),m=d(l),n=a(171),o=d(n),p=a(170),q=d(p),r=a(159),s=d(r);e.__dashjs_factory_name="ProtectionModel_01b",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{154:154,159:159,168:168,170:170,171:171,173:173,215:215}],161:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){H=F.getLogger(G),I=null,J=null,K=null,L=[],N=(0,g.default)(C).getInstance(),M=y()}function c(){var a=L.length,b=void 0;0!==a?function(){for(var c=function(a){z(a),0===L.length&&(J?(J.removeEventListener("encrypted",M),J.setMediaKeys(null).then(function(){D.trigger(E.TEARDOWN_COMPLETE)})):D.trigger(E.TEARDOWN_COMPLETE))},d=0;d<a;d++)b=L[d],function(a){b.session.closed.then(function(){c(a)}),x(b).catch(function(){c(a)})}(b)}():D.trigger(E.TEARDOWN_COMPLETE)}function d(){for(var a=void 0,b=0;b<L.length;b++)a=L[b],a.getUsable()||x(a).catch(function(){z(a)})}function e(){return I}function f(){for(var a=[],b=0;b<L.length;b++)L[b].initData&&a.push(L[b].initData);return a}function h(a){w(a,0)}function j(a){a.mksa.createMediaKeys().then(function(b){I=a.keySystem,K=b,J?J.setMediaKeys(K).then(function(){D.trigger(E.INTERNAL_KEY_SYSTEM_SELECTED)}):D.trigger(E.INTERNAL_KEY_SYSTEM_SELECTED)}).catch(function(){D.trigger(E.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+a.keySystem.systemString+")! Could not create MediaKeys -- TODO"})})}function l(a){J!==a&&(J&&(J.removeEventListener("encrypted",M),J.setMediaKeys&&J.setMediaKeys(null)),(J=a)&&(J.addEventListener("encrypted",M),J.setMediaKeys&&K&&J.setMediaKeys(K)))}function n(a){if(!I||!K)throw new Error("Can not set server certificate until you have selected a key system");K.setServerCertificate(a).then(function(){H.info("DRM: License server certificate successfully updated."),D.trigger(E.SERVER_CERTIFICATE_UPDATED)}).catch(function(a){D.trigger(E.SERVER_CERTIFICATE_UPDATED,{error:new m.default(k.default.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,k.default.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+a.name)})})}function p(a,b,c){if(!I||!K)throw new Error("Can not create sessions until you have selected a key system");var d=K.createSession(c),e=B(d,a,c),f=this.getKeySystem(),g=f.systemString===s.default.CLEARKEY_KEYSTEM_STRING&&b&&b.clearkeys?"keyids":"cenc";d.generateRequest(g,a).then(function(){H.debug("DRM: Session created. SessionID = "+e.getSessionID()),D.trigger(E.KEY_SESSION_CREATED,{data:e})}).catch(function(a){z(e),D.trigger(E.KEY_SESSION_CREATED,{data:null,error:new m.default(k.default.KEY_SESSION_CREATED_ERROR_CODE,k.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Error generating key request -- "+a.name)})})}function r(a,b){var c=a.session;N.isClearKey(I)&&(b=b.toJWK()),c.update(b).catch(function(b){D.trigger(E.KEY_ERROR,{data:new m.default(k.default.MEDIA_KEYERR_CODE,"Error sending update() message! "+b.name,a)})})}function t(a,b,c){if(!I||!K)throw new Error("Can not load sessions until you have selected a key system");for(var d=0;d<L.length;d++)if(a===L[d].sessionId)return void H.warn("DRM: Ignoring session ID because we have already seen it!");var e=K.createSession(c),f=B(e,b,c,a);e.load(a).then(function(b){b?(H.debug("DRM: Session loaded. SessionID = "+f.getSessionID()),D.trigger(E.KEY_SESSION_CREATED,{data:f})):(z(f),D.trigger(E.KEY_SESSION_CREATED,{data:null,error:new m.default(k.default.KEY_SESSION_CREATED_ERROR_CODE,k.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session! Invalid Session ID ("+a+")")}))}).catch(function(b){z(f),D.trigger(E.KEY_SESSION_CREATED,{data:null,error:new m.default(k.default.KEY_SESSION_CREATED_ERROR_CODE,k.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session ("+a+")! "+b.name)})})}function u(a){a.session.remove().then(function(){H.debug("DRM: Session removed. SessionID = "+a.getSessionID()),D.trigger(E.KEY_SESSION_REMOVED,{data:a.getSessionID()})},function(b){D.trigger(E.KEY_SESSION_REMOVED,{data:null,error:"Error removing session ("+a.getSessionID()+"). "+b.name})})}function v(a){x(a).catch(function(b){z(a),D.trigger(E.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+a.getSessionID()+") "+b.name})})}function w(a,b){if(void 0===navigator.requestMediaKeySystemAccess||"function"!=typeof navigator.requestMediaKeySystemAccess)return void D.trigger(E.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Insecure origins are not allowed"});!function(b){var c=a[b].ks,d=a[b].configs;navigator.requestMediaKeySystemAccess(c.systemString,d).then(function(a){var b="function"==typeof a.getConfiguration?a.getConfiguration():null,d=new q.default(c,b);d.mksa=a,D.trigger(E.KEY_SYSTEM_ACCESS_COMPLETE,{data:d})}).catch(function(c){++b<a.length?w(a,b):D.trigger(E.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! "+c.message})})}(b)}function x(a){var b=a.session;return b.removeEventListener("keystatuseschange",a),b.removeEventListener("message",a),b.close()}function y(){return{handleEvent:function(a){switch(a.type){case"encrypted":if(a.initData){var b=ArrayBuffer.isView(a.initData)?a.initData.buffer:a.initData;D.trigger(E.NEED_KEY,{key:new i.default(b,a.initDataType)})}}}}}function z(a){for(var b=0;b<L.length;b++)if(L[b]===a){L.splice(b,1);break}}function A(a){var b=void 0,c=void 0;return a&&a.length>0&&(a[0]&&("string"==typeof a[0]?b=a[0]:c=a[0]),a[1]&&("string"==typeof a[1]?b=a[1]:c=a[1])),{status:b,keyId:c}}function B(a,b,c,d){var e={session:a,initData:b,sessionId:d,handleEvent:function(a){switch(a.type){case"keystatuseschange":D.trigger(E.KEY_STATUSES_CHANGED,{data:this}),a.target.keyStatuses.forEach(function(){var a=A(arguments);switch(a.status){case"expired":D.trigger(E.INTERNAL_KEY_STATUS_CHANGED,{error:new m.default(k.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,k.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)});break;default:D.trigger(E.INTERNAL_KEY_STATUS_CHANGED,a)}});break;case"message":var b=ArrayBuffer.isView(a.message)?a.message.buffer:a.message;D.trigger(E.INTERNAL_KEY_MESSAGE,{data:new o.default(this,b,void 0,a.messageType)})}},getSessionID:function(){return a.sessionId},getExpirationTime:function(){return a.expiration},getKeyStatuses:function(){return a.keyStatuses},getUsable:function(){var b=!1;return a.keyStatuses.forEach(function(){"usable"===A(arguments).status&&(b=!0)}),b},getSessionType:function(){return c}};return a.addEventListener("keystatuseschange",e),a.addEventListener("message",e),a.closed.then(function(){z(e),H.debug("DRM: Session closed. SessionID = "+e.getSessionID()),D.trigger(E.KEY_SESSION_CLOSED,{data:e.getSessionID()})}),L.push(e),e}a=a||{};var C=this.context,D=a.eventBus,E=a.events,F=a.debug,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0;return G={getAllInitData:f,requestKeySystemAccess:h,getKeySystem:e,selectKeySystem:j,setMediaElement:l,setServerCertificate:n,createKeySession:p,updateKeySession:r,loadKeySession:t,removeKeySession:u,closeKeySession:v,stop:d,reset:c},b(),G}Object.defineProperty(c,"__esModule",{value:!0});var f=a(154),g=d(f),h=a(173),i=d(h),j=a(159),k=d(j),l=a(215),m=d(l),n=a(168),o=d(n),p=a(170),q=d(p),r=a(103),s=d(r);e.__dashjs_factory_name="ProtectionModel_21Jan2015",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{103:103,154:154,159:159,168:168,170:170,173:173,215:215}],162:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){E=B.getLogger(D),F=null,G=null,H=null,I=null,J=[],L=(0,g.default)(y).getInstance(),K=v()}function c(){try{for(var a=0;a<J.length;a++)p(J[a]);F&&F.removeEventListener(C.needkey,K),z.trigger(A.TEARDOWN_COMPLETE)}catch(b){z.trigger(A.TEARDOWN_COMPLETE,{error:"Error tearing down key sessions and MediaKeys! -- "+b.message})}}function d(){return G}function e(){for(var a=[],b=0;b<J.length;b++)a.push(J[b].initData);return a}function f(a){for(var b=!1,c=0;c<a.length;c++)for(var d=a[c].ks.systemString,e=a[c].configs,f=null,g=null,h=0;h<e.length;h++){var i=e[h].audioCapabilities,j=e[h].videoCapabilities;if(i&&0!==i.length){f=[];for(var k=0;k<i.length;k++)window[C.MediaKeys].isTypeSupported(d,i[k].contentType)&&f.push(i[k])}if(j&&0!==j.length){g=[];for(var l=0;l<j.length;l++)window[C.MediaKeys].isTypeSupported(d,j[l].contentType)&&g.push(j[l])}if(!(!f&&!g||f&&0===f.length||g&&0===g.length)){b=!0;var m=new q.default(f,g),n=L.getKeySystemBySystemString(d);z.trigger(A.KEY_SYSTEM_ACCESS_COMPLETE,{data:new s.default(n,m)});break}}b||z.trigger(A.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})}function h(a){try{H=a.mediaKeys=new window[C.MediaKeys](a.keySystem.systemString),G=a.keySystem,I=a,F&&w(),z.trigger(A.INTERNAL_KEY_SYSTEM_SELECTED)}catch(b){z.trigger(A.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+G.systemString+")! Could not create MediaKeys -- TODO"})}}function j(a){F!==a&&(F&&F.removeEventListener(C.needkey,K),(F=a)&&(F.addEventListener(C.needkey,K),H&&w()))}function l(a,b,c,d){if(!G||!H||!I)throw new Error("Can not create sessions until you have selected a key system");var e=null;if(I.ksConfiguration.videoCapabilities&&I.ksConfiguration.videoCapabilities.length>0&&(e=I.ksConfiguration.videoCapabilities[0]),null===e&&I.ksConfiguration.audioCapabilities&&I.ksConfiguration.audioCapabilities.length>0&&(e=I.ksConfiguration.audioCapabilities[0]),null===e)throw new Error("Can not create sessions for unknown content types.");var f=e.contentType,g=H.createSession(f,new Uint8Array(a),d?new Uint8Array(d):null),h=x(g,a);g.addEventListener(C.error,h),g.addEventListener(C.message,h),g.addEventListener(C.ready,h),g.addEventListener(C.close,h),J.push(h),E.debug("DRM: Session created. SessionID = "+h.getSessionID()),z.trigger(A.KEY_SESSION_CREATED,{data:h})}function n(a,b){var c=a.session;L.isClearKey(G)?c.update(new Uint8Array(b.toJWK())):c.update(new Uint8Array(b))}function p(a){var b=a.session;b.removeEventListener(C.error,a),b.removeEventListener(C.message,a),b.removeEventListener(C.ready,a),b.removeEventListener(C.close,a);for(var c=0;c<J.length;c++)if(J[c]===a){J.splice(c,1);break}b[C.release]()}function r(){}function t(){}function u(){}function v(){return{handleEvent:function(a){switch(a.type){case C.needkey:if(a.initData){var b=ArrayBuffer.isView(a.initData)?a.initData.buffer:a.initData;z.trigger(A.NEED_KEY,{key:new i.default(b,"cenc")})}}}}}function w(){var a=null,b=function(){F.removeEventListener("loadedmetadata",a),F[C.setMediaKeys](H),z.trigger(A.VIDEO_ELEMENT_SELECTED)};F.readyState>=1?b():(a=b.bind(this),F.addEventListener("loadedmetadata",a))}function x(a,b){return{session:a,initData:b,getSessionID:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(a){switch(a.type){case C.error:z.trigger(A.KEY_ERROR,{data:new k.default(m.default.MEDIA_KEYERR_CODE,"KeyError",this)});break;case C.message:var b=ArrayBuffer.isView(a.message)?a.message.buffer:a.message;z.trigger(A.INTERNAL_KEY_MESSAGE,{data:new o.default(this,b,a.destinationURL)});break;case C.ready:E.debug("DRM: Key added."),z.trigger(A.KEY_ADDED);break;case C.close:E.debug("DRM: Session closed. SessionID = "+this.getSessionID()),z.trigger(A.KEY_SESSION_CLOSED,{data:this.getSessionID()})}}}}a=a||{};var y=this.context,z=a.eventBus,A=a.events,B=a.debug,C=a.api,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0;return D={getAllInitData:e,requestKeySystemAccess:f,getKeySystem:d,selectKeySystem:h,setMediaElement:j,createKeySession:l,updateKeySession:n,closeKeySession:p,setServerCertificate:r,loadKeySession:t,removeKeySession:u,stop:c,reset:c},b(),D}Object.defineProperty(c,"__esModule",{value:!0});var f=a(154),g=d(f),h=a(173),i=d(h),j=a(215),k=d(j),l=a(159),m=d(l),n=a(168),o=d(n),p=a(171),q=d(p),r=a(170),s=d(r);e.__dashjs_factory_name="ProtectionModel_3Feb2014",c.default=dashjs.FactoryMaker.getClassFactory(e),b.exports=c.default},{154:154,159:159,168:168,170:170,171:171,173:173,215:215}],163:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(b)));a+="/?";for(var d=0;d<c.kids.length;d++)a+=c.kids[d]+"&";return a=a.substring(0,a.length-1)}function b(){return"GET"}function c(){return"json"}function d(a){if(!a.hasOwnProperty("keys"))return null;for(var b=[],c=0;c<a.keys.length;c++){var d=a.keys[c],e=d.kid.replace(/=/g,""),f=d.k.replace(/=/g,"");b.push(new g.default(e,f))}return new i.default(b)}function e(a){return String.fromCharCode.apply(null,new Uint8Array(a))}return{getServerURLFromMessage:a,getHTTPMethod:b,getResponseType:c,getLicenseMessage:d,getErrorResponse:e}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(169),g=d(f),h=a(167),i=d(h);e.__dashjs_factory_name="ClearKey",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{167:167,169:169}],164:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){if(!i||!i.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}function c(a){return a}function d(){return"POST"}function e(a){return j[a].responseType}function f(a,c){return b(),j[c].getLicenseMessage(a)}function h(a,b){return j[b].getErrorResponse(a)}a=a||{};var i=a.BASE64,j={};j[g.default.WIDEVINE_KEYSTEM_STRING]={responseType:"json",getLicenseMessage:function(a){return i.decodeArray(a.license)},getErrorResponse:function(a){return a}},j[g.default.PLAYREADY_KEYSTEM_STRING]={responseType:"arraybuffer",getLicenseMessage:function(a){return a},getErrorResponse:function(a){return String.fromCharCode.apply(null,new Uint8Array(a))}};return{getServerURLFromMessage:c,getHTTPMethod:d,getResponseType:e,getLicenseMessage:f,getErrorResponse:h}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(103),g=d(f);e.__dashjs_factory_name="DRMToday",c.default=dashjs.FactoryMaker.getSingletonFactory(e),b.exports=c.default},{103:103}],165:[function(a,b,c){"use strict";function d(){function a(a){var b=String.fromCharCode.apply(null,new Uint8Array(a));return decodeURIComponent(escape(b))}function b(b){if(window.DOMParser){var c=a(b),d=new window.DOMParser,e=d.parseFromString(c,"text/xml"),f=e?e.getElementsByTagNameNS(i,"Envelope")[0]:null,g=f?f.getElementsByTagNameNS(i,"Body")[0]:null;if(g?g.getElementsByTagNameNS(i,"Fault")[0]:null)return null}return b}function c(b){var c="",d="",e="",f=-1,g=-1;if(window.DOMParser){var h=a(b),j=new window.DOMParser,k=j.parseFromString(h,"text/xml"),l=k?k.getElementsByTagNameNS(i,"Envelope")[0]:null,m=l?l.getElementsByTagNameNS(i,"Body")[0]:null,n=m?m.getElementsByTagNameNS(i,"Fault")[0]:null,o=n?n.getElementsByTagName("detail")[0]:null,p=o?o.getElementsByTagName("Exception")[0]:null,q=null;if(null===n)return h;q=n.getElementsByTagName("faultstring")[0].firstChild,c=q?q.nodeValue:null,null!==p&&(q=p.getElementsByTagName("StatusCode")[0],d=q?q.firstChild.nodeValue:null,q=p.getElementsByTagName("Message")[0],e=q?q.firstChild.nodeValue:null,f=e?e.lastIndexOf("[")+1:-1,g=e?e.indexOf("]"):-1,e=e?e.substring(f,g):"")}var r="code: "+d+", name: "+c;return e&&(r+=", message: "+e),r}function d(a){return a}function e(){return"POST"}function f(){return"arraybuffer"}function g(a){return b.call(this,a)}function h(a){return c.call(this,a)}var i="http://schemas.xmlsoap.org/soap/envelope/";return{getServerURLFromMessage:d,getHTTPMethod:e,getResponseType:f,getLicenseMessage:g,getErrorResponse:h}}Object.defineProperty(c,"__esModule",{value:!0}),d.__dashjs_factory_name="PlayReady",c.default=dashjs.FactoryMaker.getSingletonFactory(d),b.exports=c.default},{}],166:[function(a,b,c){"use strict";function d(){function a(a){return a}function b(){return"POST"}function c(){return"arraybuffer"}function d(a){return a}function e(a){return String.fromCharCode.apply(null,new Uint8Array(a))}return{getServerURLFromMessage:a,getHTTPMethod:b,getResponseType:c,getLicenseMessage:d,getErrorResponse:e}}Object.defineProperty(c,"__esModule",{value:!0}),d.__dashjs_factory_name="Widevine",c.default=dashjs.FactoryMaker.getSingletonFactory(d),b.exports=c.default},{}],167:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b,c){if(d(this,a),c&&"persistent"!==c&&"temporary"!==c)throw new Error("Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'");this.keyPairs=b,this.type=c}return e(a,[{key:"toJWK",value:function(){var a=void 0,b=this.keyPairs.length,c={keys:[]};for(a=0;a<b;a++){var d={kty:"oct",alg:"A128KW",kid:this.keyPairs[a].keyID,k:this.keyPairs[a].key};c.keys.push(d)}this.type&&(c.type=this.type);var e=JSON.stringify(c),f=e.length,g=new ArrayBuffer(f),h=new Uint8Array(g);for(a=0;a<f;a++)h[a]=e.charCodeAt(a);return g}}]),a}();c.default=f,b.exports=c.default},{}],168:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e,f){d(this,a),this.sessionToken=b,this.message=c,this.defaultURL=e,this.messageType=f||"license-request"};c.default=e,b.exports=c.default},{}],169:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.keyID=b,this.key=c};c.default=e,b.exports=c.default},{}],170:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.keySystem=b,this.ksConfiguration=c};c.default=e,b.exports=c.default},{}],171:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e,f,g){d(this,a),this.initDataTypes=["cenc"],b&&b.length&&(this.audioCapabilities=b),c&&c.length&&(this.videoCapabilities=c),this.distinctiveIdentifier=e,this.persistentState=f,this.sessionTypes=g};c.default=e,b.exports=c.default},{}],172:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.contentType=b,this.robustness=c};c.default=e,b.exports=c.default},{}],173:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c){d(this,a),this.initData=b,this.initDataType=c};c.default=e,b.exports=c.default},{}],174:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=b&&b.droppedVideoFrames?b.droppedVideoFrames:0,g=b&&b.totalVideoFrames?b.totalVideoFrames:0,h=c-e;e=c;var i=g-f;f=g,isNaN(a)||(d[a]?(d[a].droppedVideoFrames+=h,d[a].totalVideoFrames+=i):d[a]={droppedVideoFrames:h,totalVideoFrames:i})}function b(){return d}function c(a){d=[],e=a.droppedVideoFrames,f=a.totalVideoFrames}var d=[],e=0,f=0;return{push:a,getFrameHistory:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="DroppedFramesHistory";var h=g.default.getClassFactory(e);c.default=h,b.exports=c.default},{48:48}],175:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){var a=d();return a?a.type:null}function c(){var a=d();return a?a.streamInfo:null}function d(){return r?r.mediaInfo:null}function e(){return r}function f(){return q}function g(){return l}function h(){return m}function i(){return n}function j(){return o}function k(){return p}a=a||{};var l=a.abrController,m=a.switchHistory,n=a.droppedFramesHistory,o=a.currentRequest,p=a.useBufferOccupancyABR,q=a.streamProcessor?a.streamProcessor.getScheduleController():null,r=a.streamProcessor?a.streamProcessor.getRepresentationInfo():null;return{getMediaType:b,getMediaInfo:d,getDroppedFramesHistory:i,getCurrentRequest:j,getSwitchHistory:h,getStreamInfo:c,getScheduleController:f,getAbrController:g,getRepresentationInfo:e,useBufferOccupancyABR:k}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="RulesContext",c.default=g.default.getClassFactory(e),b.exports=c.default},{48:48}],176:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b,c){function d(a){var b=i.DEFAULT;return a!==i.DEFAULT&&a!==i.STRONG&&a!==i.WEAK||(b=a),b}var e=void 0,f=void 0,g=void 0;return e=void 0===a?h:a,f=d(c),g=void 0===b?null:b,{quality:e,reason:g,priority:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=-1,i={DEFAULT:.5,STRONG:1,WEAK:0};e.__dashjs_factory_name="SwitchRequest";var j=g.default.getClassFactory(e);j.NO_CHANGE=h,j.PRIORITY=i,g.default.updateClassFactory(e.__dashjs_factory_name,j),c.default=j,b.exports=c.default},{48:48}],177:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){a.newValue===i.default.NO_CHANGE&&(a.newValue=a.oldValue),d[a.oldValue]||(d[a.oldValue]={noDrops:0,drops:0,dropSize:0});var b=a.newValue-a.oldValue,c=b<0?1:0,f=c?-b:0,g=c?0:1;if(d[a.oldValue].drops+=c,d[a.oldValue].dropSize+=f,d[a.oldValue].noDrops+=g,e.push({idx:a.oldValue,noDrop:g,drop:c,dropSize:f}),e.length>j){var h=e.shift();d[h.idx].drops-=h.drop,d[h.idx].dropSize-=h.dropSize,d[h.idx].noDrops-=h.noDrop}}function b(){return d}function c(){d=[],e=[]}var d=[],e=[];return{push:a,getSwitchRequests:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(176),i=d(h),j=8;e.__dashjs_factory_name="SwitchRequestHistory";var k=g.default.getClassFactory(e);c.default=k,b.exports=c.default},{176:176,48:48}],178:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){F={throughputHalfLife:{fast:x,slow:w},latencyHalfLife:{fast:z,slow:y}},p()}function c(a,b,c){return a===g.default.VIDEO?c<A.getCacheLoadThresholdForType(g.default.VIDEO):a===g.default.AUDIO?c<A.getCacheLoadThresholdForType(g.default.AUDIO):void 0}function d(a,b,d){if(b.trace&&b.trace.length){var f=b.tresponse.getTime()-b.trequest.getTime()||1,g=b._tfinish.getTime()-b.tresponse.getTime()||1,h=b.trace.reduce(function(a,b){return a+b.b[0]},0),i=void 0;i=A.getLowLatencyEnabled()?b.trace.reduce(function(a,b){return a+b.d},0):d?g:f+g;var j=Math.round(8*h/i);if(n(a),c(a,f,g)){if(B[a].length>0&&!B[a].hasCachedEntries)return;B[a].hasCachedEntries=!0}else B[a]&&B[a].hasCachedEntries&&o(a);B[a].push(j),B[a].length>q&&B[a].shift(),C[a].push(f),C[a].length>q&&C[a].shift(),e(D[a],j,.001*g,F.throughputHalfLife),e(E[a],f,1,F.latencyHalfLife)}}function e(a,b,c,d){var e=Math.pow(.5,c/d.fast);a.fastEstimate=(1-e)*b+e*a.fastEstimate;var f=Math.pow(.5,c/d.slow);a.slowEstimate=(1-f)*b+f*a.slowEstimate,a.totalWeight+=c}function f(a,b,c){var d=void 0,e=void 0;if(a?(d=B[b],e=c?r:s):(d=C[b],e=t),d){if(e>=d.length)e=d.length;else if(a)for(var f=1;f<e;++f){var g=d[f]/d[f-1];if((g>=v||g<=1/u)&&(e+=1)===d.length)break}}else e=0;return e}function h(a,b,c){return A.getMovingAverageMethod()!==g.default.MOVING_AVERAGE_SLIDING_WINDOW?j(a,b):i(a,b,c)}function i(a,b,c){var d=f(a,b,c),e=a?B:C,g=e[b];return 0!==d&&g&&0!==g.length?(g=g.slice(-d),g.reduce(function(a,b){return a+b})/g.length):NaN}function j(a,b){var c=a?F.throughputHalfLife:F.latencyHalfLife,d=a?D[b]:E[b];if(!d||d.totalWeight<=0)return NaN;var e=d.fastEstimate/(1-Math.pow(.5,d.totalWeight/c.fast)),f=d.slowEstimate/(1-Math.pow(.5,d.totalWeight/c.slow));return a?Math.min(e,f):Math.max(e,f)}function k(a,b){return h(!0,a,b)}function l(a,b){var c=k(a,b);return isNaN(c)||(c*=A.getBandwidthSafetyFactor()),c}function m(a){return h(!1,a)}function n(a){B[a]=B[a]||[],C[a]=C[a]||[],D[a]=D[a]||{fastEstimate:0,slowEstimate:0,totalWeight:0},E[a]=E[a]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function o(a){delete B[a],delete C[a],delete D[a],delete E[a],n(a)}function p(){B={},C={},D={},E={}}a=a||{};var q=20,r=3,s=4,t=4,u=1.3,v=1.3,w=8,x=3,y=2,z=1,A=a.mediaPlayerModel,B=void 0,C=void 0,D=void 0,E=void 0,F=void 0,G={push:d,getAverageThroughput:k,getSafeAverageThroughput:l,getAverageLatency:m,reset:p};return b(),G}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(48),i=d(h);e.__dashjs_factory_name="ThroughputHistory",c.default=i.default.getClassFactory(e),b.exports=c.default},{101:101,48:48}],179:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){r=[],s=[],l.getUseDefaultABRRules()&&(r.push((0,q.default)(j).create({metricsModel:n,dashMetrics:p,mediaPlayerModel:l})),r.push((0,g.default)(j).create({metricsModel:n,dashMetrics:p})),r.push((0,i.default)(j).create({metricsModel:n,dashMetrics:p})),r.push((0,o.default)(j).create()),r.push((0,m.default)(j).create()),s.push((0,k.default)(j).create({metricsModel:n,dashMetrics:p,mediaPlayerModel:l}))),l.getABRCustomRules().forEach(function(a){a.type===v&&r.push(a.rule(j).create()),a.type===w&&s.push(a.rule(j).create())})}function c(a){return a.filter(function(a){return a.quality>u.default.NO_CHANGE})}function d(a){var b={},c=void 0,d=void 0,e=void 0,f=void 0,g=void 0;if(0!==a.length){for(b[u.default.PRIORITY.STRONG]=u.default.NO_CHANGE,b[u.default.PRIORITY.WEAK]=u.default.NO_CHANGE,b[u.default.PRIORITY.DEFAULT]=u.default.NO_CHANGE,c=0,d=a.length;c<d;c+=1)e=a[c],e.quality!==u.default.NO_CHANGE&&(b[e.priority]=b[e.priority]>u.default.NO_CHANGE?Math.min(b[e.priority],e.quality):e.quality);return b[u.default.PRIORITY.WEAK]!==u.default.NO_CHANGE&&(f=b[u.default.PRIORITY.WEAK]),b[u.default.PRIORITY.DEFAULT]!==u.default.NO_CHANGE&&(f=b[u.default.PRIORITY.DEFAULT]),b[u.default.PRIORITY.STRONG]!==u.default.NO_CHANGE&&(f=b[u.default.PRIORITY.STRONG]),f!==u.default.NO_CHANGE&&(g=f),(0,u.default)(j).create(g)}}function e(a){return d(c(r.map(function(b){return b.getMaxIndex(a)})))||(0,u.default)(j).create()}function f(a){return d(c(s.map(function(b){return b.shouldAbandon(a)})))||(0,u.default)(j).create()}function h(){[r,s].forEach(function(a){a&&a.length&&a.forEach(function(a){return a.reset&&a.reset()})}),r=[],s=[]}a=a||{};var j=this.context,l=a.mediaPlayerModel,n=a.metricsModel,p=a.dashMetrics,r=void 0,s=void 0;return{initialize:b,reset:h,getMaxQuality:e,shouldAbandonFragment:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(185),g=d(f),h=a(183),i=d(h),j=a(180),k=d(j),l=a(182),m=d(l),n=a(184),o=d(n),p=a(181),q=d(p),r=a(48),s=d(r),t=a(176),u=d(t),v="qualitySwitchRules",w="abandonFragmentRules";e.__dashjs_factory_name="ABRRulesCollection";var x=s.default.getClassFactory(e);x.QUALITY_SWITCH_RULES=v,x.ABANDON_FRAGMENT_RULES=w,s.default.updateSingletonFactory(e.__dashjs_factory_name,x),c.default=x,b.exports=c.default},{176:176,180:180,181:181,182:182,183:183,184:184,185:185,48:48}],180:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){r=(0,k.default)(m).getInstance().getLogger(q),h()}function c(a,b){s[a]=s[a]||{},s[a][b]=s[a][b]||{}}function d(a,b){u[a]=u[a]||[],u[a].push(b)}function f(a){var b=(0,g.default)(m).create(g.default.NO_CHANGE,{name:e.__dashjs_factory_name});if(!(a&&a.hasOwnProperty("getMediaInfo")&&a.hasOwnProperty("getMediaType")&&a.hasOwnProperty("getCurrentRequest")&&a.hasOwnProperty("getRepresentationInfo")&&a.hasOwnProperty("getAbrController")))return b;var f=a.getMediaInfo(),h=a.getMediaType(),k=a.getCurrentRequest();if(!isNaN(k.index)){c(h,k.index);var q=n.getStableBufferTime();if(p.getCurrentBufferLevel(o.getReadOnlyMetricsFor(h))>q)return b;var v=s[h][k.index];if(null===v||null===k.firstByteDate||t.hasOwnProperty(v.id))return b;if(void 0===v.firstByteTime&&(u[h]=[],v.firstByteTime=k.firstByteDate.getTime(),v.segmentDuration=k.duration,v.bytesTotal=k.bytesTotal,v.id=k.index),v.bytesLoaded=k.bytesLoaded,v.elapsedTime=(new Date).getTime()-v.firstByteTime,v.bytesLoaded>0&&v.elapsedTime>0&&d(h,Math.round(8*v.bytesLoaded/v.elapsedTime)),u[h].length>=l&&v.elapsedTime>j&&v.bytesLoaded<v.bytesTotal){var w=u[h].reduce(function(a,b){return a+b},0);if(v.measuredBandwidthInKbps=Math.round(w/u[h].length),v.estimatedTimeOfDownload=+(8*v.bytesTotal/v.measuredBandwidthInKbps/1e3).toFixed(2),v.estimatedTimeOfDownload<v.segmentDuration*i||0===a.getRepresentationInfo().quality)return b;if(!t.hasOwnProperty(v.id)){var x=a.getAbrController(),y=v.bytesTotal-v.bytesLoaded,z=x.getBitrateList(f),A=x.getQualityForBitrate(f,v.measuredBandwidthInKbps*n.getBandwidthSafetyFactor());y>v.bytesTotal*z[A].bitrate/z[x.getQualityFor(h,f.streamInfo)].bitrate&&(b.quality=A,b.reason.throughput=v.measuredBandwidthInKbps,b.reason.fragmentID=v.id,t[v.id]=v,r.debug("( ",h,"frag id",v.id,") is asking to abandon and switch to quality to ",A," measured bandwidth was",v.measuredBandwidthInKbps),delete s[h][v.id])}}else v.bytesLoaded===v.bytesTotal&&delete s[h][v.id]}return b}function h(){s={},t={},u=[]}a=a||{};var i=1.8,j=500,l=5,m=this.context,n=a.mediaPlayerModel,o=a.metricsModel,p=a.dashMetrics,q=void 0,r=void 0,s=void 0,t=void 0,u=void 0;return q={shouldAbandon:f,reset:h},b(),q}Object.defineProperty(c,"__esModule",{value:!0});var f=a(176),g=d(f),h=a(48),i=d(h),j=a(46),k=d(j);e.__dashjs_factory_name="AbandonRequestsRule",c.default=i.default.getClassFactory(e),b.exports=c.default},{176:176,46:46,48:48}],181:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){P=(0,r.default)(J).getInstance().getLogger(O),H(),N.on(p.default.BUFFER_EMPTY,y,O),N.on(p.default.PLAYBACK_SEEKING,z,O),N.on(p.default.PERIOD_SWITCH_STARTED,A,O),N.on(p.default.MEDIA_FRAGMENT_LOADED,B,O),N.on(p.default.METRIC_ADDED,C,O),N.on(p.default.QUALITY_CHANGE_REQUESTED,E,O),N.on(p.default.FRAGMENT_LOADING_ABANDONED,F,O)}function c(a){return a.map(function(a){return Math.log(a)})}function d(a,b,c){var d=c.reduce(function(a,b,d){return b>c[a]?d:a},0);if(0===d)return null;var e=Math.max(a,v+w*b.length),f=(c[d]-1)/(e/v-1);return{gp:f,Vp:v/f}}function e(a){var b={},e=a.getMediaInfo(),g=e.bitrateList.map(function(a){return a.bandwidth}),h=c(g);h=h.map(function(a){return a-h[0]+1});var i=M.getStableBufferTime(),j=d(i,g,h);return j?(b.state=t,b.bitrates=g,b.utilities=h,b.stableBufferTime=i,b.Vp=j.Vp,b.gp=j.gp,b.lastQuality=0,f(b)):b.state=s,b}function f(a){a.placeholderBuffer=0,a.mostAdvancedSegmentStart=NaN,a.lastSegmentWasReplacement=!1,a.lastSegmentStart=NaN,a.lastSegmentDurationS=NaN,a.lastSegmentRequestTimeMs=NaN, +a.lastSegmentFinishTimeMs=NaN}function h(a,b){var c=M.getStableBufferTime();if(a.stableBufferTime!==c){var e=d(c,a.bitrates,a.utilities);if(e.Vp!==a.Vp||e.gp!==a.gp){var f=K.getCurrentBufferLevel(L.getReadOnlyMetricsFor(b)),g=f+a.placeholderBuffer;g-=v,g*=e.Vp/a.Vp,g+=v,a.stableBufferTime=c,a.Vp=e.Vp,a.gp=e.gp,a.placeholderBuffer=Math.max(0,g-f)}}}function j(a){var b=a.getMediaType(),c=Q[b];return c?c.state!==s&&h(c,b):(c=e(a),Q[b]=c),c}function k(a,b){for(var c=a.bitrates.length,d=NaN,e=NaN,f=0;f<c;++f){var g=(a.Vp*(a.utilities[f]+a.gp)-b)/a.bitrates[f];(isNaN(e)||g>=e)&&(e=g,d=f)}return d}function m(a,b){return a.Vp*(a.utilities[b]+a.gp)}function o(a,b){for(var c=a.bitrates[b],d=a.utilities[b],e=0,f=b-1;f>=0;--f)if(a.utilities[f]<a.utilities[b]){var g=a.bitrates[f],h=a.utilities[f],i=a.Vp*(a.gp+(c*h-g*d)/(c-g));e=Math.max(e,i)}return e}function q(a,b){var c=Date.now();if(isNaN(a.lastSegmentFinishTimeMs)){if(!isNaN(a.lastCallTimeMs)){var d=.001*(c-a.lastCallTimeMs);a.placeholderBuffer+=Math.max(0,d)}}else{var d=.001*(c-a.lastSegmentFinishTimeMs);a.placeholderBuffer+=Math.max(0,d)}a.lastCallTimeMs=c,a.lastSegmentStart=NaN,a.lastSegmentRequestTimeMs=NaN,a.lastSegmentFinishTimeMs=NaN,h(a,b)}function y(){for(var a in Q)Q.hasOwnProperty(a)&&Q[a].state===u&&(Q[a].placeholderBuffer=0)}function z(){for(var a in Q)if(Q.hasOwnProperty(a)){var b=Q[a];b.state!==s&&(b.state=t,f(b))}}function A(){}function B(a){if(a&&a.chunk&&a.chunk.mediaInfo){var b=Q[a.chunk.mediaInfo.type];if(b&&b.state!==s){var c=a.chunk.start;isNaN(b.mostAdvancedSegmentStart)||c>b.mostAdvancedSegmentStart?(b.mostAdvancedSegmentStart=c,b.lastSegmentWasReplacement=!1):b.lastSegmentWasReplacement=!0,b.lastSegmentStart=c,b.lastSegmentDurationS=a.chunk.duration,b.lastQuality=a.chunk.quality,D(b,a.chunk.mediaInfo.type)}}}function C(a){if(a&&a.metric===g.default.HTTP_REQUEST&&a.value&&a.value.type===l.HTTPRequest.MEDIA_SEGMENT_TYPE&&a.value.trace&&a.value.trace.length){var b=Q[a.mediaType];b&&b.state!==s&&(b.lastSegmentRequestTimeMs=a.value.trequest.getTime(),b.lastSegmentFinishTimeMs=a.value._tfinish.getTime(),D(b,a.mediaType))}}function D(a,b){if(!isNaN(a.lastSegmentStart)&&!isNaN(a.lastSegmentRequestTimeMs)&&!isNaN(a.placeholderBuffer)){if(a.placeholderBuffer*=x,!isNaN(a.lastSegmentFinishTimeMs)){var c=K.getCurrentBufferLevel(L.getReadOnlyMetricsFor(b)),d=c+.001*(a.lastSegmentFinishTimeMs-a.lastSegmentRequestTimeMs),e=m(a,a.lastQuality),f=Math.max(0,e-d);a.placeholderBuffer=Math.min(f,a.placeholderBuffer)}a.lastSegmentWasReplacement&&!isNaN(a.lastSegmentDurationS)&&(a.placeholderBuffer+=a.lastSegmentDurationS),a.lastSegmentStart=NaN,a.lastSegmentRequestTimeMs=NaN}}function E(a){if(a){var b=Q[a.mediaType];b&&b.state!==s&&(b.abrQuality=a.newQuality)}}function F(a){if(a){var b=Q[a.mediaType];if(b&&b.state!==s){var c=K.getCurrentBufferLevel(L.getReadOnlyMetricsFor(a.mediaType)),d=void 0;d=b.abrQuality>0?o(b,b.abrQuality):v;var e=Math.max(0,d-c);b.placeholderBuffer=Math.min(b.placeholderBuffer,e)}}}function G(a){var b=a.getMediaInfo(),c=a.getMediaType(),d=L.getReadOnlyMetricsFor(c),e=a.getScheduleController(),g=a.getStreamInfo(),h=a.getAbrController(),l=h.getThroughputHistory(),n=g?g.id:null,p=g&&g.manifestInfo&&g.manifestInfo.isDynamic,r=a.useBufferOccupancyABR(),v=(0,i.default)(J).create();if(v.reason=v.reason||{},!r)return v;e.setTimeToLoadDelay(0);var w=j(a);if(w.state===s)return v;var x=K.getCurrentBufferLevel(d),y=l.getAverageThroughput(c,p),z=l.getSafeAverageThroughput(c,p),A=l.getAverageLatency(c),B=void 0;if(v.reason.state=w.state,v.reason.throughput=y,v.reason.latency=A,isNaN(y))return v;switch(w.state){case t:B=h.getQualityForBitrate(b,z,A),v.quality=B,v.reason.throughput=z,w.placeholderBuffer=Math.max(0,o(w,B)-x),w.lastQuality=B,!isNaN(w.lastSegmentDurationS)&&x>=w.lastSegmentDurationS&&(w.state=u);break;case u:q(w,c),B=k(w,x+w.placeholderBuffer);var C=h.getQualityForBitrate(b,z,A);B>w.lastQuality&&B>C&&(B=Math.max(C,w.lastQuality));var D=Math.max(0,x+w.placeholderBuffer-m(w,B));D<=w.placeholderBuffer?(w.placeholderBuffer-=D,D=0):(D-=w.placeholderBuffer,w.placeholderBuffer=0,B<h.getTopQualityIndexFor(c,n)?e.setTimeToLoadDelay(1e3*D):D=0),v.quality=B,v.reason.throughput=y,v.reason.latency=A,v.reason.bufferLevel=x,v.reason.placeholderBuffer=w.placeholderBuffer,v.reason.delay=D,w.lastQuality=B;break;default:P.debug("BOLA ABR rule invoked in bad state."),v.quality=h.getQualityForBitrate(b,z,A),v.reason.state=w.state,v.reason.throughput=z,v.reason.latency=A,w.state=t,f(w)}return v}function H(){Q={}}function I(){H(),N.off(p.default.BUFFER_EMPTY,y,O),N.off(p.default.PLAYBACK_SEEKING,z,O),N.off(p.default.PERIOD_SWITCH_STARTED,A,O),N.off(p.default.MEDIA_FRAGMENT_LOADED,B,O),N.off(p.default.METRIC_ADDED,C,O),N.off(p.default.QUALITY_CHANGE_REQUESTED,E,O),N.off(p.default.FRAGMENT_LOADING_ABANDONED,F,O)}a=a||{};var J=this.context,K=a.dashMetrics,L=a.metricsModel,M=a.mediaPlayerModel,N=(0,n.default)(J).getInstance(),O=void 0,P=void 0,Q=void 0;return O={getMaxIndex:G,reset:I},b(),O}Object.defineProperty(c,"__esModule",{value:!0});var f=a(102),g=d(f),h=a(176),i=d(h),j=a(48),k=d(j),l=a(235),m=a(47),n=d(m),o=a(53),p=d(o),q=a(46),r=d(q),s=0,t=1,u=2,v=10,w=2,x=.99;e.__dashjs_factory_name="BolaRule",c.default=k.default.getClassFactory(e),b.exports=c.default},{102:102,176:176,235:235,46:46,47:47,48:48,53:53}],182:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){e=(0,k.default)(c).getInstance().getLogger(d)}function b(a){var b=a.getDroppedFramesHistory();if(b){for(var d=b.getFrameHistory(),h=0,j=0,k=i.default.NO_CHANGE,l=1;l<d.length;l++)if(d[l]&&(h=d[l].droppedVideoFrames,(j=d[l].totalVideoFrames)>g&&h/j>f)){k=l-1,e.debug("index: "+k+" Dropped Frames: "+h+" Total Frames: "+j);break}return(0,i.default)(c).create(k,{droppedFrames:h})}return(0,i.default)(c).create()}var c=this.context,d=void 0,e=void 0,f=.15,g=375;return d={getMaxIndex:b},a(),d}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(176),i=d(h),j=a(46),k=d(j);e.__dashjs_factory_name="DroppedFramesRule",c.default=g.default.getClassFactory(e),b.exports=c.default},{176:176,46:46,48:48}],183:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){u=(0,o.default)(m).getInstance().getLogger(t),f(),n.on(k.default.PLAYBACK_SEEKING,h,t)}function c(){if(!(p&&p.hasOwnProperty("getReadOnlyMetricsFor")&&r&&r.hasOwnProperty("getCurrentBufferLevel")))throw new Error(s.default.MISSING_CONFIG_ERROR)}function d(a){var b=(0,q.default)(m).create();if(!a||!a.hasOwnProperty("getMediaType"))return b;c();var d=a.getMediaType(),f=p.getReadOnlyMetricsFor(d),h=f.BufferState.length>0?f.BufferState[f.BufferState.length-1]:null,i=a.getRepresentationInfo(),j=i.fragmentDuration;if(!h||!e(d,h)||!j)return b;if(h.state===g.default.BUFFER_EMPTY)u.debug("Switch to index 0; buffer is empty."),b.quality=0,b.reason="InsufficientBufferRule: Buffer is empty";else{var k=a.getMediaInfo(),n=a.getAbrController(),o=n.getThroughputHistory(),s=r.getCurrentBufferLevel(f),t=o.getAverageThroughput(d),v=o.getAverageLatency(d),w=t*(s/j)*l;b.quality=n.getQualityForBitrate(k,w,v),b.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return b}function e(a,b){v[a]=v[a]||{};var c=!1;return v[a].firstBufferLoadedEvent?c=!0:b&&b.state===g.default.BUFFER_LOADED&&(v[a].firstBufferLoadedEvent=!0,c=!0),c}function f(){v={}}function h(){f()}function j(){f(),n.off(k.default.PLAYBACK_SEEKING,h,t)}a=a||{};var l=.5,m=this.context,n=(0,i.default)(m).getInstance(),p=a.metricsModel,r=a.dashMetrics,t=void 0,u=void 0,v=void 0;return t={getMaxIndex:d,reset:j},b(),t}Object.defineProperty(c,"__esModule",{value:!0});var f=a(107),g=d(f),h=a(47),i=d(h),j=a(53),k=d(j),l=a(48),m=d(l),n=a(46),o=d(n),p=a(176),q=d(p),r=a(101),s=d(r);e.__dashjs_factory_name="InsufficientBufferRule",c.default=m.default.getClassFactory(e),b.exports=c.default},{101:101,107:107,176:176,46:46,47:47,48:48,53:53}],184:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){e=(0,i.default)(c).getInstance().getLogger(d)}function b(a){for(var b=a?a.getSwitchHistory():null,d=b?b.getSwitchRequests():[],h=0,i=0,j=0,l=(0,k.default)(c).create(),m=0;m<d.length;m++)if(void 0!==d[m]&&(h+=d[m].drops,i+=d[m].noDrops,j+=d[m].dropSize,h+i>=g&&h/i>f)){l.quality=m>0&&d[m].drops>0?m-1:m,l.reason={index:l.quality,drops:h,noDrops:i,dropSize:j},e.debug("Switch history rule index: "+l.quality+" samples: "+(h+i)+" drops: "+h);break}return l}var c=this.context,d=void 0,e=void 0,f=.075,g=6;return d={getMaxIndex:b},a(),d}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h),j=a(176),k=d(j);e.__dashjs_factory_name="SwitchHistoryRule",c.default=g.default.getClassFactory(e),b.exports=c.default},{176:176,46:46,48:48}],185:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){k=(0,m.default)(f).getInstance().getLogger(j)}function c(){if(!h||!h.hasOwnProperty("getReadOnlyMetricsFor"))throw new Error(q.default.MISSING_CONFIG_ERROR)}function d(a){var b=(0,o.default)(f).create();if(!(a&&a.hasOwnProperty("getMediaInfo")&&a.hasOwnProperty("getMediaType")&&a.hasOwnProperty("useBufferOccupancyABR")&&a.hasOwnProperty("getAbrController")&&a.hasOwnProperty("getScheduleController")))return b;c();var d=a.getMediaInfo(),e=a.getMediaType(),j=h.getReadOnlyMetricsFor(e),l=a.getScheduleController(),m=a.getAbrController(),n=a.getStreamInfo(),p=n&&n.manifestInfo?n.manifestInfo.isDynamic:null,q=m.getThroughputHistory(),r=q.getSafeAverageThroughput(e,p),s=q.getAverageLatency(e),t=j.BufferState.length>0?j.BufferState[j.BufferState.length-1]:null,u=a.useBufferOccupancyABR();return!j||isNaN(r)||!t||u?b:(m.getAbandonmentStateFor(e)!==i.default.ABANDON_LOAD&&(t.state===g.default.BUFFER_LOADED||p)&&(b.quality=m.getQualityForBitrate(d,r,s),l.setTimeToLoadDelay(0),k.debug("requesting switch to index: ",b.quality,"type: ",e,"Average throughput",Math.round(r),"kbps"),b.reason={throughput:r,latency:s}),b)}function e(){}a=a||{};var f=this.context,h=a.metricsModel,j=void 0,k=void 0;return j={getMaxIndex:d,reset:e},b(),j}Object.defineProperty(c,"__esModule",{value:!0});var f=a(107),g=d(f),h=a(104),i=d(h),j=a(48),k=d(j),l=a(46),m=d(l),n=a(176),o=d(n),p=a(101),q=d(p);e.__dashjs_factory_name="ThroughputRule",c.default=k.default.getClassFactory(e),b.exports=c.default},{101:101,104:104,107:107,176:176,46:46,48:48}],186:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){}function c(a,b){return!a||e.getCurrentBufferLevel(f.getReadOnlyMetricsFor(a.getType()))<d(a,b)}function d(a,b){var c=NaN;if(!a)return c;var d=a.getType(),k=a.getRepresentationInfo();if(d===g.default.FRAGMENTED_TEXT)c=i.isTextEnabled()?k.fragmentDuration:0;else if(d===g.default.AUDIO&&b){var l=e.getCurrentBufferLevel(f.getReadOnlyMetricsFor(g.default.VIDEO));c=isNaN(k.fragmentDuration)?l:Math.max(l,k.fragmentDuration)}else{var m=k.mediaInfo.streamInfo;if(j.isPlayingAtTopQuality(m)){var n=m.manifestInfo.duration>=h.getLongFormContentDurationThreshold();c=n?h.getBufferTimeAtTopQualityLongForm():h.getBufferTimeAtTopQuality()}else c=h.getStableBufferTime()}return c}a=a||{};var e=a.dashMetrics,f=a.metricsModel,h=a.mediaPlayerModel,i=a.textController,j=a.abrController,k={execute:c,getBufferTarget:d};return b(),k}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(48),i=d(h);e.__dashjs_factory_name="BufferLevelRule",c.default=i.default.getClassFactory(e),b.exports=c.default},{101:101,48:48}],187:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){j=(0,i.default)(d).getInstance().getLogger(h)}function c(a,b){if(!a)return null;var c=a.getRepresentationInfo(),d=c.mediaInfo,h=d.type,i=a.getScheduleController(),k=i.getSeekTarget(),l=!isNaN(k),n=a.getBufferController(),o=a.getPlaybackController().getNormalizedTime(),p=l?k:e.getIndexHandlerTime(a),q=!1,r=void 0;if(l&&i.setSeekTarget(NaN),isNaN(p)||h===g.default.FRAGMENTED_TEXT&&!f.isTextEnabled())return null;if(n){var s=n.getRangeAt(p),t=n.getRangeAt(o),u=n.getBuffer().getAllBufferRanges(),v=u?u.length:0;null===s&&null===t||l||((!s||t&&t.start!=s.start&&t.end!=s.end)&&(v>1&&h!==g.default.FRAGMENTED_TEXT&&(a.getFragmentModel().removeExecutedRequestsAfterTime(t.end),q=!0),s=t),j.debug("Prior to making a request for time, NextFragmentRequestRule is aligning index handler's currentTime with bufferedRange.end for",h,".",p,"was changed to",s.end),p=s.end)}if(b)p=b.startTime+b.duration/2,r=e.getFragmentRequest(a,c,p,{timeThreshold:0,ignoreIsFinished:!0});else{for(r=e.getFragmentRequest(a,c,p,{keepIdx:!l&&!q});r&&r.action!==m.default.ACTION_COMPLETE&&a.getFragmentModel().isFragmentLoaded(r);)r=e.getFragmentRequest(a,c);r&&(isNaN(r.startTime+r.duration)||e.setIndexHandlerTime(a,r.startTime+r.duration),r.delayLoadingTime=(new Date).getTime()+i.getTimeToLoadDelay(),i.setTimeToLoadDelay(0))}return r}a=a||{};var d=this.context,e=a.adapter,f=a.textController,h=void 0,j=void 0;return h={execute:c},b(),h}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(46),i=d(h),j=a(48),k=d(j),l=a(217),m=d(l);e.__dashjs_factory_name="NextFragmentRequestRule",c.default=k.default.getClassFactory(e),b.exports=c.default},{101:101,217:217,46:46,48:48}],188:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){for(var b="",c=0;c<a.length;++c){b+=a[c].uchar}return b.length-b.replace(/^\s+/,"").length}function b(a){return"left: "+3.125*a.x+"%; top: "+6.66*a.y1+"%; width: "+(100-3.125*a.x)+"%; height: "+6.66*Math.max(a.y2-1-a.y1,1)+"%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;"}function c(a){return"red"===a?"rgb(255, 0, 0)":"green"===a?"rgb(0, 255, 0)":"blue"===a?"rgb(0, 0, 255)":"cyan"===a?"rgb(0, 255, 255)":"magenta"===a?"rgb(255, 0, 255)":"yellow"===a?"rgb(255, 255, 0)":"white"===a?"rgb(255, 255, 255)":"black"===a?"rgb(0, 0, 0)":a}function d(a,b){var d=a.videoHeight/15;return b?"font-size: "+d+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; color: "+(b.foreground?c(b.foreground):"rgb(255, 255, 255)")+"; font-style: "+(b.italics?"italic":"normal")+"; text-decoration: "+(b.underline?"underline":"none")+"; white-space: pre; background-color: "+(b.background?c(b.background):"transparent")+";":"font-size: "+d+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;"}function e(a){return a.replace(/^\s+/g,"")}function f(a){return a.replace(/\s+$/g,"")}function g(c,g,i,j){var k=null,l=null,m=!1,n=-1,o={start:g,end:i,spans:[]},p="style_cea608_white_black",q={},r={},s=[],t=void 0,u=void 0;for(t=0;t<15;++t){var v=j.rows[t],w="",x=null;if(!1===v.isEmpty()){var y=a(v.chars);null===k&&(k={x:y,y1:t,y2:t+1,p:[]}),y!==n&&m&&(k.p.push(o),o={start:g,end:i,spans:[]},k.y2=t,k.name="region_"+k.x+"_"+k.y1+"_"+k.y2,!1===q.hasOwnProperty(k.name)?(s.push(k),q[k.name]=k):(l=q[k.name],l.p.contat(k.p)),k={x:y,y1:t,y2:t+1,p:[]});for(var z=0;z<v.chars.length;++z){var A=v.chars[z],B=A.penState;if(null===x||!B.equals(x)){w.trim().length>0&&(o.spans.push({name:p,line:w,row:t}),w="");var C="style_cea608_"+B.foreground+"_"+B.background;B.underline&&(C+="_underline"),B.italics&&(C+="_italics"),r.hasOwnProperty(C)||(r[C]=JSON.parse(JSON.stringify(B))),x=B,p=C}w+=A.uchar}w.trim().length>0&&o.spans.push({name:p,line:w,row:t}),m=!0,n=y}else m=!1,n=-1,k&&(k.p.push(o),o={start:g,end:i,spans:[]},k.y2=t,k.name="region_"+k.x+"_"+k.y1+"_"+k.y2,!1===q.hasOwnProperty(k.name)?(s.push(k),q[k.name]=k):(l=q[k.name],l.p.contat(k.p)),k=null)}k&&(k.p.push(o),k.y2=t+1,k.name="region_"+k.x+"_"+k.y1+"_"+k.y2,!1===q.hasOwnProperty(k.name)?(s.push(k),q[k.name]=k):(l=q[k.name],l.p.contat(k.p)),k=null);var D=[];for(t=0;t<s.length;++t){var E=s[t],F="sub_cea608_"+h++,G=document.createElement("div");G.id=F;var H=b(E);G.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+H;var I=document.createElement("div");I.className="paragraph bodyStyle",I.style.cssText=d(c);var J=document.createElement("div");J.className="cueUniWrapper",J.style.cssText="unicode-bidi: normal; direction: ltr;";for(var K=0;K<E.p.length;++K){var L=E.p[K],M=0;for(u=0;u<L.spans.length;++u){var N=L.spans[u];if(N.line.length>0){if(0!==u&&M!=N.row){var O=document.createElement("br");O.className="lineBreak",J.appendChild(O)}var P=!1;M===N.row&&(P=!0),M=N.row;var Q=r[N.name],R=document.createElement("span");R.className="spanPadding "+N.name+" customSpanColor",R.style.cssText=d(c,Q),0!==u&&P?u===L.spans.length-1?R.textContent=f(N.line):R.textContent=N.line:L.spans.length>1&&u<L.spans.length-1&&N.row===L.spans[u+1].row?R.textContent=e(N.line):R.textContent=N.line.trim(),J.appendChild(R)}}}I.appendChild(J),G.appendChild(I);var S={bodyStyle:["%",90]};for(var T in r)r.hasOwnProperty(T)&&(S[T]=["%",90]);D.push({type:"html",start:g,end:i,cueHTMLElement:G,cueID:F,cellResolution:[32,15],isFromCEA608:!0,fontSize:S,lineHeight:{},linePadding:{}})}return D}var h=0;return{createHTMLCaptionsFromScreen:g}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="EmbeddedTextHtmlRender",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{48:48}],189:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){N=!1,O=null,M=!1,F.on(k.default.DATA_UPDATE_COMPLETED,z,L),F.on(k.default.INIT_FRAGMENT_LOADED,A,L)}function c(){return x}function d(a){j(a),Q=(0,o.default)(E).getInstance()}function e(a){try{if(P=(0,q.default)(E).create(O,a),!N){var b=P.getBuffer();b.hasOwnProperty(g.default.INITIALIZE)&&b.initialize(J,K),N=!0}return P}catch(c){if(a.isText||-1!==a.codec.indexOf('codecs="stpp')||-1!==a.codec.indexOf('codecs="wvtt'))try{P=G.getTextSourceBuffer()}catch(c){H.mediaSourceError("Error creating "+I+" source buffer."),H.error(new u.default(w.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+I+" : "+c.message))}else H.mediaSourceError("Error creating "+I+" source buffer."),H.error(new u.default(w.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+I))}}function f(){return I}function h(){return P}function j(a){O=a}function l(){return O}function m(){return K}function n(){return!1}function p(){}function r(){}function t(){return 0}function v(){return M}function y(a){F.off(k.default.DATA_UPDATE_COMPLETED,z,L),F.off(k.default.INIT_FRAGMENT_LOADED,A,L),!a&&P&&(P.abort(),P.reset(),P=null)}function z(a){if(a.sender.getStreamProcessor()===K){Q.extract(K.getStreamInfo().id,a.sender.getCurrentRepresentation().id)||F.trigger(k.default.TIMED_TEXT_REQUESTED,{index:0,sender:a.sender})}}function A(a){a.fragmentModel===K.getFragmentModel()&&a.chunk.bytes&&(Q.save(a.chunk),P.append(a.chunk),F.trigger(k.default.STREAM_COMPLETED,{request:a.request,fragmentModel:a.fragmentModel}))}function B(a,b){Q.extract(a,b)||F.trigger(k.default.TIMED_TEXT_REQUESTED,{index:0,sender:L})}function C(){return null}function D(a){P.timestampOffset===a||isNaN(a)||(P.timestampOffset=a)}a=a||{};var E=this.context,F=(0,i.default)(E).getInstance(),G=(0,s.default)(E).getInstance(),H=a.errHandler,I=a.type,J=a.mimeType,K=a.streamProcessor,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0;return L={getBufferControllerType:c,initialize:d,createBuffer:e,getType:f,getStreamProcessor:m,setSeekStartTime:r,getBuffer:h,getBufferLevel:t,setMediaSource:j,getMediaSource:l,getIsBufferingCompleted:v,getIsPruningInProgress:n,dischargePreBuffer:p,switchInitData:B,getRangeAt:C,reset:y,updateTimestampOffset:D},b(),L}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(47),i=d(h),j=a(53),k=d(j),l=a(48),m=d(l),n=a(203),o=d(n),p=a(97),q=d(p),r=a(191),s=d(r),t=a(215),u=d(t),v=a(50),w=d(v),x="NotFragmentedTextBufferController";e.__dashjs_factory_name=x,c.default=m.default.getClassFactory(e),b.exports=c.default},{101:101,191:191,203:203,215:215,47:47,48:48,50:50,53:53,97:97}],190:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){y=a.type===g.default.FRAGMENTED_TEXT?(0,k.default)(x).create({type:a.type,metricsModel:a.metricsModel,mediaPlayerModel:a.mediaPlayerModel,manifestModel:a.manifestModel,errHandler:a.errHandler,streamController:a.streamController,mediaController:a.mediaController,adapter:a.adapter,textController:a.textController,abrController:a.abrController,playbackController:a.playbackController,streamProcessor:a.streamProcessor}):(0,m.default)(x).create({type:a.type,mimeType:a.mimeType,errHandler:a.errHandler,streamProcessor:a.streamProcessor})}function c(){return y.getBufferControllerType()}function d(a,b){return y.initialize(a,b)}function e(a){return y.createBuffer(a)}function f(){return y.getType()}function h(){return y.getBuffer()}function i(a){y.setBuffer(a)}function j(){return y.getMediaSource()}function l(a){y.setMediaSource(a)}function n(){y.getStreamProcessor()}function o(a){y.setSeekStartTime(a)}function p(){return y.getBufferLevel()}function q(a){y.reset(a)}function r(){return y.getIsBufferingCompleted()}function s(a,b){y.switchInitData(a,b)}function t(){return y.getIsPruningInProgress()}function u(){return y.dischargePreBuffer()}function v(a){return y.getRangeAt(a)}function w(a){var b=h();b.timestampOffset===a||isNaN(a)||(b.timestampOffset=a)}a=a||{};var x=this.context,y=void 0,z=void 0;return z={getBufferControllerType:c,initialize:d,createBuffer:e,getType:f,getStreamProcessor:n,setSeekStartTime:o,getBuffer:h,setBuffer:i,getBufferLevel:p,setMediaSource:l,getMediaSource:j,getIsBufferingCompleted:r,getIsPruningInProgress:t,dischargePreBuffer:u,switchInitData:s,getRangeAt:v,reset:q,updateTimestampOffset:w},b(),z}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(48),i=d(h),j=a(107),k=d(j),l=a(189),m=d(l);e.__dashjs_factory_name="TextBufferController",c.default=i.default.getClassFactory(e),b.exports=c.default},{101:101,107:107,189:189,48:48}],191:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){M="",N=-1,O=!0,Q=!1,I=(0,m.default)(z).getInstance(),J=(0,o.default)(z).getInstance(),K=(0,q.default)(z).getInstance(),B=(0,k.default)(z).getInstance(),L=(0,s.default)(z).getInstance(),I.initialize(),L.on(u.default.TEXT_TRACKS_QUEUE_INITIALIZED,i,A),x()}function b(a){a&&(a.errHandler&&(C=a.errHandler),a.dashManifestModel&&(D=a.dashManifestModel),a.manifestModel&&(E=a.manifestModel),a.mediaController&&(F=a.mediaController),a.videoModel&&(G=a.videoModel),a.streamController&&(H=a.streamController),a.textTracks&&(I=a.textTracks),a.vttParser&&(J=a.vttParser),a.ttmlParser&&(K=a.ttmlParser),B.setConfig({errHandler:C,dashManifestModel:D,manifestModel:E,mediaController:F,videoModel:G,streamController:H,textTracks:I,vttParser:J,ttmlParser:K}))}function c(){return B}function d(){return P}function e(a){B.addEmbeddedTrack(a)}function f(a){(0,v.checkParameterType)(a,"string"),M=a}function h(){return M}function i(a){var b=this,c=a.tracks,d=a.index;c.some(function(a,c){if(a.lang===M)return b.setTextTrack(c),d=c,!0}),O||this.setTextTrack(-1),N=d,L.trigger(u.default.TEXT_TRACKS_ADDED,{enabled:p(),index:d,tracks:c})}function j(a){(0,v.checkParameterType)(a,"boolean"),(O=a)||this.setTextTrack(-1)}function l(){return O}function n(a){(0,v.checkParameterType)(a,"boolean"),p()!==a&&(a&&this.setTextTrack(N),a||(N=this.getCurrentTrackIdx(),this.setTextTrack(-1)))}function p(){var a=!0;return P&&!Q&&(a=!1),a}function r(a){(0,v.checkParameterType)(a,"boolean"),Q=a}function t(a){var b=B.getConfig(),c=b.fragmentModel,d=b.fragmentedTracks,e=b.videoModel,f=void 0,h=void 0;P=-1===a;var i=I.getCurrentTrackIdx();if(i!==a){I.setModeForTrackIdx(i,g.default.TEXT_HIDDEN),I.setCurrentTrackIdx(a),I.setModeForTrackIdx(a,g.default.TEXT_SHOWING);var j=I.getCurrentTrackInfo();if(j&&j.isFragmented&&!j.isEmbedded)for(var k=0;k<d.length;k++){var l=d[k];if(j.lang===l.lang&&j.index===l.index&&(l.id?j.label===l.id:j.label===l.index)){var m=F.getCurrentTrackFor(g.default.FRAGMENTED_TEXT,H.getActiveStreamInfo());if(l!==m)c.abortRequests(),c.removeExecutedRequestsBeforeTime(),B.remove(),I.deleteCuesFromTrackIdx(i),F.setTrack(l),B.setCurrentFragmentedTrackIdx(k);else if(-1===i){for(var n=H.getActiveStreamProcessors(),o=0;o<n.length;o++)if(n[o].getType()===g.default.FRAGMENTED_TEXT){h=n[o];break}h.getIndexHandler().setCurrentTime(e.getTime()),h.getScheduleController().start()}}}else if(j&&!j.isFragmented){for(var n=H.getActiveStreamProcessors(),k=0;k<n.length;k++)if(n[k].getType()===g.default.TEXT){h=n[k],f=h.getMediaInfoArr();break}if(h&&f)for(var k=0;k<f.length;k++)if(f[k].index===j.index&&f[k].lang===j.lang){h.selectMediaInfo(f[k]);break}}}}function w(){return I.getCurrentTrackIdx()}function x(){P=!1}function y(){x(),B.resetEmbedded(),B.reset()}var z=this.context,A=void 0,B=void 0,C=void 0,D=void 0,E=void 0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0;return A={setConfig:b,getTextSourceBuffer:c,getAllTracksAreDisabled:d,addEmbeddedTrack:e,getTextDefaultLanguage:h,setTextDefaultLanguage:f,setTextDefaultEnabled:j,getTextDefaultEnabled:l,enableText:n,isTextEnabled:p,setTextTrack:t,getCurrentTrackIdx:w,enableForcedTextStreaming:r,reset:y},a(),A}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(48),i=d(h),j=a(192),k=d(j),l=a(193),m=d(l),n=a(211),o=d(n),p=a(209),q=d(p),r=a(47),s=d(r),t=a(53),u=d(t),v=a(208);e.__dashjs_factory_name="TextController",c.default=i.default.getSingletonFactory(e),b.exports=c.default},{101:101,192:192,193:193,208:208,209:209,211:211,47:47,48:48,53:53}],192:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){M=(0,r.default)(I).getInstance().getLogger(L),c()}function b(){X=null,Z=NaN,$=[],ba=null,Y=!1}function c(){b(),V=[],S=null}function d(a,b){K||m(),W.setConfig({videoModel:_}),W.initialize(),N||(N=(0,l.default)(I).getInstance()),e(a,b)}function e(a,b){var c=!P.getIsTextTrack(a);if(b){if(V=V.concat(b.getMediaInfoArr()),c){X=b.getFragmentModel(),L.buffered=(0,n.default)(I).create(),$=R.getTracksFor(g.default.FRAGMENTED_TEXT,aa.getActiveStreamInfo());for(var d=R.getCurrentTrackFor(g.default.FRAGMENTED_TEXT,aa.getActiveStreamInfo()),e=0;e<$.length;e++)if($[e]===d){u(e);break}}for(var e=0;e<V.length;e++)w(null,V[e])}}function f(){W.deleteAllTextTracks(),N=null,V=[],X=null,Y=!1,$=[]}function i(){c(),aa=null,_=null,W=null}function k(a){var b=a.chunk;b.mediaInfo.embeddedCaptions&&y(b.bytes,b)}function m(){da=[],W=(0,t.default)(I).getInstance(),W.setConfig({videoModel:_}),W.initialize(),N=(0,l.default)(I).getInstance(),ca=null,ea=!1,fa=0,ia=[],ha=[],ga=null,K=!0,ja=(0,v.default)(I).getInstance();var a=aa.getActiveStreamProcessors();for(var b in a)if("video"===a[b].getType()){ka=a[b].getRepresentationInfo().MSETimeOffset;break}J.on(D.default.VIDEO_CHUNK_RECEIVED,k,this)}function o(){J.off(D.default.VIDEO_CHUNK_RECEIVED,k,this),W&&W.deleteAllTextTracks(),K=!1,da=[],ia=[null,null],ha=[],ga=null}function p(a){if(K||m(),a)if(a.id===g.default.CC1||a.id===g.default.CC3){for(var b=0;b<da.length;b++)if(da[b].id===a.id)return;da.push(a)}else M.warn("Embedded track "+a.id+" not supported!")}function q(a){a&&(a.errHandler&&(O=a.errHandler),a.dashManifestModel&&(P=a.dashManifestModel),a.manifestModel&&(Q=a.manifestModel),a.mediaController&&(R=a.mediaController),a.videoModel&&(_=a.videoModel),a.streamController&&(aa=a.streamController),a.textTracks&&(W=a.textTracks),a.vttParser&&(T=a.vttParser),a.ttmlParser&&(U=a.ttmlParser))}function s(){return{fragmentModel:X,fragmentedTracks:$,videoModel:_}}function u(a){ca=a}function w(a,b){var c=new j.default,d={subtitle:"subtitles",caption:"captions"},e=function(){var a=b.roles.length>0?d[b.roles[0]]:d.caption;return a=a===d.caption||a===d.subtitle?a:d.caption},f=function(){var a=!1;return b.codec&&b.codec.search(g.default.STPP)>=0&&(a=!0),b.mimeType&&b.mimeType.search(g.default.TTML)>=0&&(a=!0),a};c.captionData=a,c.lang=b.lang,c.label=b.id?b.id:b.index,c.index=b.index,c.isTTML=f(),c.defaultTrack=C(b),c.isFragmented=!P.getIsTextTrack(b.mimeType),c.isEmbedded=!!b.isEmbedded,c.kind=e(),c.roles=b.roles,c.accessibility=b.accessibility;var h=(V?V.length:0)+da.length;W.addTextTrack(c,h)}function y(a,b){var c=void 0,d=void 0,e=void 0,f=void 0,i=void 0,j=void 0,k=void 0,l=b.mediaInfo,m=l.type,n=l.mimeType,o=l.codec||n;if(!o)return void M.error("No text type defined");if(m===g.default.FRAGMENTED_TEXT)if(Y)if(j=N.getSamplesInfo(a),d=j.sampleList,null===ba&&d.length>0&&(ba=d[0].cts-b.start*Z),o.search(g.default.STPP)>=0)for(S=null!==S?S:E(o),e=0;e<d.length;e++){var p=d[e],q=p.cts,r=q-ba;this.buffered.add(r/Z,(r+p.duration)/Z);var s=new DataView(a,p.offset,p.subSizes[0]);k=x.default.Utils.dataViewToString(s,g.default.UTF8);var t=[],u=p.offset+p.subSizes[0];for(f=1;f<p.subSizes.length;f++){var v=new Uint8Array(a,u,p.subSizes[f]),y=String.fromCharCode.apply(null,v);t.push(y),u+=p.subSizes[f]}try{var B=Q.getValue(),C=B.ttmlTimeIsRelative?q/Z:0;c=S.parse(k,C,q/Z,(q+p.duration)/Z,t),W.addCaptions(ca,ba/Z,c)}catch(ma){X.removeExecutedRequestsBeforeTime(),this.remove(),M.error("TTML parser error: "+ma.message)}}else{var D=[];for(e=0;e<d.length;e++){var p=d[e];p.cts-=ba,this.buffered.add(p.cts/Z,(p.cts+p.duration)/Z);var G=a.slice(p.offset,p.offset+p.size),I=x.default.parseBuffer(G);for(f=0;f<I.boxes.length;f++){var J=I.boxes[f];if(M.debug("VTT box1: "+J.type),"vtte"!==J.type&&"vttc"===J.type)for(M.debug("VTT vttc boxes.length = "+J.boxes.length),i=0;i<J.boxes.length;i++){var K=J.boxes[i];if(M.debug("VTT box2: "+K.type),"payl"===K.type){var L=K.cue_text;M.debug("VTT cue_text = "+L);var P=p.cts/Z,R=(p.cts+p.duration)/Z;D.push({start:P,end:R,data:L,styles:{}}),M.debug("VTT "+P+"-"+R+" : "+L)}}}}D.length>0&&W.addCaptions(ca,0,D)}else Y=!0,Z=N.getMediaTimescaleFromMoov(a);else if(m===g.default.TEXT){var s=new DataView(a,0,a.byteLength);k=x.default.Utils.dataViewToString(s,g.default.UTF8);try{c=E(o).parse(k,0),W.addCaptions(W.getCurrentTrackIdx(),0,c)}catch(ma){O.timedTextError(ma,"parse",k),O.error(new F.default(H.default.TIMED_TEXT_ERROR_ID_PARSE_CODE,H.default.TIMED_TEXT_ERROR_MESSAGE_PARSE+ma.message,k))}}else if(m===g.default.VIDEO)if(b.segmentType===h.HTTPRequest.INIT_SEGMENT_TYPE){if(0===fa)for(fa=N.getMediaTimescaleFromMoov(a),e=0;e<da.length;e++)w(null,da[e])}else{if(0===fa)return void M.warn("CEA-608: No timescale for embeddedTextTrack yet");var T=function(a,b){function c(a,c,d){var e=null;if(_.getTTMLRenderingDiv())e=ja.createHTMLCaptionsFromScreen(_.getElement(),a,c,d);else{e=[{start:a,end:c,data:d.getDisplayText(),styles:{}}]}e&&W.addCaptions(b,0,e)}return c};j=N.getSamplesInfo(a);var U=j.lastSequenceNumber;if(!ia[0]&&!ia[1]){var V=void 0,$=void 0;for(e=0;e<da.length;e++){if(da[e].id===g.default.CC1?(0,$=W.getTrackIdxForId(g.default.CC1)):da[e].id===g.default.CC3&&(1,$=W.getTrackIdxForId(g.default.CC3)),-1===$)return void M.warn("CEA-608: data before track is ready.");V=T(this,$),ia[e]=new z.default.Cea608Parser(e+1,{newCue:V},null)}}if(fa&&-1==ha.indexOf(U)){if(null!==ga&&U!==ga+j.numSequences)for(e=0;e<ia.length;e++)ia[e]&&ia[e].reset();for(var aa=A(a,j.sampleList),ea=0;ea<ia.length;ea++){var ka=aa.fields[ea],la=ia[ea];if(la)for(e=0;e<ka.length;e++)la.addData(ka[e][0]/fa,ka[e][1])}ga=U,ha.push(U)}}}function A(a,b){if(0===b.length)return null;for(var c={splits:[],fields:[[],[]] +},d=new DataView(a),e=0;e<b.length;e++)for(var f=b[e],g=z.default.findCea608Nalus(d,f.offset,f.size),h=null,i=0,j=0;j<g.length;j++)for(var k=z.default.extractCea608DataFromRange(d,g[j]),l=0;l<2;l++)k[l].length>0&&(f.cts!==h?i=0:i+=1,c.fields[l].push([f.cts+ka*fa,k[l],i]),h=f.cts);return c.fields.forEach(function(a){a.sort(function(a,b){return a[0]===b[0]?a[2]-b[2]:a[0]-b[0]})}),c}function C(a){var b=!1;return da.length>1&&a.isEmbedded?b=a.id&&a.id===g.default.CC1:1===da.length?a.id&&"CC"===a.id.substring(0,2)&&(b=!0):0===da.length&&(b=a.index===V[0].index),b}function E(a){var b=void 0;return a.search(g.default.VTT)>=0?b=T:(a.search(g.default.TTML)>=0||a.search(g.default.STPP)>=0)&&(b=U),b}function G(a,b){void 0===a&&a===b&&(a=this.buffered.start(0),b=this.buffered.end(this.buffered.length-1)),this.buffered.remove(a,b)}var I=this.context,J=(0,B.default)(I).getInstance(),K=!1,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0,V=void 0,W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,_=void 0,aa=void 0,ba=void 0,ca=void 0,da=void 0,ea=void 0,fa=void 0,ga=void 0,ha=void 0,ia=void 0,ja=void 0,ka=void 0;return L={initialize:d,append:y,abort:f,addEmbeddedTrack:p,resetEmbedded:o,setConfig:q,getConfig:s,setCurrentFragmentedTrackIdx:u,remove:G,reset:i},a(),L}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(235),i=a(227),j=d(i),k=a(197),l=d(k),m=a(199),n=d(m),o=a(48),p=d(o),q=a(46),r=d(q),s=a(193),t=d(s),u=a(188),v=d(u),w=a(6),x=d(w),y=a(2),z=d(y),A=a(47),B=d(A),C=a(53),D=d(C),E=a(215),F=d(E),G=a(50),H=d(G);e.__dashjs_factory_name="TextSourceBuffer",c.default=p.default.getSingletonFactory(e),b.exports=c.default},{101:101,188:188,193:193,197:197,199:199,2:2,215:215,227:227,235:235,46:46,47:47,48:48,50:50,53:53,6:6}],193:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){H=(0,o.default)(E).getInstance().getLogger(G)}function b(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(I=window.VTTCue||window.TextTrackCue,K=[],L=[],M=-1,N=0,O=0,P=0,Q=0,R=null,S=null,U=!1,W=2147483647,V=null,void 0!==document.fullscreenElement?T="fullscreenElement":void 0!==document.webkitIsFullScreen?T="webkitIsFullScreen":document.msFullscreenElement?T="msFullscreenElement":document.mozFullScreen&&(T="mozFullScreen"))}function c(a){var b=K[a].kind,c=void 0!==K[a].label?K[a].label:K[a].lang,d=K[a].lang,e=K[a].isTTML,f=K[a].isEmbedded,g=J.addTextTrack(b,c,d);return g.isEmbedded=f,g.isTTML=e,g}function d(a){U=a,R&&!document[T]&&(R.style.zIndex=a?W:null)}function e(a,b){if(K.length===b)return void H.error("Trying to add too many tracks.");if(K.push(a),K.length===b){K.sort(function(a,b){return a.index-b.index}),R=J.getTTMLRenderingDiv();for(var d=-1,e=0;e<K.length;e++){var f=c.call(this,e);L.push(f),K[e].defaultTrack&&(f.default=!0,d=e);var h=n(e);h&&(h.mode=g.default.TEXT_SHOWING,R&&(K[e].isTTML||K[e].isEmbedded)?h.renderingType="html":h.renderingType="default"),this.addCaptions(e,0,K[e].captionData),F.trigger(k.default.TEXT_TRACK_ADDED)}if(s.call(this,d),d>=0)for(var i=0;i<K.length;i++){var j=n(i);j&&(j.mode=i===d?g.default.TEXT_SHOWING:g.default.TEXT_HIDDEN)}F.trigger(k.default.TEXT_TRACKS_QUEUE_INITIALIZED,{index:M,tracks:K})}}function f(a,b,c,d,e,f){var g=a/b,h=c/d,i=0,j=0;g>h?(j=b,i=j/d*c):(i=a,j=i/c*d);var k=0,l=0,m=0,n=0;return i/j>e?(n=j,m=j*e):(m=i,n=i/e),k=(a-m)/2,l=(b-n)/2,f?{x:k+.1*m,y:l+.1*n,w:.8*m,h:.8*n}:{x:k,y:l,w:m,h:n}}function h(a,b){var c=J.getClientWidth(),d=J.getClientHeight(),e=J.getVideoWidth(),g=J.getVideoHeight(),h=J.getVideoRelativeOffsetTop(),i=J.getVideoRelativeOffsetLeft(),j=e/g,l=!1;a.isFromCEA608&&(j=3.5/3,l=!0);var m=f.call(this,c,d,e,g,j,l),n=m.w,o=m.h,p=m.x,q=m.y;if(n!=P||o!=Q||p!=N||q!=O||b){if(N=p+i,O=q+h,P=n,Q=o,R){var r=R.style;r.left=N+"px",r.top=O+"px",r.width=P+"px",r.height=Q+"px",r.zIndex=T&&document[T]||U?W:null,F.trigger(k.default.CAPTION_CONTAINER_RESIZE,{})}var s=a.activeCues;if(s)for(var t=s.length,u=0;u<t;++u){var v=s[u];v.scaleCue(v)}}}function j(a){var b=P,c=Q,d=void 0,e=void 0,f=void 0,g=void 0,h=void 0;if(a.cellResolution){var i=[b/a.cellResolution[0],c/a.cellResolution[1]];if(a.linePadding)for(d in a.linePadding)if(a.linePadding.hasOwnProperty(d)){var j=a.linePadding[d];e=(j*i[0]).toString();for(var k=document.getElementsByClassName("spanPadding"),m=0;m<k.length;m++)k[m].style.cssText=k[m].style.cssText.replace(/(padding-left\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+e),k[m].style.cssText=k[m].style.cssText.replace(/(padding-right\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+e)}if(a.fontSize){for(d in a.fontSize)if(a.fontSize.hasOwnProperty(d)){"%"===a.fontSize[d][0]?f=a.fontSize[d][1]/100:"c"===a.fontSize[d][0]&&(f=a.fontSize[d][1]),e=(f*i[1]).toString(),h="defaultFontSize"!==d?document.getElementsByClassName(d):document.getElementsByClassName("paragraph");for(var n=0;n<h.length;n++)h[n].style.cssText=h[n].style.cssText.replace(/(font-size\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+e)}if(a.lineHeight)for(d in a.lineHeight)if(a.lineHeight.hasOwnProperty(d)){"%"===a.lineHeight[d][0]?g=a.lineHeight[d][1]/100:"c"===a.fontSize[d][0]&&(g=a.lineHeight[d][1]),e=(g*i[1]).toString(),h=document.getElementsByClassName(d);for(var o=0;o<h.length;o++)h[o].style.cssText=h[o].style.cssText.replace(/(line-height\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+e)}}}if(a.isd){var p=document.getElementById(a.cueID);p&&R.removeChild(p),l(a)}}function l(a){if(R){var b=document.createElement("div");R.appendChild(b),V=(0,p.renderHTML)(a.isd,b,function(b){var c=/^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/,d=/^#(.*)$/;if(c.test(b)){var e=c.exec(b),f=parseInt(e[4],10)-1,g=btoa(a.images[f]),h="data:image/png;base64,"+g;return h}if(d.test(b)){var e=d.exec(b),f=e[1],h="data:image/png;base64,"+a.embeddedImages[f];return h}return null},R.clientHeight,R.clientWidth,!1,function(a){H.info("renderCaption :",a)},V,!0),b.id=a.cueID,F.trigger(k.default.CAPTION_RENDERED,{captionDiv:b,currentTrackIdx:M})}}function m(a,b,c){var d=n(a),e=this;if(d&&c&&0!==c.length)for(var f=0;f<c.length;f++){var h=void 0,i=c[f];d.cellResolution=i.cellResolution,d.isFromCEA608=i.isFromCEA608,"html"===i.type&&R?(h=new I(i.start-b,i.end-b,""),h.cueHTMLElement=i.cueHTMLElement,h.isd=i.isd,h.images=i.images,h.embeddedImages=i.embeddedImages,h.cueID=i.cueID,h.scaleCue=j.bind(e),h.cellResolution=i.cellResolution,h.lineHeight=i.lineHeight,h.linePadding=i.linePadding,h.fontSize=i.fontSize,R.style.left=N+"px",R.style.top=O+"px",R.style.width=P+"px",R.style.height=Q+"px",h.onenter=function(){d.mode===g.default.TEXT_SHOWING&&(this.isd?(l(this),H.debug("Cue enter id:"+this.cueID)):(R.appendChild(this.cueHTMLElement),j.call(e,this)))},h.onexit=function(){if(R)for(var a=R.childNodes,b=0;b<a.length;++b)a[b].id===this.cueID&&(H.debug("Cue exit id:"+a[b].id),R.removeChild(a[b]))}):i.data&&(h=new I(i.start-b,i.end-b,i.data),i.styles&&(void 0!==i.styles.align&&"align"in h&&(h.align=i.styles.align),void 0!==i.styles.line&&"line"in h&&(h.line=i.styles.line),void 0!==i.styles.position&&"position"in h&&(h.position=i.styles.position),void 0!==i.styles.size&&"size"in h&&(h.size=i.styles.size)));try{h?d.addCue(h):H.error("impossible to display subtitles.")}catch(k){throw u(d),d.addCue(h),k}}}function n(a){return a>=0&&K[a]?J.getTextTrack(K[a].kind,K[a].label,K[a].lang,K[a].isTTML,K[a].isEmbedded):null}function q(){return M}function r(a){for(var b=-1,c=0;c<K.length;c++)if(K[c].label===a){b=c;break}return b}function s(a){if(a!==M){M=a;var b=n(M);t.call(this,b),S&&(clearInterval(S),S=null),b&&"html"===b.renderingType&&(h.call(this,b,!0),S=setInterval(h.bind(this,b),500))}}function t(a){A.call(this),a&&"html"===a.renderingType?y.call(this):z.call(this)}function u(a){if(a.cues)for(var b=a.cues,c=b.length-1,d=c;d>=0;d--)a.removeCue(b[d])}function v(a){var b=n(a);b&&u(b)}function w(){for(var a=L?L.length:0,b=0;b<a;b++){var c=n(b);c&&(u.call(this,c),c.mode="disabled")}L=[],K=[],S&&(clearInterval(S),S=null),M=-1,A.call(this)}function x(a){J.removeChild(L[a]),L.splice(a,1)}function y(){var a=document.getElementById("native-cue-style");if(!a){a=document.createElement("style"),a.id="native-cue-style",document.head.appendChild(a);var b=a.sheet,c=J.getElement();try{c&&(c.id?b.insertRule("#"+c.id+"::cue {background: transparent}",0):0!==c.classList.length?b.insertRule("."+c.className+"::cue {background: transparent}",0):b.insertRule("video::cue {background: transparent}",0))}catch(d){H.info(""+d.message)}}}function z(){var a=document.getElementById("native-cue-style");a&&document.head.removeChild(a)}function A(){if(R)for(;R.firstChild;)R.removeChild(R.firstChild)}function B(a){a&&a.videoModel&&(J=a.videoModel)}function C(a,b){var c=n(a);c&&c.mode!==b&&(c.mode=b)}function D(){return K[M]}var E=this.context,F=(0,i.default)(E).getInstance(),G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0,N=void 0,O=void 0,P=void 0,Q=void 0,R=void 0,S=void 0,T=void 0,U=void 0,V=void 0,W=void 0;return G={initialize:b,displayCConTop:d,addTextTrack:e,addCaptions:m,getCurrentTrackIdx:q,setCurrentTrackIdx:s,getTrackIdxForId:r,getCurrentTrackInfo:D,setModeForTrackIdx:C,deleteCuesFromTrackIdx:v,deleteAllTextTracks:w,deleteTextTrack:x,setConfig:B},a(),G}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(47),i=d(h),j=a(53),k=d(j),l=a(48),m=d(l),n=a(46),o=d(n),p=a(41);e.__dashjs_factory_name="TextTracks",c.default=m.default.getSingletonFactory(e),b.exports=c.default},{101:101,41:41,46:46,47:47,48:48,53:53}],194:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){h(),n=(0,m.default)(j).create({dashManifestModel:a.dashManifestModel,adapter:a.adapter,baseURLController:a.baseURLController,stream:a.stream,timelineConverter:a.timelineConverter})}function c(a,b){var c=n.getCurrentTrack();if(!c||c.segmentDuration<=0||void 0===a||null===a)return null;var e=Math.floor(a/c.segmentDuration),f=a%c.segmentDuration,g=Math.floor(f*c.tilesHor*c.tilesVert/c.segmentDuration),h=new k.default;return h.width=Math.floor(c.widthPerTile),h.height=Math.floor(c.heightPerTile),h.x=Math.floor(g%c.tilesHor)*c.widthPerTile,h.y=Math.floor(g/c.tilesHor)*c.heightPerTile,"readThumbnail"in c?c.readThumbnail(a,function(a){h.url=a,b&&b(h)}):(h.url=d(c,e),b&&b(h),h)}function d(a,b){var c=b+a.startNumber,d=(0,p.replaceTokenForTemplate)(a.templateUrl,"Number",c);return d=(0,p.replaceTokenForTemplate)(d,"Time",(c-1)*a.segmentDuration),d=(0,p.replaceTokenForTemplate)(d,"Bandwidth",a.bandwidth),(0,p.unescapeDollarsInTemplate)(d)}function e(a){n.setTrackByIndex(a)}function f(){return n.getCurrentTrackIndex()}function g(){var a=0;return n.getTracks().map(function(b){var c=new o.default;return c.mediaType=i.default.IMAGE,c.qualityIndex=a++,c.bitrate=b.bitrate,c.width=b.width,c.height=b.height,c})}function h(){n&&n.reset()}var j=this.context,l=void 0,n=void 0;return l={get:c,setTrackByIndex:e,getCurrentTrackIndex:f,getBitrateList:g,reset:h},b(),l}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(101),i=d(h),j=a(228),k=d(j),l=a(195),m=d(l),n=a(214),o=d(n),p=a(77);e.__dashjs_factory_name="ThumbnailController",c.default=g.default.getClassFactory(e),b.exports=c.default},{101:101,195:195,214:214,228:228,48:48,77:77}],195:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){n(),A=(0,v.default)(q).create({}),C=(0,t.default)(q).getInstance(),B=(0,r.default)(q).getInstance(),B.setConfig({baseURLController:x,metricsModel:E,mediaPlayerModel:F,errHandler:G}),d()}function c(a,b){var c=[],d=0,e=void 0,f=void 0,g=void 0,h=void 0;for(e=0,f=a.length;e<f;e++)g=a[e],h=(0,p.getTimeBasedSegment)(D,s.getIsDynamic(),b,g.startTime,g.duration,g.timescale,g.media,g.mediaRange,d),c.push(h),h=null,d++;return c}function d(){if(y&&s&&u){var a=y.getStreamInfo();if(a){var b=u.getMediaInfoForType(a,g.default.IMAGE);if(b){var c=u.getDataForMedia(b);if(c){var d=s.getRepresentationsForAdaptation(c);d&&d.length>0&&d.forEach(function(a){a.segmentInfoType===i.default.SEGMENT_TEMPLATE&&a.segmentDuration>0&&a.media&&e(a),a.segmentInfoType===i.default.SEGMENT_BASE&&e(a,!0)}),I.length>0&&(I.sort(function(a,b){return a.bitrate-b.bitrate}),J=I.length-1)}}}}}function e(a,b){var d=new m.default;d.id=a.id,d.bitrate=a.bandwidth,d.width=a.width,d.height=a.height,d.tilesHor=1,d.tilesVert=1,a.essentialProperties&&a.essentialProperties.forEach(function(a){if(w.indexOf(a.schemeIdUri)>=0&&a.value){var b=a.value.split("x");2!==b.length||isNaN(b[0])||isNaN(b[1])||(d.tilesHor=parseInt(b[0],10),d.tilesVert=parseInt(b[1],10))}}),b?B.loadSegments(a,g.default.IMAGE,a.indexRange,{},function(a,b){var e=[];a=c(a,b),d.segmentDuration=a[0].duration,d.readThumbnail=function(c,d){var f=null;e.some(function(a){if(a.start<=c&&a.end>c)return f=a.url,!0}),f?d(f):a.some(function(a){if(a.mediaStartTime<=c&&a.mediaStartTime+a.duration>c){var f=x.resolve(b.path);return A.load({method:"get",url:f.url,request:{range:a.mediaRange,responseType:"arraybuffer"},onload:function(b){var c=C.getSamplesInfo(b.target.response),f=new Blob([b.target.response.slice(c.sampleList[0].offset,c.sampleList[0].offset+c.sampleList[0].size)],{type:"image/jpeg"}),g=window.URL.createObjectURL(f);e.push({start:a.mediaStartTime,end:a.mediaStartTime+a.duration,url:g}),d&&d(g)}}),!0}})}}):(d.startNumber=a.startNumber,d.segmentDuration=a.segmentDuration,d.timescale=a.timescale,d.templateUrl=f(a)),d.tilesHor>0&&d.tilesVert>0&&(d.widthPerTile=d.width/d.tilesHor,d.heightPerTile=d.height/d.tilesVert,I.push(d))}function f(a){var b=z.isRelative(a.media)?z.resolve(a.media,x.resolve(a.path).url):a.media;return b?(0,p.replaceIDForTemplate)(b,a.id):""}function h(){return I}function j(){return J}function k(){return J<0?null:I[J]}function l(a){I&&0!==I.length&&(a>=I.length&&(a=I.length-1),J=a)}function n(){I=[],J=-1}var q=this.context,s=a.dashManifestModel,u=a.adapter,x=a.baseURLController,y=a.stream,z=(0,o.default)(q).getInstance(),A=void 0,B=void 0,C=void 0,D=a.timelineConverter,E=a.metricsModel,F=a.mediaPlayerModel,G=a.errHandler,H=void 0,I=void 0,J=void 0;return H={initialize:b,getTracks:h,reset:n,setTrackByIndex:l,getCurrentTrack:k,getCurrentTrackIndex:j},b(),H}Object.defineProperty(c,"__esModule",{value:!0});var f=a(101),g=d(f),h=a(60),i=d(h),j=a(48),k=d(j),l=a(229),m=d(l),n=a(210),o=d(n),p=a(77),q=a(58),r=d(q),s=a(197),t=d(s),u=a(149),v=d(u),w=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];e.__dashjs_factory_name="ThumbnailTracks",c.default=k.default.getClassFactory(e),b.exports=c.default},{101:101,149:149,197:197,210:210,229:229,48:48,58:58,60:60,77:77}],196:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){p=(0,m.default)(h).create({updateEventName:k.default.SERVICE_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:k.default.SERVICE_LOCATION_BLACKLIST_ADD}),r=(0,q.default)(h).create({blacklistController:p}),s=(0,o.default)(h).create({blacklistController:p}),t=r}function b(a){a.selector&&(t=a.selector),a.dashManifestModel&&(l=a.dashManifestModel)}function c(){if(!l||!l.hasOwnProperty("getIsDVB"))throw new Error(w.default.MISSING_CONFIG_ERROR)}function d(a){c(),t=l.getIsDVB(a)?s:r}function e(a){if(a){var b=a.baseUrls,c=a.selectedIdx;if(!isNaN(c))return b[c];var d=t.select(b);return d?(a.selectedIdx=b.indexOf(d),d):(j.trigger(k.default.URL_RESOLUTION_FAILED,{error:new u.default(g.default.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,g.default.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(t===r&&f()))}}function f(){p.reset()}var h=this.context,j=(0,i.default)(h).getInstance(),l=void 0,n=void 0,p=void 0,r=void 0,s=void 0,t=void 0;return n={chooseSelectorFromManifest:d,select:e,reset:f,setConfig:b},a(),n}Object.defineProperty(c,"__esModule",{value:!0});var f=a(50),g=d(f),h=a(47),i=d(h),j=a(53),k=d(j),l=a(106),m=d(l),n=a(213),o=d(n),p=a(212),q=d(p),r=a(48),s=d(r),t=a(215),u=d(t),v=a(101),w=d(v);e.__dashjs_factory_name="BaseURLSelector",c.default=s.default.getClassFactory(e),b.exports=c.default},{101:101,106:106,212:212,213:213,215:215,47:47,48:48,50:50,53:53}],197:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){k=(0,g.default)(n).getInstance().getLogger(l)}function b(a){if(!a)return null;void 0===a.fileStart&&(a.fileStart=0);var b=m.default.parseBuffer(a),c=(0,i.default)(n).create();return c.setData(b),c}function c(a,b,c){if(void 0===c&&(c=0),!b||c+8>=b.byteLength)return new o.default(0,!1);for(var d=b instanceof ArrayBuffer?new Uint8Array(b):b,e=void 0,g=0;c<d.byteLength;){var i=f(d,c),j=h(d,c+4);if(0===i)break;c+i<=d.byteLength&&(a.indexOf(j)>=0?e=new o.default(c,!0,i):g=c+i),c+=i}return e||new o.default(g,!1)}function d(a){if(!a||0===a.byteLength)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};var c=b(a),d=c.getBoxes("moof"),e=c.getBoxes("mfhd"),f=void 0,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=void 0,m=void 0,n=void 0,o=void 0,p=void 0,q=void 0,r=void 0,s=void 0,t=void 0,u=void 0,v=void 0;u=c.getBoxes("moof").length,t=e[e.length-1].sequence_number,h=0,k=[];var w=-1,x=-1;for(p=0;p<d.length;p++){var y=d[p],z=y.getChildBoxes("traf");for(n=0;n<z.length;n++){var A=z[n],B=A.getChildBox("tfhd"),C=A.getChildBox("tfdt");j=C.baseMediaDecodeTime;var D=A.getChildBoxes("trun"),E=A.getChildBoxes("subs");for(o=0;o<D.length;o++){var F=D[o];for(h=F.sample_count,s=(B.base_data_offset||0)+(F.data_offset||0),m=0;m<h;m++){l=F.samples[m],f=void 0!==l.sample_duration?l.sample_duration:B.default_sample_duration,i=void 0!==l.sample_size?l.sample_size:B.default_sample_size,g=void 0!==l.sample_composition_time_offset?l.sample_composition_time_offset:0;var G={dts:j,cts:j+g,duration:f,offset:y.offset+s,size:i,subSizes:[i]};if(E)for(q=0;q<E.length;q++){var H=E[q];if(w<H.entry_count-1&&m>x&&(w++,x+=H.entries[w].sample_delta),m==x){G.subSizes=[];var I=H.entries[w];for(r=0;r<I.subsample_count;r++)G.subSizes.push(I.subsamples[r].subsample_size)}}k.push(G),s+=i,j+=f}}v=j-C.baseMediaDecodeTime}}return{sampleList:k,lastSequenceNumber:t,totalDuration:v,numSequences:u}}function e(a){var c=b(a),d=c?c.getBox("mdhd"):void 0;return d?d.timescale:NaN}function f(a,b){return a[b+3]>>>0|a[b+2]<<8>>>0|a[b+1]<<16>>>0|a[b]<<24>>>0}function h(a,b){return String.fromCharCode(a[b++])+String.fromCharCode(a[b++])+String.fromCharCode(a[b++])+String.fromCharCode(a[b])}function j(a){var c=null,d=void 0,e=void 0,f=b(a);if(!f)return c;var g=f.getBox("ftyp"),h=f.getBox("moov");return k.debug("Searching for initialization."),h&&h.isComplete&&(d=g?g.offset:h.offset,e=h.offset+h.size-1,c=d+"-"+e,k.debug("Found the initialization. Range: "+c)),c}var k=void 0,l=void 0,n=this.context;return l={parse:b,findLastTopIsoBoxCompleted:c,getMediaTimescaleFromMoov:e,getSamplesInfo:d,findInitRange:j},a(),l}Object.defineProperty(c,"__esModule",{value:!0});var f=a(46),g=d(f),h=a(204),i=d(h),j=a(48),k=d(j),l=a(6),m=d(l),n=a(220),o=d(n);e.__dashjs_factory_name="BoxParser",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{204:204,220:220,46:46,48:48,6:6}],198:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){g=!1}function b(){var a="WebKitMediaSource"in window,b="MediaSource"in window;return a||b}function c(){return g}function d(a){g=a}function e(a){return!!("MediaSource"in window&&MediaSource.isTypeSupported(a))||!!("WebKitMediaSource"in window&&WebKitMediaSource.isTypeSupported(a))}var f=void 0,g=void 0;return f={supportsMediaSource:b,supportsEncryptedMedia:c,supportsCodec:e,setEncryptedMediaSupported:d},a(),f}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="Capabilities",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{48:48}],199:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){var c=0;for(c=0;c<this.customTimeRangeArray.length&&a>this.customTimeRangeArray[c].start;c++);for(this.customTimeRangeArray.splice(c,0,{start:a,end:b}),c=0;c<this.customTimeRangeArray.length-1;c++)this.mergeRanges(c,c+1)&&c--;this.length=this.customTimeRangeArray.length}function b(){this.customTimeRangeArray=[],this.length=0}function c(a,b){for(var c=0;c<this.customTimeRangeArray.length;c++)if(a<=this.customTimeRangeArray[c].start&&b>=this.customTimeRangeArray[c].end)this.customTimeRangeArray.splice(c,1),c--;else{if(a>this.customTimeRangeArray[c].start&&b<this.customTimeRangeArray[c].end){this.customTimeRangeArray.splice(c+1,0,{start:b,end:this.customTimeRangeArray[c].end}),this.customTimeRangeArray[c].end=a;break}a>this.customTimeRangeArray[c].start&&a<this.customTimeRangeArray[c].end?this.customTimeRangeArray[c].end=a:b>this.customTimeRangeArray[c].start&&b<this.customTimeRangeArray[c].end&&(this.customTimeRangeArray[c].start=b)}this.length=this.customTimeRangeArray.length}function d(a,b){var c=this.customTimeRangeArray[a],d=this.customTimeRangeArray[b];return c.start<=d.start&&d.start<=c.end&&c.end<=d.end?(c.end=d.end,this.customTimeRangeArray.splice(b,1),!0):d.start<=c.start&&c.start<=d.end&&d.end<=c.end?(c.start=d.start,this.customTimeRangeArray.splice(b,1),!0):d.start<=c.start&&c.start<=d.end&&c.end<=d.end?(this.customTimeRangeArray.splice(a,1),!0):c.start<=d.start&&d.start<=c.end&&d.end<=c.end&&(this.customTimeRangeArray.splice(b,1),!0)}function e(a){return(0,h.checkInteger)(a),a>=this.customTimeRangeArray.length||a<0?NaN:this.customTimeRangeArray[a].start}function f(a){return(0,h.checkInteger)(a),a>=this.customTimeRangeArray.length||a<0?NaN:this.customTimeRangeArray[a].end}return{customTimeRangeArray:[],length:0,add:a,clear:b,remove:c,mergeRanges:d,start:e,end:f}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(208);e.__dashjs_factory_name="CustomTimeRanges",c.default=g.default.getClassFactory(e),b.exports=c.default},{208:208,48:48}],200:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){x=(0,i.default)(u).getInstance().getLogger(w),d()}function c(a){if(void 0!==y)return y;y=!1;var b="1",c="1",d=void 0;try{"undefined"!=typeof window&&(d=window[a])}catch(e){return x.warn("DOMStorage access denied: "+e.message),y}if(!d||a!==o&&a!==p)return y;try{d.setItem(b,c),d.removeItem(b),y=!0}catch(e){x.warn("DOMStorage is supported, but cannot be used: "+e.message)}return y}function d(){c(o)&&l.forEach(function(a){var b=localStorage.getItem(a.oldKey);if(b){localStorage.removeItem(a.oldKey);try{localStorage.setItem(a.newKey,b)}catch(c){x.error(c.message)}}})}function e(){var a=6e5;return Math.round((new Date).getTime()/a)*a}function f(a,b){return c(a)&&v["get"+b+"CachingInfo"]().enabled}function g(){if(!v||!v.hasOwnProperty("getLastMediaSettingsCachingInfo"))throw new Error(k.default.MISSING_CONFIG_ERROR)}function h(a){if(g(),!f(o,r))return null;var b=null,c=n.replace(/\?/,a);try{var d=JSON.parse(localStorage.getItem(c))||{},e=(new Date).getTime()-parseInt(d.timestamp,10)>=v.getLastMediaSettingsCachingInfo().ttl||!1;b=d.settings,e&&(localStorage.removeItem(c),b=null)}catch(h){return null}return b}function j(a){var b=NaN;if(g(),f(o,q)){var c=m.replace(/\?/,a);try{var d=JSON.parse(localStorage.getItem(c))||{},e=(new Date).getTime()-parseInt(d.timestamp,10)>=v.getLastMediaSettingsCachingInfo().ttl||!1,h=parseFloat(d.bitrate);isNaN(h)||e?e&&localStorage.removeItem(c):(b=h,x.debug("Last saved bitrate for "+a+" was "+h))}catch(i){return null}}return b}function s(a,b){if(f(o,r)){var c=n.replace(/\?/,a);try{localStorage.setItem(c,JSON.stringify({settings:b,timestamp:e()}))}catch(d){x.error(d.message)}}}function t(a,b){if(f(o,q)&&b){var c=m.replace(/\?/,a);try{localStorage.setItem(c,JSON.stringify({bitrate:b.toFixed(3),timestamp:e()}))}catch(d){x.error(d.message)}}}a=a||{};var u=this.context,v=a.mediaPlayerModel,w=void 0,x=void 0,y=void 0;return w={getSavedBitrateSettings:j,setSavedBitrateSettings:t,getSavedMediaSettings:h,setSavedMediaSettings:s},b(),w}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h),j=a(101),k=d(j),l=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}],m="dashjs_?_bitrate",n="dashjs_?_settings",o="localStorage",p="sessionStorage",q="LastBitrate",r="LastMediaSettings";e.__dashjs_factory_name="DOMStorage";var s=g.default.getSingletonFactory(e);c.default=s,b.exports=c.default},{101:101,46:46,48:48}],201:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){return n}function c(a){n=a}function d(a,b){var c=!0,d=0,e=void 0,f=void 0;if(void 0===b&&(b=!1),a.tag>16777215?(m.getUint32(n)!==a.tag&&(c=!1),d=4):a.tag>65535?(e=m.getUint16(n),f=m.getUint8(n+2),256*e+f!==a.tag&&(c=!1),d=3):a.tag>255?(m.getUint16(n)!==a.tag&&(c=!1),d=2):(m.getUint8(n)!==a.tag&&(c=!1),d=1),!c&&a.required&&!b)throw new Error("required tag not found");return c&&(n+=d),c}function e(a,b){var c=d(a,b);return c&&h(),c}function f(a){var b=void 0;return d(a),b=h(),l[a.parse](b)}function g(a,b){var c=d(a,b),e=void 0;return c&&(e=h(),n+=e),c}function h(a){var b=1,c=128,d=8,e=-1,f=0,g=m.getUint8(n),h=0;for(h=0;h<d;h+=1){if((g&c)===c){f=void 0===a?g&~c:g,e=h;break}c>>=1}for(h=0;h<e;h+=1,b+=1)f=f<<8|255&m.getUint8(n+b);return n+=b,f}function i(a){var b=void 0;switch(a){case 4:b=m.getFloat32(n),n+=4;break;case 8:b=m.getFloat64(n),n+=8}return b}function j(a){for(var b=0,c=0;c<a;c+=1)b<<=8,b|=255&m.getUint8(n+c);return n+=a,b}function k(){return n<m.byteLength}a=a||{};var l=void 0,m=new DataView(a.data),n=0;return l={getPos:b,setPos:c,consumeTag:d,consumeTagAndSize:e,parseTag:f,skipOverElement:g,getMatroskaCodedNum:h,getMatroskaFloat:i,getMatroskaUint:j,moreData:k}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="EBMLParser",c.default=g.default.getClassFactory(e),b.exports=c.default},{48:48}],202:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){l.trigger(i.default.ERROR,{error:"capability",event:a})}function b(a,b,c){l.trigger(i.default.ERROR,{error:"download",event:{id:a,url:b,request:c}})}function c(a,b,c,d){l.trigger(i.default.ERROR,{error:"manifestError",event:{message:a,id:b,manifest:c,event:d}})}function d(a,b,c){l.trigger(i.default.ERROR,{error:"cc",event:{message:a,id:b,cc:c}})}function e(a){l.trigger(i.default.ERROR,{error:"mediasource",event:a})}function f(a){l.trigger(i.default.ERROR,{error:"key_session",event:a})}function h(a){l.trigger(i.default.ERROR,{error:"key_message",event:a})}function j(a){l.trigger(i.default.ERROR,{error:a})}var k=this.context,l=(0,g.default)(k).getInstance();return{capabilityError:a,downloadError:b,manifestError:c,timedTextError:d,mediaSourceError:e,mediaKeySessionError:f,mediaKeyMessageError:h,error:j}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(47),g=d(f),h=a(53),i=d(h),j=a(48),k=d(j);e.__dashjs_factory_name="ErrorHandler",c.default=k.default.getSingletonFactory(e),b.exports=c.default},{47:47,48:48,53:53}],203:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){var b=a.streamId,c=a.representationId;d[b]=d[b]||{},d[b][c]=a}function b(a,b){return d&&d[a]&&d[a][b]?d[a][b]:null}function c(){d={}}var d={};return{save:a,extract:b,reset:c}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="InitCache",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{48:48}],204:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a&&f&&f.boxes&&0!==f.boxes.length&&"function"==typeof f.fetch?e(f.fetch(a)):null}function b(a){var b=[];if(!a||!f||"function"!=typeof f.fetchAll)return b;for(var c=f.fetchAll(a),d=void 0,g=0,h=c.length;g<h;g++)(d=e(c[g]))&&b.push(d);return b}function c(a){f=a}function d(){if(!f||!f.boxes||!f.boxes.length)return null;var a=f.boxes[f.boxes.length-1].type,c=b(a);return c.length>0?c[c.length-1]:null}function e(a){if(!a)return null;var b=new g.default(a);return a.hasOwnProperty("_incomplete")&&(b.isComplete=!a._incomplete),b}var f=void 0;return{getBox:a,getBoxes:b,setData:c,getLastBox:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(219),g=d(f),h=a(48),i=d(h);e.__dashjs_factory_name="IsoFile",c.default=i.default.getClassFactory(e),b.exports=c.default},{219:219,48:48}],205:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(){if(!(e&&e.hasOwnProperty("getExpectedLiveEdge")&&f&&f.hasOwnProperty("getRepresentationInfo")))throw new Error(i.default.MISSING_CONFIG_ERROR)}function c(){b();var a=f.getRepresentationInfo(),c=a.DVRWindow.end;return a.useCalculatedLiveEdgeTime&&(c=e.getExpectedLiveEdge(),e.setClientTimeOffset(c-a.DVRWindow.end)),c}function d(){e=null,f=null}a=a||{};var e=a.timelineConverter,f=a.streamProcessor;return{getLiveEdge:c,reset:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(101),i=d(h);e.__dashjs_factory_name="LiveEdgeFinder",c.default=g.default.getClassFactory(e),b.exports=c.default},{101:101,48:48}],206:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a,b){return(0,i.default)(a,b)}return{areEqual:a}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(7),i=d(h);e.__dashjs_factory_name="ObjectUtils",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{48:48,7:7}],207:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(a){return a}function b(a){return a}return{modifyRequestURL:a,modifyRequestHeader:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="RequestModifier",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{48:48}],208:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(typeof a!==b)throw j.default.BAD_ARGUMENT_ERROR}function f(a){if(null===a||isNaN(a)||a%1!=0)throw j.default.BAD_ARGUMENT_ERROR+" : argument is not an integer"}function g(a,b,c){if(a<b||a>c)throw j.default.BAD_ARGUMENT_ERROR+" : argument out of range"}function h(a){if("string"!=typeof a||a!==j.default.AUDIO&&a!==j.default.VIDEO)throw j.default.BAD_ARGUMENT_ERROR}Object.defineProperty(c,"__esModule",{value:!0}),c.checkParameterType=e,c.checkInteger=f,c.checkRange=g,c.checkIsVideoOrAudioType=h;var i=a(101),j=d(i)},{101:101}],209:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){g=(0,i.default)(d).getInstance().getLogger(f)}function b(){var a="cue_TTML_"+h;return h++,a}function c(a,c,d,f,h){var i="",j=[],k=void 0,l=void 0,o=void 0,p={},q={},r="",s="",t={onOpenTag:function(a,b,c){if("image"===b&&"http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"===a){if(!c[" imagetype"]||"PNG"!==c[" imagetype"].value)return void g.warn("smpte-tt imagetype != PNG. Discarded");r=c["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){r&&(q[r]=s.trim()),s="",r=""},onText:function(a){r&&(s+=a)}};if(!a)throw i="no ttml data to parse",new Error(i);p.data=a,e.trigger(m.default.TTML_TO_PARSE,p);var u=(0,n.fromXML)(p.data,function(a){i=a},t);e.trigger(m.default.TTML_PARSED,{ttmlString:p.data,ttmlDoc:u});var v=u.getMediaTimeEvents();for(o=0;o<v.length;o++){var w=(0,n.generateISD)(u,v[o],function(a){i=a});w.contents.some(function(a){return a.contents.length})&&(k=v[o]+c<d?d:v[o]+c,l=v[o+1]+c>f?f:v[o+1]+c,k<l&&j.push({start:k,end:l,type:"html",cueID:b(),isd:w,images:h,embeddedImages:q}))}if(""!==i)throw g.error(i),new Error(i);return j}var d=this.context,e=(0,k.default)(d).getInstance(),f=void 0,g=void 0,h=0;return f={parse:c},a(),f} +Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h),j=a(47),k=d(j),l=a(53),m=d(l),n=a(41);e.__dashjs_factory_name="TTMLParser",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{41:41,46:46,47:47,48:48,53:53}],210:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){try{new window.URL("x","http://y");k=p}catch(a){}finally{k=k||q}}function b(a){var b=a.indexOf("/"),c=a.lastIndexOf("/");return-1!==b?c===b+1?a:(-1!==a.indexOf("?")&&(a=a.substring(0,a.indexOf("?"))),a.substring(0,c+1)):""}function c(a){var b=a.match(o);return b?b[1]:""}function d(a){var b=a.match(l);return b?b[0]:""}function e(a){return!l.test(a)}function f(a){return e(a)&&"/"===a.charAt(0)}function g(a){return 0===a.indexOf("//")}function h(a){return m.test(a)}function i(a){return n.test(a)}function j(a,b){return k(a,b)}var k=void 0,l=/^[a-z][a-z0-9+\-.]*:/i,m=/^https?:\/\//i,n=/^https:\/\//i,o=/^([a-z][a-z0-9+\-.]*:\/\/[^\/]+)\/?/i,p=function(a,b){try{return new window.URL(a,b).toString()}catch(c){return a}},q=function(a,h){var i=b;if(!h)return a;if(!e(a))return a;f(a)&&(i=c),g(a)&&(i=d);var j=i(h);return[j,a].join("/"!==j.charAt(j.length-1)&&"/"!==a.charAt(0)?"/":"")};return a(),{parseBaseUrl:b,parseOrigin:c,parseScheme:d,isRelative:e,isPathAbsolute:f,isSchemeRelative:g,isHTTPURL:h,isHTTPS:i,resolve:j}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="URLUtils",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{48:48}],211:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(){function a(){k=(0,i.default)(g).getInstance().getLogger(h),l=/(?:\r\n|\r|\n)/gm,m=/-->/,n=/(^[\s]+|[\s]+$)/g,o=/\s\b/g}function b(a){var b=[],e=void 0,g=void 0;if(!a)return b;a=a.split(l),e=a.length,g=-1;for(var h=0;h<e;h++){var i=a[h];if(i.length>0&&i!==j&&i.match(m)){var o=d(i),p=o.cuePoints,q=o.styles,r=f(a,h+1),s=c(p[0].replace(n,"")),t=c(p[1].replace(n,""));!isNaN(s)&&!isNaN(t)&&s>=g&&t>s?""!==r?(g=s,b.push({start:s,end:t,data:r,styles:q})):k.error("Skipping cue due to empty/malformed cue text"):k.error("Skipping cue due to incorrect cue timing")}}return b}function c(a){var b=a.split(":"),c=b.length-1;return a=60*parseInt(b[c-1],10)+parseFloat(b[c]),2===c&&(a+=3600*parseInt(b[0],10)),a}function d(a){var b=a.split(m),c=b[1].split(o);return c.shift(),b[1]=c[0],c.shift(),{cuePoints:b,styles:e(c)}}function e(a){var b={};return a.forEach(function(a){if(a.split(/:/).length>1){var c=a.split(/:/)[1];c&&-1!=c.search(/%/)&&(c=parseInt(c.replace(/%/,""),10)),(a.match(/align/)||a.match(/A/))&&(b.align=c),(a.match(/line/)||a.match(/L/))&&(b.line=c),(a.match(/position/)||a.match(/P/))&&(b.position=c),(a.match(/size/)||a.match(/S/))&&(b.size=c)}}),b}function f(a,b){for(var c=b,d="",e="",f=void 0;""!==a[c]&&c<a.length;)c++;if((f=c-b)>1)for(var g=0;g<f;g++){if(e=a[b+g],e.match(m)){d="";break}d+=e,g!==f-1&&(d+="\n")}else e=a[b],e.match(m)||(d=e);return d}var g=this.context,h=void 0,k=void 0,l=void 0,m=void 0,n=void 0,o=void 0;return h={parse:b},a(),h}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f),h=a(46),i=d(h),j="WEBVTT";e.__dashjs_factory_name="VTTParser",c.default=g.default.getSingletonFactory(e),b.exports=c.default},{46:46,48:48}],212:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=0,d=void 0;return a&&a.some(function(a,d){return b=d,!c.contains(a.serviceLocation)})&&(d=a[b]),d}a=a||{};var c=a.blacklistController;return{select:b}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="BasicSelector",c.default=g.default.getClassFactory(e),b.exports=c.default},{48:48}],213:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){function b(a){var b=[],c=function(a){return!b.length||!a.dvb_priority||-1===b.indexOf(a.dvb_priority)},d=function(a){return!e.contains(a.serviceLocation)||(a.dvb_priority&&b.push(a.dvb_priority),!1)};return a.filter(d).filter(c)}function c(a){var b=function(a,b){var c=a.dvb_priority-b.dvb_priority;return isNaN(c)?0:c},c=function(a,b,c){return!b||c[0].dvb_priority&&a.dvb_priority&&c[0].dvb_priority===a.dvb_priority},d=0,e=[],f=0,g=void 0,h=void 0;if(h=a.sort(b).filter(c),h.length)return h.length>1&&(h.forEach(function(a){d+=a.dvb_weight,e.push(d)}),g=Math.floor(Math.random()*(d-1)),e.every(function(a,b){return f=b,!(g<a)})),h[f]}function d(a){return a&&c(b(a))}a=a||{};var e=a.blacklistController;return{select:d}}Object.defineProperty(c,"__esModule",{value:!0});var f=a(48),g=d(f);e.__dashjs_factory_name="DVBSelector",c.default=g.default.getClassFactory(e),b.exports=c.default},{48:48}],214:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN};c.default=e,b.exports=c.default},{}],215:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e){d(this,a),this.code=b||null,this.message=c||null,this.data=e||null};c.default=e,b.exports=c.default},{}],216:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.streamId=null,this.mediaInfo=null,this.segmentType=null,this.quality=NaN,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representationId=null,this.endFragment=null};c.default=e,b.exports=c.default},{}],217:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.action=a.ACTION_DOWNLOAD,this.startTime=NaN,this.mediaType=null,this.mediaInfo=null,this.type=null,this.duration=NaN,this.timescale=NaN,this.range=null,this.url=null,this.serviceLocation=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.quality=NaN,this.index=NaN,this.availabilityStartTime=null,this.availabilityEndTime=null,this.wallStartTime=null,this.bytesLoaded=NaN,this.bytesTotal=NaN,this.delayLoadingTime=NaN,this.responseType="arraybuffer",this.representationId=null};e.ACTION_DOWNLOAD="download",e.ACTION_COMPLETE="complete",c.default=e,b.exports=c.default},{}],218:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(217),i=d(h),j=function(a){function b(a){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.url=a||null,this.checkForExistenceOnly=!0}return f(b,a),b}(i.default);c.default=j,b.exports=c.default},{217:217}],219:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(b){if(d(this,a),this.offset=b._offset,this.type=b.type,this.size=b.size,this.boxes=[],b.boxes)for(var c=0;c<b.boxes.length;c++)this.boxes.push(new a(b.boxes[c]));switch(this.isComplete=!0,b.type){case"sidx":if(this.timescale=b.timescale,this.earliest_presentation_time=b.earliest_presentation_time,this.first_offset=b.first_offset,this.references=b.references,b.references){this.references=[];for(var c=0;c<b.references.length;c++){var e={reference_type:b.references[c].reference_type,referenced_size:b.references[c].referenced_size,subsegment_duration:b.references[c].subsegment_duration};this.references.push(e)}}break;case"emsg":this.id=b.id,this.value=b.value,this.timescale=b.timescale,this.scheme_id_uri=b.scheme_id_uri,this.presentation_time_delta=1===b.version?b.presentation_time:b.presentation_time_delta,this.event_duration=b.event_duration,this.message_data=b.message_data;break;case"mdhd":this.timescale=b.timescale;break;case"mfhd":this.sequence_number=b.sequence_number;break;case"subs":this.entry_count=b.entry_count,this.entries=b.entries;break;case"tfhd":this.base_data_offset=b.base_data_offset,this.sample_description_index=b.sample_description_index,this.default_sample_duration=b.default_sample_duration,this.default_sample_size=b.default_sample_size,this.default_sample_flags=b.default_sample_flags,this.flags=b.flags;break;case"tfdt":this.version=b.version,this.baseMediaDecodeTime=b.baseMediaDecodeTime,this.flags=b.flags;break;case"trun":if(this.sample_count=b.sample_count,this.first_sample_flags=b.first_sample_flags,this.data_offset=b.data_offset,this.flags=b.flags,this.samples=b.samples,b.samples){this.samples=[];for(var c=0,f=b.samples.length;c<f;c++){var g={sample_size:b.samples[c].sample_size,sample_duration:b.samples[c].sample_duration,sample_composition_time_offset:b.samples[c].sample_composition_time_offset};this.samples.push(g)}}}}return e(a,[{key:"getChildBox",value:function(a){for(var b=0;b<this.boxes.length;b++)if(this.boxes[b].type===a)return this.boxes[b]}},{key:"getChildBoxes",value:function(a){for(var b=[],c=0;c<this.boxes.length;c++)this.boxes[c].type===a&&b.push(this.boxes[c]);return b}}]),a}();c.default=f,b.exports=c.default},{}],220:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(b,c,e){d(this,a),this.lastCompletedOffset=b,this.found=c,this.size=e};c.default=e,b.exports=c.default},{}],221:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.DVRWindowSize=NaN,this.loadedTime=null,this.availableFrom=null,this.minBufferTime=NaN,this.duration=NaN,this.isDynamic=!1,this.maxFragmentDuration=null};c.default=e,b.exports=c.default},{}],222:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.index=null,this.type=null,this.streamInfo=null,this.representationCount=0,this.lang=null,this.viewpoint=null,this.accessibility=null,this.audioChannelConfiguration=null,this.roles=null,this.codec=null,this.mimeType=null,this.contentProtection=null,this.isText=!1,this.KID=null,this.bitrateList=null};c.default=e,b.exports=c.default},{}],223:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[]};c.default=e,b.exports=c.default},{}],224:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.quality=null,this.DVRWindow=null,this.fragmentDuration=null,this.mediaInfo=null,this.MSETimeOffset=null};c.default=e,b.exports=c.default},{}],225:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.id=null,this.index=null,this.start=NaN,this.duration=NaN,this.manifestInfo=null,this.isLast=!0};c.default=e,b.exports=c.default},{}],226:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0});var g=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;if(void 0===i)return;return i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return;a=j,b=f,c=g,d=!0,h=j=void 0}},h=a(101),i=d(h),j=a(217),k=d(j),l=function(a){function b(a,c){e(this,b),g(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),this.url=a||null,this.type=c||null,this.mediaType=i.default.STREAM,this.responseType=""}return f(b,a),b}(k.default);c.default=l,b.exports=c.default},{101:101,217:217}],227:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.captionData=null,this.label=null,this.lang=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1};c.default=e,b.exports=c.default},{}],228:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.url=null,this.width=null,this.height=null,this.x=null,this.y=null};c.default=e,b.exports=c.default},{}],229:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl="",this.id=""};c.default=e,b.exports=c.default},{}],230:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null};c.default=e,b.exports=c.default},{}],231:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.t=null,this.level=null};c.default=e,b.exports=c.default},{}],232:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var f=a(107),g=d(f),h=function a(){e(this,a),this.target=null,this.state=g.default.BUFFER_EMPTY};c.default=h,b.exports=c.default},{107:107}],233:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.time=null,this.range=null,this.manifestInfo=null};c.default=e,b.exports=c.default},{}],234:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.time=null,this.droppedFrames=null};c.default=e,b.exports=c.default},{}],235:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this._stream=null,this._tfinish=null,this._mediaduration=null,this._responseHeaders=null,this._serviceLocation=null},f=function a(){d(this,a),this.s=null,this.d=null,this.b=[]};e.GET="GET",e.HEAD="HEAD",e.MPD_TYPE="MPD",e.XLINK_EXPANSION_TYPE="XLinkExpansion",e.INIT_SEGMENT_TYPE="InitializationSegment",e.INDEX_SEGMENT_TYPE="IndexSegment",e.MEDIA_SEGMENT_TYPE="MediaSegment",e.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",e.OTHER_TYPE="other",c.HTTPRequest=e,c.HTTPRequestTrace=f},{}],236:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.representationInfo=[]},f=function a(){d(this,a),this.id=null,this.index=null,this.start=null,this.duration=null},g=function a(){d(this,a),this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null};c.ManifestUpdate=e,c.ManifestUpdateStreamInfo=f,c.ManifestUpdateRepresentationInfo=g},{}],237:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.start=null,this.mstart=null,this.starttype=null,this.trace=[]};e.INITIAL_PLAYOUT_START_REASON="initial_playout",e.SEEK_START_REASON="seek",e.RESUME_FROM_PAUSE_START_REASON="resume",e.METRICS_COLLECTION_START_REASON="metrics_collection_start";var f=function a(){d(this,a),this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null};f.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",f.REBUFFERING_REASON="rebuffering",f.USER_REQUEST_STOP_REASON="user_request",f.END_OF_PERIOD_STOP_REASON="end_of_period",f.END_OF_CONTENT_STOP_REASON="end_of_content",f.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",f.FAILURE_STOP_REASON="failure",c.PlayList=e,c.PlayListTrace=f},{}],238:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.t=null,this.mt=null,this.to=null,this.lto=null};c.default=e,b.exports=c.default},{}],239:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.loadingRequests=[],this.executedRequests=[]};c.default=e,b.exports=c.default},{}],240:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null};c.default=e,b.exports=c.default},{}],241:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var e=function a(){d(this,a),this.tcpid=null,this.dest=null,this.topen=null,this.tclose=null,this.tconnect=null};c.default=e,b.exports=c.default},{}]},{},[4]); +//# sourceMappingURL=dash.all.min.js.map \ No newline at end of file diff --git a/embed/players/update.sh b/embed/players/update.sh new file mode 100755 index 00000000..8bfd6ed5 --- /dev/null +++ b/embed/players/update.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "Dashjs" +wget https://cdn.dashjs.org/latest/dash.all.min.js -O dash.all.min.js + +echo "Videojs" +echo "You'll want to check for the latest version at https://videojs.com/getting-started/#download-cdn" +wget https://vjs.zencdn.net/7.3.0/video.min.js -O video.min.js diff --git a/embed/players/video.js b/embed/players/video.js deleted file mode 100644 index 09cf6021..00000000 --- a/embed/players/video.js +++ /dev/null @@ -1,24722 +0,0 @@ -/** - * @license - * Video.js 6.2.0 <http://videojs.com/> - * Copyright Brightcove, Inc. <https://www.brightcove.com/> - * Available under Apache License Version 2.0 - * <https://github.com/videojs/video.js/blob/master/LICENSE> - * - * Includes vtt.js <https://github.com/mozilla/vtt.js> - * Available under Apache License Version 2.0 - * <https://github.com/mozilla/vtt.js/blob/master/LICENSE> - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.videojs = factory()); -}(this, (function () { 'use strict'; - -var version = "6.2.0"; - -var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - - - - -function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; -} - -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof commonjsGlobal !== "undefined") { - win = commonjsGlobal; -} else if (typeof self !== "undefined"){ - win = self; -} else { - win = {}; -} - -var window_1 = win; - -var empty = {}; - - -var empty$1 = (Object.freeze || Object)({ - 'default': empty -}); - -var minDoc = ( empty$1 && empty ) || empty$1; - -var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : - typeof window !== 'undefined' ? window : {}; - - -var doccy; - -if (typeof document !== 'undefined') { - doccy = document; -} else { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; - - if (!doccy) { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; - } -} - -var document_1 = doccy; - -/** - * @file browser.js - * @module browser - */ -var USER_AGENT = window_1.navigator && window_1.navigator.userAgent || ''; -var webkitVersionMap = /AppleWebKit\/([\d.]+)/i.exec(USER_AGENT); -var appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null; - -/* - * Device is an iPhone - * - * @type {Boolean} - * @constant - * @private - */ -var IS_IPAD = /iPad/i.test(USER_AGENT); - -// The Facebook app's UIWebView identifies as both an iPhone and iPad, so -// to identify iPhones, we need to exclude iPads. -// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/ -var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD; -var IS_IPOD = /iPod/i.test(USER_AGENT); -var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD; - -var IOS_VERSION = function () { - var match = USER_AGENT.match(/OS (\d+)_/i); - - if (match && match[1]) { - return match[1]; - } - return null; -}(); - -var IS_ANDROID = /Android/i.test(USER_AGENT); -var ANDROID_VERSION = function () { - // This matches Android Major.Minor.Patch versions - // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned - var match = USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i); - - if (!match) { - return null; - } - - var major = match[1] && parseFloat(match[1]); - var minor = match[2] && parseFloat(match[2]); - - if (major && minor) { - return parseFloat(match[1] + '.' + match[2]); - } else if (major) { - return major; - } - return null; -}(); - -// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser -var IS_OLD_ANDROID = IS_ANDROID && /webkit/i.test(USER_AGENT) && ANDROID_VERSION < 2.3; -var IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537; - -var IS_FIREFOX = /Firefox/i.test(USER_AGENT); -var IS_EDGE = /Edge/i.test(USER_AGENT); -var IS_CHROME = !IS_EDGE && /Chrome/i.test(USER_AGENT); -var CHROME_VERSION = function () { - var match = USER_AGENT.match(/Chrome\/(\d+)/); - - if (match && match[1]) { - return parseFloat(match[1]); - } - return null; -}(); -var IS_IE8 = /MSIE\s8\.0/.test(USER_AGENT); -var IE_VERSION = function () { - var result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT); - var version = result && parseFloat(result[1]); - - if (!version && /Trident\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) { - // IE 11 has a different user agent string than other IE versions - version = 11.0; - } - - return version; -}(); - -var IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE; -var IS_ANY_SAFARI = IS_SAFARI || IS_IOS; - -var TOUCH_ENABLED = isReal() && ('ontouchstart' in window_1 || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch); - -var BACKGROUND_SIZE_SUPPORTED = isReal() && 'backgroundSize' in window_1.document.createElement('video').style; - -var browser = (Object.freeze || Object)({ - IS_IPAD: IS_IPAD, - IS_IPHONE: IS_IPHONE, - IS_IPOD: IS_IPOD, - IS_IOS: IS_IOS, - IOS_VERSION: IOS_VERSION, - IS_ANDROID: IS_ANDROID, - ANDROID_VERSION: ANDROID_VERSION, - IS_OLD_ANDROID: IS_OLD_ANDROID, - IS_NATIVE_ANDROID: IS_NATIVE_ANDROID, - IS_FIREFOX: IS_FIREFOX, - IS_EDGE: IS_EDGE, - IS_CHROME: IS_CHROME, - CHROME_VERSION: CHROME_VERSION, - IS_IE8: IS_IE8, - IE_VERSION: IE_VERSION, - IS_SAFARI: IS_SAFARI, - IS_ANY_SAFARI: IS_ANY_SAFARI, - TOUCH_ENABLED: TOUCH_ENABLED, - BACKGROUND_SIZE_SUPPORTED: BACKGROUND_SIZE_SUPPORTED -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { - return typeof obj; -} : function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; -}; - - - - - - - - - - - -var classCallCheck = function (instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -}; - - - - - - - - - - - -var inherits = function (subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; -}; - - - - - - - - - - - -var possibleConstructorReturn = function (self, call) { - if (!self) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return call && (typeof call === "object" || typeof call === "function") ? call : self; -}; - - - - - - - - - - - -var taggedTemplateLiteralLoose = function (strings, raw) { - strings.raw = raw; - return strings; -}; - -/** - * @file obj.js - * @module obj - */ - -/** - * @callback obj:EachCallback - * - * @param {Mixed} value - * The current key for the object that is being iterated over. - * - * @param {string} key - * The current key-value for object that is being iterated over - */ - -/** - * @callback obj:ReduceCallback - * - * @param {Mixed} accum - * The value that is accumulating over the reduce loop. - * - * @param {Mixed} value - * The current key for the object that is being iterated over. - * - * @param {string} key - * The current key-value for object that is being iterated over - * - * @return {Mixed} - * The new accumulated value. - */ -var toString = Object.prototype.toString; - -/** - * Get the keys of an Object - * - * @param {Object} - * The Object to get the keys from - * - * @return {string[]} - * An array of the keys from the object. Returns an empty array if the - * object passed in was invalid or had no keys. - * - * @private - */ -var keys = function keys(object) { - return isObject(object) ? Object.keys(object) : []; -}; - -/** - * Array-like iteration for objects. - * - * @param {Object} object - * The object to iterate over - * - * @param {obj:EachCallback} fn - * The callback function which is called for each key in the object. - */ -function each(object, fn) { - keys(object).forEach(function (key) { - return fn(object[key], key); - }); -} - -/** - * Array-like reduce for objects. - * - * @param {Object} object - * The Object that you want to reduce. - * - * @param {Function} fn - * A callback function which is called for each key in the object. It - * receives the accumulated value and the per-iteration value and key - * as arguments. - * - * @param {Mixed} [initial = 0] - * Starting value - * - * @return {Mixed} - * The final accumulated value. - */ -function reduce(object, fn) { - var initial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - - return keys(object).reduce(function (accum, key) { - return fn(accum, object[key], key); - }, initial); -} - -/** - * Object.assign-style object shallow merge/extend. - * - * @param {Object} target - * @param {Object} ...sources - * @return {Object} - */ -function assign(target) { - for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - sources[_key - 1] = arguments[_key]; - } - - if (Object.assign) { - return Object.assign.apply(Object, [target].concat(sources)); - } - - sources.forEach(function (source) { - if (!source) { - return; - } - - each(source, function (value, key) { - target[key] = value; - }); - }); - - return target; -} - -/** - * Returns whether a value is an object of any kind - including DOM nodes, - * arrays, regular expressions, etc. Not functions, though. - * - * This avoids the gotcha where using `typeof` on a `null` value - * results in `'object'`. - * - * @param {Object} value - * @return {Boolean} - */ -function isObject(value) { - return !!value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object'; -} - -/** - * Returns whether an object appears to be a "plain" object - that is, a - * direct instance of `Object`. - * - * @param {Object} value - * @return {Boolean} - */ -function isPlain(value) { - return isObject(value) && toString.call(value) === '[object Object]' && value.constructor === Object; -} - -/** - * @file log.js - * @module log - */ -var log = void 0; - -// This is the private tracking variable for logging level. -var level = 'all'; - -// This is the private tracking variable for the logging history. -var history = []; - -/** - * Log messages to the console and history based on the type of message - * - * @private - * @param {string} type - * The name of the console method to use. - * - * @param {Array} args - * The arguments to be passed to the matching console method. - * - * @param {boolean} [stringify] - * By default, only old IEs should get console argument stringification, - * but this is exposed as a parameter to facilitate testing. - */ -var logByType = function logByType(type, args) { - var stringify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !!IE_VERSION && IE_VERSION < 11; - - var lvl = log.levels[level]; - var lvlRegExp = new RegExp('^(' + lvl + ')$'); - - if (type !== 'log') { - - // Add the type to the front of the message when it's not "log". - args.unshift(type.toUpperCase() + ':'); - } - - // Add a clone of the args at this point to history. - if (history) { - history.push([].concat(args)); - } - - // Add console prefix after adding to history. - args.unshift('VIDEOJS:'); - - // If there's no console then don't try to output messages, but they will - // still be stored in history. - // - // Was setting these once outside of this function, but containing them - // in the function makes it easier to test cases where console doesn't exist - // when the module is executed. - var fn = window_1.console && window_1.console[type]; - - // Bail out if there's no console or if this type is not allowed by the - // current logging level. - if (!fn || !lvl || !lvlRegExp.test(type)) { - return; - } - - // IEs previous to 11 log objects uselessly as "[object Object]"; so, JSONify - // objects and arrays for those less-capable browsers. - if (stringify) { - args = args.map(function (a) { - if (isObject(a) || Array.isArray(a)) { - try { - return JSON.stringify(a); - } catch (x) { - return String(a); - } - } - - // Cast to string before joining, so we get null and undefined explicitly - // included in output (as we would in a modern console). - return String(a); - }).join(' '); - } - - // Old IE versions do not allow .apply() for console methods (they are - // reported as objects rather than functions). - if (!fn.apply) { - fn(args); - } else { - fn[Array.isArray(args) ? 'apply' : 'call'](window_1.console, args); - } -}; - -/** - * Logs plain debug messages. Similar to `console.log`. - * - * @class - * @param {Mixed[]} args - * One or more messages or objects that should be logged. - */ -log = function log() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - logByType('log', args); -}; - -/** - * Enumeration of available logging levels, where the keys are the level names - * and the values are `|`-separated strings containing logging methods allowed - * in that logging level. These strings are used to create a regular expression - * matching the function name being called. - * - * Levels provided by video.js are: - * - * - `off`: Matches no calls. Any value that can be cast to `false` will have - * this effect. The most restrictive. - * - `all` (default): Matches only Video.js-provided functions (`log`, - * `log.warn`, and `log.error`). - * - `warn`: Matches `log.warn` and `log.error` calls. - * - `error`: Matches only `log.error` calls. - * - * @type {Object} - */ -log.levels = { - all: 'log|warn|error', - error: 'error', - off: '', - warn: 'warn|error', - DEFAULT: level -}; - -/** - * Get or set the current logging level. If a string matching a key from - * {@link log.levels} is provided, acts as a setter. Regardless of argument, - * returns the current logging level. - * - * @param {string} [lvl] - * Pass to set a new logging level. - * - * @return {string} - * The current logging level. - */ -log.level = function (lvl) { - if (typeof lvl === 'string') { - if (!log.levels.hasOwnProperty(lvl)) { - throw new Error('"' + lvl + '" in not a valid log level'); - } - level = lvl; - } - return level; -}; - -/** - * Returns an array containing everything that has been logged to the history. - * - * This array is a shallow clone of the internal history record. However, its - * contents are _not_ cloned; so, mutating objects inside this array will - * mutate them in history. - * - * @return {Array} - */ -log.history = function () { - return history ? [].concat(history) : []; -}; - -/** - * Clears the internal history tracking, but does not prevent further history - * tracking. - */ -log.history.clear = function () { - if (history) { - history.length = 0; - } -}; - -/** - * Disable history tracking if it is currently enabled. - */ -log.history.disable = function () { - if (history !== null) { - history.length = 0; - history = null; - } -}; - -/** - * Enable history tracking if it is currently disabled. - */ -log.history.enable = function () { - if (history === null) { - history = []; - } -}; - -/** - * Logs error messages. Similar to `console.error`. - * - * @param {Mixed[]} args - * One or more messages or objects that should be logged as an error - */ -log.error = function () { - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - return logByType('error', args); -}; - -/** - * Logs warning messages. Similar to `console.warn`. - * - * @param {Mixed[]} args - * One or more messages or objects that should be logged as a warning. - */ -log.warn = function () { - for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - return logByType('warn', args); -}; - -var log$1 = log; - -function clean (s) { - return s.replace(/\n\r?\s*/g, '') -} - - -var tsml = function tsml (sa) { - var s = '' - , i = 0; - - for (; i < arguments.length; i++) - s += clean(sa[i]) + (arguments[i + 1] || ''); - - return s -}; - -/** - * @file computed-style.js - * @module computed-style - */ -/** - * A safe getComputedStyle with an IE8 fallback. - * - * This is needed because in Firefox, if the player is loaded in an iframe with - * `display:none`, then `getComputedStyle` returns `null`, so, we do a null-check to - * make sure that the player doesn't break in these cases. - * - * @param {Element} el - * The element you want the computed style of - * - * @param {string} prop - * The property name you want - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - * - * @static - * @const - */ -function computedStyle(el, prop) { - if (!el || !prop) { - return ''; - } - - if (typeof window_1.getComputedStyle === 'function') { - var cs = window_1.getComputedStyle(el); - - return cs ? cs[prop] : ''; - } - - return el.currentStyle[prop] || ''; -} - -var _templateObject = taggedTemplateLiteralLoose(['Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.'], ['Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.']); - -/** - * @file dom.js - * @module dom - */ -/** - * Detect if a value is a string with any non-whitespace characters. - * - * @param {string} str - * The string to check - * - * @return {boolean} - * - True if the string is non-blank - * - False otherwise - * - */ -function isNonBlankString(str) { - return typeof str === 'string' && /\S/.test(str); -} - -/** - * Throws an error if the passed string has whitespace. This is used by - * class methods to be relatively consistent with the classList API. - * - * @param {string} str - * The string to check for whitespace. - * - * @throws {Error} - * Throws an error if there is whitespace in the string. - * - */ -function throwIfWhitespace(str) { - if (/\s/.test(str)) { - throw new Error('class has illegal whitespace characters'); - } -} - -/** - * Produce a regular expression for matching a className within an elements className. - * - * @param {string} className - * The className to generate the RegExp for. - * - * @return {RegExp} - * The RegExp that will check for a specific `className` in an elements - * className. - */ -function classRegExp(className) { - return new RegExp('(^|\\s)' + className + '($|\\s)'); -} - -/** - * Whether the current DOM interface appears to be real. - * - * @return {Boolean} - */ -function isReal() { - return ( - - // Both document and window will never be undefined thanks to `global`. - document_1 === window_1.document && - - // In IE < 9, DOM methods return "object" as their type, so all we can - // confidently check is that it exists. - typeof document_1.createElement !== 'undefined' - ); -} - -/** - * Determines, via duck typing, whether or not a value is a DOM element. - * - * @param {Mixed} value - * The thing to check - * - * @return {boolean} - * - True if it is a DOM element - * - False otherwise - */ -function isEl(value) { - return isObject(value) && value.nodeType === 1; -} - -/** - * Creates functions to query the DOM using a given method. - * - * @param {string} method - * The method to create the query with. - * - * @return {Function} - * The query method - */ -function createQuerier(method) { - return function (selector, context) { - if (!isNonBlankString(selector)) { - return document_1[method](null); - } - if (isNonBlankString(context)) { - context = document_1.querySelector(context); - } - - var ctx = isEl(context) ? context : document_1; - - return ctx[method] && ctx[method](selector); - }; -} - -/** - * Creates an element and applies properties. - * - * @param {string} [tagName='div'] - * Name of tag to be created. - * - * @param {Object} [properties={}] - * Element properties to be applied. - * - * @param {Object} [attributes={}] - * Element attributes to be applied. - * - * @param {String|Element|TextNode|Array|Function} [content] - * Contents for the element (see: {@link dom:normalizeContent}) - * - * @return {Element} - * The element that was created. - */ -function createEl() { - var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div'; - var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var content = arguments[3]; - - var el = document_1.createElement(tagName); - - Object.getOwnPropertyNames(properties).forEach(function (propName) { - var val = properties[propName]; - - // See #2176 - // We originally were accepting both properties and attributes in the - // same object, but that doesn't work so well. - if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') { - log$1.warn(tsml(_templateObject, propName, val)); - el.setAttribute(propName, val); - - // Handle textContent since it's not supported everywhere and we have a - // method for it. - } else if (propName === 'textContent') { - textContent(el, val); - } else { - el[propName] = val; - } - }); - - Object.getOwnPropertyNames(attributes).forEach(function (attrName) { - el.setAttribute(attrName, attributes[attrName]); - }); - - if (content) { - appendContent(el, content); - } - - return el; -} - -/** - * Injects text into an element, replacing any existing contents entirely. - * - * @param {Element} el - * The element to add text content into - * - * @param {string} text - * The text content to add. - * - * @return {Element} - * The element with added text content. - */ -function textContent(el, text) { - if (typeof el.textContent === 'undefined') { - el.innerText = text; - } else { - el.textContent = text; - } - return el; -} - -/** - * Insert an element as the first child node of another - * - * @param {Element} child - * Element to insert - * - * @param {Element} parent - * Element to insert child into - */ -function prependTo(child, parent) { - if (parent.firstChild) { - parent.insertBefore(child, parent.firstChild); - } else { - parent.appendChild(child); - } -} - -/** - * Check if an element has a CSS class - * - * @param {Element} element - * Element to check - * - * @param {string} classToCheck - * Class name to check for - * - * @return {boolean} - * - True if the element had the class - * - False otherwise. - * - * @throws {Error} - * Throws an error if `classToCheck` has white space. - */ -function hasClass(element, classToCheck) { - throwIfWhitespace(classToCheck); - if (element.classList) { - return element.classList.contains(classToCheck); - } - return classRegExp(classToCheck).test(element.className); -} - -/** - * Add a CSS class name to an element - * - * @param {Element} element - * Element to add class name to. - * - * @param {string} classToAdd - * Class name to add. - * - * @return {Element} - * The dom element with the added class name. - */ -function addClass(element, classToAdd) { - if (element.classList) { - element.classList.add(classToAdd); - - // Don't need to `throwIfWhitespace` here because `hasElClass` will do it - // in the case of classList not being supported. - } else if (!hasClass(element, classToAdd)) { - element.className = (element.className + ' ' + classToAdd).trim(); - } - - return element; -} - -/** - * Remove a CSS class name from an element - * - * @param {Element} element - * Element to remove a class name from. - * - * @param {string} classToRemove - * Class name to remove - * - * @return {Element} - * The dom element with class name removed. - */ -function removeClass(element, classToRemove) { - if (element.classList) { - element.classList.remove(classToRemove); - } else { - throwIfWhitespace(classToRemove); - element.className = element.className.split(/\s+/).filter(function (c) { - return c !== classToRemove; - }).join(' '); - } - - return element; -} - -/** - * The callback definition for toggleElClass. - * - * @callback Dom~PredicateCallback - * @param {Element} element - * The DOM element of the Component. - * - * @param {string} classToToggle - * The `className` that wants to be toggled - * - * @return {boolean|undefined} - * - If true the `classToToggle` will get added to `element`. - * - If false the `classToToggle` will get removed from `element`. - * - If undefined this callback will be ignored - */ - -/** - * Adds or removes a CSS class name on an element depending on an optional - * condition or the presence/absence of the class name. - * - * @param {Element} element - * The element to toggle a class name on. - * - * @param {string} classToToggle - * The class that should be toggled - * - * @param {boolean|PredicateCallback} [predicate] - * See the return value for {@link Dom~PredicateCallback} - * - * @return {Element} - * The element with a class that has been toggled. - */ -function toggleClass(element, classToToggle, predicate) { - - // This CANNOT use `classList` internally because IE does not support the - // second parameter to the `classList.toggle()` method! Which is fine because - // `classList` will be used by the add/remove functions. - var has = hasClass(element, classToToggle); - - if (typeof predicate === 'function') { - predicate = predicate(element, classToToggle); - } - - if (typeof predicate !== 'boolean') { - predicate = !has; - } - - // If the necessary class operation matches the current state of the - // element, no action is required. - if (predicate === has) { - return; - } - - if (predicate) { - addClass(element, classToToggle); - } else { - removeClass(element, classToToggle); - } - - return element; -} - -/** - * Apply attributes to an HTML element. - * - * @param {Element} el - * Element to add attributes to. - * - * @param {Object} [attributes] - * Attributes to be applied. - */ -function setAttributes(el, attributes) { - Object.getOwnPropertyNames(attributes).forEach(function (attrName) { - var attrValue = attributes[attrName]; - - if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) { - el.removeAttribute(attrName); - } else { - el.setAttribute(attrName, attrValue === true ? '' : attrValue); - } - }); -} - -/** - * Get an element's attribute values, as defined on the HTML tag - * Attributes are not the same as properties. They're defined on the tag - * or with setAttribute (which shouldn't be used with HTML) - * This will return true or false for boolean attributes. - * - * @param {Element} tag - * Element from which to get tag attributes. - * - * @return {Object} - * All attributes of the element. - */ -function getAttributes(tag) { - var obj = {}; - - // known boolean attributes - // we can check for matching boolean properties, but older browsers - // won't know about HTML5 boolean attributes that we still read from - var knownBooleans = ',' + 'autoplay,controls,loop,muted,default' + ','; - - if (tag && tag.attributes && tag.attributes.length > 0) { - var attrs = tag.attributes; - - for (var i = attrs.length - 1; i >= 0; i--) { - var attrName = attrs[i].name; - var attrVal = attrs[i].value; - - // check for known booleans - // the matching element property will return a value for typeof - if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(',' + attrName + ',') !== -1) { - // the value of an included boolean attribute is typically an empty - // string ('') which would equal false if we just check for a false value. - // we also don't want support bad code like autoplay='false' - attrVal = attrVal !== null ? true : false; - } - - obj[attrName] = attrVal; - } - } - - return obj; -} - -/** - * Get the value of an element's attribute - * - * @param {Element} el - * A DOM element - * - * @param {string} attribute - * Attribute to get the value of - * - * @return {string} - * value of the attribute - */ -function getAttribute(el, attribute) { - return el.getAttribute(attribute); -} - -/** - * Set the value of an element's attribute - * - * @param {Element} el - * A DOM element - * - * @param {string} attribute - * Attribute to set - * - * @param {string} value - * Value to set the attribute to - */ -function setAttribute(el, attribute, value) { - el.setAttribute(attribute, value); -} - -/** - * Remove an element's attribute - * - * @param {Element} el - * A DOM element - * - * @param {string} attribute - * Attribute to remove - */ -function removeAttribute(el, attribute) { - el.removeAttribute(attribute); -} - -/** - * Attempt to block the ability to select text while dragging controls - */ -function blockTextSelection() { - document_1.body.focus(); - document_1.onselectstart = function () { - return false; - }; -} - -/** - * Turn off text selection blocking - */ -function unblockTextSelection() { - document_1.onselectstart = function () { - return true; - }; -} - -/** - * Identical to the native `getBoundingClientRect` function, but ensures that - * the method is supported at all (it is in all browsers we claim to support) - * and that the element is in the DOM before continuing. - * - * This wrapper function also shims properties which are not provided by some - * older browsers (namely, IE8). - * - * Additionally, some browsers do not support adding properties to a - * `ClientRect`/`DOMRect` object; so, we shallow-copy it with the standard - * properties (except `x` and `y` which are not widely supported). This helps - * avoid implementations where keys are non-enumerable. - * - * @param {Element} el - * Element whose `ClientRect` we want to calculate. - * - * @return {Object|undefined} - * Always returns a plain - */ -function getBoundingClientRect(el) { - if (el && el.getBoundingClientRect && el.parentNode) { - var rect = el.getBoundingClientRect(); - var result = {}; - - ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(function (k) { - if (rect[k] !== undefined) { - result[k] = rect[k]; - } - }); - - if (!result.height) { - result.height = parseFloat(computedStyle(el, 'height')); - } - - if (!result.width) { - result.width = parseFloat(computedStyle(el, 'width')); - } - - return result; - } -} - -/** - * The postion of a DOM element on the page. - * - * @typedef {Object} module:dom~Position - * - * @property {number} left - * Pixels to the left - * - * @property {number} top - * Pixels on top - */ - -/** - * Offset Left. - * getBoundingClientRect technique from - * John Resig - * - * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/ - * - * @param {Element} el - * Element from which to get offset - * - * @return {module:dom~Position} - * The position of the element that was passed in. - */ -function findPosition(el) { - var box = void 0; - - if (el.getBoundingClientRect && el.parentNode) { - box = el.getBoundingClientRect(); - } - - if (!box) { - return { - left: 0, - top: 0 - }; - } - - var docEl = document_1.documentElement; - var body = document_1.body; - - var clientLeft = docEl.clientLeft || body.clientLeft || 0; - var scrollLeft = window_1.pageXOffset || body.scrollLeft; - var left = box.left + scrollLeft - clientLeft; - - var clientTop = docEl.clientTop || body.clientTop || 0; - var scrollTop = window_1.pageYOffset || body.scrollTop; - var top = box.top + scrollTop - clientTop; - - // Android sometimes returns slightly off decimal values, so need to round - return { - left: Math.round(left), - top: Math.round(top) - }; -} - -/** - * x and y coordinates for a dom element or mouse pointer - * - * @typedef {Object} Dom~Coordinates - * - * @property {number} x - * x coordinate in pixels - * - * @property {number} y - * y coordinate in pixels - */ - -/** - * Get pointer position in element - * Returns an object with x and y coordinates. - * The base on the coordinates are the bottom left of the element. - * - * @param {Element} el - * Element on which to get the pointer position on - * - * @param {EventTarget~Event} event - * Event object - * - * @return {Dom~Coordinates} - * A Coordinates object corresponding to the mouse position. - * - */ -function getPointerPosition(el, event) { - var position = {}; - var box = findPosition(el); - var boxW = el.offsetWidth; - var boxH = el.offsetHeight; - - var boxY = box.top; - var boxX = box.left; - var pageY = event.pageY; - var pageX = event.pageX; - - if (event.changedTouches) { - pageX = event.changedTouches[0].pageX; - pageY = event.changedTouches[0].pageY; - } - - position.y = Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH)); - position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW)); - - return position; -} - -/** - * Determines, via duck typing, whether or not a value is a text node. - * - * @param {Mixed} value - * Check if this value is a text node. - * - * @return {boolean} - * - True if it is a text node - * - False otherwise - */ -function isTextNode(value) { - return isObject(value) && value.nodeType === 3; -} - -/** - * Empties the contents of an element. - * - * @param {Element} el - * The element to empty children from - * - * @return {Element} - * The element with no children - */ -function emptyEl(el) { - while (el.firstChild) { - el.removeChild(el.firstChild); - } - return el; -} - -/** - * Normalizes content for eventual insertion into the DOM. - * - * This allows a wide range of content definition methods, but protects - * from falling into the trap of simply writing to `innerHTML`, which is - * an XSS concern. - * - * The content for an element can be passed in multiple types and - * combinations, whose behavior is as follows: - * - * @param {String|Element|TextNode|Array|Function} content - * - String: Normalized into a text node. - * - Element/TextNode: Passed through. - * - Array: A one-dimensional array of strings, elements, nodes, or functions - * (which return single strings, elements, or nodes). - * - Function: If the sole argument, is expected to produce a string, element, - * node, or array as defined above. - * - * @return {Array} - * All of the content that was passed in normalized. - */ -function normalizeContent(content) { - - // First, invoke content if it is a function. If it produces an array, - // that needs to happen before normalization. - if (typeof content === 'function') { - content = content(); - } - - // Next up, normalize to an array, so one or many items can be normalized, - // filtered, and returned. - return (Array.isArray(content) ? content : [content]).map(function (value) { - - // First, invoke value if it is a function to produce a new value, - // which will be subsequently normalized to a Node of some kind. - if (typeof value === 'function') { - value = value(); - } - - if (isEl(value) || isTextNode(value)) { - return value; - } - - if (typeof value === 'string' && /\S/.test(value)) { - return document_1.createTextNode(value); - } - }).filter(function (value) { - return value; - }); -} - -/** - * Normalizes and appends content to an element. - * - * @param {Element} el - * Element to append normalized content to. - * - * - * @param {String|Element|TextNode|Array|Function} content - * See the `content` argument of {@link dom:normalizeContent} - * - * @return {Element} - * The element with appended normalized content. - */ -function appendContent(el, content) { - normalizeContent(content).forEach(function (node) { - return el.appendChild(node); - }); - return el; -} - -/** - * Normalizes and inserts content into an element; this is identical to - * `appendContent()`, except it empties the element first. - * - * @param {Element} el - * Element to insert normalized content into. - * - * @param {String|Element|TextNode|Array|Function} content - * See the `content` argument of {@link dom:normalizeContent} - * - * @return {Element} - * The element with inserted normalized content. - * - */ -function insertContent(el, content) { - return appendContent(emptyEl(el), content); -} - -/** - * Finds a single DOM element matching `selector` within the optional - * `context` of another DOM element (defaulting to `document`). - * - * @param {string} selector - * A valid CSS selector, which will be passed to `querySelector`. - * - * @param {Element|String} [context=document] - * A DOM element within which to query. Can also be a selector - * string in which case the first matching element will be used - * as context. If missing (or no element matches selector), falls - * back to `document`. - * - * @return {Element|null} - * The element that was found or null. - */ -var $ = createQuerier('querySelector'); - -/** - * Finds a all DOM elements matching `selector` within the optional - * `context` of another DOM element (defaulting to `document`). - * - * @param {string} selector - * A valid CSS selector, which will be passed to `querySelectorAll`. - * - * @param {Element|String} [context=document] - * A DOM element within which to query. Can also be a selector - * string in which case the first matching element will be used - * as context. If missing (or no element matches selector), falls - * back to `document`. - * - * @return {NodeList} - * A element list of elements that were found. Will be empty if none were found. - * - */ -var $$ = createQuerier('querySelectorAll'); - - - -var Dom = (Object.freeze || Object)({ - isReal: isReal, - isEl: isEl, - createEl: createEl, - textContent: textContent, - prependTo: prependTo, - hasClass: hasClass, - addClass: addClass, - removeClass: removeClass, - toggleClass: toggleClass, - setAttributes: setAttributes, - getAttributes: getAttributes, - getAttribute: getAttribute, - setAttribute: setAttribute, - removeAttribute: removeAttribute, - blockTextSelection: blockTextSelection, - unblockTextSelection: unblockTextSelection, - getBoundingClientRect: getBoundingClientRect, - findPosition: findPosition, - getPointerPosition: getPointerPosition, - isTextNode: isTextNode, - emptyEl: emptyEl, - normalizeContent: normalizeContent, - appendContent: appendContent, - insertContent: insertContent, - $: $, - $$: $$ -}); - -/** - * @file guid.js - * @module guid - */ - -/** - * Unique ID for an element or function - * @type {Number} - */ -var _guid = 1; - -/** - * Get a unique auto-incrementing ID by number that has not been returned before. - * - * @return {number} - * A new unique ID. - */ -function newGUID() { - return _guid++; -} - -/** - * @file dom-data.js - * @module dom-data - */ -/** - * Element Data Store. - * - * Allows for binding data to an element without putting it directly on the - * element. Ex. Event listeners are stored here. - * (also from jsninja.com, slightly modified and updated for closure compiler) - * - * @type {Object} - * @private - */ -var elData = {}; - -/* - * Unique attribute name to store an element's guid in - * - * @type {String} - * @constant - * @private - */ -var elIdAttr = 'vdata' + new Date().getTime(); - -/** - * Returns the cache object where data for an element is stored - * - * @param {Element} el - * Element to store data for. - * - * @return {Object} - * The cache object for that el that was passed in. - */ -function getData(el) { - var id = el[elIdAttr]; - - if (!id) { - id = el[elIdAttr] = newGUID(); - } - - if (!elData[id]) { - elData[id] = {}; - } - - return elData[id]; -} - -/** - * Returns whether or not an element has cached data - * - * @param {Element} el - * Check if this element has cached data. - * - * @return {boolean} - * - True if the DOM element has cached data. - * - False otherwise. - */ -function hasData(el) { - var id = el[elIdAttr]; - - if (!id) { - return false; - } - - return !!Object.getOwnPropertyNames(elData[id]).length; -} - -/** - * Delete data for the element from the cache and the guid attr from getElementById - * - * @param {Element} el - * Remove cached data for this element. - */ -function removeData(el) { - var id = el[elIdAttr]; - - if (!id) { - return; - } - - // Remove all stored data - delete elData[id]; - - // Remove the elIdAttr property from the DOM node - try { - delete el[elIdAttr]; - } catch (e) { - if (el.removeAttribute) { - el.removeAttribute(elIdAttr); - } else { - // IE doesn't appear to support removeAttribute on the document element - el[elIdAttr] = null; - } - } -} - -/** - * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/) - * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible) - * This should work very similarly to jQuery's events, however it's based off the book version which isn't as - * robust as jquery's, so there's probably some differences. - * - * @module events - */ - -/** - * Clean up the listener cache and dispatchers - * - * @param {Element|Object} elem - * Element to clean up - * - * @param {string} type - * Type of event to clean up - */ -function _cleanUpEvents(elem, type) { - var data = getData(elem); - - // Remove the events of a particular type if there are none left - if (data.handlers[type].length === 0) { - delete data.handlers[type]; - // data.handlers[type] = null; - // Setting to null was causing an error with data.handlers - - // Remove the meta-handler from the element - if (elem.removeEventListener) { - elem.removeEventListener(type, data.dispatcher, false); - } else if (elem.detachEvent) { - elem.detachEvent('on' + type, data.dispatcher); - } - } - - // Remove the events object if there are no types left - if (Object.getOwnPropertyNames(data.handlers).length <= 0) { - delete data.handlers; - delete data.dispatcher; - delete data.disabled; - } - - // Finally remove the element data if there is no data left - if (Object.getOwnPropertyNames(data).length === 0) { - removeData(elem); - } -} - -/** - * Loops through an array of event types and calls the requested method for each type. - * - * @param {Function} fn - * The event method we want to use. - * - * @param {Element|Object} elem - * Element or object to bind listeners to - * - * @param {string} type - * Type of event to bind to. - * - * @param {EventTarget~EventListener} callback - * Event listener. - */ -function _handleMultipleEvents(fn, elem, types, callback) { - types.forEach(function (type) { - // Call the event method for each one of the types - fn(elem, type, callback); - }); -} - -/** - * Fix a native event to have standard property values - * - * @param {Object} event - * Event object to fix. - * - * @return {Object} - * Fixed event object. - */ -function fixEvent(event) { - - function returnTrue() { - return true; - } - - function returnFalse() { - return false; - } - - // Test if fixing up is needed - // Used to check if !event.stopPropagation instead of isPropagationStopped - // But native events return true for stopPropagation, but don't have - // other expected methods like isPropagationStopped. Seems to be a problem - // with the Javascript Ninja code. So we're just overriding all events now. - if (!event || !event.isPropagationStopped) { - var old = event || window_1.event; - - event = {}; - // Clone the old object so that we can modify the values event = {}; - // IE8 Doesn't like when you mess with native event properties - // Firefox returns false for event.hasOwnProperty('type') and other props - // which makes copying more difficult. - // TODO: Probably best to create a whitelist of event props - for (var key in old) { - // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y - // Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation - // and webkitMovementX/Y - if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY') { - // Chrome 32+ warns if you try to copy deprecated returnValue, but - // we still want to if preventDefault isn't supported (IE8). - if (!(key === 'returnValue' && old.preventDefault)) { - event[key] = old[key]; - } - } - } - - // The event occurred on this element - if (!event.target) { - event.target = event.srcElement || document_1; - } - - // Handle which other element the event is related to - if (!event.relatedTarget) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Stop the default browser action - event.preventDefault = function () { - if (old.preventDefault) { - old.preventDefault(); - } - event.returnValue = false; - old.returnValue = false; - event.defaultPrevented = true; - }; - - event.defaultPrevented = false; - - // Stop the event from bubbling - event.stopPropagation = function () { - if (old.stopPropagation) { - old.stopPropagation(); - } - event.cancelBubble = true; - old.cancelBubble = true; - event.isPropagationStopped = returnTrue; - }; - - event.isPropagationStopped = returnFalse; - - // Stop the event from bubbling and executing other handlers - event.stopImmediatePropagation = function () { - if (old.stopImmediatePropagation) { - old.stopImmediatePropagation(); - } - event.isImmediatePropagationStopped = returnTrue; - event.stopPropagation(); - }; - - event.isImmediatePropagationStopped = returnFalse; - - // Handle mouse position - if (event.clientX !== null && event.clientX !== undefined) { - var doc = document_1.documentElement; - var body = document_1.body; - - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Handle key presses - event.which = event.charCode || event.keyCode; - - // Fix button for mouse clicks: - // 0 == left; 1 == middle; 2 == right - if (event.button !== null && event.button !== undefined) { - - // The following is disabled because it does not pass videojs-standard - // and... yikes. - /* eslint-disable */ - event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0; - /* eslint-enable */ - } - } - - // Returns fixed-up instance - return event; -} - -/** - * Add an event listener to element - * It stores the handler function in a separate cache object - * and adds a generic handler to the element's event, - * along with a unique id (guid) to the element. - * - * @param {Element|Object} elem - * Element or object to bind listeners to - * - * @param {string|string[]} type - * Type of event to bind to. - * - * @param {EventTarget~EventListener} fn - * Event listener. - */ -function on(elem, type, fn) { - if (Array.isArray(type)) { - return _handleMultipleEvents(on, elem, type, fn); - } - - var data = getData(elem); - - // We need a place to store all our handler data - if (!data.handlers) { - data.handlers = {}; - } - - if (!data.handlers[type]) { - data.handlers[type] = []; - } - - if (!fn.guid) { - fn.guid = newGUID(); - } - - data.handlers[type].push(fn); - - if (!data.dispatcher) { - data.disabled = false; - - data.dispatcher = function (event, hash) { - - if (data.disabled) { - return; - } - - event = fixEvent(event); - - var handlers = data.handlers[event.type]; - - if (handlers) { - // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off. - var handlersCopy = handlers.slice(0); - - for (var m = 0, n = handlersCopy.length; m < n; m++) { - if (event.isImmediatePropagationStopped()) { - break; - } else { - try { - handlersCopy[m].call(elem, event, hash); - } catch (e) { - log$1.error(e); - } - } - } - } - }; - } - - if (data.handlers[type].length === 1) { - if (elem.addEventListener) { - elem.addEventListener(type, data.dispatcher, false); - } else if (elem.attachEvent) { - elem.attachEvent('on' + type, data.dispatcher); - } - } -} - -/** - * Removes event listeners from an element - * - * @param {Element|Object} elem - * Object to remove listeners from. - * - * @param {string|string[]} [type] - * Type of listener to remove. Don't include to remove all events from element. - * - * @param {EventTarget~EventListener} [fn] - * Specific listener to remove. Don't include to remove listeners for an event - * type. - */ -function off(elem, type, fn) { - // Don't want to add a cache object through getElData if not needed - if (!hasData(elem)) { - return; - } - - var data = getData(elem); - - // If no events exist, nothing to unbind - if (!data.handlers) { - return; - } - - if (Array.isArray(type)) { - return _handleMultipleEvents(off, elem, type, fn); - } - - // Utility function - var removeType = function removeType(t) { - data.handlers[t] = []; - _cleanUpEvents(elem, t); - }; - - // Are we removing all bound events? - if (!type) { - for (var t in data.handlers) { - removeType(t); - } - return; - } - - var handlers = data.handlers[type]; - - // If no handlers exist, nothing to unbind - if (!handlers) { - return; - } - - // If no listener was provided, remove all listeners for type - if (!fn) { - removeType(type); - return; - } - - // We're only removing a single handler - if (fn.guid) { - for (var n = 0; n < handlers.length; n++) { - if (handlers[n].guid === fn.guid) { - handlers.splice(n--, 1); - } - } - } - - _cleanUpEvents(elem, type); -} - -/** - * Trigger an event for an element - * - * @param {Element|Object} elem - * Element to trigger an event on - * - * @param {EventTarget~Event|string} event - * A string (the type) or an event object with a type attribute - * - * @param {Object} [hash] - * data hash to pass along with the event - * - * @return {boolean|undefined} - * - Returns the opposite of `defaultPrevented` if default was prevented - * - Otherwise returns undefined - */ -function trigger(elem, event, hash) { - // Fetches element data and a reference to the parent (for bubbling). - // Don't want to add a data object to cache for every parent, - // so checking hasElData first. - var elemData = hasData(elem) ? getData(elem) : {}; - var parent = elem.parentNode || elem.ownerDocument; - // type = event.type || event, - // handler; - - // If an event name was passed as a string, creates an event out of it - if (typeof event === 'string') { - event = { type: event, target: elem }; - } - // Normalizes the event properties. - event = fixEvent(event); - - // If the passed element has a dispatcher, executes the established handlers. - if (elemData.dispatcher) { - elemData.dispatcher.call(elem, event, hash); - } - - // Unless explicitly stopped or the event does not bubble (e.g. media events) - // recursively calls this function to bubble the event up the DOM. - if (parent && !event.isPropagationStopped() && event.bubbles === true) { - trigger.call(null, parent, event, hash); - - // If at the top of the DOM, triggers the default action unless disabled. - } else if (!parent && !event.defaultPrevented) { - var targetData = getData(event.target); - - // Checks if the target has a default action for this event. - if (event.target[event.type]) { - // Temporarily disables event dispatching on the target as we have already executed the handler. - targetData.disabled = true; - // Executes the default action. - if (typeof event.target[event.type] === 'function') { - event.target[event.type](); - } - // Re-enables event dispatching. - targetData.disabled = false; - } - } - - // Inform the triggerer if the default was prevented by returning false - return !event.defaultPrevented; -} - -/** - * Trigger a listener only once for an event - * - * @param {Element|Object} elem - * Element or object to bind to. - * - * @param {string|string[]} type - * Name/type of event - * - * @param {Event~EventListener} fn - * Event Listener function - */ -function one(elem, type, fn) { - if (Array.isArray(type)) { - return _handleMultipleEvents(one, elem, type, fn); - } - var func = function func() { - off(elem, type, func); - fn.apply(this, arguments); - }; - - // copy the guid to the new function so it can removed using the original function's ID - func.guid = fn.guid = fn.guid || newGUID(); - on(elem, type, func); -} - -var Events = (Object.freeze || Object)({ - fixEvent: fixEvent, - on: on, - off: off, - trigger: trigger, - one: one -}); - -/** - * @file setup.js - Functions for setting up a player without - * user interaction based on the data-setup `attribute` of the video tag. - * - * @module setup - */ -var _windowLoaded = false; -var videojs$2 = void 0; - -/** - * Set up any tags that have a data-setup `attribute` when the player is started. - */ -var autoSetup = function autoSetup() { - - // Protect against breakage in non-browser environments. - if (!isReal()) { - return; - } - - // One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack* - // var vids = Array.prototype.slice.call(document.getElementsByTagName('video')); - // var audios = Array.prototype.slice.call(document.getElementsByTagName('audio')); - // var mediaEls = vids.concat(audios); - - // Because IE8 doesn't support calling slice on a node list, we need to loop - // through each list of elements to build up a new, combined list of elements. - var vids = document_1.getElementsByTagName('video'); - var audios = document_1.getElementsByTagName('audio'); - var mediaEls = []; - - if (vids && vids.length > 0) { - for (var i = 0, e = vids.length; i < e; i++) { - mediaEls.push(vids[i]); - } - } - - if (audios && audios.length > 0) { - for (var _i = 0, _e = audios.length; _i < _e; _i++) { - mediaEls.push(audios[_i]); - } - } - - // Check if any media elements exist - if (mediaEls && mediaEls.length > 0) { - - for (var _i2 = 0, _e2 = mediaEls.length; _i2 < _e2; _i2++) { - var mediaEl = mediaEls[_i2]; - - // Check if element exists, has getAttribute func. - // IE seems to consider typeof el.getAttribute == 'object' instead of - // 'function' like expected, at least when loading the player immediately. - if (mediaEl && mediaEl.getAttribute) { - - // Make sure this player hasn't already been set up. - if (mediaEl.player === undefined) { - var options = mediaEl.getAttribute('data-setup'); - - // Check if data-setup attr exists. - // We only auto-setup if they've added the data-setup attr. - if (options !== null) { - // Create new video.js instance. - videojs$2(mediaEl); - } - } - - // If getAttribute isn't defined, we need to wait for the DOM. - } else { - autoSetupTimeout(1); - break; - } - } - - // No videos were found, so keep looping unless page is finished loading. - } else if (!_windowLoaded) { - autoSetupTimeout(1); - } -}; - -/** - * Wait until the page is loaded before running autoSetup. This will be called in - * autoSetup if `hasLoaded` returns false. - * - * @param {number} wait - * How long to wait in ms - * - * @param {module:videojs} [vjs] - * The videojs library function - */ -function autoSetupTimeout(wait, vjs) { - if (vjs) { - videojs$2 = vjs; - } - - window_1.setTimeout(autoSetup, wait); -} - -if (isReal() && document_1.readyState === 'complete') { - _windowLoaded = true; -} else { - /** - * Listen for the load event on window, and set _windowLoaded to true. - * - * @listens load - */ - one(window_1, 'load', function () { - _windowLoaded = true; - }); -} - -/** - * @file stylesheet.js - * @module stylesheet - */ -/** - * Create a DOM syle element given a className for it. - * - * @param {string} className - * The className to add to the created style element. - * - * @return {Element} - * The element that was created. - */ -var createStyleElement = function createStyleElement(className) { - var style = document_1.createElement('style'); - - style.className = className; - - return style; -}; - -/** - * Add text to a DOM element. - * - * @param {Element} el - * The Element to add text content to. - * - * @param {string} content - * The text to add to the element. - */ -var setTextContent = function setTextContent(el, content) { - if (el.styleSheet) { - el.styleSheet.cssText = content; - } else { - el.textContent = content; - } -}; - -/** - * @file fn.js - * @module fn - */ -/** - * Bind (a.k.a proxy or Context). A simple method for changing the context of a function - * It also stores a unique id on the function so it can be easily removed from events. - * - * @param {Mixed} context - * The object to bind as scope. - * - * @param {Function} fn - * The function to be bound to a scope. - * - * @param {number} [uid] - * An optional unique ID for the function to be set - * - * @return {Function} - * The new function that will be bound into the context given - */ -var bind = function bind(context, fn, uid) { - // Make sure the function has a unique ID - if (!fn.guid) { - fn.guid = newGUID(); - } - - // Create the new function that changes the context - var bound = function bound() { - return fn.apply(context, arguments); - }; - - // Allow for the ability to individualize this function - // Needed in the case where multiple objects might share the same prototype - // IF both items add an event listener with the same function, then you try to remove just one - // it will remove both because they both have the same guid. - // when using this, you need to use the bind method when you remove the listener as well. - // currently used in text tracks - bound.guid = uid ? uid + '_' + fn.guid : fn.guid; - - return bound; -}; - -/** - * Wraps the given function, `fn`, with a new function that only invokes `fn` - * at most once per every `wait` milliseconds. - * - * @param {Function} fn - * The function to be throttled. - * - * @param {Number} wait - * The number of milliseconds by which to throttle. - * - * @return {Function} - */ -var throttle = function throttle(fn, wait) { - var last = Date.now(); - - var throttled = function throttled() { - var now = Date.now(); - - if (now - last >= wait) { - fn.apply(undefined, arguments); - last = now; - } - }; - - return throttled; -}; - -/** - * @file src/js/event-target.js - */ -/** - * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It - * adds shorthand functions that wrap around lengthy functions. For example: - * the `on` function is a wrapper around `addEventListener`. - * - * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget} - * @class EventTarget - */ -var EventTarget = function EventTarget() {}; - -/** - * A Custom DOM event. - * - * @typedef {Object} EventTarget~Event - * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent} - */ - -/** - * All event listeners should follow the following format. - * - * @callback EventTarget~EventListener - * @this {EventTarget} - * - * @param {EventTarget~Event} event - * the event that triggered this function - * - * @param {Object} [hash] - * hash of data sent during the event - */ - -/** - * An object containing event names as keys and booleans as values. - * - * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger} - * will have extra functionality. See that function for more information. - * - * @property EventTarget.prototype.allowedEvents_ - * @private - */ -EventTarget.prototype.allowedEvents_ = {}; - -/** - * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a - * function that will get called when an event with a certain name gets triggered. - * - * @param {string|string[]} type - * An event name or an array of event names. - * - * @param {EventTarget~EventListener} fn - * The function to call with `EventTarget`s - */ -EventTarget.prototype.on = function (type, fn) { - // Remove the addEventListener alias before calling Events.on - // so we don't get into an infinite type loop - var ael = this.addEventListener; - - this.addEventListener = function () {}; - on(this, type, fn); - this.addEventListener = ael; -}; - -/** - * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic - * the standard DOM API. - * - * @function - * @see {@link EventTarget#on} - */ -EventTarget.prototype.addEventListener = EventTarget.prototype.on; - -/** - * Removes an `event listener` for a specific event from an instance of `EventTarget`. - * This makes it so that the `event listener` will no longer get called when the - * named event happens. - * - * @param {string|string[]} type - * An event name or an array of event names. - * - * @param {EventTarget~EventListener} fn - * The function to remove. - */ -EventTarget.prototype.off = function (type, fn) { - off(this, type, fn); -}; - -/** - * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic - * the standard DOM API. - * - * @function - * @see {@link EventTarget#off} - */ -EventTarget.prototype.removeEventListener = EventTarget.prototype.off; - -/** - * This function will add an `event listener` that gets triggered only once. After the - * first trigger it will get removed. This is like adding an `event listener` - * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself. - * - * @param {string|string[]} type - * An event name or an array of event names. - * - * @param {EventTarget~EventListener} fn - * The function to be called once for each event name. - */ -EventTarget.prototype.one = function (type, fn) { - // Remove the addEventListener alialing Events.on - // so we don't get into an infinite type loop - var ael = this.addEventListener; - - this.addEventListener = function () {}; - one(this, type, fn); - this.addEventListener = ael; -}; - -/** - * This function causes an event to happen. This will then cause any `event listeners` - * that are waiting for that event, to get called. If there are no `event listeners` - * for an event then nothing will happen. - * - * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`. - * Trigger will also call the `on` + `uppercaseEventName` function. - * - * Example: - * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call - * `onClick` if it exists. - * - * @param {string|EventTarget~Event|Object} event - * The name of the event, an `Event`, or an object with a key of type set to - * an event name. - */ -EventTarget.prototype.trigger = function (event) { - var type = event.type || event; - - if (typeof event === 'string') { - event = { type: type }; - } - event = fixEvent(event); - - if (this.allowedEvents_[type] && this['on' + type]) { - this['on' + type](event); - } - - trigger(this, event); -}; - -/** - * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic - * the standard DOM API. - * - * @function - * @see {@link EventTarget#trigger} - */ -EventTarget.prototype.dispatchEvent = EventTarget.prototype.trigger; - -/** - * @file mixins/evented.js - * @module evented - */ -/** - * Returns whether or not an object has had the evented mixin applied. - * - * @param {Object} object - * An object to test. - * - * @return {boolean} - * Whether or not the object appears to be evented. - */ -var isEvented = function isEvented(object) { - return object instanceof EventTarget || !!object.eventBusEl_ && ['on', 'one', 'off', 'trigger'].every(function (k) { - return typeof object[k] === 'function'; - }); -}; - -/** - * Whether a value is a valid event type - non-empty string or array. - * - * @private - * @param {string|Array} type - * The type value to test. - * - * @return {boolean} - * Whether or not the type is a valid event type. - */ -var isValidEventType = function isValidEventType(type) { - return ( - // The regex here verifies that the `type` contains at least one non- - // whitespace character. - typeof type === 'string' && /\S/.test(type) || Array.isArray(type) && !!type.length - ); -}; - -/** - * Validates a value to determine if it is a valid event target. Throws if not. - * - * @private - * @throws {Error} - * If the target does not appear to be a valid event target. - * - * @param {Object} target - * The object to test. - */ -var validateTarget = function validateTarget(target) { - if (!target.nodeName && !isEvented(target)) { - throw new Error('Invalid target; must be a DOM node or evented object.'); - } -}; - -/** - * Validates a value to determine if it is a valid event target. Throws if not. - * - * @private - * @throws {Error} - * If the type does not appear to be a valid event type. - * - * @param {string|Array} type - * The type to test. - */ -var validateEventType = function validateEventType(type) { - if (!isValidEventType(type)) { - throw new Error('Invalid event type; must be a non-empty string or array.'); - } -}; - -/** - * Validates a value to determine if it is a valid listener. Throws if not. - * - * @private - * @throws {Error} - * If the listener is not a function. - * - * @param {Function} listener - * The listener to test. - */ -var validateListener = function validateListener(listener) { - if (typeof listener !== 'function') { - throw new Error('Invalid listener; must be a function.'); - } -}; - -/** - * Takes an array of arguments given to `on()` or `one()`, validates them, and - * normalizes them into an object. - * - * @private - * @param {Object} self - * The evented object on which `on()` or `one()` was called. This - * object will be bound as the `this` value for the listener. - * - * @param {Array} args - * An array of arguments passed to `on()` or `one()`. - * - * @return {Object} - * An object containing useful values for `on()` or `one()` calls. - */ -var normalizeListenArgs = function normalizeListenArgs(self, args) { - - // If the number of arguments is less than 3, the target is always the - // evented object itself. - var isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_; - var target = void 0; - var type = void 0; - var listener = void 0; - - if (isTargetingSelf) { - target = self.eventBusEl_; - - // Deal with cases where we got 3 arguments, but we are still listening to - // the evented object itself. - if (args.length >= 3) { - args.shift(); - } - - type = args[0]; - listener = args[1]; - } else { - target = args[0]; - type = args[1]; - listener = args[2]; - } - - validateTarget(target); - validateEventType(type); - validateListener(listener); - - listener = bind(self, listener); - - return { isTargetingSelf: isTargetingSelf, target: target, type: type, listener: listener }; -}; - -/** - * Adds the listener to the event type(s) on the target, normalizing for - * the type of target. - * - * @private - * @param {Element|Object} target - * A DOM node or evented object. - * - * @param {string} method - * The event binding method to use ("on" or "one"). - * - * @param {string|Array} type - * One or more event type(s). - * - * @param {Function} listener - * A listener function. - */ -var listen = function listen(target, method, type, listener) { - validateTarget(target); - - if (target.nodeName) { - Events[method](target, type, listener); - } else { - target[method](type, listener); - } -}; - -/** - * Contains methods that provide event capabilites to an object which is passed - * to {@link module:evented|evented}. - * - * @mixin EventedMixin - */ -var EventedMixin = { - - /** - * Add a listener to an event (or events) on this object or another evented - * object. - * - * @param {string|Array|Element|Object} targetOrType - * If this is a string or array, it represents the event type(s) - * that will trigger the listener. - * - * Another evented object can be passed here instead, which will - * cause the listener to listen for events on _that_ object. - * - * In either case, the listener's `this` value will be bound to - * this object. - * - * @param {string|Array|Function} typeOrListener - * If the first argument was a string or array, this should be the - * listener function. Otherwise, this is a string or array of event - * type(s). - * - * @param {Function} [listener] - * If the first argument was another evented object, this will be - * the listener function. - */ - on: function on$$1() { - var _this = this; - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var _normalizeListenArgs = normalizeListenArgs(this, args), - isTargetingSelf = _normalizeListenArgs.isTargetingSelf, - target = _normalizeListenArgs.target, - type = _normalizeListenArgs.type, - listener = _normalizeListenArgs.listener; - - listen(target, 'on', type, listener); - - // If this object is listening to another evented object. - if (!isTargetingSelf) { - - // If this object is disposed, remove the listener. - var removeListenerOnDispose = function removeListenerOnDispose() { - return _this.off(target, type, listener); - }; - - // Use the same function ID as the listener so we can remove it later it - // using the ID of the original listener. - removeListenerOnDispose.guid = listener.guid; - - // Add a listener to the target's dispose event as well. This ensures - // that if the target is disposed BEFORE this object, we remove the - // removal listener that was just added. Otherwise, we create a memory leak. - var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose() { - return _this.off('dispose', removeListenerOnDispose); - }; - - // Use the same function ID as the listener so we can remove it later - // it using the ID of the original listener. - removeRemoverOnTargetDispose.guid = listener.guid; - - listen(this, 'on', 'dispose', removeListenerOnDispose); - listen(target, 'on', 'dispose', removeRemoverOnTargetDispose); - } - }, - - - /** - * Add a listener to an event (or events) on this object or another evented - * object. The listener will only be called once and then removed. - * - * @param {string|Array|Element|Object} targetOrType - * If this is a string or array, it represents the event type(s) - * that will trigger the listener. - * - * Another evented object can be passed here instead, which will - * cause the listener to listen for events on _that_ object. - * - * In either case, the listener's `this` value will be bound to - * this object. - * - * @param {string|Array|Function} typeOrListener - * If the first argument was a string or array, this should be the - * listener function. Otherwise, this is a string or array of event - * type(s). - * - * @param {Function} [listener] - * If the first argument was another evented object, this will be - * the listener function. - */ - one: function one$$1() { - var _this2 = this; - - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - var _normalizeListenArgs2 = normalizeListenArgs(this, args), - isTargetingSelf = _normalizeListenArgs2.isTargetingSelf, - target = _normalizeListenArgs2.target, - type = _normalizeListenArgs2.type, - listener = _normalizeListenArgs2.listener; - - // Targeting this evented object. - - - if (isTargetingSelf) { - listen(target, 'one', type, listener); - - // Targeting another evented object. - } else { - var wrapper = function wrapper() { - for (var _len3 = arguments.length, largs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - largs[_key3] = arguments[_key3]; - } - - _this2.off(target, type, wrapper); - listener.apply(null, largs); - }; - - // Use the same function ID as the listener so we can remove it later - // it using the ID of the original listener. - wrapper.guid = listener.guid; - listen(target, 'one', type, wrapper); - } - }, - - - /** - * Removes listener(s) from event(s) on an evented object. - * - * @param {string|Array|Element|Object} [targetOrType] - * If this is a string or array, it represents the event type(s). - * - * Another evented object can be passed here instead, in which case - * ALL 3 arguments are _required_. - * - * @param {string|Array|Function} [typeOrListener] - * If the first argument was a string or array, this may be the - * listener function. Otherwise, this is a string or array of event - * type(s). - * - * @param {Function} [listener] - * If the first argument was another evented object, this will be - * the listener function; otherwise, _all_ listeners bound to the - * event type(s) will be removed. - */ - off: function off$$1(targetOrType, typeOrListener, listener) { - - // Targeting this evented object. - if (!targetOrType || isValidEventType(targetOrType)) { - off(this.eventBusEl_, targetOrType, typeOrListener); - - // Targeting another evented object. - } else { - var target = targetOrType; - var type = typeOrListener; - - // Fail fast and in a meaningful way! - validateTarget(target); - validateEventType(type); - validateListener(listener); - - // Ensure there's at least a guid, even if the function hasn't been used - listener = bind(this, listener); - - // Remove the dispose listener on this evented object, which was given - // the same guid as the event listener in on(). - this.off('dispose', listener); - - if (target.nodeName) { - off(target, type, listener); - off(target, 'dispose', listener); - } else if (isEvented(target)) { - target.off(type, listener); - target.off('dispose', listener); - } - } - }, - - - /** - * Fire an event on this evented object, causing its listeners to be called. - * - * @param {string|Object} event - * An event type or an object with a type property. - * - * @param {Object} [hash] - * An additional object to pass along to listeners. - * - * @returns {boolean} - * Whether or not the default behavior was prevented. - */ - trigger: function trigger$$1(event, hash) { - return trigger(this.eventBusEl_, event, hash); - } -}; - -/** - * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object. - * - * @param {Object} target - * The object to which to add event methods. - * - * @param {Object} [options={}] - * Options for customizing the mixin behavior. - * - * @param {String} [options.eventBusKey] - * By default, adds a `eventBusEl_` DOM element to the target object, - * which is used as an event bus. If the target object already has a - * DOM element that should be used, pass its key here. - * - * @return {Object} - * The target object. - */ -function evented(target) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var eventBusKey = options.eventBusKey; - - // Set or create the eventBusEl_. - - if (eventBusKey) { - if (!target[eventBusKey].nodeName) { - throw new Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.'); - } - target.eventBusEl_ = target[eventBusKey]; - } else { - target.eventBusEl_ = createEl('span', { className: 'vjs-event-bus' }); - } - - assign(target, EventedMixin); - - // When any evented object is disposed, it removes all its listeners. - target.on('dispose', function () { - return target.off(); - }); - - return target; -} - -/** - * @file mixins/stateful.js - * @module stateful - */ -/** - * Contains methods that provide statefulness to an object which is passed - * to {@link module:stateful}. - * - * @mixin StatefulMixin - */ -var StatefulMixin = { - - /** - * A hash containing arbitrary keys and values representing the state of - * the object. - * - * @type {Object} - */ - state: {}, - - /** - * Set the state of an object by mutating its - * {@link module:stateful~StatefulMixin.state|state} object in place. - * - * @fires module:stateful~StatefulMixin#statechanged - * @param {Object|Function} stateUpdates - * A new set of properties to shallow-merge into the plugin state. - * Can be a plain object or a function returning a plain object. - * - * @returns {Object|undefined} - * An object containing changes that occurred. If no changes - * occurred, returns `undefined`. - */ - setState: function setState(stateUpdates) { - var _this = this; - - // Support providing the `stateUpdates` state as a function. - if (typeof stateUpdates === 'function') { - stateUpdates = stateUpdates(); - } - - var changes = void 0; - - each(stateUpdates, function (value, key) { - - // Record the change if the value is different from what's in the - // current state. - if (_this.state[key] !== value) { - changes = changes || {}; - changes[key] = { - from: _this.state[key], - to: value - }; - } - - _this.state[key] = value; - }); - - // Only trigger "statechange" if there were changes AND we have a trigger - // function. This allows us to not require that the target object be an - // evented object. - if (changes && isEvented(this)) { - - /** - * An event triggered on an object that is both - * {@link module:stateful|stateful} and {@link module:evented|evented} - * indicating that its state has changed. - * - * @event module:stateful~StatefulMixin#statechanged - * @type {Object} - * @property {Object} changes - * A hash containing the properties that were changed and - * the values they were changed `from` and `to`. - */ - this.trigger({ - changes: changes, - type: 'statechanged' - }); - } - - return changes; - } -}; - -/** - * Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target - * object. - * - * If the target object is {@link module:evented|evented} and has a - * `handleStateChanged` method, that method will be automatically bound to the - * `statechanged` event on itself. - * - * @param {Object} target - * The object to be made stateful. - * - * @param {Object} [defaultState] - * A default set of properties to populate the newly-stateful object's - * `state` property. - * - * @returns {Object} - * Returns the `target`. - */ -function stateful(target, defaultState) { - assign(target, StatefulMixin); - - // This happens after the mixing-in because we need to replace the `state` - // added in that step. - target.state = assign({}, target.state, defaultState); - - // Auto-bind the `handleStateChanged` method of the target object if it exists. - if (typeof target.handleStateChanged === 'function' && isEvented(target)) { - target.on('statechanged', target.handleStateChanged); - } - - return target; -} - -/** - * @file to-title-case.js - * @module to-title-case - */ - -/** - * Uppercase the first letter of a string. - * - * @param {string} string - * String to be uppercased - * - * @return {string} - * The string with an uppercased first letter - */ -function toTitleCase(string) { - if (typeof string !== 'string') { - return string; - } - - return string.charAt(0).toUpperCase() + string.slice(1); -} - -/** - * Compares the TitleCase versions of the two strings for equality. - * - * @param {string} str1 - * The first string to compare - * - * @param {string} str2 - * The second string to compare - * - * @return {boolean} - * Whether the TitleCase versions of the strings are equal - */ -function titleCaseEquals(str1, str2) { - return toTitleCase(str1) === toTitleCase(str2); -} - -/** - * @file merge-options.js - * @module merge-options - */ -/** - * Deep-merge one or more options objects, recursively merging **only** plain - * object properties. - * - * @param {Object[]} sources - * One or more objects to merge into a new object. - * - * @returns {Object} - * A new object that is the merged result of all sources. - */ -function mergeOptions() { - var result = {}; - - for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - sources.forEach(function (source) { - if (!source) { - return; - } - - each(source, function (value, key) { - if (!isPlain(value)) { - result[key] = value; - return; - } - - if (!isPlain(result[key])) { - result[key] = {}; - } - - result[key] = mergeOptions(result[key], value); - }); - }); - - return result; -} - -/** - * Player Component - Base class for all UI objects - * - * @file component.js - */ -/** - * Base class for all UI Components. - * Components are UI objects which represent both a javascript object and an element - * in the DOM. They can be children of other components, and can have - * children themselves. - * - * Components can also use methods from {@link EventTarget} - */ - -var Component = function () { - - /** - * A callback that is called when a component is ready. Does not have any - * paramters and any callback value will be ignored. - * - * @callback Component~ReadyCallback - * @this Component - */ - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Object[]} [options.children] - * An array of children objects to intialize this component with. Children objects have - * a name property that will be used if more than one component of the same type needs to be - * added. - * - * @param {Component~ReadyCallback} [ready] - * Function that gets called when the `Component` is ready. - */ - function Component(player, options, ready) { - classCallCheck(this, Component); - - - // The component might be the player itself and we can't pass `this` to super - if (!player && this.play) { - this.player_ = player = this; // eslint-disable-line - } else { - this.player_ = player; - } - - // Make a copy of prototype.options_ to protect against overriding defaults - this.options_ = mergeOptions({}, this.options_); - - // Updated options with supplied options - options = this.options_ = mergeOptions(this.options_, options); - - // Get ID from options or options element if one is supplied - this.id_ = options.id || options.el && options.el.id; - - // If there was no ID from the options, generate one - if (!this.id_) { - // Don't require the player ID function in the case of mock players - var id = player && player.id && player.id() || 'no_player'; - - this.id_ = id + '_component_' + newGUID(); - } - - this.name_ = options.name || null; - - // Create element if one wasn't provided in options - if (options.el) { - this.el_ = options.el; - } else if (options.createEl !== false) { - this.el_ = this.createEl(); - } - - // Make this an evented object and use `el_`, if available, as its event bus - evented(this, { eventBusKey: this.el_ ? 'el_' : null }); - stateful(this, this.constructor.defaultState); - - this.children_ = []; - this.childIndex_ = {}; - this.childNameIndex_ = {}; - - // Add any child components in options - if (options.initChildren !== false) { - this.initChildren(); - } - - this.ready(ready); - // Don't want to trigger ready here or it will before init is actually - // finished for all children that run this constructor - - if (options.reportTouchActivity !== false) { - this.enableTouchActivity(); - } - } - - /** - * Dispose of the `Component` and all child components. - * - * @fires Component#dispose - */ - - - Component.prototype.dispose = function dispose() { - - /** - * Triggered when a `Component` is disposed. - * - * @event Component#dispose - * @type {EventTarget~Event} - * - * @property {boolean} [bubbles=false] - * set to false so that the close event does not - * bubble up - */ - this.trigger({ type: 'dispose', bubbles: false }); - - // Dispose all children. - if (this.children_) { - for (var i = this.children_.length - 1; i >= 0; i--) { - if (this.children_[i].dispose) { - this.children_[i].dispose(); - } - } - } - - // Delete child references - this.children_ = null; - this.childIndex_ = null; - this.childNameIndex_ = null; - - if (this.el_) { - // Remove element from DOM - if (this.el_.parentNode) { - this.el_.parentNode.removeChild(this.el_); - } - - removeData(this.el_); - this.el_ = null; - } - }; - - /** - * Return the {@link Player} that the `Component` has attached to. - * - * @return {Player} - * The player that this `Component` has attached to. - */ - - - Component.prototype.player = function player() { - return this.player_; - }; - - /** - * Deep merge of options objects with new options. - * > Note: When both `obj` and `options` contain properties whose values are objects. - * The two properties get merged using {@link module:mergeOptions} - * - * @param {Object} obj - * The object that contains new options. - * - * @return {Object} - * A new object of `this.options_` and `obj` merged together. - * - * @deprecated since version 5 - */ - - - Component.prototype.options = function options(obj) { - log$1.warn('this.options() has been deprecated and will be moved to the constructor in 6.0'); - - if (!obj) { - return this.options_; - } - - this.options_ = mergeOptions(this.options_, obj); - return this.options_; - }; - - /** - * Get the `Component`s DOM element - * - * @return {Element} - * The DOM element for this `Component`. - */ - - - Component.prototype.el = function el() { - return this.el_; - }; - - /** - * Create the `Component`s DOM element. - * - * @param {string} [tagName] - * Element's DOM node type. e.g. 'div' - * - * @param {Object} [properties] - * An object of properties that should be set. - * - * @param {Object} [attributes] - * An object of attributes that should be set. - * - * @return {Element} - * The element that gets created. - */ - - - Component.prototype.createEl = function createEl$$1(tagName, properties, attributes) { - return createEl(tagName, properties, attributes); - }; - - /** - * Localize a string given the string in english. - * - * If tokens are provided, it'll try and run a simple token replacement on the provided string. - * The tokens it loooks for look like `{1}` with the index being 1-indexed into the tokens array. - * - * If a `defaultValue` is provided, it'll use that over `string`, - * if a value isn't found in provided language files. - * This is useful if you want to have a descriptive key for token replacement - * but have a succinct localized string and not require `en.json` to be included. - * - * Currently, it is used for the progress bar timing. - * ```js - * { - * "progress bar timing: currentTime={1} duration={2}": "{1} of {2}" - * } - * ``` - * It is then used like so: - * ```js - * this.localize('progress bar timing: currentTime={1} duration{2}', - * [this.player_.currentTime(), this.player_.duration()], - * '{1} of {2}'); - * ``` - * - * Which outputs something like: `01:23 of 24:56`. - * - * - * @param {string} string - * The string to localize and the key to lookup in the language files. - * @param {string[]} [tokens] - * If the current item has token replacements, provide the tokens here. - * @param {string} [defaultValue] - * Defaults to `string`. Can be a default value to use for token replacement - * if the lookup key is needed to be separate. - * - * @return {string} - * The localized string or if no localization exists the english string. - */ - - - Component.prototype.localize = function localize(string, tokens) { - var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : string; - - var code = this.player_.language && this.player_.language(); - var languages = this.player_.languages && this.player_.languages(); - var language = languages && languages[code]; - var primaryCode = code && code.split('-')[0]; - var primaryLang = languages && languages[primaryCode]; - - var localizedString = defaultValue; - - if (language && language[string]) { - localizedString = language[string]; - } else if (primaryLang && primaryLang[string]) { - localizedString = primaryLang[string]; - } - - if (tokens) { - localizedString = localizedString.replace(/\{(\d+)\}/g, function (match, index) { - var value = tokens[index - 1]; - var ret = value; - - if (typeof value === 'undefined') { - ret = match; - } - - return ret; - }); - } - - return localizedString; - }; - - /** - * Return the `Component`s DOM element. This is where children get inserted. - * This will usually be the the same as the element returned in {@link Component#el}. - * - * @return {Element} - * The content element for this `Component`. - */ - - - Component.prototype.contentEl = function contentEl() { - return this.contentEl_ || this.el_; - }; - - /** - * Get this `Component`s ID - * - * @return {string} - * The id of this `Component` - */ - - - Component.prototype.id = function id() { - return this.id_; - }; - - /** - * Get the `Component`s name. The name gets used to reference the `Component` - * and is set during registration. - * - * @return {string} - * The name of this `Component`. - */ - - - Component.prototype.name = function name() { - return this.name_; - }; - - /** - * Get an array of all child components - * - * @return {Array} - * The children - */ - - - Component.prototype.children = function children() { - return this.children_; - }; - - /** - * Returns the child `Component` with the given `id`. - * - * @param {string} id - * The id of the child `Component` to get. - * - * @return {Component|undefined} - * The child `Component` with the given `id` or undefined. - */ - - - Component.prototype.getChildById = function getChildById(id) { - return this.childIndex_[id]; - }; - - /** - * Returns the child `Component` with the given `name`. - * - * @param {string} name - * The name of the child `Component` to get. - * - * @return {Component|undefined} - * The child `Component` with the given `name` or undefined. - */ - - - Component.prototype.getChild = function getChild(name) { - if (!name) { - return; - } - - name = toTitleCase(name); - - return this.childNameIndex_[name]; - }; - - /** - * Add a child `Component` inside the current `Component`. - * - * - * @param {string|Component} child - * The name or instance of a child to add. - * - * @param {Object} [options={}] - * The key/value store of options that will get passed to children of - * the child. - * - * @param {number} [index=this.children_.length] - * The index to attempt to add a child into. - * - * @return {Component} - * The `Component` that gets added as a child. When using a string the - * `Component` will get created by this process. - */ - - - Component.prototype.addChild = function addChild(child) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.children_.length; - - var component = void 0; - var componentName = void 0; - - // If child is a string, create component with options - if (typeof child === 'string') { - componentName = toTitleCase(child); - - var componentClassName = options.componentClass || componentName; - - // Set name through options - options.name = componentName; - - // Create a new object & element for this controls set - // If there's no .player_, this is a player - var ComponentClass = Component.getComponent(componentClassName); - - if (!ComponentClass) { - throw new Error('Component ' + componentClassName + ' does not exist'); - } - - // data stored directly on the videojs object may be - // misidentified as a component to retain - // backwards-compatibility with 4.x. check to make sure the - // component class can be instantiated. - if (typeof ComponentClass !== 'function') { - return null; - } - - component = new ComponentClass(this.player_ || this, options); - - // child is a component instance - } else { - component = child; - } - - this.children_.splice(index, 0, component); - - if (typeof component.id === 'function') { - this.childIndex_[component.id()] = component; - } - - // If a name wasn't used to create the component, check if we can use the - // name function of the component - componentName = componentName || component.name && toTitleCase(component.name()); - - if (componentName) { - this.childNameIndex_[componentName] = component; - } - - // Add the UI object's element to the container div (box) - // Having an element is not required - if (typeof component.el === 'function' && component.el()) { - var childNodes = this.contentEl().children; - var refNode = childNodes[index] || null; - - this.contentEl().insertBefore(component.el(), refNode); - } - - // Return so it can stored on parent object if desired. - return component; - }; - - /** - * Remove a child `Component` from this `Component`s list of children. Also removes - * the child `Component`s element from this `Component`s element. - * - * @param {Component} component - * The child `Component` to remove. - */ - - - Component.prototype.removeChild = function removeChild(component) { - if (typeof component === 'string') { - component = this.getChild(component); - } - - if (!component || !this.children_) { - return; - } - - var childFound = false; - - for (var i = this.children_.length - 1; i >= 0; i--) { - if (this.children_[i] === component) { - childFound = true; - this.children_.splice(i, 1); - break; - } - } - - if (!childFound) { - return; - } - - this.childIndex_[component.id()] = null; - this.childNameIndex_[component.name()] = null; - - var compEl = component.el(); - - if (compEl && compEl.parentNode === this.contentEl()) { - this.contentEl().removeChild(component.el()); - } - }; - - /** - * Add and initialize default child `Component`s based upon options. - */ - - - Component.prototype.initChildren = function initChildren() { - var _this = this; - - var children = this.options_.children; - - if (children) { - // `this` is `parent` - var parentOptions = this.options_; - - var handleAdd = function handleAdd(child) { - var name = child.name; - var opts = child.opts; - - // Allow options for children to be set at the parent options - // e.g. videojs(id, { controlBar: false }); - // instead of videojs(id, { children: { controlBar: false }); - if (parentOptions[name] !== undefined) { - opts = parentOptions[name]; - } - - // Allow for disabling default components - // e.g. options['children']['posterImage'] = false - if (opts === false) { - return; - } - - // Allow options to be passed as a simple boolean if no configuration - // is necessary. - if (opts === true) { - opts = {}; - } - - // We also want to pass the original player options - // to each component as well so they don't need to - // reach back into the player for options later. - opts.playerOptions = _this.options_.playerOptions; - - // Create and add the child component. - // Add a direct reference to the child by name on the parent instance. - // If two of the same component are used, different names should be supplied - // for each - var newChild = _this.addChild(name, opts); - - if (newChild) { - _this[name] = newChild; - } - }; - - // Allow for an array of children details to passed in the options - var workingChildren = void 0; - var Tech = Component.getComponent('Tech'); - - if (Array.isArray(children)) { - workingChildren = children; - } else { - workingChildren = Object.keys(children); - } - - workingChildren - // children that are in this.options_ but also in workingChildren would - // give us extra children we do not want. So, we want to filter them out. - .concat(Object.keys(this.options_).filter(function (child) { - return !workingChildren.some(function (wchild) { - if (typeof wchild === 'string') { - return child === wchild; - } - return child === wchild.name; - }); - })).map(function (child) { - var name = void 0; - var opts = void 0; - - if (typeof child === 'string') { - name = child; - opts = children[name] || _this.options_[name] || {}; - } else { - name = child.name; - opts = child; - } - - return { name: name, opts: opts }; - }).filter(function (child) { - // we have to make sure that child.name isn't in the techOrder since - // techs are registerd as Components but can't aren't compatible - // See https://github.com/videojs/video.js/issues/2772 - var c = Component.getComponent(child.opts.componentClass || toTitleCase(child.name)); - - return c && !Tech.isTech(c); - }).forEach(handleAdd); - } - }; - - /** - * Builds the default DOM class name. Should be overriden by sub-components. - * - * @return {string} - * The DOM class name for this object. - * - * @abstract - */ - - - Component.prototype.buildCSSClass = function buildCSSClass() { - // Child classes can include a function that does: - // return 'CLASS NAME' + this._super(); - return ''; - }; - - /** - * Bind a listener to the component's ready state. - * Different from event listeners in that if the ready event has already happened - * it will trigger the function immediately. - * - * @return {Component} - * Returns itself; method can be chained. - */ - - - Component.prototype.ready = function ready(fn) { - var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - if (fn) { - if (this.isReady_) { - if (sync) { - fn.call(this); - } else { - // Call the function asynchronously by default for consistency - this.setTimeout(fn, 1); - } - } else { - this.readyQueue_ = this.readyQueue_ || []; - this.readyQueue_.push(fn); - } - } - }; - - /** - * Trigger all the ready listeners for this `Component`. - * - * @fires Component#ready - */ - - - Component.prototype.triggerReady = function triggerReady() { - this.isReady_ = true; - - // Ensure ready is triggerd asynchronously - this.setTimeout(function () { - var readyQueue = this.readyQueue_; - - // Reset Ready Queue - this.readyQueue_ = []; - - if (readyQueue && readyQueue.length > 0) { - readyQueue.forEach(function (fn) { - fn.call(this); - }, this); - } - - // Allow for using event listeners also - /** - * Triggered when a `Component` is ready. - * - * @event Component#ready - * @type {EventTarget~Event} - */ - this.trigger('ready'); - }, 1); - }; - - /** - * Find a single DOM element matching a `selector`. This can be within the `Component`s - * `contentEl()` or another custom context. - * - * @param {string} selector - * A valid CSS selector, which will be passed to `querySelector`. - * - * @param {Element|string} [context=this.contentEl()] - * A DOM element within which to query. Can also be a selector string in - * which case the first matching element will get used as context. If - * missing `this.contentEl()` gets used. If `this.contentEl()` returns - * nothing it falls back to `document`. - * - * @return {Element|null} - * the dom element that was found, or null - * - * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors) - */ - - - Component.prototype.$ = function $$$1(selector, context) { - return $(selector, context || this.contentEl()); - }; - - /** - * Finds all DOM element matching a `selector`. This can be within the `Component`s - * `contentEl()` or another custom context. - * - * @param {string} selector - * A valid CSS selector, which will be passed to `querySelectorAll`. - * - * @param {Element|string} [context=this.contentEl()] - * A DOM element within which to query. Can also be a selector string in - * which case the first matching element will get used as context. If - * missing `this.contentEl()` gets used. If `this.contentEl()` returns - * nothing it falls back to `document`. - * - * @return {NodeList} - * a list of dom elements that were found - * - * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors) - */ - - - Component.prototype.$$ = function $$$$1(selector, context) { - return $$(selector, context || this.contentEl()); - }; - - /** - * Check if a component's element has a CSS class name. - * - * @param {string} classToCheck - * CSS class name to check. - * - * @return {boolean} - * - True if the `Component` has the class. - * - False if the `Component` does not have the class` - */ - - - Component.prototype.hasClass = function hasClass$$1(classToCheck) { - return hasClass(this.el_, classToCheck); - }; - - /** - * Add a CSS class name to the `Component`s element. - * - * @param {string} classToAdd - * CSS class name to add - */ - - - Component.prototype.addClass = function addClass$$1(classToAdd) { - addClass(this.el_, classToAdd); - }; - - /** - * Remove a CSS class name from the `Component`s element. - * - * @param {string} classToRemove - * CSS class name to remove - */ - - - Component.prototype.removeClass = function removeClass$$1(classToRemove) { - removeClass(this.el_, classToRemove); - }; - - /** - * Add or remove a CSS class name from the component's element. - * - `classToToggle` gets added when {@link Component#hasClass} would return false. - * - `classToToggle` gets removed when {@link Component#hasClass} would return true. - * - * @param {string} classToToggle - * The class to add or remove based on (@link Component#hasClass} - * - * @param {boolean|Dom~predicate} [predicate] - * An {@link Dom~predicate} function or a boolean - */ - - - Component.prototype.toggleClass = function toggleClass$$1(classToToggle, predicate) { - toggleClass(this.el_, classToToggle, predicate); - }; - - /** - * Show the `Component`s element if it is hidden by removing the - * 'vjs-hidden' class name from it. - */ - - - Component.prototype.show = function show() { - this.removeClass('vjs-hidden'); - }; - - /** - * Hide the `Component`s element if it is currently showing by adding the - * 'vjs-hidden` class name to it. - */ - - - Component.prototype.hide = function hide() { - this.addClass('vjs-hidden'); - }; - - /** - * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing' - * class name to it. Used during fadeIn/fadeOut. - * - * @private - */ - - - Component.prototype.lockShowing = function lockShowing() { - this.addClass('vjs-lock-showing'); - }; - - /** - * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing' - * class name from it. Used during fadeIn/fadeOut. - * - * @private - */ - - - Component.prototype.unlockShowing = function unlockShowing() { - this.removeClass('vjs-lock-showing'); - }; - - /** - * Get the value of an attribute on the `Component`s element. - * - * @param {string} attribute - * Name of the attribute to get the value from. - * - * @return {string|null} - * - The value of the attribute that was asked for. - * - Can be an empty string on some browsers if the attribute does not exist - * or has no value - * - Most browsers will return null if the attibute does not exist or has - * no value. - * - * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute} - */ - - - Component.prototype.getAttribute = function getAttribute$$1(attribute) { - return getAttribute(this.el_, attribute); - }; - - /** - * Set the value of an attribute on the `Component`'s element - * - * @param {string} attribute - * Name of the attribute to set. - * - * @param {string} value - * Value to set the attribute to. - * - * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute} - */ - - - Component.prototype.setAttribute = function setAttribute$$1(attribute, value) { - setAttribute(this.el_, attribute, value); - }; - - /** - * Remove an attribute from the `Component`s element. - * - * @param {string} attribute - * Name of the attribute to remove. - * - * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute} - */ - - - Component.prototype.removeAttribute = function removeAttribute$$1(attribute) { - removeAttribute(this.el_, attribute); - }; - - /** - * Get or set the width of the component based upon the CSS styles. - * See {@link Component#dimension} for more detailed information. - * - * @param {number|string} [num] - * The width that you want to set postfixed with '%', 'px' or nothing. - * - * @param {boolean} [skipListeners] - * Skip the componentresize event trigger - * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. - */ - - - Component.prototype.width = function width(num, skipListeners) { - return this.dimension('width', num, skipListeners); - }; - - /** - * Get or set the height of the component based upon the CSS styles. - * See {@link Component#dimension} for more detailed information. - * - * @param {number|string} [num] - * The height that you want to set postfixed with '%', 'px' or nothing. - * - * @param {boolean} [skipListeners] - * Skip the componentresize event trigger - * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. - */ - - - Component.prototype.height = function height(num, skipListeners) { - return this.dimension('height', num, skipListeners); - }; - - /** - * Set both the width and height of the `Component` element at the same time. - * - * @param {number|string} width - * Width to set the `Component`s element to. - * - * @param {number|string} height - * Height to set the `Component`s element to. - */ - - - Component.prototype.dimensions = function dimensions(width, height) { - // Skip componentresize listeners on width for optimization - this.width(width, true); - this.height(height); - }; - - /** - * Get or set width or height of the `Component` element. This is the shared code - * for the {@link Component#width} and {@link Component#height}. - * - * Things to know: - * - If the width or height in an number this will return the number postfixed with 'px'. - * - If the width/height is a percent this will return the percent postfixed with '%' - * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function - * defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`. - * See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/} - * for more information - * - If you want the computed style of the component, use {@link Component#currentWidth} - * and {@link {Component#currentHeight} - * - * @fires Component#componentresize - * - * @param {string} widthOrHeight - 8 'width' or 'height' - * - * @param {number|string} [num] - 8 New dimension - * - * @param {boolean} [skipListeners] - * Skip componentresize event trigger - * - * @return {number} - * The dimension when getting or 0 if unset - */ - - - Component.prototype.dimension = function dimension(widthOrHeight, num, skipListeners) { - if (num !== undefined) { - // Set to zero if null or literally NaN (NaN !== NaN) - if (num === null || num !== num) { - num = 0; - } - - // Check if using css width/height (% or px) and adjust - if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) { - this.el_.style[widthOrHeight] = num; - } else if (num === 'auto') { - this.el_.style[widthOrHeight] = ''; - } else { - this.el_.style[widthOrHeight] = num + 'px'; - } - - // skipListeners allows us to avoid triggering the resize event when setting both width and height - if (!skipListeners) { - /** - * Triggered when a component is resized. - * - * @event Component#componentresize - * @type {EventTarget~Event} - */ - this.trigger('componentresize'); - } - - return; - } - - // Not setting a value, so getting it - // Make sure element exists - if (!this.el_) { - return 0; - } - - // Get dimension value from style - var val = this.el_.style[widthOrHeight]; - var pxIndex = val.indexOf('px'); - - if (pxIndex !== -1) { - // Return the pixel value with no 'px' - return parseInt(val.slice(0, pxIndex), 10); - } - - // No px so using % or no style was set, so falling back to offsetWidth/height - // If component has display:none, offset will return 0 - // TODO: handle display:none and no dimension style using px - return parseInt(this.el_['offset' + toTitleCase(widthOrHeight)], 10); - }; - - /** - * Get the width or the height of the `Component` elements computed style. Uses - * `window.getComputedStyle`. - * - * @param {string} widthOrHeight - * A string containing 'width' or 'height'. Whichever one you want to get. - * - * @return {number} - * The dimension that gets asked for or 0 if nothing was set - * for that dimension. - */ - - - Component.prototype.currentDimension = function currentDimension(widthOrHeight) { - var computedWidthOrHeight = 0; - - if (widthOrHeight !== 'width' && widthOrHeight !== 'height') { - throw new Error('currentDimension only accepts width or height value'); - } - - if (typeof window_1.getComputedStyle === 'function') { - var computedStyle = window_1.getComputedStyle(this.el_); - - computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight]; - } - - // remove 'px' from variable and parse as integer - computedWidthOrHeight = parseFloat(computedWidthOrHeight); - - // if the computed value is still 0, it's possible that the browser is lying - // and we want to check the offset values. - // This code also runs on IE8 and wherever getComputedStyle doesn't exist. - if (computedWidthOrHeight === 0) { - var rule = 'offset' + toTitleCase(widthOrHeight); - - computedWidthOrHeight = this.el_[rule]; - } - - return computedWidthOrHeight; - }; - - /** - * An object that contains width and height values of the `Component`s - * computed style. Uses `window.getComputedStyle`. - * - * @typedef {Object} Component~DimensionObject - * - * @property {number} width - * The width of the `Component`s computed style. - * - * @property {number} height - * The height of the `Component`s computed style. - */ - - /** - * Get an object that contains width and height values of the `Component`s - * computed style. - * - * @return {Component~DimensionObject} - * The dimensions of the components element - */ - - - Component.prototype.currentDimensions = function currentDimensions() { - return { - width: this.currentDimension('width'), - height: this.currentDimension('height') - }; - }; - - /** - * Get the width of the `Component`s computed style. Uses `window.getComputedStyle`. - * - * @return {number} width - * The width of the `Component`s computed style. - */ - - - Component.prototype.currentWidth = function currentWidth() { - return this.currentDimension('width'); - }; - - /** - * Get the height of the `Component`s computed style. Uses `window.getComputedStyle`. - * - * @return {number} height - * The height of the `Component`s computed style. - */ - - - Component.prototype.currentHeight = function currentHeight() { - return this.currentDimension('height'); - }; - - /** - * Set the focus to this component - */ - - - Component.prototype.focus = function focus() { - this.el_.focus(); - }; - - /** - * Remove the focus from this component - */ - - - Component.prototype.blur = function blur() { - this.el_.blur(); - }; - - /** - * Emit a 'tap' events when touch event support gets detected. This gets used to - * support toggling the controls through a tap on the video. They get enabled - * because every sub-component would have extra overhead otherwise. - * - * @private - * @fires Component#tap - * @listens Component#touchstart - * @listens Component#touchmove - * @listens Component#touchleave - * @listens Component#touchcancel - * @listens Component#touchend - */ - - - Component.prototype.emitTapEvents = function emitTapEvents() { - // Track the start time so we can determine how long the touch lasted - var touchStart = 0; - var firstTouch = null; - - // Maximum movement allowed during a touch event to still be considered a tap - // Other popular libs use anywhere from 2 (hammer.js) to 15, - // so 10 seems like a nice, round number. - var tapMovementThreshold = 10; - - // The maximum length a touch can be while still being considered a tap - var touchTimeThreshold = 200; - - var couldBeTap = void 0; - - this.on('touchstart', function (event) { - // If more than one finger, don't consider treating this as a click - if (event.touches.length === 1) { - // Copy pageX/pageY from the object - firstTouch = { - pageX: event.touches[0].pageX, - pageY: event.touches[0].pageY - }; - // Record start time so we can detect a tap vs. "touch and hold" - touchStart = new Date().getTime(); - // Reset couldBeTap tracking - couldBeTap = true; - } - }); - - this.on('touchmove', function (event) { - // If more than one finger, don't consider treating this as a click - if (event.touches.length > 1) { - couldBeTap = false; - } else if (firstTouch) { - // Some devices will throw touchmoves for all but the slightest of taps. - // So, if we moved only a small distance, this could still be a tap - var xdiff = event.touches[0].pageX - firstTouch.pageX; - var ydiff = event.touches[0].pageY - firstTouch.pageY; - var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff); - - if (touchDistance > tapMovementThreshold) { - couldBeTap = false; - } - } - }); - - var noTap = function noTap() { - couldBeTap = false; - }; - - // TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s - this.on('touchleave', noTap); - this.on('touchcancel', noTap); - - // When the touch ends, measure how long it took and trigger the appropriate - // event - this.on('touchend', function (event) { - firstTouch = null; - // Proceed only if the touchmove/leave/cancel event didn't happen - if (couldBeTap === true) { - // Measure how long the touch lasted - var touchTime = new Date().getTime() - touchStart; - - // Make sure the touch was less than the threshold to be considered a tap - if (touchTime < touchTimeThreshold) { - // Don't let browser turn this into a click - event.preventDefault(); - /** - * Triggered when a `Component` is tapped. - * - * @event Component#tap - * @type {EventTarget~Event} - */ - this.trigger('tap'); - // It may be good to copy the touchend event object and change the - // type to tap, if the other event properties aren't exact after - // Events.fixEvent runs (e.g. event.target) - } - } - }); - }; - - /** - * This function reports user activity whenever touch events happen. This can get - * turned off by any sub-components that wants touch events to act another way. - * - * Report user touch activity when touch events occur. User activity gets used to - * determine when controls should show/hide. It is simple when it comes to mouse - * events, because any mouse event should show the controls. So we capture mouse - * events that bubble up to the player and report activity when that happens. - * With touch events it isn't as easy as `touchstart` and `touchend` toggle player - * controls. So touch events can't help us at the player level either. - * - * User activity gets checked asynchronously. So what could happen is a tap event - * on the video turns the controls off. Then the `touchend` event bubbles up to - * the player. Which, if it reported user activity, would turn the controls right - * back on. We also don't want to completely block touch events from bubbling up. - * Furthermore a `touchmove` event and anything other than a tap, should not turn - * controls back on. - * - * @listens Component#touchstart - * @listens Component#touchmove - * @listens Component#touchend - * @listens Component#touchcancel - */ - - - Component.prototype.enableTouchActivity = function enableTouchActivity() { - // Don't continue if the root player doesn't support reporting user activity - if (!this.player() || !this.player().reportUserActivity) { - return; - } - - // listener for reporting that the user is active - var report = bind(this.player(), this.player().reportUserActivity); - - var touchHolding = void 0; - - this.on('touchstart', function () { - report(); - // For as long as the they are touching the device or have their mouse down, - // we consider them active even if they're not moving their finger or mouse. - // So we want to continue to update that they are active - this.clearInterval(touchHolding); - // report at the same interval as activityCheck - touchHolding = this.setInterval(report, 250); - }); - - var touchEnd = function touchEnd(event) { - report(); - // stop the interval that maintains activity if the touch is holding - this.clearInterval(touchHolding); - }; - - this.on('touchmove', report); - this.on('touchend', touchEnd); - this.on('touchcancel', touchEnd); - }; - - /** - * A callback that has no parameters and is bound into `Component`s context. - * - * @callback Component~GenericCallback - * @this Component - */ - - /** - * Creates a function that runs after an `x` millisecond timeout. This function is a - * wrapper around `window.setTimeout`. There are a few reasons to use this one - * instead though: - * 1. It gets cleared via {@link Component#clearTimeout} when - * {@link Component#dispose} gets called. - * 2. The function callback will gets turned into a {@link Component~GenericCallback} - * - * > Note: You can use `window.clearTimeout` on the id returned by this function. This - * will cause its dispose listener not to get cleaned up! Please use - * {@link Component#clearTimeout} or {@link Component#dispose}. - * - * @param {Component~GenericCallback} fn - * The function that will be run after `timeout`. - * - * @param {number} timeout - * Timeout in milliseconds to delay before executing the specified function. - * - * @return {number} - * Returns a timeout ID that gets used to identify the timeout. It can also - * get used in {@link Component#clearTimeout} to clear the timeout that - * was set. - * - * @listens Component#dispose - * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout} - */ - - - Component.prototype.setTimeout = function setTimeout(fn, timeout) { - fn = bind(this, fn); - - var timeoutId = window_1.setTimeout(fn, timeout); - var disposeFn = function disposeFn() { - this.clearTimeout(timeoutId); - }; - - disposeFn.guid = 'vjs-timeout-' + timeoutId; - - this.on('dispose', disposeFn); - - return timeoutId; - }; - - /** - * Clears a timeout that gets created via `window.setTimeout` or - * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout} - * use this function instead of `window.clearTimout`. If you don't your dispose - * listener will not get cleaned up until {@link Component#dispose}! - * - * @param {number} timeoutId - * The id of the timeout to clear. The return value of - * {@link Component#setTimeout} or `window.setTimeout`. - * - * @return {number} - * Returns the timeout id that was cleared. - * - * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout} - */ - - - Component.prototype.clearTimeout = function clearTimeout(timeoutId) { - window_1.clearTimeout(timeoutId); - - var disposeFn = function disposeFn() {}; - - disposeFn.guid = 'vjs-timeout-' + timeoutId; - - this.off('dispose', disposeFn); - - return timeoutId; - }; - - /** - * Creates a function that gets run every `x` milliseconds. This function is a wrapper - * around `window.setInterval`. There are a few reasons to use this one instead though. - * 1. It gets cleared via {@link Component#clearInterval} when - * {@link Component#dispose} gets called. - * 2. The function callback will be a {@link Component~GenericCallback} - * - * @param {Component~GenericCallback} fn - * The function to run every `x` seconds. - * - * @param {number} interval - * Execute the specified function every `x` milliseconds. - * - * @return {number} - * Returns an id that can be used to identify the interval. It can also be be used in - * {@link Component#clearInterval} to clear the interval. - * - * @listens Component#dispose - * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval} - */ - - - Component.prototype.setInterval = function setInterval(fn, interval) { - fn = bind(this, fn); - - var intervalId = window_1.setInterval(fn, interval); - - var disposeFn = function disposeFn() { - this.clearInterval(intervalId); - }; - - disposeFn.guid = 'vjs-interval-' + intervalId; - - this.on('dispose', disposeFn); - - return intervalId; - }; - - /** - * Clears an interval that gets created via `window.setInterval` or - * {@link Component#setInterval}. If you set an inteval via {@link Component#setInterval} - * use this function instead of `window.clearInterval`. If you don't your dispose - * listener will not get cleaned up until {@link Component#dispose}! - * - * @param {number} intervalId - * The id of the interval to clear. The return value of - * {@link Component#setInterval} or `window.setInterval`. - * - * @return {number} - * Returns the interval id that was cleared. - * - * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval} - */ - - - Component.prototype.clearInterval = function clearInterval(intervalId) { - window_1.clearInterval(intervalId); - - var disposeFn = function disposeFn() {}; - - disposeFn.guid = 'vjs-interval-' + intervalId; - - this.off('dispose', disposeFn); - - return intervalId; - }; - - /** - * Queues up a callback to be passed to requestAnimationFrame (rAF), but - * with a few extra bonuses: - * - * - Supports browsers that do not support rAF by falling back to - * {@link Component#setTimeout}. - * - * - The callback is turned into a {@link Component~GenericCallback} (i.e. - * bound to the component). - * - * - Automatic cancellation of the rAF callback is handled if the component - * is disposed before it is called. - * - * @param {Component~GenericCallback} fn - * A function that will be bound to this component and executed just - * before the browser's next repaint. - * - * @return {number} - * Returns an rAF ID that gets used to identify the timeout. It can - * also be used in {@link Component#cancelAnimationFrame} to cancel - * the animation frame callback. - * - * @listens Component#dispose - * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame} - */ - - - Component.prototype.requestAnimationFrame = function requestAnimationFrame(fn) { - var _this2 = this; - - if (this.supportsRaf_) { - fn = bind(this, fn); - - var id = window_1.requestAnimationFrame(fn); - var disposeFn = function disposeFn() { - return _this2.cancelAnimationFrame(id); - }; - - disposeFn.guid = 'vjs-raf-' + id; - this.on('dispose', disposeFn); - - return id; - } - - // Fall back to using a timer. - return this.setTimeout(fn, 1000 / 60); - }; - - /** - * Cancels a queued callback passed to {@link Component#requestAnimationFrame} - * (rAF). - * - * If you queue an rAF callback via {@link Component#requestAnimationFrame}, - * use this function instead of `window.cancelAnimationFrame`. If you don't, - * your dispose listener will not get cleaned up until {@link Component#dispose}! - * - * @param {number} id - * The rAF ID to clear. The return value of {@link Component#requestAnimationFrame}. - * - * @return {number} - * Returns the rAF ID that was cleared. - * - * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/cancelAnimationFrame} - */ - - - Component.prototype.cancelAnimationFrame = function cancelAnimationFrame(id) { - if (this.supportsRaf_) { - window_1.cancelAnimationFrame(id); - - var disposeFn = function disposeFn() {}; - - disposeFn.guid = 'vjs-raf-' + id; - - this.off('dispose', disposeFn); - - return id; - } - - // Fall back to using a timer. - return this.clearTimeout(id); - }; - - /** - * Register a `Component` with `videojs` given the name and the component. - * - * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s - * should be registered using {@link Tech.registerTech} or - * {@link videojs:videojs.registerTech}. - * - * > NOTE: This function can also be seen on videojs as - * {@link videojs:videojs.registerComponent}. - * - * @param {string} name - * The name of the `Component` to register. - * - * @param {Component} ComponentToRegister - * The `Component` class to register. - * - * @return {Component} - * The `Component` that was registered. - */ - - - Component.registerComponent = function registerComponent(name, ComponentToRegister) { - if (typeof name !== 'string' || !name) { - throw new Error('Illegal component name, "' + name + '"; must be a non-empty string.'); - } - - var Tech = Component.getComponent('Tech'); - - // We need to make sure this check is only done if Tech has been registered. - var isTech = Tech && Tech.isTech(ComponentToRegister); - var isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype); - - if (isTech || !isComp) { - var reason = void 0; - - if (isTech) { - reason = 'techs must be registered using Tech.registerTech()'; - } else { - reason = 'must be a Component subclass'; - } - - throw new Error('Illegal component, "' + name + '"; ' + reason + '.'); - } - - name = toTitleCase(name); - - if (!Component.components_) { - Component.components_ = {}; - } - - var Player = Component.getComponent('Player'); - - if (name === 'Player' && Player && Player.players) { - var players = Player.players; - var playerNames = Object.keys(players); - - // If we have players that were disposed, then their name will still be - // in Players.players. So, we must loop through and verify that the value - // for each item is not null. This allows registration of the Player component - // after all players have been disposed or before any were created. - if (players && playerNames.length > 0 && playerNames.map(function (pname) { - return players[pname]; - }).every(Boolean)) { - throw new Error('Can not register Player component after player has been created.'); - } - } - - Component.components_[name] = ComponentToRegister; - - return ComponentToRegister; - }; - - /** - * Get a `Component` based on the name it was registered with. - * - * @param {string} name - * The Name of the component to get. - * - * @return {Component} - * The `Component` that got registered under the given name. - * - * @deprecated In `videojs` 6 this will not return `Component`s that were not - * registered using {@link Component.registerComponent}. Currently we - * check the global `videojs` object for a `Component` name and - * return that if it exists. - */ - - - Component.getComponent = function getComponent(name) { - if (!name) { - return; - } - - name = toTitleCase(name); - - if (Component.components_ && Component.components_[name]) { - return Component.components_[name]; - } - }; - - return Component; -}(); - -/** - * Whether or not this component supports `requestAnimationFrame`. - * - * This is exposed primarily for testing purposes. - * - * @private - * @type {Boolean} - */ - - -Component.prototype.supportsRaf_ = typeof window_1.requestAnimationFrame === 'function' && typeof window_1.cancelAnimationFrame === 'function'; - -Component.registerComponent('Component', Component); - -/** - * @file time-ranges.js - * @module time-ranges - */ - -/** - * Returns the time for the specified index at the start or end - * of a TimeRange object. - * - * @function time-ranges:indexFunction - * - * @param {number} [index=0] - * The range number to return the time for. - * - * @return {number} - * The time that offset at the specified index. - * - * @depricated index must be set to a value, in the future this will throw an error. - */ - -/** - * An object that contains ranges of time for various reasons. - * - * @typedef {Object} TimeRange - * - * @property {number} length - * The number of time ranges represented by this Object - * - * @property {time-ranges:indexFunction} start - * Returns the time offset at which a specified time range begins. - * - * @property {time-ranges:indexFunction} end - * Returns the time offset at which a specified time range begins. - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges - */ - -/** - * Check if any of the time ranges are over the maximum index. - * - * @param {string} fnName - * The function name to use for logging - * - * @param {number} index - * The index to check - * - * @param {number} maxIndex - * The maximum possible index - * - * @throws {Error} if the timeRanges provided are over the maxIndex - */ -function rangeCheck(fnName, index, maxIndex) { - if (typeof index !== 'number' || index < 0 || index > maxIndex) { - throw new Error('Failed to execute \'' + fnName + '\' on \'TimeRanges\': The index provided (' + index + ') is non-numeric or out of bounds (0-' + maxIndex + ').'); - } -} - -/** - * Check if any of the time ranges are over the maximum index. - * - * @param {string} fnName - * The function name to use for logging - * - * @param {string} valueIndex - * The proprety that should be used to get the time. should be 'start' or 'end' - * - * @param {Array} ranges - * An array of time ranges - * - * @param {Array} [rangeIndex=0] - * The index to start the search at - * - * @return {number} - * The time that offset at the specified index. - * - * - * @depricated rangeIndex must be set to a value, in the future this will throw an error. - * @throws {Error} if rangeIndex is more than the length of ranges - */ -function getRange(fnName, valueIndex, ranges, rangeIndex) { - rangeCheck(fnName, rangeIndex, ranges.length - 1); - return ranges[rangeIndex][valueIndex]; -} - -/** - * Create a time range object givent ranges of time. - * - * @param {Array} [ranges] - * An array of time ranges. - */ -function createTimeRangesObj(ranges) { - if (ranges === undefined || ranges.length === 0) { - return { - length: 0, - start: function start() { - throw new Error('This TimeRanges object is empty'); - }, - end: function end() { - throw new Error('This TimeRanges object is empty'); - } - }; - } - return { - length: ranges.length, - start: getRange.bind(null, 'start', 0, ranges), - end: getRange.bind(null, 'end', 1, ranges) - }; -} - -/** - * Should create a fake `TimeRange` object which mimics an HTML5 time range instance. - * - * @param {number|Array} start - * The start of a single range or an array of ranges - * - * @param {number} end - * The end of a single range. - * - * @private - */ -function createTimeRanges(start, end) { - if (Array.isArray(start)) { - return createTimeRangesObj(start); - } else if (start === undefined || end === undefined) { - return createTimeRangesObj(); - } - return createTimeRangesObj([[start, end]]); -} - -/** - * @file buffer.js - * @module buffer - */ -/** - * Compute the percentage of the media that has been buffered. - * - * @param {TimeRange} buffered - * The current `TimeRange` object representing buffered time ranges - * - * @param {number} duration - * Total duration of the media - * - * @return {number} - * Percent buffered of the total duration in decimal form. - */ -function bufferedPercent(buffered, duration) { - var bufferedDuration = 0; - var start = void 0; - var end = void 0; - - if (!duration) { - return 0; - } - - if (!buffered || !buffered.length) { - buffered = createTimeRanges(0, 0); - } - - for (var i = 0; i < buffered.length; i++) { - start = buffered.start(i); - end = buffered.end(i); - - // buffered end can be bigger than duration by a very small fraction - if (end > duration) { - end = duration; - } - - bufferedDuration += end - start; - } - - return bufferedDuration / duration; -} - -/** - * @file fullscreen-api.js - * @module fullscreen-api - * @private - */ -/** - * Store the browser-specific methods for the fullscreen API. - * - * @type {Object} - * @see [Specification]{@link https://fullscreen.spec.whatwg.org} - * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js} - */ -var FullscreenApi = {}; - -// browser API methods -var apiMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], -// WebKit -['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], -// Old WebKit (Safari 5.1) -['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], -// Mozilla -['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], -// Microsoft -['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']]; - -var specApi = apiMap[0]; -var browserApi = void 0; - -// determine the supported set of functions -for (var i = 0; i < apiMap.length; i++) { - // check for exitFullscreen function - if (apiMap[i][1] in document_1) { - browserApi = apiMap[i]; - break; - } -} - -// map the browser API names to the spec API names -if (browserApi) { - for (var _i = 0; _i < browserApi.length; _i++) { - FullscreenApi[specApi[_i]] = browserApi[_i]; - } -} - -/** - * @file media-error.js - */ -/** - * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class. - * - * @param {number|string|Object|MediaError} value - * This can be of multiple types: - * - number: should be a standard error code - * - string: an error message (the code will be 0) - * - Object: arbitrary properties - * - `MediaError` (native): used to populate a video.js `MediaError` object - * - `MediaError` (video.js): will return itself if it's already a - * video.js `MediaError` object. - * - * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror} - * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes} - * - * @class MediaError - */ -function MediaError(value) { - - // Allow redundant calls to this constructor to avoid having `instanceof` - // checks peppered around the code. - if (value instanceof MediaError) { - return value; - } - - if (typeof value === 'number') { - this.code = value; - } else if (typeof value === 'string') { - // default code is zero, so this is a custom error - this.message = value; - } else if (isObject(value)) { - - // We assign the `code` property manually because native `MediaError` objects - // do not expose it as an own/enumerable property of the object. - if (typeof value.code === 'number') { - this.code = value.code; - } - - assign(this, value); - } - - if (!this.message) { - this.message = MediaError.defaultMessages[this.code] || ''; - } -} - -/** - * The error code that refers two one of the defined `MediaError` types - * - * @type {Number} - */ -MediaError.prototype.code = 0; - -/** - * An optional message that to show with the error. Message is not part of the HTML5 - * video spec but allows for more informative custom errors. - * - * @type {String} - */ -MediaError.prototype.message = ''; - -/** - * An optional status code that can be set by plugins to allow even more detail about - * the error. For example a plugin might provide a specific HTTP status code and an - * error message for that code. Then when the plugin gets that error this class will - * know how to display an error message for it. This allows a custom message to show - * up on the `Player` error overlay. - * - * @type {Array} - */ -MediaError.prototype.status = null; - -/** - * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the - * specification listed under {@link MediaError} for more information. - * - * @enum {array} - * @readonly - * @property {string} 0 - MEDIA_ERR_CUSTOM - * @property {string} 1 - MEDIA_ERR_CUSTOM - * @property {string} 2 - MEDIA_ERR_ABORTED - * @property {string} 3 - MEDIA_ERR_NETWORK - * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED - * @property {string} 5 - MEDIA_ERR_ENCRYPTED - */ -MediaError.errorTypes = ['MEDIA_ERR_CUSTOM', 'MEDIA_ERR_ABORTED', 'MEDIA_ERR_NETWORK', 'MEDIA_ERR_DECODE', 'MEDIA_ERR_SRC_NOT_SUPPORTED', 'MEDIA_ERR_ENCRYPTED']; - -/** - * The default `MediaError` messages based on the {@link MediaError.errorTypes}. - * - * @type {Array} - * @constant - */ -MediaError.defaultMessages = { - 1: 'You aborted the media playback', - 2: 'A network error caused the media download to fail part-way.', - 3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.', - 4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.', - 5: 'The media is encrypted and we do not have the keys to decrypt it.' -}; - -// Add types as properties on MediaError -// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4; -for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) { - MediaError[MediaError.errorTypes[errNum]] = errNum; - // values should be accessible on both the class and instance - MediaError.prototype[MediaError.errorTypes[errNum]] = errNum; -} - -var tuple = SafeParseTuple; - -function SafeParseTuple(obj, reviver) { - var json; - var error = null; - - try { - json = JSON.parse(obj, reviver); - } catch (err) { - error = err; - } - - return [error, json] -} - -/** - * @file text-track-list-converter.js Utilities for capturing text track state and - * re-creating tracks based on a capture. - * - * @module text-track-list-converter - */ - -/** - * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that - * represents the {@link TextTrack}'s state. - * - * @param {TextTrack} track - * The text track to query. - * - * @return {Object} - * A serializable javascript representation of the TextTrack. - * @private - */ -var trackToJson_ = function trackToJson_(track) { - var ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce(function (acc, prop, i) { - - if (track[prop]) { - acc[prop] = track[prop]; - } - - return acc; - }, { - cues: track.cues && Array.prototype.map.call(track.cues, function (cue) { - return { - startTime: cue.startTime, - endTime: cue.endTime, - text: cue.text, - id: cue.id - }; - }) - }); - - return ret; -}; - -/** - * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the - * state of all {@link TextTrack}s currently configured. The return array is compatible with - * {@link text-track-list-converter:jsonToTextTracks}. - * - * @param {Tech} tech - * The tech object to query - * - * @return {Array} - * A serializable javascript representation of the {@link Tech}s - * {@link TextTrackList}. - */ -var textTracksToJson = function textTracksToJson(tech) { - - var trackEls = tech.$$('track'); - - var trackObjs = Array.prototype.map.call(trackEls, function (t) { - return t.track; - }); - var tracks = Array.prototype.map.call(trackEls, function (trackEl) { - var json = trackToJson_(trackEl.track); - - if (trackEl.src) { - json.src = trackEl.src; - } - return json; - }); - - return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) { - return trackObjs.indexOf(track) === -1; - }).map(trackToJson_)); -}; - -/** - * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript - * object {@link TextTrack} representations. - * - * @param {Array} json - * An array of `TextTrack` representation objects, like those that would be - * produced by `textTracksToJson`. - * - * @param {Tech} tech - * The `Tech` to create the `TextTrack`s on. - */ -var jsonToTextTracks = function jsonToTextTracks(json, tech) { - json.forEach(function (track) { - var addedTrack = tech.addRemoteTextTrack(track).track; - - if (!track.src && track.cues) { - track.cues.forEach(function (cue) { - return addedTrack.addCue(cue); - }); - } - }); - - return tech.textTracks(); -}; - -var textTrackConverter = { textTracksToJson: textTracksToJson, jsonToTextTracks: jsonToTextTracks, trackToJson_: trackToJson_ }; - -/** - * @file modal-dialog.js - */ -var MODAL_CLASS_NAME = 'vjs-modal-dialog'; -var ESC = 27; - -/** - * The `ModalDialog` displays over the video and its controls, which blocks - * interaction with the player until it is closed. - * - * Modal dialogs include a "Close" button and will close when that button - * is activated - or when ESC is pressed anywhere. - * - * @extends Component - */ - -var ModalDialog = function (_Component) { - inherits(ModalDialog, _Component); - - /** - * Create an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Mixed} [options.content=undefined] - * Provide customized content for this modal. - * - * @param {string} [options.description] - * A text description for the modal, primarily for accessibility. - * - * @param {boolean} [options.fillAlways=false] - * Normally, modals are automatically filled only the first time - * they open. This tells the modal to refresh its content - * every time it opens. - * - * @param {string} [options.label] - * A text label for the modal, primarily for accessibility. - * - * @param {boolean} [options.temporary=true] - * If `true`, the modal can only be opened once; it will be - * disposed as soon as it's closed. - * - * @param {boolean} [options.uncloseable=false] - * If `true`, the user will not be able to close the modal - * through the UI in the normal ways. Programmatic closing is - * still possible. - */ - function ModalDialog(player, options) { - classCallCheck(this, ModalDialog); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false; - - _this.closeable(!_this.options_.uncloseable); - _this.content(_this.options_.content); - - // Make sure the contentEl is defined AFTER any children are initialized - // because we only want the contents of the modal in the contentEl - // (not the UI elements like the close button). - _this.contentEl_ = createEl('div', { - className: MODAL_CLASS_NAME + '-content' - }, { - role: 'document' - }); - - _this.descEl_ = createEl('p', { - className: MODAL_CLASS_NAME + '-description vjs-control-text', - id: _this.el().getAttribute('aria-describedby') - }); - - textContent(_this.descEl_, _this.description()); - _this.el_.appendChild(_this.descEl_); - _this.el_.appendChild(_this.contentEl_); - return _this; - } - - /** - * Create the `ModalDialog`'s DOM element - * - * @return {Element} - * The DOM element that gets created. - */ - - - ModalDialog.prototype.createEl = function createEl$$1() { - return _Component.prototype.createEl.call(this, 'div', { - className: this.buildCSSClass(), - tabIndex: -1 - }, { - 'aria-describedby': this.id() + '_description', - 'aria-hidden': 'true', - 'aria-label': this.label(), - 'role': 'dialog' - }); - }; - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - ModalDialog.prototype.buildCSSClass = function buildCSSClass() { - return MODAL_CLASS_NAME + ' vjs-hidden ' + _Component.prototype.buildCSSClass.call(this); - }; - - /** - * Handles `keydown` events on the document, looking for ESC, which closes - * the modal. - * - * @param {EventTarget~Event} e - * The keypress that triggered this event. - * - * @listens keydown - */ - - - ModalDialog.prototype.handleKeyPress = function handleKeyPress(e) { - if (e.which === ESC && this.closeable()) { - this.close(); - } - }; - - /** - * Returns the label string for this modal. Primarily used for accessibility. - * - * @return {string} - * the localized or raw label of this modal. - */ - - - ModalDialog.prototype.label = function label() { - return this.localize(this.options_.label || 'Modal Window'); - }; - - /** - * Returns the description string for this modal. Primarily used for - * accessibility. - * - * @return {string} - * The localized or raw description of this modal. - */ - - - ModalDialog.prototype.description = function description() { - var desc = this.options_.description || this.localize('This is a modal window.'); - - // Append a universal closeability message if the modal is closeable. - if (this.closeable()) { - desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.'); - } - - return desc; - }; - - /** - * Opens the modal. - * - * @fires ModalDialog#beforemodalopen - * @fires ModalDialog#modalopen - */ - - - ModalDialog.prototype.open = function open() { - if (!this.opened_) { - var player = this.player(); - - /** - * Fired just before a `ModalDialog` is opened. - * - * @event ModalDialog#beforemodalopen - * @type {EventTarget~Event} - */ - this.trigger('beforemodalopen'); - this.opened_ = true; - - // Fill content if the modal has never opened before and - // never been filled. - if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) { - this.fill(); - } - - // If the player was playing, pause it and take note of its previously - // playing state. - this.wasPlaying_ = !player.paused(); - - if (this.options_.pauseOnOpen && this.wasPlaying_) { - player.pause(); - } - - if (this.closeable()) { - this.on(this.el_.ownerDocument, 'keydown', bind(this, this.handleKeyPress)); - } - - player.controls(false); - this.show(); - this.conditionalFocus_(); - this.el().setAttribute('aria-hidden', 'false'); - - /** - * Fired just after a `ModalDialog` is opened. - * - * @event ModalDialog#modalopen - * @type {EventTarget~Event} - */ - this.trigger('modalopen'); - this.hasBeenOpened_ = true; - } - }; - - /** - * If the `ModalDialog` is currently open or closed. - * - * @param {boolean} [value] - * If given, it will open (`true`) or close (`false`) the modal. - * - * @return {boolean} - * the current open state of the modaldialog - */ - - - ModalDialog.prototype.opened = function opened(value) { - if (typeof value === 'boolean') { - this[value ? 'open' : 'close'](); - } - return this.opened_; - }; - - /** - * Closes the modal, does nothing if the `ModalDialog` is - * not open. - * - * @fires ModalDialog#beforemodalclose - * @fires ModalDialog#modalclose - */ - - - ModalDialog.prototype.close = function close() { - if (!this.opened_) { - return; - } - var player = this.player(); - - /** - * Fired just before a `ModalDialog` is closed. - * - * @event ModalDialog#beforemodalclose - * @type {EventTarget~Event} - */ - this.trigger('beforemodalclose'); - this.opened_ = false; - - if (this.wasPlaying_ && this.options_.pauseOnOpen) { - player.play(); - } - - if (this.closeable()) { - this.off(this.el_.ownerDocument, 'keydown', bind(this, this.handleKeyPress)); - } - - player.controls(true); - this.hide(); - this.el().setAttribute('aria-hidden', 'true'); - - /** - * Fired just after a `ModalDialog` is closed. - * - * @event ModalDialog#modalclose - * @type {EventTarget~Event} - */ - this.trigger('modalclose'); - this.conditionalBlur_(); - - if (this.options_.temporary) { - this.dispose(); - } - }; - - /** - * Check to see if the `ModalDialog` is closeable via the UI. - * - * @param {boolean} [value] - * If given as a boolean, it will set the `closeable` option. - * - * @return {boolean} - * Returns the final value of the closable option. - */ - - - ModalDialog.prototype.closeable = function closeable(value) { - if (typeof value === 'boolean') { - var closeable = this.closeable_ = !!value; - var close = this.getChild('closeButton'); - - // If this is being made closeable and has no close button, add one. - if (closeable && !close) { - - // The close button should be a child of the modal - not its - // content element, so temporarily change the content element. - var temp = this.contentEl_; - - this.contentEl_ = this.el_; - close = this.addChild('closeButton', { controlText: 'Close Modal Dialog' }); - this.contentEl_ = temp; - this.on(close, 'close', this.close); - } - - // If this is being made uncloseable and has a close button, remove it. - if (!closeable && close) { - this.off(close, 'close', this.close); - this.removeChild(close); - close.dispose(); - } - } - return this.closeable_; - }; - - /** - * Fill the modal's content element with the modal's "content" option. - * The content element will be emptied before this change takes place. - */ - - - ModalDialog.prototype.fill = function fill() { - this.fillWith(this.content()); - }; - - /** - * Fill the modal's content element with arbitrary content. - * The content element will be emptied before this change takes place. - * - * @fires ModalDialog#beforemodalfill - * @fires ModalDialog#modalfill - * - * @param {Mixed} [content] - * The same rules apply to this as apply to the `content` option. - */ - - - ModalDialog.prototype.fillWith = function fillWith(content) { - var contentEl = this.contentEl(); - var parentEl = contentEl.parentNode; - var nextSiblingEl = contentEl.nextSibling; - - /** - * Fired just before a `ModalDialog` is filled with content. - * - * @event ModalDialog#beforemodalfill - * @type {EventTarget~Event} - */ - this.trigger('beforemodalfill'); - this.hasBeenFilled_ = true; - - // Detach the content element from the DOM before performing - // manipulation to avoid modifying the live DOM multiple times. - parentEl.removeChild(contentEl); - this.empty(); - insertContent(contentEl, content); - /** - * Fired just after a `ModalDialog` is filled with content. - * - * @event ModalDialog#modalfill - * @type {EventTarget~Event} - */ - this.trigger('modalfill'); - - // Re-inject the re-filled content element. - if (nextSiblingEl) { - parentEl.insertBefore(contentEl, nextSiblingEl); - } else { - parentEl.appendChild(contentEl); - } - - // make sure that the close button is last in the dialog DOM - var closeButton = this.getChild('closeButton'); - - if (closeButton) { - parentEl.appendChild(closeButton.el_); - } - }; - - /** - * Empties the content element. This happens anytime the modal is filled. - * - * @fires ModalDialog#beforemodalempty - * @fires ModalDialog#modalempty - */ - - - ModalDialog.prototype.empty = function empty() { - /** - * Fired just before a `ModalDialog` is emptied. - * - * @event ModalDialog#beforemodalempty - * @type {EventTarget~Event} - */ - this.trigger('beforemodalempty'); - emptyEl(this.contentEl()); - - /** - * Fired just after a `ModalDialog` is emptied. - * - * @event ModalDialog#modalempty - * @type {EventTarget~Event} - */ - this.trigger('modalempty'); - }; - - /** - * Gets or sets the modal content, which gets normalized before being - * rendered into the DOM. - * - * This does not update the DOM or fill the modal, but it is called during - * that process. - * - * @param {Mixed} [value] - * If defined, sets the internal content value to be used on the - * next call(s) to `fill`. This value is normalized before being - * inserted. To "clear" the internal content value, pass `null`. - * - * @return {Mixed} - * The current content of the modal dialog - */ - - - ModalDialog.prototype.content = function content(value) { - if (typeof value !== 'undefined') { - this.content_ = value; - } - return this.content_; - }; - - /** - * conditionally focus the modal dialog if focus was previously on the player. - * - * @private - */ - - - ModalDialog.prototype.conditionalFocus_ = function conditionalFocus_() { - var activeEl = document_1.activeElement; - var playerEl = this.player_.el_; - - this.previouslyActiveEl_ = null; - - if (playerEl.contains(activeEl) || playerEl === activeEl) { - this.previouslyActiveEl_ = activeEl; - - this.focus(); - - this.on(document_1, 'keydown', this.handleKeyDown); - } - }; - - /** - * conditionally blur the element and refocus the last focused element - * - * @private - */ - - - ModalDialog.prototype.conditionalBlur_ = function conditionalBlur_() { - if (this.previouslyActiveEl_) { - this.previouslyActiveEl_.focus(); - this.previouslyActiveEl_ = null; - } - - this.off(document_1, 'keydown', this.handleKeyDown); - }; - - /** - * Keydown handler. Attached when modal is focused. - * - * @listens keydown - */ - - - ModalDialog.prototype.handleKeyDown = function handleKeyDown(event) { - // exit early if it isn't a tab key - if (event.which !== 9) { - return; - } - - var focusableEls = this.focusableEls_(); - var activeEl = this.el_.querySelector(':focus'); - var focusIndex = void 0; - - for (var i = 0; i < focusableEls.length; i++) { - if (activeEl === focusableEls[i]) { - focusIndex = i; - break; - } - } - - if (document_1.activeElement === this.el_) { - focusIndex = 0; - } - - if (event.shiftKey && focusIndex === 0) { - focusableEls[focusableEls.length - 1].focus(); - event.preventDefault(); - } else if (!event.shiftKey && focusIndex === focusableEls.length - 1) { - focusableEls[0].focus(); - event.preventDefault(); - } - }; - - /** - * get all focusable elements - * - * @private - */ - - - ModalDialog.prototype.focusableEls_ = function focusableEls_() { - var allChildren = this.el_.querySelectorAll('*'); - - return Array.prototype.filter.call(allChildren, function (child) { - return (child instanceof window_1.HTMLAnchorElement || child instanceof window_1.HTMLAreaElement) && child.hasAttribute('href') || (child instanceof window_1.HTMLInputElement || child instanceof window_1.HTMLSelectElement || child instanceof window_1.HTMLTextAreaElement || child instanceof window_1.HTMLButtonElement) && !child.hasAttribute('disabled') || child instanceof window_1.HTMLIFrameElement || child instanceof window_1.HTMLObjectElement || child instanceof window_1.HTMLEmbedElement || child.hasAttribute('tabindex') && child.getAttribute('tabindex') !== -1 || child.hasAttribute('contenteditable'); - }); - }; - - return ModalDialog; -}(Component); - -/** - * Default options for `ModalDialog` default options. - * - * @type {Object} - * @private - */ - - -ModalDialog.prototype.options_ = { - pauseOnOpen: true, - temporary: true -}; - -Component.registerComponent('ModalDialog', ModalDialog); - -/** - * @file track-list.js - */ -/** - * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and - * {@link VideoTrackList} - * - * @extends EventTarget - */ - -var TrackList = function (_EventTarget) { - inherits(TrackList, _EventTarget); - - /** - * Create an instance of this class - * - * @param {Track[]} tracks - * A list of tracks to initialize the list with. - * - * @param {Object} [list] - * The child object with inheritance done manually for ie8. - * - * @abstract - */ - function TrackList() { - var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - var _ret; - - var list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - classCallCheck(this, TrackList); - - var _this = possibleConstructorReturn(this, _EventTarget.call(this)); - - if (!list) { - list = _this; // eslint-disable-line - if (IS_IE8) { - list = document_1.createElement('custom'); - for (var prop in TrackList.prototype) { - if (prop !== 'constructor') { - list[prop] = TrackList.prototype[prop]; - } - } - } - } - - list.tracks_ = []; - - /** - * @memberof TrackList - * @member {number} length - * The current number of `Track`s in the this Trackist. - * @instance - */ - Object.defineProperty(list, 'length', { - get: function get$$1() { - return this.tracks_.length; - } - }); - - for (var i = 0; i < tracks.length; i++) { - list.addTrack(tracks[i]); - } - - // must return the object, as for ie8 it will not be this - // but a reference to a document object - return _ret = list, possibleConstructorReturn(_this, _ret); - } - - /** - * Add a {@link Track} to the `TrackList` - * - * @param {Track} track - * The audio, video, or text track to add to the list. - * - * @fires TrackList#addtrack - */ - - - TrackList.prototype.addTrack = function addTrack(track) { - var index = this.tracks_.length; - - if (!('' + index in this)) { - Object.defineProperty(this, index, { - get: function get$$1() { - return this.tracks_[index]; - } - }); - } - - // Do not add duplicate tracks - if (this.tracks_.indexOf(track) === -1) { - this.tracks_.push(track); - /** - * Triggered when a track is added to a track list. - * - * @event TrackList#addtrack - * @type {EventTarget~Event} - * @property {Track} track - * A reference to track that was added. - */ - this.trigger({ - track: track, - type: 'addtrack' - }); - } - }; - - /** - * Remove a {@link Track} from the `TrackList` - * - * @param {Track} rtrack - * The audio, video, or text track to remove from the list. - * - * @fires TrackList#removetrack - */ - - - TrackList.prototype.removeTrack = function removeTrack(rtrack) { - var track = void 0; - - for (var i = 0, l = this.length; i < l; i++) { - if (this[i] === rtrack) { - track = this[i]; - if (track.off) { - track.off(); - } - - this.tracks_.splice(i, 1); - - break; - } - } - - if (!track) { - return; - } - - /** - * Triggered when a track is removed from track list. - * - * @event TrackList#removetrack - * @type {EventTarget~Event} - * @property {Track} track - * A reference to track that was removed. - */ - this.trigger({ - track: track, - type: 'removetrack' - }); - }; - - /** - * Get a Track from the TrackList by a tracks id - * - * @param {String} id - the id of the track to get - * @method getTrackById - * @return {Track} - * @private - */ - - - TrackList.prototype.getTrackById = function getTrackById(id) { - var result = null; - - for (var i = 0, l = this.length; i < l; i++) { - var track = this[i]; - - if (track.id === id) { - result = track; - break; - } - } - - return result; - }; - - return TrackList; -}(EventTarget); - -/** - * Triggered when a different track is selected/enabled. - * - * @event TrackList#change - * @type {EventTarget~Event} - */ - -/** - * Events that can be called with on + eventName. See {@link EventHandler}. - * - * @property {Object} TrackList#allowedEvents_ - * @private - */ - - -TrackList.prototype.allowedEvents_ = { - change: 'change', - addtrack: 'addtrack', - removetrack: 'removetrack' -}; - -// emulate attribute EventHandler support to allow for feature detection -for (var event in TrackList.prototype.allowedEvents_) { - TrackList.prototype['on' + event] = null; -} - -/** - * @file audio-track-list.js - */ -/** - * Anywhere we call this function we diverge from the spec - * as we only support one enabled audiotrack at a time - * - * @param {AudioTrackList} list - * list to work on - * - * @param {AudioTrack} track - * The track to skip - * - * @private - */ -var disableOthers = function disableOthers(list, track) { - for (var i = 0; i < list.length; i++) { - if (track.id === list[i].id) { - continue; - } - // another audio track is enabled, disable it - list[i].enabled = false; - } -}; - -/** - * The current list of {@link AudioTrack} for a media file. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist} - * @extends TrackList - */ - -var AudioTrackList = function (_TrackList) { - inherits(AudioTrackList, _TrackList); - - /** - * Create an instance of this class. - * - * @param {AudioTrack[]} [tracks=[]] - * A list of `AudioTrack` to instantiate the list with. - */ - function AudioTrackList() { - var _this, _ret; - - var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - classCallCheck(this, AudioTrackList); - - var list = void 0; - - // make sure only 1 track is enabled - // sorted from last index to first index - for (var i = tracks.length - 1; i >= 0; i--) { - if (tracks[i].enabled) { - disableOthers(tracks, tracks[i]); - break; - } - } - - // IE8 forces us to implement inheritance ourselves - // as it does not support Object.defineProperty properly - if (IS_IE8) { - list = document_1.createElement('custom'); - for (var prop in TrackList.prototype) { - if (prop !== 'constructor') { - list[prop] = TrackList.prototype[prop]; - } - } - for (var _prop in AudioTrackList.prototype) { - if (_prop !== 'constructor') { - list[_prop] = AudioTrackList.prototype[_prop]; - } - } - } - - list = (_this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this); - list.changing_ = false; - - return _ret = list, possibleConstructorReturn(_this, _ret); - } - - /** - * Add an {@link AudioTrack} to the `AudioTrackList`. - * - * @param {AudioTrack} track - * The AudioTrack to add to the list - * - * @fires TrackList#addtrack - */ - - - AudioTrackList.prototype.addTrack = function addTrack(track) { - var _this2 = this; - - if (track.enabled) { - disableOthers(this, track); - } - - _TrackList.prototype.addTrack.call(this, track); - // native tracks don't have this - if (!track.addEventListener) { - return; - } - - /** - * @listens AudioTrack#enabledchange - * @fires TrackList#change - */ - track.addEventListener('enabledchange', function () { - // when we are disabling other tracks (since we don't support - // more than one track at a time) we will set changing_ - // to true so that we don't trigger additional change events - if (_this2.changing_) { - return; - } - _this2.changing_ = true; - disableOthers(_this2, track); - _this2.changing_ = false; - _this2.trigger('change'); - }); - }; - - return AudioTrackList; -}(TrackList); - -/** - * @file video-track-list.js - */ -/** - * Un-select all other {@link VideoTrack}s that are selected. - * - * @param {VideoTrackList} list - * list to work on - * - * @param {VideoTrack} track - * The track to skip - * - * @private - */ -var disableOthers$1 = function disableOthers(list, track) { - for (var i = 0; i < list.length; i++) { - if (track.id === list[i].id) { - continue; - } - // another video track is enabled, disable it - list[i].selected = false; - } -}; - -/** - * The current list of {@link VideoTrack} for a video. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist} - * @extends TrackList - */ - -var VideoTrackList = function (_TrackList) { - inherits(VideoTrackList, _TrackList); - - /** - * Create an instance of this class. - * - * @param {VideoTrack[]} [tracks=[]] - * A list of `VideoTrack` to instantiate the list with. - */ - function VideoTrackList() { - var _this, _ret; - - var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - classCallCheck(this, VideoTrackList); - - var list = void 0; - - // make sure only 1 track is enabled - // sorted from last index to first index - for (var i = tracks.length - 1; i >= 0; i--) { - if (tracks[i].selected) { - disableOthers$1(tracks, tracks[i]); - break; - } - } - - // IE8 forces us to implement inheritance ourselves - // as it does not support Object.defineProperty properly - if (IS_IE8) { - list = document_1.createElement('custom'); - for (var prop in TrackList.prototype) { - if (prop !== 'constructor') { - list[prop] = TrackList.prototype[prop]; - } - } - for (var _prop in VideoTrackList.prototype) { - if (_prop !== 'constructor') { - list[_prop] = VideoTrackList.prototype[_prop]; - } - } - } - - list = (_this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this); - list.changing_ = false; - - /** - * @member {number} VideoTrackList#selectedIndex - * The current index of the selected {@link VideoTrack`}. - */ - Object.defineProperty(list, 'selectedIndex', { - get: function get$$1() { - for (var _i = 0; _i < this.length; _i++) { - if (this[_i].selected) { - return _i; - } - } - return -1; - }, - set: function set$$1() {} - }); - - return _ret = list, possibleConstructorReturn(_this, _ret); - } - - /** - * Add a {@link VideoTrack} to the `VideoTrackList`. - * - * @param {VideoTrack} track - * The VideoTrack to add to the list - * - * @fires TrackList#addtrack - */ - - - VideoTrackList.prototype.addTrack = function addTrack(track) { - var _this2 = this; - - if (track.selected) { - disableOthers$1(this, track); - } - - _TrackList.prototype.addTrack.call(this, track); - // native tracks don't have this - if (!track.addEventListener) { - return; - } - - /** - * @listens VideoTrack#selectedchange - * @fires TrackList#change - */ - track.addEventListener('selectedchange', function () { - if (_this2.changing_) { - return; - } - _this2.changing_ = true; - disableOthers$1(_this2, track); - _this2.changing_ = false; - _this2.trigger('change'); - }); - }; - - return VideoTrackList; -}(TrackList); - -/** - * @file text-track-list.js - */ -/** - * The current list of {@link TextTrack} for a media file. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist} - * @extends TrackList - */ - -var TextTrackList = function (_TrackList) { - inherits(TextTrackList, _TrackList); - - /** - * Create an instance of this class. - * - * @param {TextTrack[]} [tracks=[]] - * A list of `TextTrack` to instantiate the list with. - */ - function TextTrackList() { - var _this, _ret; - - var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - classCallCheck(this, TextTrackList); - - var list = void 0; - - // IE8 forces us to implement inheritance ourselves - // as it does not support Object.defineProperty properly - if (IS_IE8) { - list = document_1.createElement('custom'); - for (var prop in TrackList.prototype) { - if (prop !== 'constructor') { - list[prop] = TrackList.prototype[prop]; - } - } - for (var _prop in TextTrackList.prototype) { - if (_prop !== 'constructor') { - list[_prop] = TextTrackList.prototype[_prop]; - } - } - } - - list = (_this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this); - return _ret = list, possibleConstructorReturn(_this, _ret); - } - - /** - * Add a {@link TextTrack} to the `TextTrackList` - * - * @param {TextTrack} track - * The text track to add to the list. - * - * @fires TrackList#addtrack - */ - - - TextTrackList.prototype.addTrack = function addTrack(track) { - _TrackList.prototype.addTrack.call(this, track); - - /** - * @listens TextTrack#modechange - * @fires TrackList#change - */ - track.addEventListener('modechange', bind(this, function () { - this.trigger('change'); - })); - - var nonLanguageTextTrackKind = ['metadata', 'chapters']; - - if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) { - track.addEventListener('modechange', bind(this, function () { - this.trigger('selectedlanguagechange'); - })); - } - }; - - return TextTrackList; -}(TrackList); - -/** - * @file html-track-element-list.js - */ - -/** - * The current list of {@link HtmlTrackElement}s. - */ - -var HtmlTrackElementList = function () { - - /** - * Create an instance of this class. - * - * @param {HtmlTrackElement[]} [tracks=[]] - * A list of `HtmlTrackElement` to instantiate the list with. - */ - function HtmlTrackElementList() { - var trackElements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - classCallCheck(this, HtmlTrackElementList); - - var list = this; // eslint-disable-line - - if (IS_IE8) { - list = document_1.createElement('custom'); - - for (var prop in HtmlTrackElementList.prototype) { - if (prop !== 'constructor') { - list[prop] = HtmlTrackElementList.prototype[prop]; - } - } - } - - list.trackElements_ = []; - - /** - * @memberof HtmlTrackElementList - * @member {number} length - * The current number of `Track`s in the this Trackist. - * @instance - */ - Object.defineProperty(list, 'length', { - get: function get$$1() { - return this.trackElements_.length; - } - }); - - for (var i = 0, length = trackElements.length; i < length; i++) { - list.addTrackElement_(trackElements[i]); - } - - if (IS_IE8) { - return list; - } - } - - /** - * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList` - * - * @param {HtmlTrackElement} trackElement - * The track element to add to the list. - * - * @private - */ - - - HtmlTrackElementList.prototype.addTrackElement_ = function addTrackElement_(trackElement) { - var index = this.trackElements_.length; - - if (!('' + index in this)) { - Object.defineProperty(this, index, { - get: function get$$1() { - return this.trackElements_[index]; - } - }); - } - - // Do not add duplicate elements - if (this.trackElements_.indexOf(trackElement) === -1) { - this.trackElements_.push(trackElement); - } - }; - - /** - * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an - * {@link TextTrack}. - * - * @param {TextTrack} track - * The track associated with a track element. - * - * @return {HtmlTrackElement|undefined} - * The track element that was found or undefined. - * - * @private - */ - - - HtmlTrackElementList.prototype.getTrackElementByTrack_ = function getTrackElementByTrack_(track) { - var trackElement_ = void 0; - - for (var i = 0, length = this.trackElements_.length; i < length; i++) { - if (track === this.trackElements_[i].track) { - trackElement_ = this.trackElements_[i]; - - break; - } - } - - return trackElement_; - }; - - /** - * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList` - * - * @param {HtmlTrackElement} trackElement - * The track element to remove from the list. - * - * @private - */ - - - HtmlTrackElementList.prototype.removeTrackElement_ = function removeTrackElement_(trackElement) { - for (var i = 0, length = this.trackElements_.length; i < length; i++) { - if (trackElement === this.trackElements_[i]) { - this.trackElements_.splice(i, 1); - - break; - } - } - }; - - return HtmlTrackElementList; -}(); - -/** - * @file text-track-cue-list.js - */ -/** - * @typedef {Object} TextTrackCueList~TextTrackCue - * - * @property {string} id - * The unique id for this text track cue - * - * @property {number} startTime - * The start time for this text track cue - * - * @property {number} endTime - * The end time for this text track cue - * - * @property {boolean} pauseOnExit - * Pause when the end time is reached if true. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue} - */ - -/** - * A List of TextTrackCues. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist} - */ - -var TextTrackCueList = function () { - - /** - * Create an instance of this class.. - * - * @param {Array} cues - * A list of cues to be initialized with - */ - function TextTrackCueList(cues) { - classCallCheck(this, TextTrackCueList); - - var list = this; // eslint-disable-line - - if (IS_IE8) { - list = document_1.createElement('custom'); - - for (var prop in TextTrackCueList.prototype) { - if (prop !== 'constructor') { - list[prop] = TextTrackCueList.prototype[prop]; - } - } - } - - TextTrackCueList.prototype.setCues_.call(list, cues); - - /** - * @memberof TextTrackCueList - * @member {number} length - * The current number of `TextTrackCue`s in the TextTrackCueList. - * @instance - */ - Object.defineProperty(list, 'length', { - get: function get$$1() { - return this.length_; - } - }); - - if (IS_IE8) { - return list; - } - } - - /** - * A setter for cues in this list. Creates getters - * an an index for the cues. - * - * @param {Array} cues - * An array of cues to set - * - * @private - */ - - - TextTrackCueList.prototype.setCues_ = function setCues_(cues) { - var oldLength = this.length || 0; - var i = 0; - var l = cues.length; - - this.cues_ = cues; - this.length_ = cues.length; - - var defineProp = function defineProp(index) { - if (!('' + index in this)) { - Object.defineProperty(this, '' + index, { - get: function get$$1() { - return this.cues_[index]; - } - }); - } - }; - - if (oldLength < l) { - i = oldLength; - - for (; i < l; i++) { - defineProp.call(this, i); - } - } - }; - - /** - * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id. - * - * @param {string} id - * The id of the cue that should be searched for. - * - * @return {TextTrackCueList~TextTrackCue|null} - * A single cue or null if none was found. - */ - - - TextTrackCueList.prototype.getCueById = function getCueById(id) { - var result = null; - - for (var i = 0, l = this.length; i < l; i++) { - var cue = this[i]; - - if (cue.id === id) { - result = cue; - break; - } - } - - return result; - }; - - return TextTrackCueList; -}(); - -/** - * @file track-kinds.js - */ - -/** - * All possible `VideoTrackKind`s - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind - * @typedef VideoTrack~Kind - * @enum - */ -var VideoTrackKind = { - alternative: 'alternative', - captions: 'captions', - main: 'main', - sign: 'sign', - subtitles: 'subtitles', - commentary: 'commentary' -}; - -/** - * All possible `AudioTrackKind`s - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind - * @typedef AudioTrack~Kind - * @enum - */ -var AudioTrackKind = { - 'alternative': 'alternative', - 'descriptions': 'descriptions', - 'main': 'main', - 'main-desc': 'main-desc', - 'translation': 'translation', - 'commentary': 'commentary' -}; - -/** - * All possible `TextTrackKind`s - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind - * @typedef TextTrack~Kind - * @enum - */ -var TextTrackKind = { - subtitles: 'subtitles', - captions: 'captions', - descriptions: 'descriptions', - chapters: 'chapters', - metadata: 'metadata' -}; - -/** - * All possible `TextTrackMode`s - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode - * @typedef TextTrack~Mode - * @enum - */ -var TextTrackMode = { - disabled: 'disabled', - hidden: 'hidden', - showing: 'showing' -}; - -/** - * @file track.js - */ -/** - * A Track class that contains all of the common functionality for {@link AudioTrack}, - * {@link VideoTrack}, and {@link TextTrack}. - * - * > Note: This class should not be used directly - * - * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html} - * @extends EventTarget - * @abstract - */ - -var Track = function (_EventTarget) { - inherits(Track, _EventTarget); - - /** - * Create an instance of this class. - * - * @param {Object} [options={}] - * Object of option names and values - * - * @param {string} [options.kind=''] - * A valid kind for the track type you are creating. - * - * @param {string} [options.id='vjs_track_' + Guid.newGUID()] - * A unique id for this AudioTrack. - * - * @param {string} [options.label=''] - * The menu label for this track. - * - * @param {string} [options.language=''] - * A valid two character language code. - * - * @abstract - */ - function Track() { - var _ret; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - classCallCheck(this, Track); - - var _this = possibleConstructorReturn(this, _EventTarget.call(this)); - - var track = _this; // eslint-disable-line - - if (IS_IE8) { - track = document_1.createElement('custom'); - for (var prop in Track.prototype) { - if (prop !== 'constructor') { - track[prop] = Track.prototype[prop]; - } - } - } - - var trackProps = { - id: options.id || 'vjs_track_' + newGUID(), - kind: options.kind || '', - label: options.label || '', - language: options.language || '' - }; - - /** - * @memberof Track - * @member {string} id - * The id of this track. Cannot be changed after creation. - * @instance - * - * @readonly - */ - - /** - * @memberof Track - * @member {string} kind - * The kind of track that this is. Cannot be changed after creation. - * @instance - * - * @readonly - */ - - /** - * @memberof Track - * @member {string} label - * The label of this track. Cannot be changed after creation. - * @instance - * - * @readonly - */ - - /** - * @memberof Track - * @member {string} language - * The two letter language code for this track. Cannot be changed after - * creation. - * @instance - * - * @readonly - */ - - var _loop = function _loop(key) { - Object.defineProperty(track, key, { - get: function get$$1() { - return trackProps[key]; - }, - set: function set$$1() {} - }); - }; - - for (var key in trackProps) { - _loop(key); - } - - return _ret = track, possibleConstructorReturn(_this, _ret); - } - - return Track; -}(EventTarget); - -/** - * @file url.js - * @module url - */ -/** - * @typedef {Object} url:URLObject - * - * @property {string} protocol - * The protocol of the url that was parsed. - * - * @property {string} hostname - * The hostname of the url that was parsed. - * - * @property {string} port - * The port of the url that was parsed. - * - * @property {string} pathname - * The pathname of the url that was parsed. - * - * @property {string} search - * The search query of the url that was parsed. - * - * @property {string} hash - * The hash of the url that was parsed. - * - * @property {string} host - * The host of the url that was parsed. - */ - -/** - * Resolve and parse the elements of a URL. - * - * @param {String} url - * The url to parse - * - * @return {url:URLObject} - * An object of url details - */ -var parseUrl = function parseUrl(url) { - var props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host']; - - // add the url to an anchor and let the browser parse the URL - var a = document_1.createElement('a'); - - a.href = url; - - // IE8 (and 9?) Fix - // ie8 doesn't parse the URL correctly until the anchor is actually - // added to the body, and an innerHTML is needed to trigger the parsing - var addToBody = a.host === '' && a.protocol !== 'file:'; - var div = void 0; - - if (addToBody) { - div = document_1.createElement('div'); - div.innerHTML = '<a href="' + url + '"></a>'; - a = div.firstChild; - // prevent the div from affecting layout - div.setAttribute('style', 'display:none; position:absolute;'); - document_1.body.appendChild(div); - } - - // Copy the specific URL properties to a new object - // This is also needed for IE8 because the anchor loses its - // properties when it's removed from the dom - var details = {}; - - for (var i = 0; i < props.length; i++) { - details[props[i]] = a[props[i]]; - } - - // IE9 adds the port to the host property unlike everyone else. If - // a port identifier is added for standard ports, strip it. - if (details.protocol === 'http:') { - details.host = details.host.replace(/:80$/, ''); - } - - if (details.protocol === 'https:') { - details.host = details.host.replace(/:443$/, ''); - } - - if (addToBody) { - document_1.body.removeChild(div); - } - - return details; -}; - -/** - * Get absolute version of relative URL. Used to tell flash correct URL. - * - * - * @param {string} url - * URL to make absolute - * - * @return {string} - * Absolute URL - * - * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue - */ -var getAbsoluteURL = function getAbsoluteURL(url) { - // Check if absolute URL - if (!url.match(/^https?:\/\//)) { - // Convert to absolute URL. Flash hosted off-site needs an absolute URL. - var div = document_1.createElement('div'); - - div.innerHTML = '<a href="' + url + '">x</a>'; - url = div.firstChild.href; - } - - return url; -}; - -/** - * Returns the extension of the passed file name. It will return an empty string - * if passed an invalid path. - * - * @param {string} path - * The fileName path like '/path/to/file.mp4' - * - * @returns {string} - * The extension in lower case or an empty string if no - * extension could be found. - */ -var getFileExtension = function getFileExtension(path) { - if (typeof path === 'string') { - var splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i; - var pathParts = splitPathRe.exec(path); - - if (pathParts) { - return pathParts.pop().toLowerCase(); - } - } - - return ''; -}; - -/** - * Returns whether the url passed is a cross domain request or not. - * - * @param {string} url - * The url to check. - * - * @return {boolean} - * Whether it is a cross domain request or not. - */ -var isCrossOrigin = function isCrossOrigin(url) { - var winLoc = window_1.location; - var urlInfo = parseUrl(url); - - // IE8 protocol relative urls will return ':' for protocol - var srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol; - - // Check if url is for another domain/origin - // IE8 doesn't know location.origin, so we won't rely on it here - var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host; - - return crossOrigin; -}; - -var Url = (Object.freeze || Object)({ - parseUrl: parseUrl, - getAbsoluteURL: getAbsoluteURL, - getFileExtension: getFileExtension, - isCrossOrigin: isCrossOrigin -}); - -var index$1 = isFunction; - -var toString$1 = Object.prototype.toString; - -function isFunction (fn) { - var string = toString$1.call(fn); - return string === '[object Function]' || - (typeof fn === 'function' && string !== '[object RegExp]') || - (typeof window !== 'undefined' && - // IE8 and below - (fn === window.setTimeout || - fn === window.alert || - fn === window.confirm || - fn === window.prompt)) -} - -var index$3 = createCommonjsModule(function (module, exports) { -exports = module.exports = trim; - -function trim(str){ - return str.replace(/^\s*|\s*$/g, ''); -} - -exports.left = function(str){ - return str.replace(/^\s*/, ''); -}; - -exports.right = function(str){ - return str.replace(/\s*$/, ''); -}; -}); - -var index$5 = forEach; - -var toString$2 = Object.prototype.toString; -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function forEach(list, iterator, context) { - if (!index$1(iterator)) { - throw new TypeError('iterator must be a function') - } - - if (arguments.length < 3) { - context = this; - } - - if (toString$2.call(list) === '[object Array]') - forEachArray$1(list, iterator, context); - else if (typeof list === 'string') - forEachString(list, iterator, context); - else - forEachObject(list, iterator, context); -} - -function forEachArray$1(array, iterator, context) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - iterator.call(context, array[i], i, array); - } - } -} - -function forEachString(string, iterator, context) { - for (var i = 0, len = string.length; i < len; i++) { - // no such thing as a sparse string. - iterator.call(context, string.charAt(i), i, string); - } -} - -function forEachObject(object, iterator, context) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - iterator.call(context, object[k], k, object); - } - } -} - -var isArray = function(arg) { - return Object.prototype.toString.call(arg) === '[object Array]'; - }; - -var parseHeaders = function (headers) { - if (!headers) - return {} - - var result = {}; - - index$5( - index$3(headers).split('\n') - , function (row) { - var index = row.indexOf(':') - , key = index$3(row.slice(0, index)).toLowerCase() - , value = index$3(row.slice(index + 1)); - - if (typeof(result[key]) === 'undefined') { - result[key] = value; - } else if (isArray(result[key])) { - result[key].push(value); - } else { - result[key] = [ result[key], value ]; - } - } - ); - - return result -}; - -var immutable = extend; - -var hasOwnProperty$1 = Object.prototype.hasOwnProperty; - -function extend() { - var target = {}; - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (hasOwnProperty$1.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target -} - -var index = createXHR; -createXHR.XMLHttpRequest = window_1.XMLHttpRequest || noop; -createXHR.XDomainRequest = "withCredentials" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window_1.XDomainRequest; - -forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) { - createXHR[method === "delete" ? "del" : method] = function(uri, options, callback) { - options = initParams(uri, options, callback); - options.method = method.toUpperCase(); - return _createXHR(options) - }; -}); - -function forEachArray(array, iterator) { - for (var i = 0; i < array.length; i++) { - iterator(array[i]); - } -} - -function isEmpty(obj){ - for(var i in obj){ - if(obj.hasOwnProperty(i)) return false - } - return true -} - -function initParams(uri, options, callback) { - var params = uri; - - if (index$1(options)) { - callback = options; - if (typeof uri === "string") { - params = {uri:uri}; - } - } else { - params = immutable(options, {uri: uri}); - } - - params.callback = callback; - return params -} - -function createXHR(uri, options, callback) { - options = initParams(uri, options, callback); - return _createXHR(options) -} - -function _createXHR(options) { - if(typeof options.callback === "undefined"){ - throw new Error("callback argument missing") - } - - var called = false; - var callback = function cbOnce(err, response, body){ - if(!called){ - called = true; - options.callback(err, response, body); - } - }; - - function readystatechange() { - if (xhr.readyState === 4) { - setTimeout(loadFunc, 0); - } - } - - function getBody() { - // Chrome with requestType=blob throws errors arround when even testing access to responseText - var body = undefined; - - if (xhr.response) { - body = xhr.response; - } else { - body = xhr.responseText || getXml(xhr); - } - - if (isJson) { - try { - body = JSON.parse(body); - } catch (e) {} - } - - return body - } - - function errorFunc(evt) { - clearTimeout(timeoutTimer); - if(!(evt instanceof Error)){ - evt = new Error("" + (evt || "Unknown XMLHttpRequest Error") ); - } - evt.statusCode = 0; - return callback(evt, failureResponse) - } - - // will load the data & process the response in a special response object - function loadFunc() { - if (aborted) return - var status; - clearTimeout(timeoutTimer); - if(options.useXDR && xhr.status===undefined) { - //IE8 CORS GET successful response doesn't have a status field, but body is fine - status = 200; - } else { - status = (xhr.status === 1223 ? 204 : xhr.status); - } - var response = failureResponse; - var err = null; - - if (status !== 0){ - response = { - body: getBody(), - statusCode: status, - method: method, - headers: {}, - url: uri, - rawRequest: xhr - }; - if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE - response.headers = parseHeaders(xhr.getAllResponseHeaders()); - } - } else { - err = new Error("Internal XMLHttpRequest Error"); - } - return callback(err, response, response.body) - } - - var xhr = options.xhr || null; - - if (!xhr) { - if (options.cors || options.useXDR) { - xhr = new createXHR.XDomainRequest(); - }else{ - xhr = new createXHR.XMLHttpRequest(); - } - } - - var key; - var aborted; - var uri = xhr.url = options.uri || options.url; - var method = xhr.method = options.method || "GET"; - var body = options.body || options.data; - var headers = xhr.headers = options.headers || {}; - var sync = !!options.sync; - var isJson = false; - var timeoutTimer; - var failureResponse = { - body: undefined, - headers: {}, - statusCode: 0, - method: method, - url: uri, - rawRequest: xhr - }; - - if ("json" in options && options.json !== false) { - isJson = true; - headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json"); //Don't override existing accept header declared by user - if (method !== "GET" && method !== "HEAD") { - headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json"); //Don't override existing accept header declared by user - body = JSON.stringify(options.json === true ? body : options.json); - } - } - - xhr.onreadystatechange = readystatechange; - xhr.onload = loadFunc; - xhr.onerror = errorFunc; - // IE9 must have onprogress be set to a unique function. - xhr.onprogress = function () { - // IE must die - }; - xhr.onabort = function(){ - aborted = true; - }; - xhr.ontimeout = errorFunc; - xhr.open(method, uri, !sync, options.username, options.password); - //has to be after open - if(!sync) { - xhr.withCredentials = !!options.withCredentials; - } - // Cannot set timeout with sync request - // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly - // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent - if (!sync && options.timeout > 0 ) { - timeoutTimer = setTimeout(function(){ - if (aborted) return - aborted = true;//IE9 may still call readystatechange - xhr.abort("timeout"); - var e = new Error("XMLHttpRequest timeout"); - e.code = "ETIMEDOUT"; - errorFunc(e); - }, options.timeout ); - } - - if (xhr.setRequestHeader) { - for(key in headers){ - if(headers.hasOwnProperty(key)){ - xhr.setRequestHeader(key, headers[key]); - } - } - } else if (options.headers && !isEmpty(options.headers)) { - throw new Error("Headers cannot be set on an XDomainRequest object") - } - - if ("responseType" in options) { - xhr.responseType = options.responseType; - } - - if ("beforeSend" in options && - typeof options.beforeSend === "function" - ) { - options.beforeSend(xhr); - } - - // Microsoft Edge browser sends "undefined" when send is called with undefined value. - // XMLHttpRequest spec says to pass null as body to indicate no body - // See https://github.com/naugtur/xhr/issues/100. - xhr.send(body || null); - - return xhr - - -} - -function getXml(xhr) { - if (xhr.responseType === "document") { - return xhr.responseXML - } - var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror"; - if (xhr.responseType === "" && !firefoxBugTakenEffect) { - return xhr.responseXML - } - - return null -} - -function noop() {} - -/** - * @file text-track.js - */ -/** - * Takes a webvtt file contents and parses it into cues - * - * @param {string} srcContent - * webVTT file contents - * - * @param {TextTrack} track - * TextTrack to add cues to. Cues come from the srcContent. - * - * @private - */ -var parseCues = function parseCues(srcContent, track) { - var parser = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder()); - var errors = []; - - parser.oncue = function (cue) { - track.addCue(cue); - }; - - parser.onparsingerror = function (error) { - errors.push(error); - }; - - parser.onflush = function () { - track.trigger({ - type: 'loadeddata', - target: track - }); - }; - - parser.parse(srcContent); - if (errors.length > 0) { - if (window_1.console && window_1.console.groupCollapsed) { - window_1.console.groupCollapsed('Text Track parsing errors for ' + track.src); - } - errors.forEach(function (error) { - return log$1.error(error); - }); - if (window_1.console && window_1.console.groupEnd) { - window_1.console.groupEnd(); - } - } - - parser.flush(); -}; - -/** - * Load a `TextTrack` from a specifed url. - * - * @param {string} src - * Url to load track from. - * - * @param {TextTrack} track - * Track to add cues to. Comes from the content at the end of `url`. - * - * @private - */ -var loadTrack = function loadTrack(src, track) { - var opts = { - uri: src - }; - var crossOrigin = isCrossOrigin(src); - - if (crossOrigin) { - opts.cors = crossOrigin; - } - - index(opts, bind(this, function (err, response, responseBody) { - if (err) { - return log$1.error(err, response); - } - - track.loaded_ = true; - - // Make sure that vttjs has loaded, otherwise, wait till it finished loading - // NOTE: this is only used for the alt/video.novtt.js build - if (typeof window_1.WebVTT !== 'function') { - if (track.tech_) { - var loadHandler = function loadHandler() { - return parseCues(responseBody, track); - }; - - track.tech_.on('vttjsloaded', loadHandler); - track.tech_.on('vttjserror', function () { - log$1.error('vttjs failed to load, stopping trying to process ' + track.src); - track.tech_.off('vttjsloaded', loadHandler); - }); - } - } else { - parseCues(responseBody, track); - } - })); -}; - -/** - * A representation of a single `TextTrack`. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack} - * @extends Track - */ - -var TextTrack = function (_Track) { - inherits(TextTrack, _Track); - - /** - * Create an instance of this class. - * - * @param {Object} options={} - * Object of option names and values - * - * @param {Tech} options.tech - * A reference to the tech that owns this TextTrack. - * - * @param {TextTrack~Kind} [options.kind='subtitles'] - * A valid text track kind. - * - * @param {TextTrack~Mode} [options.mode='disabled'] - * A valid text track mode. - * - * @param {string} [options.id='vjs_track_' + Guid.newGUID()] - * A unique id for this TextTrack. - * - * @param {string} [options.label=''] - * The menu label for this track. - * - * @param {string} [options.language=''] - * A valid two character language code. - * - * @param {string} [options.srclang=''] - * A valid two character language code. An alternative, but deprioritized - * vesion of `options.language` - * - * @param {string} [options.src] - * A url to TextTrack cues. - * - * @param {boolean} [options.default] - * If this track should default to on or off. - */ - function TextTrack() { - var _this, _ret; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - classCallCheck(this, TextTrack); - - if (!options.tech) { - throw new Error('A tech was not provided.'); - } - - var settings = mergeOptions(options, { - kind: TextTrackKind[options.kind] || 'subtitles', - language: options.language || options.srclang || '' - }); - var mode = TextTrackMode[settings.mode] || 'disabled'; - var default_ = settings['default']; - - if (settings.kind === 'metadata' || settings.kind === 'chapters') { - mode = 'hidden'; - } - // on IE8 this will be a document element - // for every other browser this will be a normal object - var tt = (_this = possibleConstructorReturn(this, _Track.call(this, settings)), _this); - - tt.tech_ = settings.tech; - - if (IS_IE8) { - for (var prop in TextTrack.prototype) { - if (prop !== 'constructor') { - tt[prop] = TextTrack.prototype[prop]; - } - } - } - - tt.cues_ = []; - tt.activeCues_ = []; - - var cues = new TextTrackCueList(tt.cues_); - var activeCues = new TextTrackCueList(tt.activeCues_); - var changed = false; - var timeupdateHandler = bind(tt, function () { - - // Accessing this.activeCues for the side-effects of updating itself - // due to it's nature as a getter function. Do not remove or cues will - // stop updating! - /* eslint-disable no-unused-expressions */ - this.activeCues; - /* eslint-enable no-unused-expressions */ - if (changed) { - this.trigger('cuechange'); - changed = false; - } - }); - - if (mode !== 'disabled') { - tt.tech_.ready(function () { - tt.tech_.on('timeupdate', timeupdateHandler); - }, true); - } - - /** - * @memberof TextTrack - * @member {boolean} default - * If this track was set to be on or off by default. Cannot be changed after - * creation. - * @instance - * - * @readonly - */ - Object.defineProperty(tt, 'default', { - get: function get$$1() { - return default_; - }, - set: function set$$1() {} - }); - - /** - * @memberof TextTrack - * @member {string} mode - * Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will - * not be set if setting to an invalid mode. - * @instance - * - * @fires TextTrack#modechange - */ - Object.defineProperty(tt, 'mode', { - get: function get$$1() { - return mode; - }, - set: function set$$1(newMode) { - var _this2 = this; - - if (!TextTrackMode[newMode]) { - return; - } - mode = newMode; - if (mode === 'showing') { - - this.tech_.ready(function () { - _this2.tech_.on('timeupdate', timeupdateHandler); - }, true); - } - /** - * An event that fires when mode changes on this track. This allows - * the TextTrackList that holds this track to act accordingly. - * - * > Note: This is not part of the spec! - * - * @event TextTrack#modechange - * @type {EventTarget~Event} - */ - this.trigger('modechange'); - } - }); - - /** - * @memberof TextTrack - * @member {TextTrackCueList} cues - * The text track cue list for this TextTrack. - * @instance - */ - Object.defineProperty(tt, 'cues', { - get: function get$$1() { - if (!this.loaded_) { - return null; - } - - return cues; - }, - set: function set$$1() {} - }); - - /** - * @memberof TextTrack - * @member {TextTrackCueList} activeCues - * The list text track cues that are currently active for this TextTrack. - * @instance - */ - Object.defineProperty(tt, 'activeCues', { - get: function get$$1() { - if (!this.loaded_) { - return null; - } - - // nothing to do - if (this.cues.length === 0) { - return activeCues; - } - - var ct = this.tech_.currentTime(); - var active = []; - - for (var i = 0, l = this.cues.length; i < l; i++) { - var cue = this.cues[i]; - - if (cue.startTime <= ct && cue.endTime >= ct) { - active.push(cue); - } else if (cue.startTime === cue.endTime && cue.startTime <= ct && cue.startTime + 0.5 >= ct) { - active.push(cue); - } - } - - changed = false; - - if (active.length !== this.activeCues_.length) { - changed = true; - } else { - for (var _i = 0; _i < active.length; _i++) { - if (this.activeCues_.indexOf(active[_i]) === -1) { - changed = true; - } - } - } - - this.activeCues_ = active; - activeCues.setCues_(this.activeCues_); - - return activeCues; - }, - set: function set$$1() {} - }); - - if (settings.src) { - tt.src = settings.src; - loadTrack(settings.src, tt); - } else { - tt.loaded_ = true; - } - - return _ret = tt, possibleConstructorReturn(_this, _ret); - } - - /** - * Add a cue to the internal list of cues. - * - * @param {TextTrack~Cue} cue - * The cue to add to our internal list - */ - - - TextTrack.prototype.addCue = function addCue(originalCue) { - var cue = originalCue; - - if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) { - cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); - - for (var prop in originalCue) { - if (!(prop in cue)) { - cue[prop] = originalCue[prop]; - } - } - - // make sure that `id` is copied over - cue.id = originalCue.id; - cue.originalCue_ = originalCue; - } - - var tracks = this.tech_.textTracks(); - - for (var i = 0; i < tracks.length; i++) { - if (tracks[i] !== this) { - tracks[i].removeCue(cue); - } - } - - this.cues_.push(cue); - this.cues.setCues_(this.cues_); - }; - - /** - * Remove a cue from our internal list - * - * @param {TextTrack~Cue} removeCue - * The cue to remove from our internal list - */ - - - TextTrack.prototype.removeCue = function removeCue(_removeCue) { - var i = this.cues_.length; - - while (i--) { - var cue = this.cues_[i]; - - if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) { - this.cues_.splice(i, 1); - this.cues.setCues_(this.cues_); - break; - } - } - }; - - return TextTrack; -}(Track); - -/** - * cuechange - One or more cues in the track have become active or stopped being active. - */ - - -TextTrack.prototype.allowedEvents_ = { - cuechange: 'cuechange' -}; - -/** - * A representation of a single `AudioTrack`. If it is part of an {@link AudioTrackList} - * only one `AudioTrack` in the list will be enabled at a time. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack} - * @extends Track - */ - -var AudioTrack = function (_Track) { - inherits(AudioTrack, _Track); - - /** - * Create an instance of this class. - * - * @param {Object} [options={}] - * Object of option names and values - * - * @param {AudioTrack~Kind} [options.kind=''] - * A valid audio track kind - * - * @param {string} [options.id='vjs_track_' + Guid.newGUID()] - * A unique id for this AudioTrack. - * - * @param {string} [options.label=''] - * The menu label for this track. - * - * @param {string} [options.language=''] - * A valid two character language code. - * - * @param {boolean} [options.enabled] - * If this track is the one that is currently playing. If this track is part of - * an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled. - */ - function AudioTrack() { - var _this, _ret; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - classCallCheck(this, AudioTrack); - - var settings = mergeOptions(options, { - kind: AudioTrackKind[options.kind] || '' - }); - // on IE8 this will be a document element - // for every other browser this will be a normal object - var track = (_this = possibleConstructorReturn(this, _Track.call(this, settings)), _this); - var enabled = false; - - if (IS_IE8) { - for (var prop in AudioTrack.prototype) { - if (prop !== 'constructor') { - track[prop] = AudioTrack.prototype[prop]; - } - } - } - /** - * @memberof AudioTrack - * @member {boolean} enabled - * If this `AudioTrack` is enabled or not. When setting this will - * fire {@link AudioTrack#enabledchange} if the state of enabled is changed. - * @instance - * - * @fires VideoTrack#selectedchange - */ - Object.defineProperty(track, 'enabled', { - get: function get$$1() { - return enabled; - }, - set: function set$$1(newEnabled) { - // an invalid or unchanged value - if (typeof newEnabled !== 'boolean' || newEnabled === enabled) { - return; - } - enabled = newEnabled; - - /** - * An event that fires when enabled changes on this track. This allows - * the AudioTrackList that holds this track to act accordingly. - * - * > Note: This is not part of the spec! Native tracks will do - * this internally without an event. - * - * @event AudioTrack#enabledchange - * @type {EventTarget~Event} - */ - this.trigger('enabledchange'); - } - }); - - // if the user sets this track to selected then - // set selected to that true value otherwise - // we keep it false - if (settings.enabled) { - track.enabled = settings.enabled; - } - track.loaded_ = true; - - return _ret = track, possibleConstructorReturn(_this, _ret); - } - - return AudioTrack; -}(Track); - -/** - * A representation of a single `VideoTrack`. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack} - * @extends Track - */ - -var VideoTrack = function (_Track) { - inherits(VideoTrack, _Track); - - /** - * Create an instance of this class. - * - * @param {Object} [options={}] - * Object of option names and values - * - * @param {string} [options.kind=''] - * A valid {@link VideoTrack~Kind} - * - * @param {string} [options.id='vjs_track_' + Guid.newGUID()] - * A unique id for this AudioTrack. - * - * @param {string} [options.label=''] - * The menu label for this track. - * - * @param {string} [options.language=''] - * A valid two character language code. - * - * @param {boolean} [options.selected] - * If this track is the one that is currently playing. - */ - function VideoTrack() { - var _this, _ret; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - classCallCheck(this, VideoTrack); - - var settings = mergeOptions(options, { - kind: VideoTrackKind[options.kind] || '' - }); - - // on IE8 this will be a document element - // for every other browser this will be a normal object - var track = (_this = possibleConstructorReturn(this, _Track.call(this, settings)), _this); - var selected = false; - - if (IS_IE8) { - for (var prop in VideoTrack.prototype) { - if (prop !== 'constructor') { - track[prop] = VideoTrack.prototype[prop]; - } - } - } - - /** - * @memberof VideoTrack - * @member {boolean} selected - * If this `VideoTrack` is selected or not. When setting this will - * fire {@link VideoTrack#selectedchange} if the state of selected changed. - * @instance - * - * @fires VideoTrack#selectedchange - */ - Object.defineProperty(track, 'selected', { - get: function get$$1() { - return selected; - }, - set: function set$$1(newSelected) { - // an invalid or unchanged value - if (typeof newSelected !== 'boolean' || newSelected === selected) { - return; - } - selected = newSelected; - - /** - * An event that fires when selected changes on this track. This allows - * the VideoTrackList that holds this track to act accordingly. - * - * > Note: This is not part of the spec! Native tracks will do - * this internally without an event. - * - * @event VideoTrack#selectedchange - * @type {EventTarget~Event} - */ - this.trigger('selectedchange'); - } - }); - - // if the user sets this track to selected then - // set selected to that true value otherwise - // we keep it false - if (settings.selected) { - track.selected = settings.selected; - } - - return _ret = track, possibleConstructorReturn(_this, _ret); - } - - return VideoTrack; -}(Track); - -/** - * @file html-track-element.js - */ - -/** - * @memberof HTMLTrackElement - * @typedef {HTMLTrackElement~ReadyState} - * @enum {number} - */ -var NONE = 0; -var LOADING = 1; -var LOADED = 2; -var ERROR = 3; - -/** - * A single track represented in the DOM. - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement} - * @extends EventTarget - */ - -var HTMLTrackElement = function (_EventTarget) { - inherits(HTMLTrackElement, _EventTarget); - - /** - * Create an instance of this class. - * - * @param {Object} options={} - * Object of option names and values - * - * @param {Tech} options.tech - * A reference to the tech that owns this HTMLTrackElement. - * - * @param {TextTrack~Kind} [options.kind='subtitles'] - * A valid text track kind. - * - * @param {TextTrack~Mode} [options.mode='disabled'] - * A valid text track mode. - * - * @param {string} [options.id='vjs_track_' + Guid.newGUID()] - * A unique id for this TextTrack. - * - * @param {string} [options.label=''] - * The menu label for this track. - * - * @param {string} [options.language=''] - * A valid two character language code. - * - * @param {string} [options.srclang=''] - * A valid two character language code. An alternative, but deprioritized - * vesion of `options.language` - * - * @param {string} [options.src] - * A url to TextTrack cues. - * - * @param {boolean} [options.default] - * If this track should default to on or off. - */ - function HTMLTrackElement() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - classCallCheck(this, HTMLTrackElement); - - var _this = possibleConstructorReturn(this, _EventTarget.call(this)); - - var readyState = void 0; - var trackElement = _this; // eslint-disable-line - - if (IS_IE8) { - trackElement = document_1.createElement('custom'); - - for (var prop in HTMLTrackElement.prototype) { - if (prop !== 'constructor') { - trackElement[prop] = HTMLTrackElement.prototype[prop]; - } - } - } - - var track = new TextTrack(options); - - trackElement.kind = track.kind; - trackElement.src = track.src; - trackElement.srclang = track.language; - trackElement.label = track.label; - trackElement['default'] = track['default']; - - /** - * @memberof HTMLTrackElement - * @member {HTMLTrackElement~ReadyState} readyState - * The current ready state of the track element. - * @instance - */ - Object.defineProperty(trackElement, 'readyState', { - get: function get$$1() { - return readyState; - } - }); - - /** - * @memberof HTMLTrackElement - * @member {TextTrack} track - * The underlying TextTrack object. - * @instance - * - */ - Object.defineProperty(trackElement, 'track', { - get: function get$$1() { - return track; - } - }); - - readyState = NONE; - - /** - * @listens TextTrack#loadeddata - * @fires HTMLTrackElement#load - */ - track.addEventListener('loadeddata', function () { - readyState = LOADED; - - trackElement.trigger({ - type: 'load', - target: trackElement - }); - }); - - if (IS_IE8) { - var _ret; - - return _ret = trackElement, possibleConstructorReturn(_this, _ret); - } - return _this; - } - - return HTMLTrackElement; -}(EventTarget); - -HTMLTrackElement.prototype.allowedEvents_ = { - load: 'load' -}; - -HTMLTrackElement.NONE = NONE; -HTMLTrackElement.LOADING = LOADING; -HTMLTrackElement.LOADED = LOADED; -HTMLTrackElement.ERROR = ERROR; - -/* - * This file contains all track properties that are used in - * player.js, tech.js, html5.js and possibly other techs in the future. - */ - -var NORMAL = { - audio: { - ListClass: AudioTrackList, - TrackClass: AudioTrack, - capitalName: 'Audio' - }, - video: { - ListClass: VideoTrackList, - TrackClass: VideoTrack, - capitalName: 'Video' - }, - text: { - ListClass: TextTrackList, - TrackClass: TextTrack, - capitalName: 'Text' - } -}; - -Object.keys(NORMAL).forEach(function (type) { - NORMAL[type].getterName = type + 'Tracks'; - NORMAL[type].privateName = type + 'Tracks_'; -}); - -var REMOTE = { - remoteText: { - ListClass: TextTrackList, - TrackClass: TextTrack, - capitalName: 'RemoteText', - getterName: 'remoteTextTracks', - privateName: 'remoteTextTracks_' - }, - remoteTextEl: { - ListClass: HtmlTrackElementList, - TrackClass: HTMLTrackElement, - capitalName: 'RemoteTextTrackEls', - getterName: 'remoteTextTrackEls', - privateName: 'remoteTextTrackEls_' - } -}; - -var ALL = mergeOptions(NORMAL, REMOTE); - -REMOTE.names = Object.keys(REMOTE); -NORMAL.names = Object.keys(NORMAL); -ALL.names = [].concat(REMOTE.names).concat(NORMAL.names); - -/** - * Copyright 2013 vtt.js Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ -var _objCreate = Object.create || (function() { - function F() {} - return function(o) { - if (arguments.length !== 1) { - throw new Error('Object.create shim only accepts one parameter.'); - } - F.prototype = o; - return new F(); - }; -})(); - -// Creates a new ParserError object from an errorData object. The errorData -// object should have default code and message properties. The default message -// property can be overriden by passing in a message parameter. -// See ParsingError.Errors below for acceptable errors. -function ParsingError(errorData, message) { - this.name = "ParsingError"; - this.code = errorData.code; - this.message = message || errorData.message; -} -ParsingError.prototype = _objCreate(Error.prototype); -ParsingError.prototype.constructor = ParsingError; - -// ParsingError metadata for acceptable ParsingErrors. -ParsingError.Errors = { - BadSignature: { - code: 0, - message: "Malformed WebVTT signature." - }, - BadTimeStamp: { - code: 1, - message: "Malformed time stamp." - } -}; - -// Try to parse input as a time stamp. -function parseTimeStamp(input) { - - function computeSeconds(h, m, s, f) { - return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000; - } - - var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); - if (!m) { - return null; - } - - if (m[3]) { - // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds] - return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]); - } else if (m[1] > 59) { - // Timestamp takes the form of [hours]:[minutes].[milliseconds] - // First position is hours as it's over 59. - return computeSeconds(m[1], m[2], 0, m[4]); - } else { - // Timestamp takes the form of [minutes]:[seconds].[milliseconds] - return computeSeconds(0, m[1], m[2], m[4]); - } -} - -// A settings object holds key/value pairs and will ignore anything but the first -// assignment to a specific key. -function Settings() { - this.values = _objCreate(null); -} - -Settings.prototype = { - // Only accept the first assignment to any key. - set: function(k, v) { - if (!this.get(k) && v !== "") { - this.values[k] = v; - } - }, - // Return the value for a key, or a default value. - // If 'defaultKey' is passed then 'dflt' is assumed to be an object with - // a number of possible default values as properties where 'defaultKey' is - // the key of the property that will be chosen; otherwise it's assumed to be - // a single value. - get: function(k, dflt, defaultKey) { - if (defaultKey) { - return this.has(k) ? this.values[k] : dflt[defaultKey]; - } - return this.has(k) ? this.values[k] : dflt; - }, - // Check whether we have a value for a key. - has: function(k) { - return k in this.values; - }, - // Accept a setting if its one of the given alternatives. - alt: function(k, v, a) { - for (var n = 0; n < a.length; ++n) { - if (v === a[n]) { - this.set(k, v); - break; - } - } - }, - // Accept a setting if its a valid (signed) integer. - integer: function(k, v) { - if (/^-?\d+$/.test(v)) { // integer - this.set(k, parseInt(v, 10)); - } - }, - // Accept a setting if its a valid percentage. - percent: function(k, v) { - var m; - if ((m = v.match(/^([\d]{1,3})(\.[\d]*)?%$/))) { - v = parseFloat(v); - if (v >= 0 && v <= 100) { - this.set(k, v); - return true; - } - } - return false; - } -}; - -// Helper function to parse input into groups separated by 'groupDelim', and -// interprete each group as a key/value pair separated by 'keyValueDelim'. -function parseOptions(input, callback, keyValueDelim, groupDelim) { - var groups = groupDelim ? input.split(groupDelim) : [input]; - for (var i in groups) { - if (typeof groups[i] !== "string") { - continue; - } - var kv = groups[i].split(keyValueDelim); - if (kv.length !== 2) { - continue; - } - var k = kv[0]; - var v = kv[1]; - callback(k, v); - } -} - -function parseCue(input, cue, regionList) { - // Remember the original input if we need to throw an error. - var oInput = input; - // 4.1 WebVTT timestamp - function consumeTimeStamp() { - var ts = parseTimeStamp(input); - if (ts === null) { - throw new ParsingError(ParsingError.Errors.BadTimeStamp, - "Malformed timestamp: " + oInput); - } - // Remove time stamp from input. - input = input.replace(/^[^\sa-zA-Z-]+/, ""); - return ts; - } - - // 4.4.2 WebVTT cue settings - function consumeCueSettings(input, cue) { - var settings = new Settings(); - - parseOptions(input, function (k, v) { - switch (k) { - case "region": - // Find the last region we parsed with the same region id. - for (var i = regionList.length - 1; i >= 0; i--) { - if (regionList[i].id === v) { - settings.set(k, regionList[i].region); - break; - } - } - break; - case "vertical": - settings.alt(k, v, ["rl", "lr"]); - break; - case "line": - var vals = v.split(","), - vals0 = vals[0]; - settings.integer(k, vals0); - settings.percent(k, vals0) ? settings.set("snapToLines", false) : null; - settings.alt(k, vals0, ["auto"]); - if (vals.length === 2) { - settings.alt("lineAlign", vals[1], ["start", "middle", "end"]); - } - break; - case "position": - vals = v.split(","); - settings.percent(k, vals[0]); - if (vals.length === 2) { - settings.alt("positionAlign", vals[1], ["start", "middle", "end"]); - } - break; - case "size": - settings.percent(k, v); - break; - case "align": - settings.alt(k, v, ["start", "middle", "end", "left", "right"]); - break; - } - }, /:/, /\s/); - - // Apply default values for any missing fields. - cue.region = settings.get("region", null); - cue.vertical = settings.get("vertical", ""); - cue.line = settings.get("line", "auto"); - cue.lineAlign = settings.get("lineAlign", "start"); - cue.snapToLines = settings.get("snapToLines", true); - cue.size = settings.get("size", 100); - cue.align = settings.get("align", "middle"); - cue.position = settings.get("position", { - start: 0, - left: 0, - middle: 50, - end: 100, - right: 100 - }, cue.align); - cue.positionAlign = settings.get("positionAlign", { - start: "start", - left: "start", - middle: "middle", - end: "end", - right: "end" - }, cue.align); - } - - function skipWhitespace() { - input = input.replace(/^\s+/, ""); - } - - // 4.1 WebVTT cue timings. - skipWhitespace(); - cue.startTime = consumeTimeStamp(); // (1) collect cue start time - skipWhitespace(); - if (input.substr(0, 3) !== "-->") { // (3) next characters must match "-->" - throw new ParsingError(ParsingError.Errors.BadTimeStamp, - "Malformed time stamp (time stamps must be separated by '-->'): " + - oInput); - } - input = input.substr(3); - skipWhitespace(); - cue.endTime = consumeTimeStamp(); // (5) collect cue end time - - // 4.1 WebVTT cue settings list. - skipWhitespace(); - consumeCueSettings(input, cue); -} - -var ESCAPE = { - "&": "&", - "<": "<", - ">": ">", - "‎": "\u200e", - "‏": "\u200f", - " ": "\u00a0" -}; - -var TAG_NAME = { - c: "span", - i: "i", - b: "b", - u: "u", - ruby: "ruby", - rt: "rt", - v: "span", - lang: "span" -}; - -var TAG_ANNOTATION = { - v: "title", - lang: "lang" -}; - -var NEEDS_PARENT = { - rt: "ruby" -}; - -// Parse content into a document fragment. -function parseContent(window, input) { - function nextToken() { - // Check for end-of-string. - if (!input) { - return null; - } - - // Consume 'n' characters from the input. - function consume(result) { - input = input.substr(result.length); - return result; - } - - var m = input.match(/^([^<]*)(<[^>]+>?)?/); - // If there is some text before the next tag, return it, otherwise return - // the tag. - return consume(m[1] ? m[1] : m[2]); - } - - // Unescape a string 's'. - function unescape1(e) { - return ESCAPE[e]; - } - function unescape(s) { - while ((m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))) { - s = s.replace(m[0], unescape1); - } - return s; - } - - function shouldAdd(current, element) { - return !NEEDS_PARENT[element.localName] || - NEEDS_PARENT[element.localName] === current.localName; - } - - // Create an element for this tag. - function createElement(type, annotation) { - var tagName = TAG_NAME[type]; - if (!tagName) { - return null; - } - var element = window.document.createElement(tagName); - element.localName = tagName; - var name = TAG_ANNOTATION[type]; - if (name && annotation) { - element[name] = annotation.trim(); - } - return element; - } - - var rootDiv = window.document.createElement("div"), - current = rootDiv, - t, - tagStack = []; - - while ((t = nextToken()) !== null) { - if (t[0] === '<') { - if (t[1] === "/") { - // If the closing tag matches, move back up to the parent node. - if (tagStack.length && - tagStack[tagStack.length - 1] === t.substr(2).replace(">", "")) { - tagStack.pop(); - current = current.parentNode; - } - // Otherwise just ignore the end tag. - continue; - } - var ts = parseTimeStamp(t.substr(1, t.length - 2)); - var node; - if (ts) { - // Timestamps are lead nodes as well. - node = window.document.createProcessingInstruction("timestamp", ts); - current.appendChild(node); - continue; - } - var m = t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/); - // If we can't parse the tag, skip to the next tag. - if (!m) { - continue; - } - // Try to construct an element, and ignore the tag if we couldn't. - node = createElement(m[1], m[3]); - if (!node) { - continue; - } - // Determine if the tag should be added based on the context of where it - // is placed in the cuetext. - if (!shouldAdd(current, node)) { - continue; - } - // Set the class list (as a list of classes, separated by space). - if (m[2]) { - node.className = m[2].substr(1).replace('.', ' '); - } - // Append the node to the current node, and enter the scope of the new - // node. - tagStack.push(m[1]); - current.appendChild(node); - current = node; - continue; - } - - // Text nodes are leaf nodes. - current.appendChild(window.document.createTextNode(unescape(t))); - } - - return rootDiv; -} - -// This is a list of all the Unicode characters that have a strong -// right-to-left category. What this means is that these characters are -// written right-to-left for sure. It was generated by pulling all the strong -// right-to-left characters out of the Unicode data table. That table can -// found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt -var strongRTLRanges = [[0x5be, 0x5be], [0x5c0, 0x5c0], [0x5c3, 0x5c3], [0x5c6, 0x5c6], - [0x5d0, 0x5ea], [0x5f0, 0x5f4], [0x608, 0x608], [0x60b, 0x60b], [0x60d, 0x60d], - [0x61b, 0x61b], [0x61e, 0x64a], [0x66d, 0x66f], [0x671, 0x6d5], [0x6e5, 0x6e6], - [0x6ee, 0x6ef], [0x6fa, 0x70d], [0x70f, 0x710], [0x712, 0x72f], [0x74d, 0x7a5], - [0x7b1, 0x7b1], [0x7c0, 0x7ea], [0x7f4, 0x7f5], [0x7fa, 0x7fa], [0x800, 0x815], - [0x81a, 0x81a], [0x824, 0x824], [0x828, 0x828], [0x830, 0x83e], [0x840, 0x858], - [0x85e, 0x85e], [0x8a0, 0x8a0], [0x8a2, 0x8ac], [0x200f, 0x200f], - [0xfb1d, 0xfb1d], [0xfb1f, 0xfb28], [0xfb2a, 0xfb36], [0xfb38, 0xfb3c], - [0xfb3e, 0xfb3e], [0xfb40, 0xfb41], [0xfb43, 0xfb44], [0xfb46, 0xfbc1], - [0xfbd3, 0xfd3d], [0xfd50, 0xfd8f], [0xfd92, 0xfdc7], [0xfdf0, 0xfdfc], - [0xfe70, 0xfe74], [0xfe76, 0xfefc], [0x10800, 0x10805], [0x10808, 0x10808], - [0x1080a, 0x10835], [0x10837, 0x10838], [0x1083c, 0x1083c], [0x1083f, 0x10855], - [0x10857, 0x1085f], [0x10900, 0x1091b], [0x10920, 0x10939], [0x1093f, 0x1093f], - [0x10980, 0x109b7], [0x109be, 0x109bf], [0x10a00, 0x10a00], [0x10a10, 0x10a13], - [0x10a15, 0x10a17], [0x10a19, 0x10a33], [0x10a40, 0x10a47], [0x10a50, 0x10a58], - [0x10a60, 0x10a7f], [0x10b00, 0x10b35], [0x10b40, 0x10b55], [0x10b58, 0x10b72], - [0x10b78, 0x10b7f], [0x10c00, 0x10c48], [0x1ee00, 0x1ee03], [0x1ee05, 0x1ee1f], - [0x1ee21, 0x1ee22], [0x1ee24, 0x1ee24], [0x1ee27, 0x1ee27], [0x1ee29, 0x1ee32], - [0x1ee34, 0x1ee37], [0x1ee39, 0x1ee39], [0x1ee3b, 0x1ee3b], [0x1ee42, 0x1ee42], - [0x1ee47, 0x1ee47], [0x1ee49, 0x1ee49], [0x1ee4b, 0x1ee4b], [0x1ee4d, 0x1ee4f], - [0x1ee51, 0x1ee52], [0x1ee54, 0x1ee54], [0x1ee57, 0x1ee57], [0x1ee59, 0x1ee59], - [0x1ee5b, 0x1ee5b], [0x1ee5d, 0x1ee5d], [0x1ee5f, 0x1ee5f], [0x1ee61, 0x1ee62], - [0x1ee64, 0x1ee64], [0x1ee67, 0x1ee6a], [0x1ee6c, 0x1ee72], [0x1ee74, 0x1ee77], - [0x1ee79, 0x1ee7c], [0x1ee7e, 0x1ee7e], [0x1ee80, 0x1ee89], [0x1ee8b, 0x1ee9b], - [0x1eea1, 0x1eea3], [0x1eea5, 0x1eea9], [0x1eeab, 0x1eebb], [0x10fffd, 0x10fffd]]; - -function isStrongRTLChar(charCode) { - for (var i = 0; i < strongRTLRanges.length; i++) { - var currentRange = strongRTLRanges[i]; - if (charCode >= currentRange[0] && charCode <= currentRange[1]) { - return true; - } - } - - return false; -} - -function determineBidi(cueDiv) { - var nodeStack = [], - text = "", - charCode; - - if (!cueDiv || !cueDiv.childNodes) { - return "ltr"; - } - - function pushNodes(nodeStack, node) { - for (var i = node.childNodes.length - 1; i >= 0; i--) { - nodeStack.push(node.childNodes[i]); - } - } - - function nextTextNode(nodeStack) { - if (!nodeStack || !nodeStack.length) { - return null; - } - - var node = nodeStack.pop(), - text = node.textContent || node.innerText; - if (text) { - // TODO: This should match all unicode type B characters (paragraph - // separator characters). See issue #115. - var m = text.match(/^.*(\n|\r)/); - if (m) { - nodeStack.length = 0; - return m[0]; - } - return text; - } - if (node.tagName === "ruby") { - return nextTextNode(nodeStack); - } - if (node.childNodes) { - pushNodes(nodeStack, node); - return nextTextNode(nodeStack); - } - } - - pushNodes(nodeStack, cueDiv); - while ((text = nextTextNode(nodeStack))) { - for (var i = 0; i < text.length; i++) { - charCode = text.charCodeAt(i); - if (isStrongRTLChar(charCode)) { - return "rtl"; - } - } - } - return "ltr"; -} - -function computeLinePos(cue) { - if (typeof cue.line === "number" && - (cue.snapToLines || (cue.line >= 0 && cue.line <= 100))) { - return cue.line; - } - if (!cue.track || !cue.track.textTrackList || - !cue.track.textTrackList.mediaElement) { - return -1; - } - var track = cue.track, - trackList = track.textTrackList, - count = 0; - for (var i = 0; i < trackList.length && trackList[i] !== track; i++) { - if (trackList[i].mode === "showing") { - count++; - } - } - return ++count * -1; -} - -function StyleBox() { -} - -// Apply styles to a div. If there is no div passed then it defaults to the -// div on 'this'. -StyleBox.prototype.applyStyles = function(styles, div) { - div = div || this.div; - for (var prop in styles) { - if (styles.hasOwnProperty(prop)) { - div.style[prop] = styles[prop]; - } - } -}; - -StyleBox.prototype.formatStyle = function(val, unit) { - return val === 0 ? 0 : val + unit; -}; - -// Constructs the computed display state of the cue (a div). Places the div -// into the overlay which should be a block level element (usually a div). -function CueStyleBox(window, cue, styleOptions) { - var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); - var color = "rgba(255, 255, 255, 1)"; - var backgroundColor = "rgba(0, 0, 0, 0.8)"; - - if (isIE8) { - color = "rgb(255, 255, 255)"; - backgroundColor = "rgb(0, 0, 0)"; - } - - StyleBox.call(this); - this.cue = cue; - - // Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will - // have inline positioning and will function as the cue background box. - this.cueDiv = parseContent(window, cue.text); - var styles = { - color: color, - backgroundColor: backgroundColor, - position: "relative", - left: 0, - right: 0, - top: 0, - bottom: 0, - display: "inline" - }; - - if (!isIE8) { - styles.writingMode = cue.vertical === "" ? "horizontal-tb" - : cue.vertical === "lr" ? "vertical-lr" - : "vertical-rl"; - styles.unicodeBidi = "plaintext"; - } - this.applyStyles(styles, this.cueDiv); - - // Create an absolutely positioned div that will be used to position the cue - // div. Note, all WebVTT cue-setting alignments are equivalent to the CSS - // mirrors of them except "middle" which is "center" in CSS. - this.div = window.document.createElement("div"); - styles = { - textAlign: cue.align === "middle" ? "center" : cue.align, - font: styleOptions.font, - whiteSpace: "pre-line", - position: "absolute" - }; - - if (!isIE8) { - styles.direction = determineBidi(this.cueDiv); - styles.writingMode = cue.vertical === "" ? "horizontal-tb" - : cue.vertical === "lr" ? "vertical-lr" - : "vertical-rl". - stylesunicodeBidi = "plaintext"; - } - - this.applyStyles(styles); - - this.div.appendChild(this.cueDiv); - - // Calculate the distance from the reference edge of the viewport to the text - // position of the cue box. The reference edge will be resolved later when - // the box orientation styles are applied. - var textPos = 0; - switch (cue.positionAlign) { - case "start": - textPos = cue.position; - break; - case "middle": - textPos = cue.position - (cue.size / 2); - break; - case "end": - textPos = cue.position - cue.size; - break; - } - - // Horizontal box orientation; textPos is the distance from the left edge of the - // area to the left edge of the box and cue.size is the distance extending to - // the right from there. - if (cue.vertical === "") { - this.applyStyles({ - left: this.formatStyle(textPos, "%"), - width: this.formatStyle(cue.size, "%") - }); - // Vertical box orientation; textPos is the distance from the top edge of the - // area to the top edge of the box and cue.size is the height extending - // downwards from there. - } else { - this.applyStyles({ - top: this.formatStyle(textPos, "%"), - height: this.formatStyle(cue.size, "%") - }); - } - - this.move = function(box) { - this.applyStyles({ - top: this.formatStyle(box.top, "px"), - bottom: this.formatStyle(box.bottom, "px"), - left: this.formatStyle(box.left, "px"), - right: this.formatStyle(box.right, "px"), - height: this.formatStyle(box.height, "px"), - width: this.formatStyle(box.width, "px") - }); - }; -} -CueStyleBox.prototype = _objCreate(StyleBox.prototype); -CueStyleBox.prototype.constructor = CueStyleBox; - -// Represents the co-ordinates of an Element in a way that we can easily -// compute things with such as if it overlaps or intersects with another Element. -// Can initialize it with either a StyleBox or another BoxPosition. -function BoxPosition(obj) { - var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); - - // Either a BoxPosition was passed in and we need to copy it, or a StyleBox - // was passed in and we need to copy the results of 'getBoundingClientRect' - // as the object returned is readonly. All co-ordinate values are in reference - // to the viewport origin (top left). - var lh, height, width, top; - if (obj.div) { - height = obj.div.offsetHeight; - width = obj.div.offsetWidth; - top = obj.div.offsetTop; - - var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && - rects.getClientRects && rects.getClientRects(); - obj = obj.div.getBoundingClientRect(); - // In certain cases the outter div will be slightly larger then the sum of - // the inner div's lines. This could be due to bold text, etc, on some platforms. - // In this case we should get the average line height and use that. This will - // result in the desired behaviour. - lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length) - : 0; - - } - this.left = obj.left; - this.right = obj.right; - this.top = obj.top || top; - this.height = obj.height || height; - this.bottom = obj.bottom || (top + (obj.height || height)); - this.width = obj.width || width; - this.lineHeight = lh !== undefined ? lh : obj.lineHeight; - - if (isIE8 && !this.lineHeight) { - this.lineHeight = 13; - } -} - -// Move the box along a particular axis. Optionally pass in an amount to move -// the box. If no amount is passed then the default is the line height of the -// box. -BoxPosition.prototype.move = function(axis, toMove) { - toMove = toMove !== undefined ? toMove : this.lineHeight; - switch (axis) { - case "+x": - this.left += toMove; - this.right += toMove; - break; - case "-x": - this.left -= toMove; - this.right -= toMove; - break; - case "+y": - this.top += toMove; - this.bottom += toMove; - break; - case "-y": - this.top -= toMove; - this.bottom -= toMove; - break; - } -}; - -// Check if this box overlaps another box, b2. -BoxPosition.prototype.overlaps = function(b2) { - return this.left < b2.right && - this.right > b2.left && - this.top < b2.bottom && - this.bottom > b2.top; -}; - -// Check if this box overlaps any other boxes in boxes. -BoxPosition.prototype.overlapsAny = function(boxes) { - for (var i = 0; i < boxes.length; i++) { - if (this.overlaps(boxes[i])) { - return true; - } - } - return false; -}; - -// Check if this box is within another box. -BoxPosition.prototype.within = function(container) { - return this.top >= container.top && - this.bottom <= container.bottom && - this.left >= container.left && - this.right <= container.right; -}; - -// Check if this box is entirely within the container or it is overlapping -// on the edge opposite of the axis direction passed. For example, if "+x" is -// passed and the box is overlapping on the left edge of the container, then -// return true. -BoxPosition.prototype.overlapsOppositeAxis = function(container, axis) { - switch (axis) { - case "+x": - return this.left < container.left; - case "-x": - return this.right > container.right; - case "+y": - return this.top < container.top; - case "-y": - return this.bottom > container.bottom; - } -}; - -// Find the percentage of the area that this box is overlapping with another -// box. -BoxPosition.prototype.intersectPercentage = function(b2) { - var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)), - y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)), - intersectArea = x * y; - return intersectArea / (this.height * this.width); -}; - -// Convert the positions from this box to CSS compatible positions using -// the reference container's positions. This has to be done because this -// box's positions are in reference to the viewport origin, whereas, CSS -// values are in referecne to their respective edges. -BoxPosition.prototype.toCSSCompatValues = function(reference) { - return { - top: this.top - reference.top, - bottom: reference.bottom - this.bottom, - left: this.left - reference.left, - right: reference.right - this.right, - height: this.height, - width: this.width - }; -}; - -// Get an object that represents the box's position without anything extra. -// Can pass a StyleBox, HTMLElement, or another BoxPositon. -BoxPosition.getSimpleBoxPosition = function(obj) { - var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0; - var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0; - var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0; - - obj = obj.div ? obj.div.getBoundingClientRect() : - obj.tagName ? obj.getBoundingClientRect() : obj; - var ret = { - left: obj.left, - right: obj.right, - top: obj.top || top, - height: obj.height || height, - bottom: obj.bottom || (top + (obj.height || height)), - width: obj.width || width - }; - return ret; -}; - -// Move a StyleBox to its specified, or next best, position. The containerBox -// is the box that contains the StyleBox, such as a div. boxPositions are -// a list of other boxes that the styleBox can't overlap with. -function moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) { - - // Find the best position for a cue box, b, on the video. The axis parameter - // is a list of axis, the order of which, it will move the box along. For example: - // Passing ["+x", "-x"] will move the box first along the x axis in the positive - // direction. If it doesn't find a good position for it there it will then move - // it along the x axis in the negative direction. - function findBestPosition(b, axis) { - var bestPosition, - specifiedPosition = new BoxPosition(b), - percentage = 1; // Highest possible so the first thing we get is better. - - for (var i = 0; i < axis.length; i++) { - while (b.overlapsOppositeAxis(containerBox, axis[i]) || - (b.within(containerBox) && b.overlapsAny(boxPositions))) { - b.move(axis[i]); - } - // We found a spot where we aren't overlapping anything. This is our - // best position. - if (b.within(containerBox)) { - return b; - } - var p = b.intersectPercentage(containerBox); - // If we're outside the container box less then we were on our last try - // then remember this position as the best position. - if (percentage > p) { - bestPosition = new BoxPosition(b); - percentage = p; - } - // Reset the box position to the specified position. - b = new BoxPosition(specifiedPosition); - } - return bestPosition || specifiedPosition; - } - - var boxPosition = new BoxPosition(styleBox), - cue = styleBox.cue, - linePos = computeLinePos(cue), - axis = []; - - // If we have a line number to align the cue to. - if (cue.snapToLines) { - var size; - switch (cue.vertical) { - case "": - axis = [ "+y", "-y" ]; - size = "height"; - break; - case "rl": - axis = [ "+x", "-x" ]; - size = "width"; - break; - case "lr": - axis = [ "-x", "+x" ]; - size = "width"; - break; - } - - var step = boxPosition.lineHeight, - position = step * Math.round(linePos), - maxPosition = containerBox[size] + step, - initialAxis = axis[0]; - - // If the specified intial position is greater then the max position then - // clamp the box to the amount of steps it would take for the box to - // reach the max position. - if (Math.abs(position) > maxPosition) { - position = position < 0 ? -1 : 1; - position *= Math.ceil(maxPosition / step) * step; - } - - // If computed line position returns negative then line numbers are - // relative to the bottom of the video instead of the top. Therefore, we - // need to increase our initial position by the length or width of the - // video, depending on the writing direction, and reverse our axis directions. - if (linePos < 0) { - position += cue.vertical === "" ? containerBox.height : containerBox.width; - axis = axis.reverse(); - } - - // Move the box to the specified position. This may not be its best - // position. - boxPosition.move(initialAxis, position); - - } else { - // If we have a percentage line value for the cue. - var calculatedPercentage = (boxPosition.lineHeight / containerBox.height) * 100; - - switch (cue.lineAlign) { - case "middle": - linePos -= (calculatedPercentage / 2); - break; - case "end": - linePos -= calculatedPercentage; - break; - } - - // Apply initial line position to the cue box. - switch (cue.vertical) { - case "": - styleBox.applyStyles({ - top: styleBox.formatStyle(linePos, "%") - }); - break; - case "rl": - styleBox.applyStyles({ - left: styleBox.formatStyle(linePos, "%") - }); - break; - case "lr": - styleBox.applyStyles({ - right: styleBox.formatStyle(linePos, "%") - }); - break; - } - - axis = [ "+y", "-x", "+x", "-y" ]; - - // Get the box position again after we've applied the specified positioning - // to it. - boxPosition = new BoxPosition(styleBox); - } - - var bestPosition = findBestPosition(boxPosition, axis); - styleBox.move(bestPosition.toCSSCompatValues(containerBox)); -} - -function WebVTT$1() { - // Nothing -} - -// Helper to allow strings to be decoded instead of the default binary utf8 data. -WebVTT$1.StringDecoder = function() { - return { - decode: function(data) { - if (!data) { - return ""; - } - if (typeof data !== "string") { - throw new Error("Error - expected string data."); - } - return decodeURIComponent(encodeURIComponent(data)); - } - }; -}; - -WebVTT$1.convertCueToDOMTree = function(window, cuetext) { - if (!window || !cuetext) { - return null; - } - return parseContent(window, cuetext); -}; - -var FONT_SIZE_PERCENT = 0.05; -var FONT_STYLE = "sans-serif"; -var CUE_BACKGROUND_PADDING = "1.5%"; - -// Runs the processing model over the cues and regions passed to it. -// @param overlay A block level element (usually a div) that the computed cues -// and regions will be placed into. -WebVTT$1.processCues = function(window, cues, overlay) { - if (!window || !cues || !overlay) { - return null; - } - - // Remove all previous children. - while (overlay.firstChild) { - overlay.removeChild(overlay.firstChild); - } - - var paddedOverlay = window.document.createElement("div"); - paddedOverlay.style.position = "absolute"; - paddedOverlay.style.left = "0"; - paddedOverlay.style.right = "0"; - paddedOverlay.style.top = "0"; - paddedOverlay.style.bottom = "0"; - paddedOverlay.style.margin = CUE_BACKGROUND_PADDING; - overlay.appendChild(paddedOverlay); - - // Determine if we need to compute the display states of the cues. This could - // be the case if a cue's state has been changed since the last computation or - // if it has not been computed yet. - function shouldCompute(cues) { - for (var i = 0; i < cues.length; i++) { - if (cues[i].hasBeenReset || !cues[i].displayState) { - return true; - } - } - return false; - } - - // We don't need to recompute the cues' display states. Just reuse them. - if (!shouldCompute(cues)) { - for (var i = 0; i < cues.length; i++) { - paddedOverlay.appendChild(cues[i].displayState); - } - return; - } - - var boxPositions = [], - containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay), - fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100; - var styleOptions = { - font: fontSize + "px " + FONT_STYLE - }; - - (function() { - var styleBox, cue; - - for (var i = 0; i < cues.length; i++) { - cue = cues[i]; - - // Compute the intial position and styles of the cue div. - styleBox = new CueStyleBox(window, cue, styleOptions); - paddedOverlay.appendChild(styleBox.div); - - // Move the cue div to it's correct line position. - moveBoxToLinePosition(window, styleBox, containerBox, boxPositions); - - // Remember the computed div so that we don't have to recompute it later - // if we don't have too. - cue.displayState = styleBox.div; - - boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox)); - } - })(); -}; - -WebVTT$1.Parser = function(window, vttjs, decoder) { - if (!decoder) { - decoder = vttjs; - vttjs = {}; - } - if (!vttjs) { - vttjs = {}; - } - - this.window = window; - this.vttjs = vttjs; - this.state = "INITIAL"; - this.buffer = ""; - this.decoder = decoder || new TextDecoder("utf8"); - this.regionList = []; -}; - -WebVTT$1.Parser.prototype = { - // If the error is a ParsingError then report it to the consumer if - // possible. If it's not a ParsingError then throw it like normal. - reportOrThrowError: function(e) { - if (e instanceof ParsingError) { - this.onparsingerror && this.onparsingerror(e); - } else { - throw e; - } - }, - parse: function (data) { - var self = this; - - // If there is no data then we won't decode it, but will just try to parse - // whatever is in buffer already. This may occur in circumstances, for - // example when flush() is called. - if (data) { - // Try to decode the data that we received. - self.buffer += self.decoder.decode(data, {stream: true}); - } - - function collectNextLine() { - var buffer = self.buffer; - var pos = 0; - while (pos < buffer.length && buffer[pos] !== '\r' && buffer[pos] !== '\n') { - ++pos; - } - var line = buffer.substr(0, pos); - // Advance the buffer early in case we fail below. - if (buffer[pos] === '\r') { - ++pos; - } - if (buffer[pos] === '\n') { - ++pos; - } - self.buffer = buffer.substr(pos); - return line; - } - - // 3.4 WebVTT region and WebVTT region settings syntax - function parseRegion(input) { - var settings = new Settings(); - - parseOptions(input, function (k, v) { - switch (k) { - case "id": - settings.set(k, v); - break; - case "width": - settings.percent(k, v); - break; - case "lines": - settings.integer(k, v); - break; - case "regionanchor": - case "viewportanchor": - var xy = v.split(','); - if (xy.length !== 2) { - break; - } - // We have to make sure both x and y parse, so use a temporary - // settings object here. - var anchor = new Settings(); - anchor.percent("x", xy[0]); - anchor.percent("y", xy[1]); - if (!anchor.has("x") || !anchor.has("y")) { - break; - } - settings.set(k + "X", anchor.get("x")); - settings.set(k + "Y", anchor.get("y")); - break; - case "scroll": - settings.alt(k, v, ["up"]); - break; - } - }, /=/, /\s/); - - // Create the region, using default values for any values that were not - // specified. - if (settings.has("id")) { - var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)(); - region.width = settings.get("width", 100); - region.lines = settings.get("lines", 3); - region.regionAnchorX = settings.get("regionanchorX", 0); - region.regionAnchorY = settings.get("regionanchorY", 100); - region.viewportAnchorX = settings.get("viewportanchorX", 0); - region.viewportAnchorY = settings.get("viewportanchorY", 100); - region.scroll = settings.get("scroll", ""); - // Register the region. - self.onregion && self.onregion(region); - // Remember the VTTRegion for later in case we parse any VTTCues that - // reference it. - self.regionList.push({ - id: settings.get("id"), - region: region - }); - } - } - - // draft-pantos-http-live-streaming-20 - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5 - // 3.5 WebVTT - function parseTimestampMap(input) { - var settings = new Settings(); - - parseOptions(input, function(k, v) { - switch(k) { - case "MPEGT": - settings.integer(k + 'S', v); - break; - case "LOCA": - settings.set(k + 'L', parseTimeStamp(v)); - break; - } - }, /[^\d]:/, /,/); - - self.ontimestampmap && self.ontimestampmap({ - "MPEGTS": settings.get("MPEGTS"), - "LOCAL": settings.get("LOCAL") - }); - } - - // 3.2 WebVTT metadata header syntax - function parseHeader(input) { - if (input.match(/X-TIMESTAMP-MAP/)) { - // This line contains HLS X-TIMESTAMP-MAP metadata - parseOptions(input, function(k, v) { - switch(k) { - case "X-TIMESTAMP-MAP": - parseTimestampMap(v); - break; - } - }, /=/); - } else { - parseOptions(input, function (k, v) { - switch (k) { - case "Region": - // 3.3 WebVTT region metadata header syntax - parseRegion(v); - break; - } - }, /:/); - } - - } - - // 5.1 WebVTT file parsing. - try { - var line; - if (self.state === "INITIAL") { - // We can't start parsing until we have the first line. - if (!/\r\n|\n/.test(self.buffer)) { - return this; - } - - line = collectNextLine(); - - var m = line.match(/^WEBVTT([ \t].*)?$/); - if (!m || !m[0]) { - throw new ParsingError(ParsingError.Errors.BadSignature); - } - - self.state = "HEADER"; - } - - var alreadyCollectedLine = false; - while (self.buffer) { - // We can't parse a line until we have the full line. - if (!/\r\n|\n/.test(self.buffer)) { - return this; - } - - if (!alreadyCollectedLine) { - line = collectNextLine(); - } else { - alreadyCollectedLine = false; - } - - switch (self.state) { - case "HEADER": - // 13-18 - Allow a header (metadata) under the WEBVTT line. - if (/:/.test(line)) { - parseHeader(line); - } else if (!line) { - // An empty line terminates the header and starts the body (cues). - self.state = "ID"; - } - continue; - case "NOTE": - // Ignore NOTE blocks. - if (!line) { - self.state = "ID"; - } - continue; - case "ID": - // Check for the start of NOTE blocks. - if (/^NOTE($|[ \t])/.test(line)) { - self.state = "NOTE"; - break; - } - // 19-29 - Allow any number of line terminators, then initialize new cue values. - if (!line) { - continue; - } - self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, ""); - self.state = "CUE"; - // 30-39 - Check if self line contains an optional identifier or timing data. - if (line.indexOf("-->") === -1) { - self.cue.id = line; - continue; - } - // Process line as start of a cue. - /*falls through*/ - case "CUE": - // 40 - Collect cue timings and settings. - try { - parseCue(line, self.cue, self.regionList); - } catch (e) { - self.reportOrThrowError(e); - // In case of an error ignore rest of the cue. - self.cue = null; - self.state = "BADCUE"; - continue; - } - self.state = "CUETEXT"; - continue; - case "CUETEXT": - var hasSubstring = line.indexOf("-->") !== -1; - // 34 - If we have an empty line then report the cue. - // 35 - If we have the special substring '-->' then report the cue, - // but do not collect the line as we need to process the current - // one as a new cue. - if (!line || hasSubstring && (alreadyCollectedLine = true)) { - // We are done parsing self cue. - self.oncue && self.oncue(self.cue); - self.cue = null; - self.state = "ID"; - continue; - } - if (self.cue.text) { - self.cue.text += "\n"; - } - self.cue.text += line; - continue; - case "BADCUE": // BADCUE - // 54-62 - Collect and discard the remaining cue. - if (!line) { - self.state = "ID"; - } - continue; - } - } - } catch (e) { - self.reportOrThrowError(e); - - // If we are currently parsing a cue, report what we have. - if (self.state === "CUETEXT" && self.cue && self.oncue) { - self.oncue(self.cue); - } - self.cue = null; - // Enter BADWEBVTT state if header was not parsed correctly otherwise - // another exception occurred so enter BADCUE state. - self.state = self.state === "INITIAL" ? "BADWEBVTT" : "BADCUE"; - } - return this; - }, - flush: function () { - var self = this; - try { - // Finish decoding the stream. - self.buffer += self.decoder.decode(); - // Synthesize the end of the current cue or region. - if (self.cue || self.state === "HEADER") { - self.buffer += "\n\n"; - self.parse(); - } - // If we've flushed, parsed, and we're still on the INITIAL state then - // that means we don't have enough of the stream to parse the first - // line. - if (self.state === "INITIAL") { - throw new ParsingError(ParsingError.Errors.BadSignature); - } - } catch(e) { - self.reportOrThrowError(e); - } - self.onflush && self.onflush(); - return this; - } -}; - -var vtt$1 = WebVTT$1; - -/** - * Copyright 2013 vtt.js Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var autoKeyword = "auto"; -var directionSetting = { - "": true, - "lr": true, - "rl": true -}; -var alignSetting = { - "start": true, - "middle": true, - "end": true, - "left": true, - "right": true -}; - -function findDirectionSetting(value) { - if (typeof value !== "string") { - return false; - } - var dir = directionSetting[value.toLowerCase()]; - return dir ? value.toLowerCase() : false; -} - -function findAlignSetting(value) { - if (typeof value !== "string") { - return false; - } - var align = alignSetting[value.toLowerCase()]; - return align ? value.toLowerCase() : false; -} - -function extend$1(obj) { - var i = 1; - for (; i < arguments.length; i++) { - var cobj = arguments[i]; - for (var p in cobj) { - obj[p] = cobj[p]; - } - } - - return obj; -} - -function VTTCue(startTime, endTime, text) { - var cue = this; - var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); - var baseObj = {}; - - if (isIE8) { - cue = document.createElement('custom'); - } else { - baseObj.enumerable = true; - } - - /** - * Shim implementation specific properties. These properties are not in - * the spec. - */ - - // Lets us know when the VTTCue's data has changed in such a way that we need - // to recompute its display state. This lets us compute its display state - // lazily. - cue.hasBeenReset = false; - - /** - * VTTCue and TextTrackCue properties - * http://dev.w3.org/html5/webvtt/#vttcue-interface - */ - - var _id = ""; - var _pauseOnExit = false; - var _startTime = startTime; - var _endTime = endTime; - var _text = text; - var _region = null; - var _vertical = ""; - var _snapToLines = true; - var _line = "auto"; - var _lineAlign = "start"; - var _position = 50; - var _positionAlign = "middle"; - var _size = 50; - var _align = "middle"; - - Object.defineProperty(cue, - "id", extend$1({}, baseObj, { - get: function() { - return _id; - }, - set: function(value) { - _id = "" + value; - } - })); - - Object.defineProperty(cue, - "pauseOnExit", extend$1({}, baseObj, { - get: function() { - return _pauseOnExit; - }, - set: function(value) { - _pauseOnExit = !!value; - } - })); - - Object.defineProperty(cue, - "startTime", extend$1({}, baseObj, { - get: function() { - return _startTime; - }, - set: function(value) { - if (typeof value !== "number") { - throw new TypeError("Start time must be set to a number."); - } - _startTime = value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "endTime", extend$1({}, baseObj, { - get: function() { - return _endTime; - }, - set: function(value) { - if (typeof value !== "number") { - throw new TypeError("End time must be set to a number."); - } - _endTime = value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "text", extend$1({}, baseObj, { - get: function() { - return _text; - }, - set: function(value) { - _text = "" + value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "region", extend$1({}, baseObj, { - get: function() { - return _region; - }, - set: function(value) { - _region = value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "vertical", extend$1({}, baseObj, { - get: function() { - return _vertical; - }, - set: function(value) { - var setting = findDirectionSetting(value); - // Have to check for false because the setting an be an empty string. - if (setting === false) { - throw new SyntaxError("An invalid or illegal string was specified."); - } - _vertical = setting; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "snapToLines", extend$1({}, baseObj, { - get: function() { - return _snapToLines; - }, - set: function(value) { - _snapToLines = !!value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "line", extend$1({}, baseObj, { - get: function() { - return _line; - }, - set: function(value) { - if (typeof value !== "number" && value !== autoKeyword) { - throw new SyntaxError("An invalid number or illegal string was specified."); - } - _line = value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "lineAlign", extend$1({}, baseObj, { - get: function() { - return _lineAlign; - }, - set: function(value) { - var setting = findAlignSetting(value); - if (!setting) { - throw new SyntaxError("An invalid or illegal string was specified."); - } - _lineAlign = setting; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "position", extend$1({}, baseObj, { - get: function() { - return _position; - }, - set: function(value) { - if (value < 0 || value > 100) { - throw new Error("Position must be between 0 and 100."); - } - _position = value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "positionAlign", extend$1({}, baseObj, { - get: function() { - return _positionAlign; - }, - set: function(value) { - var setting = findAlignSetting(value); - if (!setting) { - throw new SyntaxError("An invalid or illegal string was specified."); - } - _positionAlign = setting; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "size", extend$1({}, baseObj, { - get: function() { - return _size; - }, - set: function(value) { - if (value < 0 || value > 100) { - throw new Error("Size must be between 0 and 100."); - } - _size = value; - this.hasBeenReset = true; - } - })); - - Object.defineProperty(cue, - "align", extend$1({}, baseObj, { - get: function() { - return _align; - }, - set: function(value) { - var setting = findAlignSetting(value); - if (!setting) { - throw new SyntaxError("An invalid or illegal string was specified."); - } - _align = setting; - this.hasBeenReset = true; - } - })); - - /** - * Other <track> spec defined properties - */ - - // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state - cue.displayState = undefined; - - if (isIE8) { - return cue; - } -} - -/** - * VTTCue methods - */ - -VTTCue.prototype.getCueAsHTML = function() { - // Assume WebVTT.convertCueToDOMTree is on the global. - return WebVTT.convertCueToDOMTree(window, this.text); -}; - -var vttcue = VTTCue; - -/** - * Copyright 2013 vtt.js Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var scrollSetting = { - "": true, - "up": true -}; - -function findScrollSetting(value) { - if (typeof value !== "string") { - return false; - } - var scroll = scrollSetting[value.toLowerCase()]; - return scroll ? value.toLowerCase() : false; -} - -function isValidPercentValue(value) { - return typeof value === "number" && (value >= 0 && value <= 100); -} - -// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface -function VTTRegion() { - var _width = 100; - var _lines = 3; - var _regionAnchorX = 0; - var _regionAnchorY = 100; - var _viewportAnchorX = 0; - var _viewportAnchorY = 100; - var _scroll = ""; - - Object.defineProperties(this, { - "width": { - enumerable: true, - get: function() { - return _width; - }, - set: function(value) { - if (!isValidPercentValue(value)) { - throw new Error("Width must be between 0 and 100."); - } - _width = value; - } - }, - "lines": { - enumerable: true, - get: function() { - return _lines; - }, - set: function(value) { - if (typeof value !== "number") { - throw new TypeError("Lines must be set to a number."); - } - _lines = value; - } - }, - "regionAnchorY": { - enumerable: true, - get: function() { - return _regionAnchorY; - }, - set: function(value) { - if (!isValidPercentValue(value)) { - throw new Error("RegionAnchorX must be between 0 and 100."); - } - _regionAnchorY = value; - } - }, - "regionAnchorX": { - enumerable: true, - get: function() { - return _regionAnchorX; - }, - set: function(value) { - if(!isValidPercentValue(value)) { - throw new Error("RegionAnchorY must be between 0 and 100."); - } - _regionAnchorX = value; - } - }, - "viewportAnchorY": { - enumerable: true, - get: function() { - return _viewportAnchorY; - }, - set: function(value) { - if (!isValidPercentValue(value)) { - throw new Error("ViewportAnchorY must be between 0 and 100."); - } - _viewportAnchorY = value; - } - }, - "viewportAnchorX": { - enumerable: true, - get: function() { - return _viewportAnchorX; - }, - set: function(value) { - if (!isValidPercentValue(value)) { - throw new Error("ViewportAnchorX must be between 0 and 100."); - } - _viewportAnchorX = value; - } - }, - "scroll": { - enumerable: true, - get: function() { - return _scroll; - }, - set: function(value) { - var setting = findScrollSetting(value); - // Have to check for false as an empty string is a legal value. - if (setting === false) { - throw new SyntaxError("An invalid or illegal string was specified."); - } - _scroll = setting; - } - } - }); -} - -var vttregion = VTTRegion; - -var browserIndex = createCommonjsModule(function (module) { -/** - * Copyright 2013 vtt.js Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Default exports for Node. Export the extended versions of VTTCue and -// VTTRegion in Node since we likely want the capability to convert back and -// forth between JSON. If we don't then it's not that big of a deal since we're -// off browser. - - - -var vttjs = module.exports = { - WebVTT: vtt$1, - VTTCue: vttcue, - VTTRegion: vttregion -}; - -window_1.vttjs = vttjs; -window_1.WebVTT = vttjs.WebVTT; - -var cueShim = vttjs.VTTCue; -var regionShim = vttjs.VTTRegion; -var nativeVTTCue = window_1.VTTCue; -var nativeVTTRegion = window_1.VTTRegion; - -vttjs.shim = function() { - window_1.VTTCue = cueShim; - window_1.VTTRegion = regionShim; -}; - -vttjs.restore = function() { - window_1.VTTCue = nativeVTTCue; - window_1.VTTRegion = nativeVTTRegion; -}; - -if (!window_1.VTTCue) { - vttjs.shim(); -} -}); - -/** - * @file tech.js - */ - -/** - * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string - * that just contains the src url alone. - * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` - * `var SourceString = 'http://example.com/some-video.mp4';` - * - * @typedef {Object|string} Tech~SourceObject - * - * @property {string} src - * The url to the source - * - * @property {string} type - * The mime type of the source - */ - -/** - * A function used by {@link Tech} to create a new {@link TextTrack}. - * - * @private - * - * @param {Tech} self - * An instance of the Tech class. - * - * @param {string} kind - * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata) - * - * @param {string} [label] - * Label to identify the text track - * - * @param {string} [language] - * Two letter language abbreviation - * - * @param {Object} [options={}] - * An object with additional text track options - * - * @return {TextTrack} - * The text track that was created. - */ -function createTrackHelper(self, kind, label, language) { - var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; - - var tracks = self.textTracks(); - - options.kind = kind; - - if (label) { - options.label = label; - } - if (language) { - options.language = language; - } - options.tech = self; - - var track = new ALL.text.TrackClass(options); - - tracks.addTrack(track); - - return track; -} - -/** - * This is the base class for media playback technology controllers, such as - * {@link Flash} and {@link HTML5} - * - * @extends Component - */ - -var Tech = function (_Component) { - inherits(Tech, _Component); - - /** - * Create an instance of this Tech. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} ready - * Callback function to call when the `HTML5` Tech is ready. - */ - function Tech() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var ready = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {}; - classCallCheck(this, Tech); - - // we don't want the tech to report user activity automatically. - // This is done manually in addControlsListeners - options.reportTouchActivity = false; - - // keep track of whether the current source has played at all to - // implement a very limited played() - var _this = possibleConstructorReturn(this, _Component.call(this, null, options, ready)); - - _this.hasStarted_ = false; - _this.on('playing', function () { - this.hasStarted_ = true; - }); - _this.on('loadstart', function () { - this.hasStarted_ = false; - }); - - ALL.names.forEach(function (name) { - var props = ALL[name]; - - if (options && options[props.getterName]) { - _this[props.privateName] = options[props.getterName]; - } - }); - - // Manually track progress in cases where the browser/flash player doesn't report it. - if (!_this.featuresProgressEvents) { - _this.manualProgressOn(); - } - - // Manually track timeupdates in cases where the browser/flash player doesn't report it. - if (!_this.featuresTimeupdateEvents) { - _this.manualTimeUpdatesOn(); - } - - ['Text', 'Audio', 'Video'].forEach(function (track) { - if (options['native' + track + 'Tracks'] === false) { - _this['featuresNative' + track + 'Tracks'] = false; - } - }); - - if (options.nativeCaptions === false || options.nativeTextTracks === false) { - _this.featuresNativeTextTracks = false; - } else if (options.nativeCaptions === true || options.nativeTextTracks === true) { - _this.featuresNativeTextTracks = true; - } - - if (!_this.featuresNativeTextTracks) { - _this.emulateTextTracks(); - } - - _this.autoRemoteTextTracks_ = new ALL.text.ListClass(); - - _this.initTrackListeners(); - - // Turn on component tap events only if not using native controls - if (!options.nativeControlsForTouch) { - _this.emitTapEvents(); - } - - if (_this.constructor) { - _this.name_ = _this.constructor.name || 'Unknown Tech'; - } - return _this; - } - - /* Fallbacks for unsupported event types - ================================================================================ */ - - /** - * Polyfill the `progress` event for browsers that don't support it natively. - * - * @see {@link Tech#trackProgress} - */ - - - Tech.prototype.manualProgressOn = function manualProgressOn() { - this.on('durationchange', this.onDurationChange); - - this.manualProgress = true; - - // Trigger progress watching when a source begins loading - this.one('ready', this.trackProgress); - }; - - /** - * Turn off the polyfill for `progress` events that was created in - * {@link Tech#manualProgressOn} - */ - - - Tech.prototype.manualProgressOff = function manualProgressOff() { - this.manualProgress = false; - this.stopTrackingProgress(); - - this.off('durationchange', this.onDurationChange); - }; - - /** - * This is used to trigger a `progress` event when the buffered percent changes. It - * sets an interval function that will be called every 500 milliseconds to check if the - * buffer end percent has changed. - * - * > This function is called by {@link Tech#manualProgressOn} - * - * @param {EventTarget~Event} event - * The `ready` event that caused this to run. - * - * @listens Tech#ready - * @fires Tech#progress - */ - - - Tech.prototype.trackProgress = function trackProgress(event) { - this.stopTrackingProgress(); - this.progressInterval = this.setInterval(bind(this, function () { - // Don't trigger unless buffered amount is greater than last time - - var numBufferedPercent = this.bufferedPercent(); - - if (this.bufferedPercent_ !== numBufferedPercent) { - /** - * See {@link Player#progress} - * - * @event Tech#progress - * @type {EventTarget~Event} - */ - this.trigger('progress'); - } - - this.bufferedPercent_ = numBufferedPercent; - - if (numBufferedPercent === 1) { - this.stopTrackingProgress(); - } - }), 500); - }; - - /** - * Update our internal duration on a `durationchange` event by calling - * {@link Tech#duration}. - * - * @param {EventTarget~Event} event - * The `durationchange` event that caused this to run. - * - * @listens Tech#durationchange - */ - - - Tech.prototype.onDurationChange = function onDurationChange(event) { - this.duration_ = this.duration(); - }; - - /** - * Get and create a `TimeRange` object for buffering. - * - * @return {TimeRange} - * The time range object that was created. - */ - - - Tech.prototype.buffered = function buffered() { - return createTimeRanges(0, 0); - }; - - /** - * Get the percentage of the current video that is currently buffered. - * - * @return {number} - * A number from 0 to 1 that represents the decimal percentage of the - * video that is buffered. - * - */ - - - Tech.prototype.bufferedPercent = function bufferedPercent$$1() { - return bufferedPercent(this.buffered(), this.duration_); - }; - - /** - * Turn off the polyfill for `progress` events that was created in - * {@link Tech#manualProgressOn} - * Stop manually tracking progress events by clearing the interval that was set in - * {@link Tech#trackProgress}. - */ - - - Tech.prototype.stopTrackingProgress = function stopTrackingProgress() { - this.clearInterval(this.progressInterval); - }; - - /** - * Polyfill the `timeupdate` event for browsers that don't support it. - * - * @see {@link Tech#trackCurrentTime} - */ - - - Tech.prototype.manualTimeUpdatesOn = function manualTimeUpdatesOn() { - this.manualTimeUpdates = true; - - this.on('play', this.trackCurrentTime); - this.on('pause', this.stopTrackingCurrentTime); - }; - - /** - * Turn off the polyfill for `timeupdate` events that was created in - * {@link Tech#manualTimeUpdatesOn} - */ - - - Tech.prototype.manualTimeUpdatesOff = function manualTimeUpdatesOff() { - this.manualTimeUpdates = false; - this.stopTrackingCurrentTime(); - this.off('play', this.trackCurrentTime); - this.off('pause', this.stopTrackingCurrentTime); - }; - - /** - * Sets up an interval function to track current time and trigger `timeupdate` every - * 250 milliseconds. - * - * @listens Tech#play - * @triggers Tech#timeupdate - */ - - - Tech.prototype.trackCurrentTime = function trackCurrentTime() { - if (this.currentTimeInterval) { - this.stopTrackingCurrentTime(); - } - this.currentTimeInterval = this.setInterval(function () { - /** - * Triggered at an interval of 250ms to indicated that time is passing in the video. - * - * @event Tech#timeupdate - * @type {EventTarget~Event} - */ - this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true }); - - // 42 = 24 fps // 250 is what Webkit uses // FF uses 15 - }, 250); - }; - - /** - * Stop the interval function created in {@link Tech#trackCurrentTime} so that the - * `timeupdate` event is no longer triggered. - * - * @listens {Tech#pause} - */ - - - Tech.prototype.stopTrackingCurrentTime = function stopTrackingCurrentTime() { - this.clearInterval(this.currentTimeInterval); - - // #1002 - if the video ends right before the next timeupdate would happen, - // the progress bar won't make it all the way to the end - this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true }); - }; - - /** - * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList}, - * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech. - * - * @fires Component#dispose - */ - - - Tech.prototype.dispose = function dispose() { - - // clear out all tracks because we can't reuse them between techs - this.clearTracks(NORMAL.names); - - // Turn off any manual progress or timeupdate tracking - if (this.manualProgress) { - this.manualProgressOff(); - } - - if (this.manualTimeUpdates) { - this.manualTimeUpdatesOff(); - } - - _Component.prototype.dispose.call(this); - }; - - /** - * Clear out a single `TrackList` or an array of `TrackLists` given their names. - * - * > Note: Techs without source handlers should call this between sources for `video` - * & `audio` tracks. You don't want to use them between tracks! - * - * @param {string[]|string} types - * TrackList names to clear, valid names are `video`, `audio`, and - * `text`. - */ - - - Tech.prototype.clearTracks = function clearTracks(types) { - var _this2 = this; - - types = [].concat(types); - // clear out all tracks because we can't reuse them between techs - types.forEach(function (type) { - var list = _this2[type + 'Tracks']() || []; - var i = list.length; - - while (i--) { - var track = list[i]; - - if (type === 'text') { - _this2.removeRemoteTextTrack(track); - } - list.removeTrack(track); - } - }); - }; - - /** - * Remove any TextTracks added via addRemoteTextTrack that are - * flagged for automatic garbage collection - */ - - - Tech.prototype.cleanupAutoTextTracks = function cleanupAutoTextTracks() { - var list = this.autoRemoteTextTracks_ || []; - var i = list.length; - - while (i--) { - var track = list[i]; - - this.removeRemoteTextTrack(track); - } - }; - - /** - * Reset the tech, which will removes all sources and reset the internal readyState. - * - * @abstract - */ - - - Tech.prototype.reset = function reset() {}; - - /** - * Get or set an error on the Tech. - * - * @param {MediaError} [err] - * Error to set on the Tech - * - * @return {MediaError|null} - * The current error object on the tech, or null if there isn't one. - */ - - - Tech.prototype.error = function error(err) { - if (err !== undefined) { - this.error_ = new MediaError(err); - this.trigger('error'); - } - return this.error_; - }; - - /** - * Returns the `TimeRange`s that have been played through for the current source. - * - * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. - * It only checks wether the source has played at all or not. - * - * @return {TimeRange} - * - A single time range if this video has played - * - An empty set of ranges if not. - */ - - - Tech.prototype.played = function played() { - if (this.hasStarted_) { - return createTimeRanges(0, 0); - } - return createTimeRanges(); - }; - - /** - * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was - * previously called. - * - * @fires Tech#timeupdate - */ - - - Tech.prototype.setCurrentTime = function setCurrentTime() { - // improve the accuracy of manual timeupdates - if (this.manualTimeUpdates) { - /** - * A manual `timeupdate` event. - * - * @event Tech#timeupdate - * @type {EventTarget~Event} - */ - this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true }); - } - }; - - /** - * Turn on listeners for {@link VideoTrackList}, {@link {AudioTrackList}, and - * {@link TextTrackList} events. - * - * This adds {@link EventTarget~EventListeners} for `addtrack`, and `removetrack`. - * - * @fires Tech#audiotrackchange - * @fires Tech#videotrackchange - * @fires Tech#texttrackchange - */ - - - Tech.prototype.initTrackListeners = function initTrackListeners() { - var _this3 = this; - - /** - * Triggered when tracks are added or removed on the Tech {@link AudioTrackList} - * - * @event Tech#audiotrackchange - * @type {EventTarget~Event} - */ - - /** - * Triggered when tracks are added or removed on the Tech {@link VideoTrackList} - * - * @event Tech#videotrackchange - * @type {EventTarget~Event} - */ - - /** - * Triggered when tracks are added or removed on the Tech {@link TextTrackList} - * - * @event Tech#texttrackchange - * @type {EventTarget~Event} - */ - NORMAL.names.forEach(function (name) { - var props = NORMAL[name]; - var trackListChanges = function trackListChanges() { - _this3.trigger(name + 'trackchange'); - }; - - var tracks = _this3[props.getterName](); - - tracks.addEventListener('removetrack', trackListChanges); - tracks.addEventListener('addtrack', trackListChanges); - - _this3.on('dispose', function () { - tracks.removeEventListener('removetrack', trackListChanges); - tracks.removeEventListener('addtrack', trackListChanges); - }); - }); - }; - - /** - * Emulate TextTracks using vtt.js if necessary - * - * @fires Tech#vttjsloaded - * @fires Tech#vttjserror - */ - - - Tech.prototype.addWebVttScript_ = function addWebVttScript_() { - var _this4 = this; - - if (window_1.WebVTT) { - return; - } - - // Initially, Tech.el_ is a child of a dummy-div wait until the Component system - // signals that the Tech is ready at which point Tech.el_ is part of the DOM - // before inserting the WebVTT script - if (document_1.body.contains(this.el())) { - - // load via require if available and vtt.js script location was not passed in - // as an option. novtt builds will turn the above require call into an empty object - // which will cause this if check to always fail. - if (!this.options_['vtt.js'] && isPlain(browserIndex) && Object.keys(browserIndex).length > 0) { - this.trigger('vttjsloaded'); - return; - } - - // load vtt.js via the script location option or the cdn of no location was - // passed in - var script = document_1.createElement('script'); - - script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js'; - script.onload = function () { - /** - * Fired when vtt.js is loaded. - * - * @event Tech#vttjsloaded - * @type {EventTarget~Event} - */ - _this4.trigger('vttjsloaded'); - }; - script.onerror = function () { - /** - * Fired when vtt.js was not loaded due to an error - * - * @event Tech#vttjsloaded - * @type {EventTarget~Event} - */ - _this4.trigger('vttjserror'); - }; - this.on('dispose', function () { - script.onload = null; - script.onerror = null; - }); - // but have not loaded yet and we set it to true before the inject so that - // we don't overwrite the injected window.WebVTT if it loads right away - window_1.WebVTT = true; - this.el().parentNode.appendChild(script); - } else { - this.ready(this.addWebVttScript_); - } - }; - - /** - * Emulate texttracks - * - */ - - - Tech.prototype.emulateTextTracks = function emulateTextTracks() { - var _this5 = this; - - var tracks = this.textTracks(); - var remoteTracks = this.remoteTextTracks(); - var handleAddTrack = function handleAddTrack(e) { - return tracks.addTrack(e.track); - }; - var handleRemoveTrack = function handleRemoveTrack(e) { - return tracks.removeTrack(e.track); - }; - - remoteTracks.on('addtrack', handleAddTrack); - remoteTracks.on('removetrack', handleRemoveTrack); - - this.addWebVttScript_(); - - var updateDisplay = function updateDisplay() { - return _this5.trigger('texttrackchange'); - }; - - var textTracksChanges = function textTracksChanges() { - updateDisplay(); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - track.removeEventListener('cuechange', updateDisplay); - if (track.mode === 'showing') { - track.addEventListener('cuechange', updateDisplay); - } - } - }; - - textTracksChanges(); - tracks.addEventListener('change', textTracksChanges); - tracks.addEventListener('addtrack', textTracksChanges); - tracks.addEventListener('removetrack', textTracksChanges); - - this.on('dispose', function () { - remoteTracks.off('addtrack', handleAddTrack); - remoteTracks.off('removetrack', handleRemoveTrack); - tracks.removeEventListener('change', textTracksChanges); - tracks.removeEventListener('addtrack', textTracksChanges); - tracks.removeEventListener('removetrack', textTracksChanges); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - track.removeEventListener('cuechange', updateDisplay); - } - }); - }; - - /** - * Create and returns a remote {@link TextTrack} object. - * - * @param {string} kind - * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata) - * - * @param {string} [label] - * Label to identify the text track - * - * @param {string} [language] - * Two letter language abbreviation - * - * @return {TextTrack} - * The TextTrack that gets created. - */ - - - Tech.prototype.addTextTrack = function addTextTrack(kind, label, language) { - if (!kind) { - throw new Error('TextTrack kind is required but was not provided'); - } - - return createTrackHelper(this, kind, label, language); - }; - - /** - * Create an emulated TextTrack for use by addRemoteTextTrack - * - * This is intended to be overridden by classes that inherit from - * Tech in order to create native or custom TextTracks. - * - * @param {Object} options - * The object should contain the options to initialize the TextTrack with. - * - * @param {string} [options.kind] - * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata). - * - * @param {string} [options.label]. - * Label to identify the text track - * - * @param {string} [options.language] - * Two letter language abbreviation. - * - * @return {HTMLTrackElement} - * The track element that gets created. - */ - - - Tech.prototype.createRemoteTextTrack = function createRemoteTextTrack(options) { - var track = mergeOptions(options, { - tech: this - }); - - return new REMOTE.remoteTextEl.TrackClass(track); - }; - - /** - * Creates a remote text track object and returns an html track element. - * - * > Note: This can be an emulated {@link HTMLTrackElement} or a native one. - * - * @param {Object} options - * See {@link Tech#createRemoteTextTrack} for more detailed properties. - * - * @param {boolean} [manualCleanup=true] - * - When false: the TextTrack will be automatically removed from the video - * element whenever the source changes - * - When True: The TextTrack will have to be cleaned up manually - * - * @return {HTMLTrackElement} - * An Html Track Element. - * - * @deprecated The default functionality for this function will be equivalent - * to "manualCleanup=false" in the future. The manualCleanup parameter will - * also be removed. - */ - - - Tech.prototype.addRemoteTextTrack = function addRemoteTextTrack() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var manualCleanup = arguments[1]; - - var htmlTrackElement = this.createRemoteTextTrack(options); - - if (manualCleanup !== true && manualCleanup !== false) { - // deprecation warning - log$1.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'); - manualCleanup = true; - } - - // store HTMLTrackElement and TextTrack to remote list - this.remoteTextTrackEls().addTrackElement_(htmlTrackElement); - this.remoteTextTracks().addTrack(htmlTrackElement.track); - - if (manualCleanup !== true) { - // create the TextTrackList if it doesn't exist - this.autoRemoteTextTracks_.addTrack(htmlTrackElement.track); - } - - return htmlTrackElement; - }; - - /** - * Remove a remote text track from the remote `TextTrackList`. - * - * @param {TextTrack} track - * `TextTrack` to remove from the `TextTrackList` - */ - - - Tech.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) { - var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track); - - // remove HTMLTrackElement and TextTrack from remote list - this.remoteTextTrackEls().removeTrackElement_(trackElement); - this.remoteTextTracks().removeTrack(track); - this.autoRemoteTextTracks_.removeTrack(track); - }; - - /** - * Gets available media playback quality metrics as specified by the W3C's Media - * Playback Quality API. - * - * @see [Spec]{@link https://wicg.github.io/media-playback-quality} - * - * @return {Object} - * An object with supported media playback quality metrics - * - * @abstract - */ - - - Tech.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() { - return {}; - }; - - /** - * A method to set a poster from a `Tech`. - * - * @abstract - */ - - - Tech.prototype.setPoster = function setPoster() {}; - - /** - * A method to check for the presence of the 'playsinine' <video> attribute. - * - * @abstract - */ - - - Tech.prototype.playsinline = function playsinline() {}; - - /** - * A method to set or unset the 'playsinine' <video> attribute. - * - * @abstract - */ - - - Tech.prototype.setPlaysinline = function setPlaysinline() {}; - - /* - * Check if the tech can support the given mime-type. - * - * The base tech does not support any type, but source handlers might - * overwrite this. - * - * @param {string} type - * The mimetype to check for support - * - * @return {string} - * 'probably', 'maybe', or empty string - * - * @see [Spec]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType} - * - * @abstract - */ - - - Tech.prototype.canPlayType = function canPlayType() { - return ''; - }; - - /** - * Check if the type is supported by this tech. - * - * The base tech does not support any type, but source handlers might - * overwrite this. - * - * @param {string} type - * The media type to check - * @return {string} Returns the native video element's response - */ - - - Tech.canPlayType = function canPlayType() { - return ''; - }; - - /** - * Check if the tech can support the given source - * @param {Object} srcObj - * The source object - * @param {Object} options - * The options passed to the tech - * @return {string} 'probably', 'maybe', or '' (empty string) - */ - - - Tech.canPlaySource = function canPlaySource(srcObj, options) { - return Tech.canPlayType(srcObj.type); - }; - - /* - * Return whether the argument is a Tech or not. - * Can be passed either a Class like `Html5` or a instance like `player.tech_` - * - * @param {Object} component - * The item to check - * - * @return {boolean} - * Whether it is a tech or not - * - True if it is a tech - * - False if it is not - */ - - - Tech.isTech = function isTech(component) { - return component.prototype instanceof Tech || component instanceof Tech || component === Tech; - }; - - /** - * Registers a `Tech` into a shared list for videojs. - * - * @param {string} name - * Name of the `Tech` to register. - * - * @param {Object} tech - * The `Tech` class to register. - */ - - - Tech.registerTech = function registerTech(name, tech) { - if (!Tech.techs_) { - Tech.techs_ = {}; - } - - if (!Tech.isTech(tech)) { - throw new Error('Tech ' + name + ' must be a Tech'); - } - - if (!Tech.canPlayType) { - throw new Error('Techs must have a static canPlayType method on them'); - } - if (!Tech.canPlaySource) { - throw new Error('Techs must have a static canPlaySource method on them'); - } - - name = toTitleCase(name); - - Tech.techs_[name] = tech; - if (name !== 'Tech') { - // camel case the techName for use in techOrder - Tech.defaultTechOrder_.push(name); - } - return tech; - }; - - /** - * Get a `Tech` from the shared list by name. - * - * @param {string} name - * `camelCase` or `TitleCase` name of the Tech to get - * - * @return {Tech|undefined} - * The `Tech` or undefined if there was no tech with the name requsted. - */ - - - Tech.getTech = function getTech(name) { - if (!name) { - return; - } - - name = toTitleCase(name); - - if (Tech.techs_ && Tech.techs_[name]) { - return Tech.techs_[name]; - } - - if (window_1 && window_1.videojs && window_1.videojs[name]) { - log$1.warn('The ' + name + ' tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)'); - return window_1.videojs[name]; - } - }; - - return Tech; -}(Component); - -/** - * Get the {@link VideoTrackList} - * - * @returns {VideoTrackList} - * @method Tech.prototype.videoTracks - */ - -/** - * Get the {@link AudioTrackList} - * - * @returns {AudioTrackList} - * @method Tech.prototype.audioTracks - */ - -/** - * Get the {@link TextTrackList} - * - * @returns {TextTrackList} - * @method Tech.prototype.textTracks - */ - -/** - * Get the remote element {@link TextTrackList} - * - * @returns {TextTrackList} - * @method Tech.prototype.remoteTextTracks - */ - -/** - * Get the remote element {@link HtmlTrackElementList} - * - * @returns {HtmlTrackElementList} - * @method Tech.prototype.remoteTextTrackEls - */ - -ALL.names.forEach(function (name) { - var props = ALL[name]; - - Tech.prototype[props.getterName] = function () { - this[props.privateName] = this[props.privateName] || new props.ListClass(); - return this[props.privateName]; - }; -}); - -/** - * List of associated text tracks - * - * @type {TextTrackList} - * @private - * @property Tech#textTracks_ - */ - -/** - * List of associated audio tracks. - * - * @type {AudioTrackList} - * @private - * @property Tech#audioTracks_ - */ - -/** - * List of associated video tracks. - * - * @type {VideoTrackList} - * @private - * @property Tech#videoTracks_ - */ - -/** - * Boolean indicating wether the `Tech` supports volume control. - * - * @type {boolean} - * @default - */ -Tech.prototype.featuresVolumeControl = true; - -/** - * Boolean indicating wether the `Tech` support fullscreen resize control. - * Resizing plugins using request fullscreen reloads the plugin - * - * @type {boolean} - * @default - */ -Tech.prototype.featuresFullscreenResize = false; - -/** - * Boolean indicating wether the `Tech` supports changing the speed at which the video - * plays. Examples: - * - Set player to play 2x (twice) as fast - * - Set player to play 0.5x (half) as fast - * - * @type {boolean} - * @default - */ -Tech.prototype.featuresPlaybackRate = false; - -/** - * Boolean indicating wether the `Tech` supports the `progress` event. This is currently - * not triggered by video-js-swf. This will be used to determine if - * {@link Tech#manualProgressOn} should be called. - * - * @type {boolean} - * @default - */ -Tech.prototype.featuresProgressEvents = false; - -/** - * Boolean indicating wether the `Tech` supports the `timeupdate` event. This is currently - * not triggered by video-js-swf. This will be used to determine if - * {@link Tech#manualTimeUpdates} should be called. - * - * @type {boolean} - * @default - */ -Tech.prototype.featuresTimeupdateEvents = false; - -/** - * Boolean indicating wether the `Tech` supports the native `TextTrack`s. - * This will help us integrate with native `TextTrack`s if the browser supports them. - * - * @type {boolean} - * @default - */ -Tech.prototype.featuresNativeTextTracks = false; - -/** - * A functional mixin for techs that want to use the Source Handler pattern. - * Source handlers are scripts for handling specific formats. - * The source handler pattern is used for adaptive formats (HLS, DASH) that - * manually load video data and feed it into a Source Buffer (Media Source Extensions) - * Example: `Tech.withSourceHandlers.call(MyTech);` - * - * @param {Tech} _Tech - * The tech to add source handler functions to. - * - * @mixes Tech~SourceHandlerAdditions - */ -Tech.withSourceHandlers = function (_Tech) { - - /** - * Register a source handler - * - * @param {Function} handler - * The source handler class - * - * @param {number} [index] - * Register it at the following index - */ - _Tech.registerSourceHandler = function (handler, index) { - var handlers = _Tech.sourceHandlers; - - if (!handlers) { - handlers = _Tech.sourceHandlers = []; - } - - if (index === undefined) { - // add to the end of the list - index = handlers.length; - } - - handlers.splice(index, 0, handler); - }; - - /** - * Check if the tech can support the given type. Also checks the - * Techs sourceHandlers. - * - * @param {string} type - * The mimetype to check. - * - * @return {string} - * 'probably', 'maybe', or '' (empty string) - */ - _Tech.canPlayType = function (type) { - var handlers = _Tech.sourceHandlers || []; - var can = void 0; - - for (var i = 0; i < handlers.length; i++) { - can = handlers[i].canPlayType(type); - - if (can) { - return can; - } - } - - return ''; - }; - - /** - * Returns the first source handler that supports the source. - * - * TODO: Answer question: should 'probably' be prioritized over 'maybe' - * - * @param {Tech~SourceObject} source - * The source object - * - * @param {Object} options - * The options passed to the tech - * - * @return {SourceHandler|null} - * The first source handler that supports the source or null if - * no SourceHandler supports the source - */ - _Tech.selectSourceHandler = function (source, options) { - var handlers = _Tech.sourceHandlers || []; - var can = void 0; - - for (var i = 0; i < handlers.length; i++) { - can = handlers[i].canHandleSource(source, options); - - if (can) { - return handlers[i]; - } - } - - return null; - }; - - /** - * Check if the tech can support the given source. - * - * @param {Tech~SourceObject} srcObj - * The source object - * - * @param {Object} options - * The options passed to the tech - * - * @return {string} - * 'probably', 'maybe', or '' (empty string) - */ - _Tech.canPlaySource = function (srcObj, options) { - var sh = _Tech.selectSourceHandler(srcObj, options); - - if (sh) { - return sh.canHandleSource(srcObj, options); - } - - return ''; - }; - - /** - * When using a source handler, prefer its implementation of - * any function normally provided by the tech. - */ - var deferrable = ['seekable', 'duration']; - - /** - * A wrapper around {@link Tech#seekable} that will call a `SourceHandler`s seekable - * function if it exists, with a fallback to the Techs seekable function. - * - * @method _Tech.seekable - */ - - /** - * A wrapper around {@link Tech#duration} that will call a `SourceHandler`s duration - * function if it exists, otherwise it will fallback to the techs duration function. - * - * @method _Tech.duration - */ - - deferrable.forEach(function (fnName) { - var originalFn = this[fnName]; - - if (typeof originalFn !== 'function') { - return; - } - - this[fnName] = function () { - if (this.sourceHandler_ && this.sourceHandler_[fnName]) { - return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments); - } - return originalFn.apply(this, arguments); - }; - }, _Tech.prototype); - - /** - * Create a function for setting the source using a source object - * and source handlers. - * Should never be called unless a source handler was found. - * - * @param {Tech~SourceObject} source - * A source object with src and type keys - */ - _Tech.prototype.setSource = function (source) { - var sh = _Tech.selectSourceHandler(source, this.options_); - - if (!sh) { - // Fall back to a native source hander when unsupported sources are - // deliberately set - if (_Tech.nativeSourceHandler) { - sh = _Tech.nativeSourceHandler; - } else { - log$1.error('No source hander found for the current source.'); - } - } - - // Dispose any existing source handler - this.disposeSourceHandler(); - this.off('dispose', this.disposeSourceHandler); - - if (sh !== _Tech.nativeSourceHandler) { - this.currentSource_ = source; - } - - this.sourceHandler_ = sh.handleSource(source, this, this.options_); - this.on('dispose', this.disposeSourceHandler); - }; - - /** - * Clean up any existing SourceHandlers and listeners when the Tech is disposed. - * - * @listens Tech#dispose - */ - _Tech.prototype.disposeSourceHandler = function () { - // if we have a source and get another one - // then we are loading something new - // than clear all of our current tracks - if (this.currentSource_) { - this.clearTracks(['audio', 'video']); - this.currentSource_ = null; - } - - // always clean up auto-text tracks - this.cleanupAutoTextTracks(); - - if (this.sourceHandler_) { - - if (this.sourceHandler_.dispose) { - this.sourceHandler_.dispose(); - } - - this.sourceHandler_ = null; - } - }; -}; - -// The base Tech class needs to be registered as a Component. It is the only -// Tech that can be registered as a Component. -Component.registerComponent('Tech', Tech); -Tech.registerTech('Tech', Tech); - -/** - * A list of techs that should be added to techOrder on Players - * - * @private - */ -Tech.defaultTechOrder_ = []; - -var middlewares = {}; - -function use(type, middleware) { - middlewares[type] = middlewares[type] || []; - middlewares[type].push(middleware); -} - - - -function setSource(player, src, next) { - player.setTimeout(function () { - return setSourceHelper(src, middlewares[src.type], next, player); - }, 1); -} - -function setTech(middleware, tech) { - middleware.forEach(function (mw) { - return mw.setTech && mw.setTech(tech); - }); -} - -function get$1(middleware, tech, method) { - return middleware.reduceRight(middlewareIterator(method), tech[method]()); -} - -function set$1(middleware, tech, method, arg) { - return tech[method](middleware.reduce(middlewareIterator(method), arg)); -} - -var allowedGetters = { - buffered: 1, - currentTime: 1, - duration: 1, - seekable: 1, - played: 1 -}; - -var allowedSetters = { - setCurrentTime: 1 -}; - -function middlewareIterator(method) { - return function (value, mw) { - if (mw[method]) { - return mw[method](value); - } - - return value; - }; -} - -function setSourceHelper() { - var src = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - var next = arguments[2]; - var player = arguments[3]; - var acc = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : []; - var lastRun = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; - var mwFactory = middleware[0], - mwrest = middleware.slice(1); - - // if mwFactory is a string, then we're at a fork in the road - - if (typeof mwFactory === 'string') { - setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun); - - // if we have an mwFactory, call it with the player to get the mw, - // then call the mw's setSource method - } else if (mwFactory) { - var mw = mwFactory(player); - - mw.setSource(assign({}, src), function (err, _src) { - - // something happened, try the next middleware on the current level - // make sure to use the old src - if (err) { - return setSourceHelper(src, mwrest, next, player, acc, lastRun); - } - - // we've succeeded, now we need to go deeper - acc.push(mw); - - // if it's the same time, continue does the current chain - // otherwise, we want to go down the new chain - setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun); - }); - } else if (mwrest.length) { - setSourceHelper(src, mwrest, next, player, acc, lastRun); - } else if (lastRun) { - next(src, acc); - } else { - setSourceHelper(src, middlewares['*'], next, player, acc, true); - } -} - -/** - * @module filter-source - */ -/** - * Filter out single bad source objects or multiple source objects in an - * array. Also flattens nested source object arrays into a 1 dimensional - * array of source objects. - * - * @param {Tech~SourceObject|Tech~SourceObject[]} src - * The src object to filter - * - * @return {Tech~SourceObject[]} - * An array of sourceobjects containing only valid sources - * - * @private - */ -var filterSource = function filterSource(src) { - // traverse array - if (Array.isArray(src)) { - var newsrc = []; - - src.forEach(function (srcobj) { - srcobj = filterSource(srcobj); - - if (Array.isArray(srcobj)) { - newsrc = newsrc.concat(srcobj); - } else if (isObject(srcobj)) { - newsrc.push(srcobj); - } - }); - - src = newsrc; - } else if (typeof src === 'string' && src.trim()) { - // convert string into object - src = [{ src: src }]; - } else if (isObject(src) && typeof src.src === 'string' && src.src && src.src.trim()) { - // src is already valid - src = [src]; - } else { - // invalid source, turn it into an empty array - src = []; - } - - return src; -}; - -/** - * @file loader.js - */ -/** - * The `MediaLoader` is the `Component` that decides which playback technology to load - * when a player is initialized. - * - * @extends Component - */ - -var MediaLoader = function (_Component) { - inherits(MediaLoader, _Component); - - /** - * Create an instance of this class. - * - * @param {Player} player - * The `Player` that this class should attach to. - * - * @param {Object} [options] - * The key/value stroe of player options. - * - * @param {Component~ReadyCallback} [ready] - * The function that is run when this component is ready. - */ - function MediaLoader(player, options, ready) { - classCallCheck(this, MediaLoader); - - // MediaLoader has no element - var options_ = mergeOptions({ createEl: false }, options); - - // If there are no sources when the player is initialized, - // load the first supported playback technology. - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options_, ready)); - - if (!options.playerOptions.sources || options.playerOptions.sources.length === 0) { - for (var i = 0, j = options.playerOptions.techOrder; i < j.length; i++) { - var techName = toTitleCase(j[i]); - var tech = Tech.getTech(techName); - - // Support old behavior of techs being registered as components. - // Remove once that deprecated behavior is removed. - if (!techName) { - tech = Component.getComponent(techName); - } - - // Check if the browser supports this technology - if (tech && tech.isSupported()) { - player.loadTech_(techName); - break; - } - } - } else { - // Loop through playback technologies (HTML5, Flash) and check for support. - // Then load the best source. - // A few assumptions here: - // All playback technologies respect preload false. - player.src(options.playerOptions.sources); - } - return _this; - } - - return MediaLoader; -}(Component); - -Component.registerComponent('MediaLoader', MediaLoader); - -/** - * @file button.js - */ -/** - * Clickable Component which is clickable or keyboard actionable, - * but is not a native HTML button. - * - * @extends Component - */ - -var ClickableComponent = function (_Component) { - inherits(ClickableComponent, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function ClickableComponent(player, options) { - classCallCheck(this, ClickableComponent); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.emitTapEvents(); - - _this.enable(); - return _this; - } - - /** - * Create the `Component`s DOM element. - * - * @param {string} [tag=div] - * The element's node type. - * - * @param {Object} [props={}] - * An object of properties that should be set on the element. - * - * @param {Object} [attributes={}] - * An object of attributes that should be set on the element. - * - * @return {Element} - * The element that gets created. - */ - - - ClickableComponent.prototype.createEl = function createEl$$1() { - var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div'; - var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - props = assign({ - innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>', - className: this.buildCSSClass(), - tabIndex: 0 - }, props); - - if (tag === 'button') { - log$1.error('Creating a ClickableComponent with an HTML element of ' + tag + ' is not supported; use a Button instead.'); - } - - // Add ARIA attributes for clickable element which is not a native HTML button - attributes = assign({ - 'role': 'button', - - // let the screen reader user know that the text of the element may change - 'aria-live': 'polite' - }, attributes); - - this.tabIndex_ = props.tabIndex; - - var el = _Component.prototype.createEl.call(this, tag, props, attributes); - - this.createControlTextEl(el); - - return el; - }; - - /** - * Create a control text element on this `Component` - * - * @param {Element} [el] - * Parent element for the control text. - * - * @return {Element} - * The control text element that gets created. - */ - - - ClickableComponent.prototype.createControlTextEl = function createControlTextEl(el) { - this.controlTextEl_ = createEl('span', { - className: 'vjs-control-text' - }); - - if (el) { - el.appendChild(this.controlTextEl_); - } - - this.controlText(this.controlText_, el); - - return this.controlTextEl_; - }; - - /** - * Get or set the localize text to use for the controls on the `Component`. - * - * @param {string} [text] - * Control text for element. - * - * @param {Element} [el=this.el()] - * Element to set the title on. - * - * @return {string} - * - The control text when getting - */ - - - ClickableComponent.prototype.controlText = function controlText(text) { - var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.el(); - - if (!text) { - return this.controlText_ || 'Need Text'; - } - - var localizedText = this.localize(text); - - this.controlText_ = text; - this.controlTextEl_.innerHTML = localizedText; - if (!this.nonIconControl) { - // Set title attribute if only an icon is shown - el.setAttribute('title', localizedText); - } - }; - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - ClickableComponent.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-control vjs-button ' + _Component.prototype.buildCSSClass.call(this); - }; - - /** - * Enable this `Component`s element. - */ - - - ClickableComponent.prototype.enable = function enable() { - if (!this.enabled_) { - this.enabled_ = true; - this.removeClass('vjs-disabled'); - this.el_.setAttribute('aria-disabled', 'false'); - if (typeof this.tabIndex_ !== 'undefined') { - this.el_.setAttribute('tabIndex', this.tabIndex_); - } - this.on(['tap', 'click'], this.handleClick); - this.on('focus', this.handleFocus); - this.on('blur', this.handleBlur); - } - }; - - /** - * Disable this `Component`s element. - */ - - - ClickableComponent.prototype.disable = function disable() { - this.enabled_ = false; - this.addClass('vjs-disabled'); - this.el_.setAttribute('aria-disabled', 'true'); - if (typeof this.tabIndex_ !== 'undefined') { - this.el_.removeAttribute('tabIndex'); - } - this.off(['tap', 'click'], this.handleClick); - this.off('focus', this.handleFocus); - this.off('blur', this.handleBlur); - }; - - /** - * This gets called when a `ClickableComponent` gets: - * - Clicked (via the `click` event, listening starts in the constructor) - * - Tapped (via the `tap` event, listening starts in the constructor) - * - The following things happen in order: - * 1. {@link ClickableComponent#handleFocus} is called via a `focus` event on the - * `ClickableComponent`. - * 2. {@link ClickableComponent#handleFocus} adds a listener for `keydown` on using - * {@link ClickableComponent#handleKeyPress}. - * 3. `ClickableComponent` has not had a `blur` event (`blur` means that focus was lost). The user presses - * the space or enter key. - * 4. {@link ClickableComponent#handleKeyPress} calls this function with the `keydown` - * event as a parameter. - * - * @param {EventTarget~Event} event - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - * @abstract - */ - - - ClickableComponent.prototype.handleClick = function handleClick(event) {}; - - /** - * This gets called when a `ClickableComponent` gains focus via a `focus` event. - * Turns on listening for `keydown` events. When they happen it - * calls `this.handleKeyPress`. - * - * @param {EventTarget~Event} event - * The `focus` event that caused this function to be called. - * - * @listens focus - */ - - - ClickableComponent.prototype.handleFocus = function handleFocus(event) { - on(document_1, 'keydown', bind(this, this.handleKeyPress)); - }; - - /** - * Called when this ClickableComponent has focus and a key gets pressed down. By - * default it will call `this.handleClick` when the key is space or enter. - * - * @param {EventTarget~Event} event - * The `keydown` event that caused this function to be called. - * - * @listens keydown - */ - - - ClickableComponent.prototype.handleKeyPress = function handleKeyPress(event) { - - // Support Space (32) or Enter (13) key operation to fire a click event - if (event.which === 32 || event.which === 13) { - event.preventDefault(); - this.trigger('click'); - } else if (_Component.prototype.handleKeyPress) { - - // Pass keypress handling up for unsupported keys - _Component.prototype.handleKeyPress.call(this, event); - } - }; - - /** - * Called when a `ClickableComponent` loses focus. Turns off the listener for - * `keydown` events. Which Stops `this.handleKeyPress` from getting called. - * - * @param {EventTarget~Event} event - * The `blur` event that caused this function to be called. - * - * @listens blur - */ - - - ClickableComponent.prototype.handleBlur = function handleBlur(event) { - off(document_1, 'keydown', bind(this, this.handleKeyPress)); - }; - - return ClickableComponent; -}(Component); - -Component.registerComponent('ClickableComponent', ClickableComponent); - -/** - * @file poster-image.js - */ -/** - * A `ClickableComponent` that handles showing the poster image for the player. - * - * @extends ClickableComponent - */ - -var PosterImage = function (_ClickableComponent) { - inherits(PosterImage, _ClickableComponent); - - /** - * Create an instance of this class. - * - * @param {Player} player - * The `Player` that this class should attach to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function PosterImage(player, options) { - classCallCheck(this, PosterImage); - - var _this = possibleConstructorReturn(this, _ClickableComponent.call(this, player, options)); - - _this.update(); - player.on('posterchange', bind(_this, _this.update)); - return _this; - } - - /** - * Clean up and dispose of the `PosterImage`. - */ - - - PosterImage.prototype.dispose = function dispose() { - this.player().off('posterchange', this.update); - _ClickableComponent.prototype.dispose.call(this); - }; - - /** - * Create the `PosterImage`s DOM element. - * - * @return {Element} - * The element that gets created. - */ - - - PosterImage.prototype.createEl = function createEl$$1() { - var el = createEl('div', { - className: 'vjs-poster', - - // Don't want poster to be tabbable. - tabIndex: -1 - }); - - // To ensure the poster image resizes while maintaining its original aspect - // ratio, use a div with `background-size` when available. For browsers that - // do not support `background-size` (e.g. IE8), fall back on using a regular - // img element. - if (!BACKGROUND_SIZE_SUPPORTED) { - this.fallbackImg_ = createEl('img'); - el.appendChild(this.fallbackImg_); - } - - return el; - }; - - /** - * An {@link EventTarget~EventListener} for {@link Player#posterchange} events. - * - * @listens Player#posterchange - * - * @param {EventTarget~Event} [event] - * The `Player#posterchange` event that triggered this function. - */ - - - PosterImage.prototype.update = function update(event) { - var url = this.player().poster(); - - this.setSrc(url); - - // If there's no poster source we should display:none on this component - // so it's not still clickable or right-clickable - if (url) { - this.show(); - } else { - this.hide(); - } - }; - - /** - * Set the source of the `PosterImage` depending on the display method. - * - * @param {string} url - * The URL to the source for the `PosterImage`. - */ - - - PosterImage.prototype.setSrc = function setSrc(url) { - if (this.fallbackImg_) { - this.fallbackImg_.src = url; - } else { - var backgroundImage = ''; - - // Any falsey values should stay as an empty string, otherwise - // this will throw an extra error - if (url) { - backgroundImage = 'url("' + url + '")'; - } - - this.el_.style.backgroundImage = backgroundImage; - } - }; - - /** - * An {@link EventTarget~EventListener} for clicks on the `PosterImage`. See - * {@link ClickableComponent#handleClick} for instances where this will be triggered. - * - * @listens tap - * @listens click - * @listens keydown - * - * @param {EventTarget~Event} event - + The `click`, `tap` or `keydown` event that caused this function to be called. - */ - - - PosterImage.prototype.handleClick = function handleClick(event) { - // We don't want a click to trigger playback when controls are disabled - if (!this.player_.controls()) { - return; - } - - if (this.player_.paused()) { - this.player_.play(); - } else { - this.player_.pause(); - } - }; - - return PosterImage; -}(ClickableComponent); - -Component.registerComponent('PosterImage', PosterImage); - -/** - * @file text-track-display.js - */ -var darkGray = '#222'; -var lightGray = '#ccc'; -var fontMap = { - monospace: 'monospace', - sansSerif: 'sans-serif', - serif: 'serif', - monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace', - monospaceSerif: '"Courier New", monospace', - proportionalSansSerif: 'sans-serif', - proportionalSerif: 'serif', - casual: '"Comic Sans MS", Impact, fantasy', - script: '"Monotype Corsiva", cursive', - smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif' -}; - -/** - * Construct an rgba color from a given hex color code. - * - * @param {number} color - * Hex number for color, like #f0e. - * - * @param {number} opacity - * Value for opacity, 0.0 - 1.0. - * - * @return {string} - * The rgba color that was created, like 'rgba(255, 0, 0, 0.3)'. - * - * @private - */ -function constructColor(color, opacity) { - return 'rgba(' + - // color looks like "#f0e" - parseInt(color[1] + color[1], 16) + ',' + parseInt(color[2] + color[2], 16) + ',' + parseInt(color[3] + color[3], 16) + ',' + opacity + ')'; -} - -/** - * Try to update the style of a DOM element. Some style changes will throw an error, - * particularly in IE8. Those should be noops. - * - * @param {Element} el - * The DOM element to be styled. - * - * @param {string} style - * The CSS property on the element that should be styled. - * - * @param {string} rule - * The style rule that should be applied to the property. - * - * @private - */ -function tryUpdateStyle(el, style, rule) { - try { - el.style[style] = rule; - } catch (e) { - - // Satisfies linter. - return; - } -} - -/** - * The component for displaying text track cues. - * - * @extends Component - */ - -var TextTrackDisplay = function (_Component) { - inherits(TextTrackDisplay, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} [ready] - * The function to call when `TextTrackDisplay` is ready. - */ - function TextTrackDisplay(player, options, ready) { - classCallCheck(this, TextTrackDisplay); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options, ready)); - - player.on('loadstart', bind(_this, _this.toggleDisplay)); - player.on('texttrackchange', bind(_this, _this.updateDisplay)); - player.on('loadstart', bind(_this, _this.preselectTrack)); - - // This used to be called during player init, but was causing an error - // if a track should show by default and the display hadn't loaded yet. - // Should probably be moved to an external track loader when we support - // tracks that don't need a display. - player.ready(bind(_this, function () { - if (player.tech_ && player.tech_.featuresNativeTextTracks) { - this.hide(); - return; - } - - player.on('fullscreenchange', bind(this, this.updateDisplay)); - - var tracks = this.options_.playerOptions.tracks || []; - - for (var i = 0; i < tracks.length; i++) { - this.player_.addRemoteTextTrack(tracks[i], true); - } - - this.preselectTrack(); - })); - return _this; - } - - /** - * Preselect a track following this precedence: - * - matches the previously selected {@link TextTrack}'s language and kind - * - matches the previously selected {@link TextTrack}'s language only - * - is the first default captions track - * - is the first default descriptions track - * - * @listens Player#loadstart - */ - - - TextTrackDisplay.prototype.preselectTrack = function preselectTrack() { - var modes = { captions: 1, subtitles: 1 }; - var trackList = this.player_.textTracks(); - var userPref = this.player_.cache_.selectedLanguage; - var firstDesc = void 0; - var firstCaptions = void 0; - var preferredTrack = void 0; - - for (var i = 0; i < trackList.length; i++) { - var track = trackList[i]; - - if (userPref && userPref.enabled && userPref.language === track.language) { - // Always choose the track that matches both language and kind - if (track.kind === userPref.kind) { - preferredTrack = track; - // or choose the first track that matches language - } else if (!preferredTrack) { - preferredTrack = track; - } - - // clear everything if offTextTrackMenuItem was clicked - } else if (userPref && !userPref.enabled) { - preferredTrack = null; - firstDesc = null; - firstCaptions = null; - } else if (track['default']) { - if (track.kind === 'descriptions' && !firstDesc) { - firstDesc = track; - } else if (track.kind in modes && !firstCaptions) { - firstCaptions = track; - } - } - } - - // The preferredTrack matches the user preference and takes - // precendence over all the other tracks. - // So, display the preferredTrack before the first default track - // and the subtitles/captions track before the descriptions track - if (preferredTrack) { - preferredTrack.mode = 'showing'; - } else if (firstCaptions) { - firstCaptions.mode = 'showing'; - } else if (firstDesc) { - firstDesc.mode = 'showing'; - } - }; - - /** - * Turn display of {@link TextTrack}'s from the current state into the other state. - * There are only two states: - * - 'shown' - * - 'hidden' - * - * @listens Player#loadstart - */ - - - TextTrackDisplay.prototype.toggleDisplay = function toggleDisplay() { - if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) { - this.hide(); - } else { - this.show(); - } - }; - - /** - * Create the {@link Component}'s DOM element. - * - * @return {Element} - * The element that was created. - */ - - - TextTrackDisplay.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-text-track-display' - }, { - 'aria-live': 'off', - 'aria-atomic': 'true' - }); - }; - - /** - * Clear all displayed {@link TextTrack}s. - */ - - - TextTrackDisplay.prototype.clearDisplay = function clearDisplay() { - if (typeof window_1.WebVTT === 'function') { - window_1.WebVTT.processCues(window_1, [], this.el_); - } - }; - - /** - * Update the displayed TextTrack when a either a {@link Player#texttrackchange} or - * a {@link Player#fullscreenchange} is fired. - * - * @listens Player#texttrackchange - * @listens Player#fullscreenchange - */ - - - TextTrackDisplay.prototype.updateDisplay = function updateDisplay() { - var tracks = this.player_.textTracks(); - - this.clearDisplay(); - - // Track display prioritization model: if multiple tracks are 'showing', - // display the first 'subtitles' or 'captions' track which is 'showing', - // otherwise display the first 'descriptions' track which is 'showing' - - var descriptionsTrack = null; - var captionsSubtitlesTrack = null; - var i = tracks.length; - - while (i--) { - var track = tracks[i]; - - if (track.mode === 'showing') { - if (track.kind === 'descriptions') { - descriptionsTrack = track; - } else { - captionsSubtitlesTrack = track; - } - } - } - - if (captionsSubtitlesTrack) { - if (this.getAttribute('aria-live') !== 'off') { - this.setAttribute('aria-live', 'off'); - } - this.updateForTrack(captionsSubtitlesTrack); - } else if (descriptionsTrack) { - if (this.getAttribute('aria-live') !== 'assertive') { - this.setAttribute('aria-live', 'assertive'); - } - this.updateForTrack(descriptionsTrack); - } - }; - - /** - * Add an {@link Texttrack} to to the {@link Tech}s {@link TextTrackList}. - * - * @param {TextTrack} track - * Text track object to be added to the list. - */ - - - TextTrackDisplay.prototype.updateForTrack = function updateForTrack(track) { - if (typeof window_1.WebVTT !== 'function' || !track.activeCues) { - return; - } - - var overrides = this.player_.textTrackSettings.getValues(); - var cues = []; - - for (var _i = 0; _i < track.activeCues.length; _i++) { - cues.push(track.activeCues[_i]); - } - - window_1.WebVTT.processCues(window_1, cues, this.el_); - - var i = cues.length; - - while (i--) { - var cue = cues[i]; - - if (!cue) { - continue; - } - - var cueDiv = cue.displayState; - - if (overrides.color) { - cueDiv.firstChild.style.color = overrides.color; - } - if (overrides.textOpacity) { - tryUpdateStyle(cueDiv.firstChild, 'color', constructColor(overrides.color || '#fff', overrides.textOpacity)); - } - if (overrides.backgroundColor) { - cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor; - } - if (overrides.backgroundOpacity) { - tryUpdateStyle(cueDiv.firstChild, 'backgroundColor', constructColor(overrides.backgroundColor || '#000', overrides.backgroundOpacity)); - } - if (overrides.windowColor) { - if (overrides.windowOpacity) { - tryUpdateStyle(cueDiv, 'backgroundColor', constructColor(overrides.windowColor, overrides.windowOpacity)); - } else { - cueDiv.style.backgroundColor = overrides.windowColor; - } - } - if (overrides.edgeStyle) { - if (overrides.edgeStyle === 'dropshadow') { - cueDiv.firstChild.style.textShadow = '2px 2px 3px ' + darkGray + ', 2px 2px 4px ' + darkGray + ', 2px 2px 5px ' + darkGray; - } else if (overrides.edgeStyle === 'raised') { - cueDiv.firstChild.style.textShadow = '1px 1px ' + darkGray + ', 2px 2px ' + darkGray + ', 3px 3px ' + darkGray; - } else if (overrides.edgeStyle === 'depressed') { - cueDiv.firstChild.style.textShadow = '1px 1px ' + lightGray + ', 0 1px ' + lightGray + ', -1px -1px ' + darkGray + ', 0 -1px ' + darkGray; - } else if (overrides.edgeStyle === 'uniform') { - cueDiv.firstChild.style.textShadow = '0 0 4px ' + darkGray + ', 0 0 4px ' + darkGray + ', 0 0 4px ' + darkGray + ', 0 0 4px ' + darkGray; - } - } - if (overrides.fontPercent && overrides.fontPercent !== 1) { - var fontSize = window_1.parseFloat(cueDiv.style.fontSize); - - cueDiv.style.fontSize = fontSize * overrides.fontPercent + 'px'; - cueDiv.style.height = 'auto'; - cueDiv.style.top = 'auto'; - cueDiv.style.bottom = '2px'; - } - if (overrides.fontFamily && overrides.fontFamily !== 'default') { - if (overrides.fontFamily === 'small-caps') { - cueDiv.firstChild.style.fontVariant = 'small-caps'; - } else { - cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily]; - } - } - } - }; - - return TextTrackDisplay; -}(Component); - -Component.registerComponent('TextTrackDisplay', TextTrackDisplay); - -/** - * @file loading-spinner.js - */ -/** - * A loading spinner for use during waiting/loading events. - * - * @extends Component - */ - -var LoadingSpinner = function (_Component) { - inherits(LoadingSpinner, _Component); - - function LoadingSpinner() { - classCallCheck(this, LoadingSpinner); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Create the `LoadingSpinner`s DOM element. - * - * @return {Element} - * The dom element that gets created. - */ - LoadingSpinner.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-loading-spinner', - dir: 'ltr' - }); - }; - - return LoadingSpinner; -}(Component); - -Component.registerComponent('LoadingSpinner', LoadingSpinner); - -/** - * @file button.js - */ -/** - * Base class for all buttons. - * - * @extends ClickableComponent - */ - -var Button = function (_ClickableComponent) { - inherits(Button, _ClickableComponent); - - function Button() { - classCallCheck(this, Button); - return possibleConstructorReturn(this, _ClickableComponent.apply(this, arguments)); - } - - /** - * Create the `Button`s DOM element. - * - * @param {string} [tag="button"] - * The element's node type. This argument is IGNORED: no matter what - * is passed, it will always create a `button` element. - * - * @param {Object} [props={}] - * An object of properties that should be set on the element. - * - * @param {Object} [attributes={}] - * An object of attributes that should be set on the element. - * - * @return {Element} - * The element that gets created. - */ - Button.prototype.createEl = function createEl(tag) { - var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - tag = 'button'; - - props = assign({ - innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>', - className: this.buildCSSClass() - }, props); - - // Add attributes for button element - attributes = assign({ - - // Necessary since the default button type is "submit" - 'type': 'button', - - // let the screen reader user know that the text of the button may change - 'aria-live': 'polite' - }, attributes); - - var el = Component.prototype.createEl.call(this, tag, props, attributes); - - this.createControlTextEl(el); - - return el; - }; - - /** - * Add a child `Component` inside of this `Button`. - * - * @param {string|Component} child - * The name or instance of a child to add. - * - * @param {Object} [options={}] - * The key/value store of options that will get passed to children of - * the child. - * - * @return {Component} - * The `Component` that gets added as a child. When using a string the - * `Component` will get created by this process. - * - * @deprecated since version 5 - */ - - - Button.prototype.addChild = function addChild(child) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var className = this.constructor.name; - - log$1.warn('Adding an actionable (user controllable) child to a Button (' + className + ') is not supported; use a ClickableComponent instead.'); - - // Avoid the error message generated by ClickableComponent's addChild method - return Component.prototype.addChild.call(this, child, options); - }; - - /** - * Enable the `Button` element so that it can be activated or clicked. Use this with - * {@link Button#disable}. - */ - - - Button.prototype.enable = function enable() { - _ClickableComponent.prototype.enable.call(this); - this.el_.removeAttribute('disabled'); - }; - - /** - * Enable the `Button` element so that it cannot be activated or clicked. Use this with - * {@link Button#enable}. - */ - - - Button.prototype.disable = function disable() { - _ClickableComponent.prototype.disable.call(this); - this.el_.setAttribute('disabled', 'disabled'); - }; - - /** - * This gets called when a `Button` has focus and `keydown` is triggered via a key - * press. - * - * @param {EventTarget~Event} event - * The event that caused this function to get called. - * - * @listens keydown - */ - - - Button.prototype.handleKeyPress = function handleKeyPress(event) { - - // Ignore Space (32) or Enter (13) key operation, which is handled by the browser for a button. - if (event.which === 32 || event.which === 13) { - return; - } - - // Pass keypress handling up for unsupported keys - _ClickableComponent.prototype.handleKeyPress.call(this, event); - }; - - return Button; -}(ClickableComponent); - -Component.registerComponent('Button', Button); - -/** - * @file big-play-button.js - */ -/** - * The initial play button that shows before the video has played. The hiding of the - * `BigPlayButton` get done via CSS and `Player` states. - * - * @extends Button - */ - -var BigPlayButton = function (_Button) { - inherits(BigPlayButton, _Button); - - function BigPlayButton() { - classCallCheck(this, BigPlayButton); - return possibleConstructorReturn(this, _Button.apply(this, arguments)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. Always returns 'vjs-big-play-button'. - */ - BigPlayButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-big-play-button'; - }; - - /** - * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} - * for more detailed information on what a click can be. - * - * @param {EventTarget~Event} event - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - BigPlayButton.prototype.handleClick = function handleClick(event) { - var playPromise = this.player_.play(); - - var cb = this.player_.getChild('controlBar'); - var playToggle = cb && cb.getChild('playToggle'); - - if (!playToggle) { - this.player_.focus(); - return; - } - - if (playPromise) { - playPromise.then(function () { - return playToggle.focus(); - }); - } else { - this.setTimeout(function () { - playToggle.focus(); - }, 1); - } - }; - - return BigPlayButton; -}(Button); - -/** - * The text that should display over the `BigPlayButton`s controls. Added to for localization. - * - * @type {string} - * @private - */ - - -BigPlayButton.prototype.controlText_ = 'Play Video'; - -Component.registerComponent('BigPlayButton', BigPlayButton); - -/** - * @file close-button.js - */ -/** - * The `CloseButton` is a `{@link Button}` that fires a `close` event when - * it gets clicked. - * - * @extends Button - */ - -var CloseButton = function (_Button) { - inherits(CloseButton, _Button); - - /** - * Creates an instance of the this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function CloseButton(player, options) { - classCallCheck(this, CloseButton); - - var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); - - _this.controlText(options && options.controlText || _this.localize('Close')); - return _this; - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - CloseButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-close-button ' + _Button.prototype.buildCSSClass.call(this); - }; - - /** - * This gets called when a `CloseButton` gets clicked. See - * {@link ClickableComponent#handleClick} for more information on when this will be - * triggered - * - * @param {EventTarget~Event} event - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - * @fires CloseButton#close - */ - - - CloseButton.prototype.handleClick = function handleClick(event) { - - /** - * Triggered when the a `CloseButton` is clicked. - * - * @event CloseButton#close - * @type {EventTarget~Event} - * - * @property {boolean} [bubbles=false] - * set to false so that the close event does not - * bubble up to parents if there is no listener - */ - this.trigger({ type: 'close', bubbles: false }); - }; - - return CloseButton; -}(Button); - -Component.registerComponent('CloseButton', CloseButton); - -/** - * @file play-toggle.js - */ -/** - * Button to toggle between play and pause. - * - * @extends Button - */ - -var PlayToggle = function (_Button) { - inherits(PlayToggle, _Button); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function PlayToggle(player, options) { - classCallCheck(this, PlayToggle); - - var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); - - _this.on(player, 'play', _this.handlePlay); - _this.on(player, 'pause', _this.handlePause); - _this.on(player, 'ended', _this.handleEnded); - return _this; - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - PlayToggle.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-play-control ' + _Button.prototype.buildCSSClass.call(this); - }; - - /** - * This gets called when an `PlayToggle` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - PlayToggle.prototype.handleClick = function handleClick(event) { - if (this.player_.paused()) { - this.player_.play(); - } else { - this.player_.pause(); - } - }; - - /** - * Add the vjs-playing class to the element so it can change appearance. - * - * @param {EventTarget~Event} [event] - * The event that caused this function to run. - * - * @listens Player#play - */ - - - PlayToggle.prototype.handlePlay = function handlePlay(event) { - this.removeClass('vjs-ended'); - this.removeClass('vjs-paused'); - this.addClass('vjs-playing'); - // change the button text to "Pause" - this.controlText('Pause'); - }; - - /** - * Add the vjs-paused class to the element so it can change appearance. - * - * @param {EventTarget~Event} [event] - * The event that caused this function to run. - * - * @listens Player#pause - */ - - - PlayToggle.prototype.handlePause = function handlePause(event) { - this.removeClass('vjs-playing'); - this.addClass('vjs-paused'); - // change the button text to "Play" - this.controlText('Play'); - }; - - /** - * Add the vjs-ended class to the element so it can change appearance - * - */ - - - PlayToggle.prototype.handleEnded = function handleEnded(event) { - this.removeClass('vjs-playing'); - this.addClass('vjs-ended'); - // change the button text to "Replay" - this.controlText('Replay'); - }; - - return PlayToggle; -}(Button); - -/** - * The text that should display over the `PlayToggle`s controls. Added for localization. - * - * @type {string} - * @private - */ - - -PlayToggle.prototype.controlText_ = 'Play'; - -Component.registerComponent('PlayToggle', PlayToggle); - -/** - * @file format-time.js - * @module Format-time - */ - -/** - * Format seconds as a time string, H:MM:SS or M:SS. Supplying a guide (in seconds) - * will force a number of leading zeros to cover the length of the guide. - * - * @param {number} seconds - * Number of seconds to be turned into a string - * - * @param {number} guide - * Number (in seconds) to model the string after - * - * @return {string} - * Time formatted as H:MM:SS or M:SS - */ -function formatTime(seconds) { - var guide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : seconds; - - seconds = seconds < 0 ? 0 : seconds; - var s = Math.floor(seconds % 60); - var m = Math.floor(seconds / 60 % 60); - var h = Math.floor(seconds / 3600); - var gm = Math.floor(guide / 60 % 60); - var gh = Math.floor(guide / 3600); - - // handle invalid times - if (isNaN(seconds) || seconds === Infinity) { - // '-' is false for all relational operators (e.g. <, >=) so this setting - // will add the minimum number of fields specified by the guide - h = m = s = '-'; - } - - // Check if we need to show hours - h = h > 0 || gh > 0 ? h + ':' : ''; - - // If hours are showing, we may need to add a leading zero. - // Always show at least one digit of minutes. - m = ((h || gm >= 10) && m < 10 ? '0' + m : m) + ':'; - - // Check if leading zero is need for seconds - s = s < 10 ? '0' + s : s; - - return h + m + s; -} - -/** - * @file current-time-display.js - */ -/** - * Displays the current time - * - * @extends Component - */ - -var CurrentTimeDisplay = function (_Component) { - inherits(CurrentTimeDisplay, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function CurrentTimeDisplay(player, options) { - classCallCheck(this, CurrentTimeDisplay); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.on(player, 'timeupdate', _this.updateContent); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - CurrentTimeDisplay.prototype.createEl = function createEl$$1() { - var el = _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-current-time vjs-time-control vjs-control' - }); - - this.contentEl_ = createEl('div', { - className: 'vjs-current-time-display', - // label the current time for screen reader users - innerHTML: '<span class="vjs-control-text">Current Time </span>' + '0:00' - }, { - // tell screen readers not to automatically read the time as it changes - 'aria-live': 'off' - }); - - el.appendChild(this.contentEl_); - return el; - }; - - /** - * Update current time display - * - * @param {EventTarget~Event} [event] - * The `timeupdate` event that caused this function to run. - * - * @listens Player#timeupdate - */ - - - CurrentTimeDisplay.prototype.updateContent = function updateContent(event) { - // Allows for smooth scrubbing, when player can't keep up. - var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); - var localizedText = this.localize('Current Time'); - var formattedTime = formatTime(time, this.player_.duration()); - - if (formattedTime !== this.formattedTime_) { - this.formattedTime_ = formattedTime; - this.contentEl_.innerHTML = '<span class="vjs-control-text">' + localizedText + '</span> ' + formattedTime; - } - }; - - return CurrentTimeDisplay; -}(Component); - -Component.registerComponent('CurrentTimeDisplay', CurrentTimeDisplay); - -/** - * @file duration-display.js - */ -/** - * Displays the duration - * - * @extends Component - */ - -var DurationDisplay = function (_Component) { - inherits(DurationDisplay, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function DurationDisplay(player, options) { - classCallCheck(this, DurationDisplay); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.on(player, 'durationchange', _this.updateContent); - - // Also listen for timeupdate and loadedmetadata because removing those - // listeners could have broken dependent applications/libraries. These - // can likely be removed for 6.0. - _this.on(player, 'timeupdate', _this.updateContent); - _this.on(player, 'loadedmetadata', _this.updateContent); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - DurationDisplay.prototype.createEl = function createEl$$1() { - var el = _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-duration vjs-time-control vjs-control' - }); - - this.contentEl_ = createEl('div', { - className: 'vjs-duration-display', - // label the duration time for screen reader users - innerHTML: '<span class="vjs-control-text">' + this.localize('Duration Time') + '</span> 0:00' - }, { - // tell screen readers not to automatically read the time as it changes - 'aria-live': 'off' - }); - - el.appendChild(this.contentEl_); - return el; - }; - - /** - * Update duration time display. - * - * @param {EventTarget~Event} [event] - * The `durationchange`, `timeupdate`, or `loadedmetadata` event that caused - * this function to be called. - * - * @listens Player#durationchange - * @listens Player#timeupdate - * @listens Player#loadedmetadata - */ - - - DurationDisplay.prototype.updateContent = function updateContent(event) { - var duration = this.player_.duration(); - - if (duration && this.duration_ !== duration) { - this.duration_ = duration; - var localizedText = this.localize('Duration Time'); - var formattedTime = formatTime(duration); - - // label the duration time for screen reader users - this.contentEl_.innerHTML = '<span class="vjs-control-text">' + localizedText + '</span> ' + formattedTime; - } - }; - - return DurationDisplay; -}(Component); - -Component.registerComponent('DurationDisplay', DurationDisplay); - -/** - * @file time-divider.js - */ -/** - * The separator between the current time and duration. - * Can be hidden if it's not needed in the design. - * - * @extends Component - */ - -var TimeDivider = function (_Component) { - inherits(TimeDivider, _Component); - - function TimeDivider() { - classCallCheck(this, TimeDivider); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Create the component's DOM element - * - * @return {Element} - * The element that was created. - */ - TimeDivider.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-time-control vjs-time-divider', - innerHTML: '<div><span>/</span></div>' - }); - }; - - return TimeDivider; -}(Component); - -Component.registerComponent('TimeDivider', TimeDivider); - -/** - * @file remaining-time-display.js - */ -/** - * Displays the time left in the video - * - * @extends Component - */ - -var RemainingTimeDisplay = function (_Component) { - inherits(RemainingTimeDisplay, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function RemainingTimeDisplay(player, options) { - classCallCheck(this, RemainingTimeDisplay); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.on(player, 'timeupdate', _this.updateContent); - _this.on(player, 'durationchange', _this.updateContent); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - RemainingTimeDisplay.prototype.createEl = function createEl$$1() { - var el = _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-remaining-time vjs-time-control vjs-control' - }); - - this.contentEl_ = createEl('div', { - className: 'vjs-remaining-time-display', - // label the remaining time for screen reader users - innerHTML: '<span class="vjs-control-text">' + this.localize('Remaining Time') + '</span> -0:00' - }, { - // tell screen readers not to automatically read the time as it changes - 'aria-live': 'off' - }); - - el.appendChild(this.contentEl_); - return el; - }; - - /** - * Update remaining time display. - * - * @param {EventTarget~Event} [event] - * The `timeupdate` or `durationchange` event that caused this to run. - * - * @listens Player#timeupdate - * @listens Player#durationchange - */ - - - RemainingTimeDisplay.prototype.updateContent = function updateContent(event) { - if (this.player_.duration()) { - var localizedText = this.localize('Remaining Time'); - var formattedTime = formatTime(this.player_.remainingTime()); - - if (formattedTime !== this.formattedTime_) { - this.formattedTime_ = formattedTime; - this.contentEl_.innerHTML = '<span class="vjs-control-text">' + localizedText + '</span> -' + formattedTime; - } - } - - // Allows for smooth scrubbing, when player can't keep up. - // var time = (this.player_.scrubbing()) ? this.player_.getCache().currentTime : this.player_.currentTime(); - // this.contentEl_.innerHTML = vjs.formatTime(time, this.player_.duration()); - }; - - return RemainingTimeDisplay; -}(Component); - -Component.registerComponent('RemainingTimeDisplay', RemainingTimeDisplay); - -/** - * @file live-display.js - */ -// TODO - Future make it click to snap to live - -/** - * Displays the live indicator when duration is Infinity. - * - * @extends Component - */ - -var LiveDisplay = function (_Component) { - inherits(LiveDisplay, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function LiveDisplay(player, options) { - classCallCheck(this, LiveDisplay); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.updateShowing(); - _this.on(_this.player(), 'durationchange', _this.updateShowing); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - LiveDisplay.prototype.createEl = function createEl$$1() { - var el = _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-live-control vjs-control' - }); - - this.contentEl_ = createEl('div', { - className: 'vjs-live-display', - innerHTML: '<span class="vjs-control-text">' + this.localize('Stream Type') + '</span>' + this.localize('LIVE') - }, { - 'aria-live': 'off' - }); - - el.appendChild(this.contentEl_); - return el; - }; - - /** - * Check the duration to see if the LiveDisplay should be showing or not. Then show/hide - * it accordingly - * - * @param {EventTarget~Event} [event] - * The {@link Player#durationchange} event that caused this function to run. - * - * @listens Player#durationchange - */ - - - LiveDisplay.prototype.updateShowing = function updateShowing(event) { - if (this.player().duration() === Infinity) { - this.show(); - } else { - this.hide(); - } - }; - - return LiveDisplay; -}(Component); - -Component.registerComponent('LiveDisplay', LiveDisplay); - -/** - * @file slider.js - */ -/** - * The base functionality for a slider. Can be vertical or horizontal. - * For instance the volume bar or the seek bar on a video is a slider. - * - * @extends Component - */ - -var Slider = function (_Component) { - inherits(Slider, _Component); - - /** - * Create an instance of this class - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function Slider(player, options) { - classCallCheck(this, Slider); - - // Set property names to bar to match with the child Slider class is looking for - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.bar = _this.getChild(_this.options_.barName); - - // Set a horizontal or vertical class on the slider depending on the slider type - _this.vertical(!!_this.options_.vertical); - - _this.on('mousedown', _this.handleMouseDown); - _this.on('touchstart', _this.handleMouseDown); - _this.on('focus', _this.handleFocus); - _this.on('blur', _this.handleBlur); - _this.on('click', _this.handleClick); - - _this.on(player, 'controlsvisible', _this.update); - - if (_this.playerEvent) { - _this.on(player, _this.playerEvent, _this.update); - } - return _this; - } - - /** - * Create the `Button`s DOM element. - * - * @param {string} type - * Type of element to create. - * - * @param {Object} [props={}] - * List of properties in Object form. - * - * @param {Object} [attributes={}] - * list of attributes in Object form. - * - * @return {Element} - * The element that gets created. - */ - - - Slider.prototype.createEl = function createEl$$1(type) { - var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - // Add the slider element class to all sub classes - props.className = props.className + ' vjs-slider'; - props = assign({ - tabIndex: 0 - }, props); - - attributes = assign({ - 'role': 'slider', - 'aria-valuenow': 0, - 'aria-valuemin': 0, - 'aria-valuemax': 100, - 'tabIndex': 0 - }, attributes); - - return _Component.prototype.createEl.call(this, type, props, attributes); - }; - - /** - * Handle `mousedown` or `touchstart` events on the `Slider`. - * - * @param {EventTarget~Event} event - * `mousedown` or `touchstart` event that triggered this function - * - * @listens mousedown - * @listens touchstart - * @fires Slider#slideractive - */ - - - Slider.prototype.handleMouseDown = function handleMouseDown(event) { - var doc = this.bar.el_.ownerDocument; - - event.preventDefault(); - blockTextSelection(); - - this.addClass('vjs-sliding'); - /** - * Triggered when the slider is in an active state - * - * @event Slider#slideractive - * @type {EventTarget~Event} - */ - this.trigger('slideractive'); - - this.on(doc, 'mousemove', this.handleMouseMove); - this.on(doc, 'mouseup', this.handleMouseUp); - this.on(doc, 'touchmove', this.handleMouseMove); - this.on(doc, 'touchend', this.handleMouseUp); - - this.handleMouseMove(event); - }; - - /** - * Handle the `mousemove`, `touchmove`, and `mousedown` events on this `Slider`. - * The `mousemove` and `touchmove` events will only only trigger this function during - * `mousedown` and `touchstart`. This is due to {@link Slider#handleMouseDown} and - * {@link Slider#handleMouseUp}. - * - * @param {EventTarget~Event} event - * `mousedown`, `mousemove`, `touchstart`, or `touchmove` event that triggered - * this function - * - * @listens mousemove - * @listens touchmove - */ - - - Slider.prototype.handleMouseMove = function handleMouseMove(event) {}; - - /** - * Handle `mouseup` or `touchend` events on the `Slider`. - * - * @param {EventTarget~Event} event - * `mouseup` or `touchend` event that triggered this function. - * - * @listens touchend - * @listens mouseup - * @fires Slider#sliderinactive - */ - - - Slider.prototype.handleMouseUp = function handleMouseUp() { - var doc = this.bar.el_.ownerDocument; - - unblockTextSelection(); - - this.removeClass('vjs-sliding'); - /** - * Triggered when the slider is no longer in an active state. - * - * @event Slider#sliderinactive - * @type {EventTarget~Event} - */ - this.trigger('sliderinactive'); - - this.off(doc, 'mousemove', this.handleMouseMove); - this.off(doc, 'mouseup', this.handleMouseUp); - this.off(doc, 'touchmove', this.handleMouseMove); - this.off(doc, 'touchend', this.handleMouseUp); - - this.update(); - }; - - /** - * Update the progress bar of the `Slider`. - * - * @returns {number} - * The percentage of progress the progress bar represents as a - * number from 0 to 1. - */ - - - Slider.prototype.update = function update() { - - // In VolumeBar init we have a setTimeout for update that pops and update - // to the end of the execution stack. The player is destroyed before then - // update will cause an error - if (!this.el_) { - return; - } - - // If scrubbing, we could use a cached value to make the handle keep up - // with the user's mouse. On HTML5 browsers scrubbing is really smooth, but - // some flash players are slow, so we might want to utilize this later. - // var progress = (this.player_.scrubbing()) ? this.player_.getCache().currentTime / this.player_.duration() : this.player_.currentTime() / this.player_.duration(); - var progress = this.getPercent(); - var bar = this.bar; - - // If there's no bar... - if (!bar) { - return; - } - - // Protect against no duration and other division issues - if (typeof progress !== 'number' || progress !== progress || progress < 0 || progress === Infinity) { - progress = 0; - } - - // Convert to a percentage for setting - var percentage = (progress * 100).toFixed(2) + '%'; - var style = bar.el().style; - - // Set the new bar width or height - if (this.vertical()) { - style.height = percentage; - } else { - style.width = percentage; - } - - return progress; - }; - - /** - * Calculate distance for slider - * - * @param {EventTarget~Event} event - * The event that caused this function to run. - * - * @return {number} - * The current position of the Slider. - * - postition.x for vertical `Slider`s - * - postition.y for horizontal `Slider`s - */ - - - Slider.prototype.calculateDistance = function calculateDistance(event) { - var position = getPointerPosition(this.el_, event); - - if (this.vertical()) { - return position.y; - } - return position.x; - }; - - /** - * Handle a `focus` event on this `Slider`. - * - * @param {EventTarget~Event} event - * The `focus` event that caused this function to run. - * - * @listens focus - */ - - - Slider.prototype.handleFocus = function handleFocus() { - this.on(this.bar.el_.ownerDocument, 'keydown', this.handleKeyPress); - }; - - /** - * Handle a `keydown` event on the `Slider`. Watches for left, rigth, up, and down - * arrow keys. This function will only be called when the slider has focus. See - * {@link Slider#handleFocus} and {@link Slider#handleBlur}. - * - * @param {EventTarget~Event} event - * the `keydown` event that caused this function to run. - * - * @listens keydown - */ - - - Slider.prototype.handleKeyPress = function handleKeyPress(event) { - // Left and Down Arrows - if (event.which === 37 || event.which === 40) { - event.preventDefault(); - this.stepBack(); - - // Up and Right Arrows - } else if (event.which === 38 || event.which === 39) { - event.preventDefault(); - this.stepForward(); - } - }; - - /** - * Handle a `blur` event on this `Slider`. - * - * @param {EventTarget~Event} event - * The `blur` event that caused this function to run. - * - * @listens blur - */ - - Slider.prototype.handleBlur = function handleBlur() { - this.off(this.bar.el_.ownerDocument, 'keydown', this.handleKeyPress); - }; - - /** - * Listener for click events on slider, used to prevent clicks - * from bubbling up to parent elements like button menus. - * - * @param {Object} event - * Event that caused this object to run - */ - - - Slider.prototype.handleClick = function handleClick(event) { - event.stopImmediatePropagation(); - event.preventDefault(); - }; - - /** - * Get/set if slider is horizontal for vertical - * - * @param {boolean} [bool] - * - true if slider is vertical, - * - false is horizontal - * - * @return {boolean} - * - true if slider is vertical, and getting - * - false if the slider is horizontal, and getting - */ - - - Slider.prototype.vertical = function vertical(bool) { - if (bool === undefined) { - return this.vertical_ || false; - } - - this.vertical_ = !!bool; - - if (this.vertical_) { - this.addClass('vjs-slider-vertical'); - } else { - this.addClass('vjs-slider-horizontal'); - } - }; - - return Slider; -}(Component); - -Component.registerComponent('Slider', Slider); - -/** - * @file load-progress-bar.js - */ -/** - * Shows loading progress - * - * @extends Component - */ - -var LoadProgressBar = function (_Component) { - inherits(LoadProgressBar, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function LoadProgressBar(player, options) { - classCallCheck(this, LoadProgressBar); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.partEls_ = []; - _this.on(player, 'progress', _this.update); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - LoadProgressBar.prototype.createEl = function createEl$$1() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-load-progress', - innerHTML: '<span class="vjs-control-text"><span>' + this.localize('Loaded') + '</span>: 0%</span>' - }); - }; - - /** - * Update progress bar - * - * @param {EventTarget~Event} [event] - * The `progress` event that caused this function to run. - * - * @listens Player#progress - */ - - - LoadProgressBar.prototype.update = function update(event) { - var buffered = this.player_.buffered(); - var duration = this.player_.duration(); - var bufferedEnd = this.player_.bufferedEnd(); - var children = this.partEls_; - - // get the percent width of a time compared to the total end - var percentify = function percentify(time, end) { - // no NaN - var percent = time / end || 0; - - return (percent >= 1 ? 1 : percent) * 100 + '%'; - }; - - // update the width of the progress bar - this.el_.style.width = percentify(bufferedEnd, duration); - - // add child elements to represent the individual buffered time ranges - for (var i = 0; i < buffered.length; i++) { - var start = buffered.start(i); - var end = buffered.end(i); - var part = children[i]; - - if (!part) { - part = this.el_.appendChild(createEl()); - children[i] = part; - } - - // set the percent based on the width of the progress bar (bufferedEnd) - part.style.left = percentify(start, bufferedEnd); - part.style.width = percentify(end - start, bufferedEnd); - } - - // remove unused buffered range elements - for (var _i = children.length; _i > buffered.length; _i--) { - this.el_.removeChild(children[_i - 1]); - } - children.length = buffered.length; - }; - - return LoadProgressBar; -}(Component); - -Component.registerComponent('LoadProgressBar', LoadProgressBar); - -/** - * @file time-tooltip.js - */ -/** - * Time tooltips display a time above the progress bar. - * - * @extends Component - */ - -var TimeTooltip = function (_Component) { - inherits(TimeTooltip, _Component); - - function TimeTooltip() { - classCallCheck(this, TimeTooltip); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Create the time tooltip DOM element - * - * @return {Element} - * The element that was created. - */ - TimeTooltip.prototype.createEl = function createEl$$1() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-time-tooltip' - }); - }; - - /** - * Updates the position of the time tooltip relative to the `SeekBar`. - * - * @param {Object} seekBarRect - * The `ClientRect` for the {@link SeekBar} element. - * - * @param {number} seekBarPoint - * A number from 0 to 1, representing a horizontal reference point - * from the left edge of the {@link SeekBar} - */ - - - TimeTooltip.prototype.update = function update(seekBarRect, seekBarPoint, content) { - var tooltipRect = getBoundingClientRect(this.el_); - var playerRect = getBoundingClientRect(this.player_.el()); - var seekBarPointPx = seekBarRect.width * seekBarPoint; - - // do nothing if either rect isn't available - // for example, if the player isn't in the DOM for testing - if (!playerRect || !tooltipRect) { - return; - } - - // This is the space left of the `seekBarPoint` available within the bounds - // of the player. We calculate any gap between the left edge of the player - // and the left edge of the `SeekBar` and add the number of pixels in the - // `SeekBar` before hitting the `seekBarPoint` - var spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx; - - // This is the space right of the `seekBarPoint` available within the bounds - // of the player. We calculate the number of pixels from the `seekBarPoint` - // to the right edge of the `SeekBar` and add to that any gap between the - // right edge of the `SeekBar` and the player. - var spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right); - - // This is the number of pixels by which the tooltip will need to be pulled - // further to the right to center it over the `seekBarPoint`. - var pullTooltipBy = tooltipRect.width / 2; - - // Adjust the `pullTooltipBy` distance to the left or right depending on - // the results of the space calculations above. - if (spaceLeftOfPoint < pullTooltipBy) { - pullTooltipBy += pullTooltipBy - spaceLeftOfPoint; - } else if (spaceRightOfPoint < pullTooltipBy) { - pullTooltipBy = spaceRightOfPoint; - } - - // Due to the imprecision of decimal/ratio based calculations and varying - // rounding behaviors, there are cases where the spacing adjustment is off - // by a pixel or two. This adds insurance to these calculations. - if (pullTooltipBy < 0) { - pullTooltipBy = 0; - } else if (pullTooltipBy > tooltipRect.width) { - pullTooltipBy = tooltipRect.width; - } - - this.el_.style.right = '-' + pullTooltipBy + 'px'; - textContent(this.el_, content); - }; - - return TimeTooltip; -}(Component); - -Component.registerComponent('TimeTooltip', TimeTooltip); - -/** - * @file play-progress-bar.js - */ -/** - * Used by {@link SeekBar} to display media playback progress as part of the - * {@link ProgressControl}. - * - * @extends Component - */ - -var PlayProgressBar = function (_Component) { - inherits(PlayProgressBar, _Component); - - function PlayProgressBar() { - classCallCheck(this, PlayProgressBar); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Create the the DOM element for this class. - * - * @return {Element} - * The element that was created. - */ - PlayProgressBar.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-play-progress vjs-slider-bar', - innerHTML: '<span class="vjs-control-text"><span>' + this.localize('Progress') + '</span>: 0%</span>' - }); - }; - - /** - * Enqueues updates to its own DOM as well as the DOM of its - * {@link TimeTooltip} child. - * - * @param {Object} seekBarRect - * The `ClientRect` for the {@link SeekBar} element. - * - * @param {number} seekBarPoint - * A number from 0 to 1, representing a horizontal reference point - * from the left edge of the {@link SeekBar} - */ - - - PlayProgressBar.prototype.update = function update(seekBarRect, seekBarPoint) { - var _this2 = this; - - // If there is an existing rAF ID, cancel it so we don't over-queue. - if (this.rafId_) { - this.cancelAnimationFrame(this.rafId_); - } - - this.rafId_ = this.requestAnimationFrame(function () { - var time = _this2.player_.scrubbing() ? _this2.player_.getCache().currentTime : _this2.player_.currentTime(); - - var content = formatTime(time, _this2.player_.duration()); - var timeTooltip = _this2.getChild('timeTooltip'); - - if (timeTooltip) { - timeTooltip.update(seekBarRect, seekBarPoint, content); - } - }); - }; - - return PlayProgressBar; -}(Component); - -/** - * Default options for {@link PlayProgressBar}. - * - * @type {Object} - * @private - */ - - -PlayProgressBar.prototype.options_ = { - children: [] -}; - -// Time tooltips should not be added to a player on mobile devices or IE8 -if ((!IE_VERSION || IE_VERSION > 8) && !IS_IOS && !IS_ANDROID) { - PlayProgressBar.prototype.options_.children.push('timeTooltip'); -} - -Component.registerComponent('PlayProgressBar', PlayProgressBar); - -/** - * @file mouse-time-display.js - */ -/** - * The {@link MouseTimeDisplay} component tracks mouse movement over the - * {@link ProgressControl}. It displays an indicator and a {@link TimeTooltip} - * indicating the time which is represented by a given point in the - * {@link ProgressControl}. - * - * @extends Component - */ - -var MouseTimeDisplay = function (_Component) { - inherits(MouseTimeDisplay, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The {@link Player} that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function MouseTimeDisplay(player, options) { - classCallCheck(this, MouseTimeDisplay); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.update = throttle(bind(_this, _this.update), 25); - return _this; - } - - /** - * Create the DOM element for this class. - * - * @return {Element} - * The element that was created. - */ - - - MouseTimeDisplay.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-mouse-display' - }); - }; - - /** - * Enqueues updates to its own DOM as well as the DOM of its - * {@link TimeTooltip} child. - * - * @param {Object} seekBarRect - * The `ClientRect` for the {@link SeekBar} element. - * - * @param {number} seekBarPoint - * A number from 0 to 1, representing a horizontal reference point - * from the left edge of the {@link SeekBar} - */ - - - MouseTimeDisplay.prototype.update = function update(seekBarRect, seekBarPoint) { - var _this2 = this; - - // If there is an existing rAF ID, cancel it so we don't over-queue. - if (this.rafId_) { - this.cancelAnimationFrame(this.rafId_); - } - - this.rafId_ = this.requestAnimationFrame(function () { - var duration = _this2.player_.duration(); - var content = formatTime(seekBarPoint * duration, duration); - - _this2.el_.style.left = seekBarRect.width * seekBarPoint + 'px'; - _this2.getChild('timeTooltip').update(seekBarRect, seekBarPoint, content); - }); - }; - - return MouseTimeDisplay; -}(Component); - -/** - * Default options for `MouseTimeDisplay` - * - * @type {Object} - * @private - */ - - -MouseTimeDisplay.prototype.options_ = { - children: ['timeTooltip'] -}; - -Component.registerComponent('MouseTimeDisplay', MouseTimeDisplay); - -/** - * @file seek-bar.js - */ -// The number of seconds the `step*` functions move the timeline. -var STEP_SECONDS = 5; - -/** - * Seek bar and container for the progress bars. Uses {@link PlayProgressBar} - * as its `bar`. - * - * @extends Slider - */ - -var SeekBar = function (_Slider) { - inherits(SeekBar, _Slider); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function SeekBar(player, options) { - classCallCheck(this, SeekBar); - - var _this = possibleConstructorReturn(this, _Slider.call(this, player, options)); - - _this.update = throttle(bind(_this, _this.update), 50); - _this.on(player, ['timeupdate', 'ended'], _this.update); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - SeekBar.prototype.createEl = function createEl$$1() { - return _Slider.prototype.createEl.call(this, 'div', { - className: 'vjs-progress-holder' - }, { - 'aria-label': this.localize('Progress Bar') - }); - }; - - /** - * Update the seek bar's UI. - * - * @param {EventTarget~Event} [event] - * The `timeupdate` or `ended` event that caused this to run. - * - * @listens Player#timeupdate - * @listens Player#ended - */ - - - SeekBar.prototype.update = function update() { - var percent = _Slider.prototype.update.call(this); - var duration = this.player_.duration(); - - // Allows for smooth scrubbing, when player can't keep up. - var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); - - // machine readable value of progress bar (percentage complete) - this.el_.setAttribute('aria-valuenow', (percent * 100).toFixed(2)); - - // human readable value of progress bar (time complete) - this.el_.setAttribute('aria-valuetext', this.localize('progress bar timing: currentTime={1} duration={2}', [formatTime(time, duration), formatTime(duration, duration)], '{1} of {2}')); - - // Update the `PlayProgressBar`. - this.bar.update(getBoundingClientRect(this.el_), percent); - - return percent; - }; - - /** - * Get the percentage of media played so far. - * - * @return {number} - * The percentage of media played so far (0 to 1). - */ - - - SeekBar.prototype.getPercent = function getPercent() { - - // Allows for smooth scrubbing, when player can't keep up. - var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); - - var percent = time / this.player_.duration(); - - return percent >= 1 ? 1 : percent; - }; - - /** - * Handle mouse down on seek bar - * - * @param {EventTarget~Event} event - * The `mousedown` event that caused this to run. - * - * @listens mousedown - */ - - - SeekBar.prototype.handleMouseDown = function handleMouseDown(event) { - this.player_.scrubbing(true); - - this.videoWasPlaying = !this.player_.paused(); - this.player_.pause(); - - _Slider.prototype.handleMouseDown.call(this, event); - }; - - /** - * Handle mouse move on seek bar - * - * @param {EventTarget~Event} event - * The `mousemove` event that caused this to run. - * - * @listens mousemove - */ - - - SeekBar.prototype.handleMouseMove = function handleMouseMove(event) { - var newTime = this.calculateDistance(event) * this.player_.duration(); - - // Don't let video end while scrubbing. - if (newTime === this.player_.duration()) { - newTime = newTime - 0.1; - } - - // Set new time (tell player to seek to new time) - this.player_.currentTime(newTime); - }; - - /** - * Handle mouse up on seek bar - * - * @param {EventTarget~Event} event - * The `mouseup` event that caused this to run. - * - * @listens mouseup - */ - - - SeekBar.prototype.handleMouseUp = function handleMouseUp(event) { - _Slider.prototype.handleMouseUp.call(this, event); - - this.player_.scrubbing(false); - if (this.videoWasPlaying) { - this.player_.play(); - } - }; - - /** - * Move more quickly fast forward for keyboard-only users - */ - - - SeekBar.prototype.stepForward = function stepForward() { - this.player_.currentTime(this.player_.currentTime() + STEP_SECONDS); - }; - - /** - * Move more quickly rewind for keyboard-only users - */ - - - SeekBar.prototype.stepBack = function stepBack() { - this.player_.currentTime(this.player_.currentTime() - STEP_SECONDS); - }; - - /** - * Toggles the playback state of the player - * This gets called when enter or space is used on the seekbar - * - * @param {EventTarget~Event} event - * The `keydown` event that caused this function to be called - * - */ - - - SeekBar.prototype.handleAction = function handleAction(event) { - if (this.player_.paused()) { - this.player_.play(); - } else { - this.player_.pause(); - } - }; - - /** - * Called when this SeekBar has focus and a key gets pressed down. By - * default it will call `this.handleAction` when the key is space or enter. - * - * @param {EventTarget~Event} event - * The `keydown` event that caused this function to be called. - * - * @listens keydown - */ - - - SeekBar.prototype.handleKeyPress = function handleKeyPress(event) { - - // Support Space (32) or Enter (13) key operation to fire a click event - if (event.which === 32 || event.which === 13) { - event.preventDefault(); - this.handleAction(event); - } else if (_Slider.prototype.handleKeyPress) { - - // Pass keypress handling up for unsupported keys - _Slider.prototype.handleKeyPress.call(this, event); - } - }; - - return SeekBar; -}(Slider); - -/** - * Default options for the `SeekBar` - * - * @type {Object} - * @private - */ - - -SeekBar.prototype.options_ = { - children: ['loadProgressBar', 'playProgressBar'], - barName: 'playProgressBar' -}; - -// MouseTimeDisplay tooltips should not be added to a player on mobile devices or IE8 -if ((!IE_VERSION || IE_VERSION > 8) && !IS_IOS && !IS_ANDROID) { - SeekBar.prototype.options_.children.splice(1, 0, 'mouseTimeDisplay'); -} - -/** - * Call the update event for this Slider when this event happens on the player. - * - * @type {string} - */ -SeekBar.prototype.playerEvent = 'timeupdate'; - -Component.registerComponent('SeekBar', SeekBar); - -/** - * @file progress-control.js - */ -/** - * The Progress Control component contains the seek bar, load progress, - * and play progress. - * - * @extends Component - */ - -var ProgressControl = function (_Component) { - inherits(ProgressControl, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function ProgressControl(player, options) { - classCallCheck(this, ProgressControl); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.handleMouseMove = throttle(bind(_this, _this.handleMouseMove), 25); - _this.on(_this.el_, 'mousemove', _this.handleMouseMove); - - _this.throttledHandleMouseSeek = throttle(bind(_this, _this.handleMouseSeek), 25); - _this.on(['mousedown', 'touchstart'], _this.handleMouseDown); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - ProgressControl.prototype.createEl = function createEl$$1() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-progress-control vjs-control' - }); - }; - - /** - * When the mouse moves over the `ProgressControl`, the pointer position - * gets passed down to the `MouseTimeDisplay` component. - * - * @param {EventTarget~Event} event - * The `mousemove` event that caused this function to run. - * - * @listen mousemove - */ - - - ProgressControl.prototype.handleMouseMove = function handleMouseMove(event) { - var seekBar = this.getChild('seekBar'); - var mouseTimeDisplay = seekBar.getChild('mouseTimeDisplay'); - var seekBarEl = seekBar.el(); - var seekBarRect = getBoundingClientRect(seekBarEl); - var seekBarPoint = getPointerPosition(seekBarEl, event).x; - - // The default skin has a gap on either side of the `SeekBar`. This means - // that it's possible to trigger this behavior outside the boundaries of - // the `SeekBar`. This ensures we stay within it at all times. - if (seekBarPoint > 1) { - seekBarPoint = 1; - } else if (seekBarPoint < 0) { - seekBarPoint = 0; - } - - if (mouseTimeDisplay) { - mouseTimeDisplay.update(seekBarRect, seekBarPoint); - } - }; - - /** - * A throttled version of the {@link ProgressControl#handleMouseSeek} listener. - * - * @method ProgressControl#throttledHandleMouseSeek - * @param {EventTarget~Event} event - * The `mousemove` event that caused this function to run. - * - * @listen mousemove - * @listen touchmove - */ - - /** - * Handle `mousemove` or `touchmove` events on the `ProgressControl`. - * - * @param {EventTarget~Event} event - * `mousedown` or `touchstart` event that triggered this function - * - * @listens mousemove - * @listens touchmove - */ - - - ProgressControl.prototype.handleMouseSeek = function handleMouseSeek(event) { - var seekBar = this.getChild('seekBar'); - - seekBar.handleMouseMove(event); - }; - - /** - * Handle `mousedown` or `touchstart` events on the `ProgressControl`. - * - * @param {EventTarget~Event} event - * `mousedown` or `touchstart` event that triggered this function - * - * @listens mousedown - * @listens touchstart - */ - - - ProgressControl.prototype.handleMouseDown = function handleMouseDown(event) { - var doc = this.el_.ownerDocument; - - this.on(doc, 'mousemove', this.throttledHandleMouseSeek); - this.on(doc, 'touchmove', this.throttledHandleMouseSeek); - this.on(doc, 'mouseup', this.handleMouseUp); - this.on(doc, 'touchend', this.handleMouseUp); - }; - - /** - * Handle `mouseup` or `touchend` events on the `ProgressControl`. - * - * @param {EventTarget~Event} event - * `mouseup` or `touchend` event that triggered this function. - * - * @listens touchend - * @listens mouseup - */ - - - ProgressControl.prototype.handleMouseUp = function handleMouseUp(event) { - var doc = this.el_.ownerDocument; - - this.off(doc, 'mousemove', this.throttledHandleMouseSeek); - this.off(doc, 'touchmove', this.throttledHandleMouseSeek); - this.off(doc, 'mouseup', this.handleMouseUp); - this.off(doc, 'touchend', this.handleMouseUp); - }; - - return ProgressControl; -}(Component); - -/** - * Default options for `ProgressControl` - * - * @type {Object} - * @private - */ - - -ProgressControl.prototype.options_ = { - children: ['seekBar'] -}; - -Component.registerComponent('ProgressControl', ProgressControl); - -/** - * @file fullscreen-toggle.js - */ -/** - * Toggle fullscreen video - * - * @extends Button - */ - -var FullscreenToggle = function (_Button) { - inherits(FullscreenToggle, _Button); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function FullscreenToggle(player, options) { - classCallCheck(this, FullscreenToggle); - - var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); - - _this.on(player, 'fullscreenchange', _this.handleFullscreenChange); - return _this; - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - FullscreenToggle.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-fullscreen-control ' + _Button.prototype.buildCSSClass.call(this); - }; - - /** - * Handles fullscreenchange on the player and change control text accordingly. - * - * @param {EventTarget~Event} [event] - * The {@link Player#fullscreenchange} event that caused this function to be - * called. - * - * @listens Player#fullscreenchange - */ - - - FullscreenToggle.prototype.handleFullscreenChange = function handleFullscreenChange(event) { - if (this.player_.isFullscreen()) { - this.controlText('Non-Fullscreen'); - } else { - this.controlText('Fullscreen'); - } - }; - - /** - * This gets called when an `FullscreenToggle` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - FullscreenToggle.prototype.handleClick = function handleClick(event) { - if (!this.player_.isFullscreen()) { - this.player_.requestFullscreen(); - } else { - this.player_.exitFullscreen(); - } - }; - - return FullscreenToggle; -}(Button); - -/** - * The text that should display over the `FullscreenToggle`s controls. Added for localization. - * - * @type {string} - * @private - */ - - -FullscreenToggle.prototype.controlText_ = 'Fullscreen'; - -Component.registerComponent('FullscreenToggle', FullscreenToggle); - -/** - * Check if volume control is supported and if it isn't hide the - * `Component` that was passed using the `vjs-hidden` class. - * - * @param {Component} self - * The component that should be hidden if volume is unsupported - * - * @param {Player} player - * A reference to the player - * - * @private - */ -var checkVolumeSupport = function checkVolumeSupport(self, player) { - // hide volume controls when they're not supported by the current tech - if (player.tech_ && !player.tech_.featuresVolumeControl) { - self.addClass('vjs-hidden'); - } - - self.on(player, 'loadstart', function () { - if (!player.tech_.featuresVolumeControl) { - self.addClass('vjs-hidden'); - } else { - self.removeClass('vjs-hidden'); - } - }); -}; - -/** - * @file volume-level.js - */ -/** - * Shows volume level - * - * @extends Component - */ - -var VolumeLevel = function (_Component) { - inherits(VolumeLevel, _Component); - - function VolumeLevel() { - classCallCheck(this, VolumeLevel); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - VolumeLevel.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-volume-level', - innerHTML: '<span class="vjs-control-text"></span>' - }); - }; - - return VolumeLevel; -}(Component); - -Component.registerComponent('VolumeLevel', VolumeLevel); - -/** - * @file volume-bar.js - */ -// Required children -/** - * The bar that contains the volume level and can be clicked on to adjust the level - * - * @extends Slider - */ - -var VolumeBar = function (_Slider) { - inherits(VolumeBar, _Slider); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function VolumeBar(player, options) { - classCallCheck(this, VolumeBar); - - var _this = possibleConstructorReturn(this, _Slider.call(this, player, options)); - - _this.on('slideractive', _this.updateLastVolume_); - _this.on(player, 'volumechange', _this.updateARIAAttributes); - player.ready(function () { - return _this.updateARIAAttributes(); - }); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - VolumeBar.prototype.createEl = function createEl() { - return _Slider.prototype.createEl.call(this, 'div', { - className: 'vjs-volume-bar vjs-slider-bar' - }, { - 'aria-label': this.localize('Volume Level'), - 'aria-live': 'polite' - }); - }; - - /** - * Handle movement events on the {@link VolumeMenuButton}. - * - * @param {EventTarget~Event} event - * The event that caused this function to run. - * - * @listens mousemove - */ - - - VolumeBar.prototype.handleMouseMove = function handleMouseMove(event) { - this.checkMuted(); - this.player_.volume(this.calculateDistance(event)); - }; - - /** - * If the player is muted unmute it. - */ - - - VolumeBar.prototype.checkMuted = function checkMuted() { - if (this.player_.muted()) { - this.player_.muted(false); - } - }; - - /** - * Get percent of volume level - * - * @return {number} - * Volume level percent as a decimal number. - */ - - - VolumeBar.prototype.getPercent = function getPercent() { - if (this.player_.muted()) { - return 0; - } - return this.player_.volume(); - }; - - /** - * Increase volume level for keyboard users - */ - - - VolumeBar.prototype.stepForward = function stepForward() { - this.checkMuted(); - this.player_.volume(this.player_.volume() + 0.1); - }; - - /** - * Decrease volume level for keyboard users - */ - - - VolumeBar.prototype.stepBack = function stepBack() { - this.checkMuted(); - this.player_.volume(this.player_.volume() - 0.1); - }; - - /** - * Update ARIA accessibility attributes - * - * @param {EventTarget~Event} [event] - * The `volumechange` event that caused this function to run. - * - * @listens Player#volumechange - */ - - - VolumeBar.prototype.updateARIAAttributes = function updateARIAAttributes(event) { - var ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_(); - - this.el_.setAttribute('aria-valuenow', ariaValue); - this.el_.setAttribute('aria-valuetext', ariaValue + '%'); - }; - - /** - * Returns the current value of the player volume as a percentage - * - * @private - */ - - - VolumeBar.prototype.volumeAsPercentage_ = function volumeAsPercentage_() { - return Math.round(this.player_.volume() * 100); - }; - - /** - * When user starts dragging the VolumeBar, store the volume and listen for - * the end of the drag. When the drag ends, if the volume was set to zero, - * set lastVolume to the stored volume. - * - * @listens slideractive - * @private - */ - - - VolumeBar.prototype.updateLastVolume_ = function updateLastVolume_() { - var _this2 = this; - - var volumeBeforeDrag = this.player_.volume(); - - this.one('sliderinactive', function () { - if (_this2.player_.volume() === 0) { - _this2.player_.lastVolume_(volumeBeforeDrag); - } - }); - }; - - return VolumeBar; -}(Slider); - -/** - * Default options for the `VolumeBar` - * - * @type {Object} - * @private - */ - - -VolumeBar.prototype.options_ = { - children: ['volumeLevel'], - barName: 'volumeLevel' -}; - -/** - * Call the update event for this Slider when this event happens on the player. - * - * @type {string} - */ -VolumeBar.prototype.playerEvent = 'volumechange'; - -Component.registerComponent('VolumeBar', VolumeBar); - -/** - * @file volume-control.js - */ -// Required children -/** - * The component for controlling the volume level - * - * @extends Component - */ - -var VolumeControl = function (_Component) { - inherits(VolumeControl, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options={}] - * The key/value store of player options. - */ - function VolumeControl(player) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, VolumeControl); - - options.vertical = options.vertical || false; - - // Pass the vertical option down to the VolumeBar if - // the VolumeBar is turned on. - if (typeof options.volumeBar === 'undefined' || isPlain(options.volumeBar)) { - options.volumeBar = options.volumeBar || {}; - options.volumeBar.vertical = options.vertical; - } - - // hide this control if volume support is missing - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - checkVolumeSupport(_this, player); - - _this.throttledHandleMouseMove = throttle(bind(_this, _this.handleMouseMove), 25); - - _this.on('mousedown', _this.handleMouseDown); - _this.on('touchstart', _this.handleMouseDown); - - // while the slider is active (the mouse has been pressed down and - // is dragging) or in focus we do not want to hide the VolumeBar - _this.on(_this.volumeBar, ['focus', 'slideractive'], function () { - _this.volumeBar.addClass('vjs-slider-active'); - _this.addClass('vjs-slider-active'); - _this.trigger('slideractive'); - }); - - _this.on(_this.volumeBar, ['blur', 'sliderinactive'], function () { - _this.volumeBar.removeClass('vjs-slider-active'); - _this.removeClass('vjs-slider-active'); - _this.trigger('sliderinactive'); - }); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - VolumeControl.prototype.createEl = function createEl() { - var orientationClass = 'vjs-volume-horizontal'; - - if (this.options_.vertical) { - orientationClass = 'vjs-volume-vertical'; - } - - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-volume-control vjs-control ' + orientationClass - }); - }; - - /** - * Handle `mousedown` or `touchstart` events on the `VolumeControl`. - * - * @param {EventTarget~Event} event - * `mousedown` or `touchstart` event that triggered this function - * - * @listens mousedown - * @listens touchstart - */ - - - VolumeControl.prototype.handleMouseDown = function handleMouseDown(event) { - var doc = this.el_.ownerDocument; - - this.on(doc, 'mousemove', this.throttledHandleMouseMove); - this.on(doc, 'touchmove', this.throttledHandleMouseMove); - this.on(doc, 'mouseup', this.handleMouseUp); - this.on(doc, 'touchend', this.handleMouseUp); - }; - - /** - * Handle `mouseup` or `touchend` events on the `VolumeControl`. - * - * @param {EventTarget~Event} event - * `mouseup` or `touchend` event that triggered this function. - * - * @listens touchend - * @listens mouseup - */ - - - VolumeControl.prototype.handleMouseUp = function handleMouseUp(event) { - var doc = this.el_.ownerDocument; - - this.off(doc, 'mousemove', this.throttledHandleMouseMove); - this.off(doc, 'touchmove', this.throttledHandleMouseMove); - this.off(doc, 'mouseup', this.handleMouseUp); - this.off(doc, 'touchend', this.handleMouseUp); - }; - - /** - * Handle `mousedown` or `touchstart` events on the `VolumeControl`. - * - * @param {EventTarget~Event} event - * `mousedown` or `touchstart` event that triggered this function - * - * @listens mousedown - * @listens touchstart - */ - - - VolumeControl.prototype.handleMouseMove = function handleMouseMove(event) { - this.volumeBar.handleMouseMove(event); - }; - - return VolumeControl; -}(Component); - -/** - * Default options for the `VolumeControl` - * - * @type {Object} - * @private - */ - - -VolumeControl.prototype.options_ = { - children: ['volumeBar'] -}; - -Component.registerComponent('VolumeControl', VolumeControl); - -/** - * @file mute-toggle.js - */ -/** - * A button component for muting the audio. - * - * @extends Button - */ - -var MuteToggle = function (_Button) { - inherits(MuteToggle, _Button); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function MuteToggle(player, options) { - classCallCheck(this, MuteToggle); - - // hide this control if volume support is missing - var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); - - checkVolumeSupport(_this, player); - - _this.on(player, ['loadstart', 'volumechange'], _this.update); - return _this; - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - MuteToggle.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-mute-control ' + _Button.prototype.buildCSSClass.call(this); - }; - - /** - * This gets called when an `MuteToggle` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - MuteToggle.prototype.handleClick = function handleClick(event) { - var vol = this.player_.volume(); - var lastVolume = this.player_.lastVolume_(); - - if (vol === 0) { - var volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume; - - this.player_.volume(volumeToSet); - this.player_.muted(false); - } else { - this.player_.muted(this.player_.muted() ? false : true); - } - }; - - /** - * Update the `MuteToggle` button based on the state of `volume` and `muted` - * on the player. - * - * @param {EventTarget~Event} [event] - * The {@link Player#loadstart} event if this function was called - * through an event. - * - * @listens Player#loadstart - * @listens Player#volumechange - */ - - - MuteToggle.prototype.update = function update(event) { - this.updateIcon_(); - this.updateControlText_(); - }; - - /** - * Update the appearance of the `MuteToggle` icon. - * - * Possible states (given `level` variable below): - * - 0: crossed out - * - 1: zero bars of volume - * - 2: one bar of volume - * - 3: two bars of volume - * - * @private - */ - - - MuteToggle.prototype.updateIcon_ = function updateIcon_() { - var vol = this.player_.volume(); - var level = 3; - - if (vol === 0 || this.player_.muted()) { - level = 0; - } else if (vol < 0.33) { - level = 1; - } else if (vol < 0.67) { - level = 2; - } - - // TODO improve muted icon classes - for (var i = 0; i < 4; i++) { - removeClass(this.el_, 'vjs-vol-' + i); - } - addClass(this.el_, 'vjs-vol-' + level); - }; - - /** - * If `muted` has changed on the player, update the control text - * (`title` attribute on `vjs-mute-control` element and content of - * `vjs-control-text` element). - * - * @private - */ - - - MuteToggle.prototype.updateControlText_ = function updateControlText_() { - var soundOff = this.player_.muted() || this.player_.volume() === 0; - var text = soundOff ? 'Unmute' : 'Mute'; - - if (this.controlText() !== text) { - this.controlText(text); - } - }; - - return MuteToggle; -}(Button); - -/** - * The text that should display over the `MuteToggle`s controls. Added for localization. - * - * @type {string} - * @private - */ - - -MuteToggle.prototype.controlText_ = 'Mute'; - -Component.registerComponent('MuteToggle', MuteToggle); - -/** - * @file volume-control.js - */ -// Required children -/** - * A Component to contain the MuteToggle and VolumeControl so that - * they can work together. - * - * @extends Component - */ - -var VolumePanel = function (_Component) { - inherits(VolumePanel, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options={}] - * The key/value store of player options. - */ - function VolumePanel(player) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, VolumePanel); - - if (typeof options.inline !== 'undefined') { - options.inline = options.inline; - } else { - options.inline = true; - } - - // pass the inline option down to the VolumeControl as vertical if - // the VolumeControl is on. - if (typeof options.volumeControl === 'undefined' || isPlain(options.volumeControl)) { - options.volumeControl = options.volumeControl || {}; - options.volumeControl.vertical = !options.inline; - } - - // hide this control if volume support is missing - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - checkVolumeSupport(_this, player); - - // while the slider is active (the mouse has been pressed down and - // is dragging) or in focus we do not want to hide the VolumeBar - _this.on(_this.volumeControl, ['slideractive'], _this.sliderActive_); - _this.on(_this.muteToggle, 'focus', _this.sliderActive_); - - _this.on(_this.volumeControl, ['sliderinactive'], _this.sliderInactive_); - _this.on(_this.muteToggle, 'blur', _this.sliderInactive_); - return _this; - } - - /** - * Add vjs-slider-active class to the VolumePanel - * - * @listens VolumeControl#slideractive - * @private - */ - - - VolumePanel.prototype.sliderActive_ = function sliderActive_() { - this.addClass('vjs-slider-active'); - }; - - /** - * Removes vjs-slider-active class to the VolumePanel - * - * @listens VolumeControl#sliderinactive - * @private - */ - - - VolumePanel.prototype.sliderInactive_ = function sliderInactive_() { - this.removeClass('vjs-slider-active'); - }; - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - VolumePanel.prototype.createEl = function createEl() { - var orientationClass = 'vjs-volume-panel-horizontal'; - - if (!this.options_.inline) { - orientationClass = 'vjs-volume-panel-vertical'; - } - - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-volume-panel vjs-control ' + orientationClass - }); - }; - - return VolumePanel; -}(Component); - -/** - * Default options for the `VolumeControl` - * - * @type {Object} - * @private - */ - - -VolumePanel.prototype.options_ = { - children: ['muteToggle', 'volumeControl'] -}; - -Component.registerComponent('VolumePanel', VolumePanel); - -/** - * @file menu.js - */ -/** - * The Menu component is used to build popup menus, including subtitle and - * captions selection menus. - * - * @extends Component - */ - -var Menu = function (_Component) { - inherits(Menu, _Component); - - /** - * Create an instance of this class. - * - * @param {Player} player - * the player that this component should attach to - * - * @param {Object} [options] - * Object of option names and values - * - */ - function Menu(player, options) { - classCallCheck(this, Menu); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - if (options) { - _this.menuButton_ = options.menuButton; - } - - _this.focusedChild_ = -1; - - _this.on('keydown', _this.handleKeyPress); - return _this; - } - - /** - * Add a {@link MenuItem} to the menu. - * - * @param {Object|string} component - * The name or instance of the `MenuItem` to add. - * - */ - - - Menu.prototype.addItem = function addItem(component) { - this.addChild(component); - component.on('click', bind(this, function (event) { - // Unpress the associated MenuButton, and move focus back to it - if (this.menuButton_) { - this.menuButton_.unpressButton(); - - // don't focus menu button if item is a caption settings item - // because focus will move elsewhere and it logs an error on IE8 - if (component.name() !== 'CaptionSettingsMenuItem') { - this.menuButton_.focus(); - } - } - })); - }; - - /** - * Create the `Menu`s DOM element. - * - * @return {Element} - * the element that was created - */ - - - Menu.prototype.createEl = function createEl$$1() { - var contentElType = this.options_.contentElType || 'ul'; - - this.contentEl_ = createEl(contentElType, { - className: 'vjs-menu-content' - }); - - this.contentEl_.setAttribute('role', 'menu'); - - var el = _Component.prototype.createEl.call(this, 'div', { - append: this.contentEl_, - className: 'vjs-menu' - }); - - el.appendChild(this.contentEl_); - - // Prevent clicks from bubbling up. Needed for Menu Buttons, - // where a click on the parent is significant - on(el, 'click', function (event) { - event.preventDefault(); - event.stopImmediatePropagation(); - }); - - return el; - }; - - /** - * Handle a `keydown` event on this menu. This listener is added in the constructor. - * - * @param {EventTarget~Event} event - * A `keydown` event that happened on the menu. - * - * @listens keydown - */ - - - Menu.prototype.handleKeyPress = function handleKeyPress(event) { - // Left and Down Arrows - if (event.which === 37 || event.which === 40) { - event.preventDefault(); - this.stepForward(); - - // Up and Right Arrows - } else if (event.which === 38 || event.which === 39) { - event.preventDefault(); - this.stepBack(); - } - }; - - /** - * Move to next (lower) menu item for keyboard users. - */ - - - Menu.prototype.stepForward = function stepForward() { - var stepChild = 0; - - if (this.focusedChild_ !== undefined) { - stepChild = this.focusedChild_ + 1; - } - this.focus(stepChild); - }; - - /** - * Move to previous (higher) menu item for keyboard users. - */ - - - Menu.prototype.stepBack = function stepBack() { - var stepChild = 0; - - if (this.focusedChild_ !== undefined) { - stepChild = this.focusedChild_ - 1; - } - this.focus(stepChild); - }; - - /** - * Set focus on a {@link MenuItem} in the `Menu`. - * - * @param {Object|string} [item=0] - * Index of child item set focus on. - */ - - - Menu.prototype.focus = function focus() { - var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - - var children = this.children().slice(); - var haveTitle = children.length && children[0].className && /vjs-menu-title/.test(children[0].className); - - if (haveTitle) { - children.shift(); - } - - if (children.length > 0) { - if (item < 0) { - item = 0; - } else if (item >= children.length) { - item = children.length - 1; - } - - this.focusedChild_ = item; - - children[item].el_.focus(); - } - }; - - return Menu; -}(Component); - -Component.registerComponent('Menu', Menu); - -/** - * @file menu-button.js - */ -/** - * A `MenuButton` class for any popup {@link Menu}. - * - * @extends Component - */ - -var MenuButton = function (_Component) { - inherits(MenuButton, _Component); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options={}] - * The key/value store of player options. - */ - function MenuButton(player) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, MenuButton); - - var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); - - _this.menuButton_ = new Button(player, options); - - _this.menuButton_.controlText(_this.controlText_); - _this.menuButton_.el_.setAttribute('aria-haspopup', 'true'); - - // Add buildCSSClass values to the button, not the wrapper - var buttonClass = Button.prototype.buildCSSClass(); - - _this.menuButton_.el_.className = _this.buildCSSClass() + ' ' + buttonClass; - _this.menuButton_.removeClass('vjs-control'); - - _this.addChild(_this.menuButton_); - - _this.update(); - - _this.enabled_ = true; - - _this.on(_this.menuButton_, 'tap', _this.handleClick); - _this.on(_this.menuButton_, 'click', _this.handleClick); - _this.on(_this.menuButton_, 'focus', _this.handleFocus); - _this.on(_this.menuButton_, 'blur', _this.handleBlur); - - _this.on('keydown', _this.handleSubmenuKeyPress); - return _this; - } - - /** - * Update the menu based on the current state of its items. - */ - - - MenuButton.prototype.update = function update() { - var menu = this.createMenu(); - - if (this.menu) { - this.removeChild(this.menu); - } - - this.menu = menu; - this.addChild(menu); - - /** - * Track the state of the menu button - * - * @type {Boolean} - * @private - */ - this.buttonPressed_ = false; - this.menuButton_.el_.setAttribute('aria-expanded', 'false'); - - if (this.items && this.items.length <= this.hideThreshold_) { - this.hide(); - } else { - this.show(); - } - }; - - /** - * Create the menu and add all items to it. - * - * @return {Menu} - * The constructed menu - */ - - - MenuButton.prototype.createMenu = function createMenu() { - var menu = new Menu(this.player_, { menuButton: this }); - - /** - * Hide the menu if the number of items is less than or equal to this threshold. This defaults - * to 0 and whenever we add items which can be hidden to the menu we'll increment it. We list - * it here because every time we run `createMenu` we need to reset the value. - * - * @protected - * @type {Number} - */ - this.hideThreshold_ = 0; - - // Add a title list item to the top - if (this.options_.title) { - var title = createEl('li', { - className: 'vjs-menu-title', - innerHTML: toTitleCase(this.options_.title), - tabIndex: -1 - }); - - this.hideThreshold_ += 1; - - menu.children_.unshift(title); - prependTo(title, menu.contentEl()); - } - - this.items = this.createItems(); - - if (this.items) { - // Add menu items to the menu - for (var i = 0; i < this.items.length; i++) { - menu.addItem(this.items[i]); - } - } - - return menu; - }; - - /** - * Create the list of menu items. Specific to each subclass. - * - * @abstract - */ - - - MenuButton.prototype.createItems = function createItems() {}; - - /** - * Create the `MenuButtons`s DOM element. - * - * @return {Element} - * The element that gets created. - */ - - - MenuButton.prototype.createEl = function createEl$$1() { - return _Component.prototype.createEl.call(this, 'div', { - className: this.buildWrapperCSSClass() - }, {}); - }; - - /** - * Allow sub components to stack CSS class names for the wrapper element - * - * @return {string} - * The constructed wrapper DOM `className` - */ - - - MenuButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - var menuButtonClass = 'vjs-menu-button'; - - // If the inline option is passed, we want to use different styles altogether. - if (this.options_.inline === true) { - menuButtonClass += '-inline'; - } else { - menuButtonClass += '-popup'; - } - - // TODO: Fix the CSS so that this isn't necessary - var buttonClass = Button.prototype.buildCSSClass(); - - return 'vjs-menu-button ' + menuButtonClass + ' ' + buttonClass + ' ' + _Component.prototype.buildCSSClass.call(this); - }; - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - MenuButton.prototype.buildCSSClass = function buildCSSClass() { - var menuButtonClass = 'vjs-menu-button'; - - // If the inline option is passed, we want to use different styles altogether. - if (this.options_.inline === true) { - menuButtonClass += '-inline'; - } else { - menuButtonClass += '-popup'; - } - - return 'vjs-menu-button ' + menuButtonClass + ' ' + _Component.prototype.buildCSSClass.call(this); - }; - - /** - * Get or set the localized control text that will be used for accessibility. - * - * > NOTE: This will come from the internal `menuButton_` element. - * - * @param {string} [text] - * Control text for element. - * - * @param {Element} [el=this.menuButton_.el()] - * Element to set the title on. - * - * @return {string} - * - The control text when getting - */ - - - MenuButton.prototype.controlText = function controlText(text) { - var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.menuButton_.el(); - - return this.menuButton_.controlText(text, el); - }; - - /** - * Handle a click on a `MenuButton`. - * See {@link ClickableComponent#handleClick} for instances where this is called. - * - * @param {EventTarget~Event} event - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - MenuButton.prototype.handleClick = function handleClick(event) { - // When you click the button it adds focus, which will show the menu. - // So we'll remove focus when the mouse leaves the button. Focus is needed - // for tab navigation. - - this.one(this.menu.contentEl(), 'mouseleave', bind(this, function (e) { - this.unpressButton(); - this.el_.blur(); - })); - if (this.buttonPressed_) { - this.unpressButton(); - } else { - this.pressButton(); - } - }; - - /** - * Set the focus to the actual button, not to this element - */ - - - MenuButton.prototype.focus = function focus() { - this.menuButton_.focus(); - }; - - /** - * Remove the focus from the actual button, not this element - */ - - - MenuButton.prototype.blur = function blur() { - this.menuButton_.blur(); - }; - - /** - * This gets called when a `MenuButton` gains focus via a `focus` event. - * Turns on listening for `keydown` events. When they happen it - * calls `this.handleKeyPress`. - * - * @param {EventTarget~Event} event - * The `focus` event that caused this function to be called. - * - * @listens focus - */ - - - MenuButton.prototype.handleFocus = function handleFocus() { - on(document_1, 'keydown', bind(this, this.handleKeyPress)); - }; - - /** - * Called when a `MenuButton` loses focus. Turns off the listener for - * `keydown` events. Which Stops `this.handleKeyPress` from getting called. - * - * @param {EventTarget~Event} event - * The `blur` event that caused this function to be called. - * - * @listens blur - */ - - - MenuButton.prototype.handleBlur = function handleBlur() { - off(document_1, 'keydown', bind(this, this.handleKeyPress)); - }; - - /** - * Handle tab, escape, down arrow, and up arrow keys for `MenuButton`. See - * {@link ClickableComponent#handleKeyPress} for instances where this is called. - * - * @param {EventTarget~Event} event - * The `keydown` event that caused this function to be called. - * - * @listens keydown - */ - - - MenuButton.prototype.handleKeyPress = function handleKeyPress(event) { - - // Escape (27) key or Tab (9) key unpress the 'button' - if (event.which === 27 || event.which === 9) { - if (this.buttonPressed_) { - this.unpressButton(); - } - // Don't preventDefault for Tab key - we still want to lose focus - if (event.which !== 9) { - event.preventDefault(); - // Set focus back to the menu button's button - this.menuButton_.el_.focus(); - } - // Up (38) key or Down (40) key press the 'button' - } else if (event.which === 38 || event.which === 40) { - if (!this.buttonPressed_) { - this.pressButton(); - event.preventDefault(); - } - } - }; - - /** - * Handle a `keydown` event on a sub-menu. The listener for this is added in - * the constructor. - * - * @param {EventTarget~Event} event - * Key press event - * - * @listens keydown - */ - - - MenuButton.prototype.handleSubmenuKeyPress = function handleSubmenuKeyPress(event) { - - // Escape (27) key or Tab (9) key unpress the 'button' - if (event.which === 27 || event.which === 9) { - if (this.buttonPressed_) { - this.unpressButton(); - } - // Don't preventDefault for Tab key - we still want to lose focus - if (event.which !== 9) { - event.preventDefault(); - // Set focus back to the menu button's button - this.menuButton_.el_.focus(); - } - } - }; - - /** - * Put the current `MenuButton` into a pressed state. - */ - - - MenuButton.prototype.pressButton = function pressButton() { - if (this.enabled_) { - this.buttonPressed_ = true; - this.menu.lockShowing(); - this.menuButton_.el_.setAttribute('aria-expanded', 'true'); - // set the focus into the submenu - this.menu.focus(); - } - }; - - /** - * Take the current `MenuButton` out of a pressed state. - */ - - - MenuButton.prototype.unpressButton = function unpressButton() { - if (this.enabled_) { - this.buttonPressed_ = false; - this.menu.unlockShowing(); - this.menuButton_.el_.setAttribute('aria-expanded', 'false'); - } - }; - - /** - * Disable the `MenuButton`. Don't allow it to be clicked. - */ - - - MenuButton.prototype.disable = function disable() { - this.unpressButton(); - - this.enabled_ = false; - this.addClass('vjs-disabled'); - - this.menuButton_.disable(); - }; - - /** - * Enable the `MenuButton`. Allow it to be clicked. - */ - - - MenuButton.prototype.enable = function enable() { - this.enabled_ = true; - this.removeClass('vjs-disabled'); - - this.menuButton_.enable(); - }; - - return MenuButton; -}(Component); - -Component.registerComponent('MenuButton', MenuButton); - -/** - * @file track-button.js - */ -/** - * The base class for buttons that toggle specific track types (e.g. subtitles). - * - * @extends MenuButton - */ - -var TrackButton = function (_MenuButton) { - inherits(TrackButton, _MenuButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function TrackButton(player, options) { - classCallCheck(this, TrackButton); - - var tracks = options.tracks; - - var _this = possibleConstructorReturn(this, _MenuButton.call(this, player, options)); - - if (_this.items.length <= 1) { - _this.hide(); - } - - if (!tracks) { - return possibleConstructorReturn(_this); - } - - var updateHandler = bind(_this, _this.update); - - tracks.addEventListener('removetrack', updateHandler); - tracks.addEventListener('addtrack', updateHandler); - _this.player_.on('ready', updateHandler); - - _this.player_.on('dispose', function () { - tracks.removeEventListener('removetrack', updateHandler); - tracks.removeEventListener('addtrack', updateHandler); - }); - return _this; - } - - return TrackButton; -}(MenuButton); - -Component.registerComponent('TrackButton', TrackButton); - -/** - * @file menu-item.js - */ -/** - * The component for a menu item. `<li>` - * - * @extends ClickableComponent - */ - -var MenuItem = function (_ClickableComponent) { - inherits(MenuItem, _ClickableComponent); - - /** - * Creates an instance of the this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options={}] - * The key/value store of player options. - * - */ - function MenuItem(player, options) { - classCallCheck(this, MenuItem); - - var _this = possibleConstructorReturn(this, _ClickableComponent.call(this, player, options)); - - _this.selectable = options.selectable; - - _this.selected(options.selected); - - if (_this.selectable) { - // TODO: May need to be either menuitemcheckbox or menuitemradio, - // and may need logical grouping of menu items. - _this.el_.setAttribute('role', 'menuitemcheckbox'); - } else { - _this.el_.setAttribute('role', 'menuitem'); - } - return _this; - } - - /** - * Create the `MenuItem's DOM element - * - * @param {string} [type=li] - * Element's node type, not actually used, always set to `li`. - * - * @param {Object} [props={}] - * An object of properties that should be set on the element - * - * @param {Object} [attrs={}] - * An object of attributes that should be set on the element - * - * @return {Element} - * The element that gets created. - */ - - - MenuItem.prototype.createEl = function createEl(type, props, attrs) { - // The control is textual, not just an icon - this.nonIconControl = true; - - return _ClickableComponent.prototype.createEl.call(this, 'li', assign({ - className: 'vjs-menu-item', - innerHTML: '<span class="vjs-menu-item-text">' + this.localize(this.options_.label) + '</span>', - tabIndex: -1 - }, props), attrs); - }; - - /** - * Any click on a `MenuItem` puts int into the selected state. - * See {@link ClickableComponent#handleClick} for instances where this is called. - * - * @param {EventTarget~Event} event - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - MenuItem.prototype.handleClick = function handleClick(event) { - this.selected(true); - }; - - /** - * Set the state for this menu item as selected or not. - * - * @param {boolean} selected - * if the menu item is selected or not - */ - - - MenuItem.prototype.selected = function selected(_selected) { - if (this.selectable) { - if (_selected) { - this.addClass('vjs-selected'); - this.el_.setAttribute('aria-checked', 'true'); - // aria-checked isn't fully supported by browsers/screen readers, - // so indicate selected state to screen reader in the control text. - this.controlText(', selected'); - } else { - this.removeClass('vjs-selected'); - this.el_.setAttribute('aria-checked', 'false'); - // Indicate un-selected state to screen reader - // Note that a space clears out the selected state text - this.controlText(' '); - } - } - }; - - return MenuItem; -}(ClickableComponent); - -Component.registerComponent('MenuItem', MenuItem); - -/** - * @file text-track-menu-item.js - */ -/** - * The specific menu item type for selecting a language within a text track kind - * - * @extends MenuItem - */ - -var TextTrackMenuItem = function (_MenuItem) { - inherits(TextTrackMenuItem, _MenuItem); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function TextTrackMenuItem(player, options) { - classCallCheck(this, TextTrackMenuItem); - - var track = options.track; - var tracks = player.textTracks(); - - // Modify options for parent MenuItem class's init. - options.label = track.label || track.language || 'Unknown'; - options.selected = track.mode === 'showing'; - - var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); - - _this.track = track; - var changeHandler = bind(_this, _this.handleTracksChange); - var selectedLanguageChangeHandler = bind(_this, _this.handleSelectedLanguageChange); - - player.on(['loadstart', 'texttrackchange'], changeHandler); - tracks.addEventListener('change', changeHandler); - tracks.addEventListener('selectedlanguagechange', selectedLanguageChangeHandler); - _this.on('dispose', function () { - tracks.removeEventListener('change', changeHandler); - tracks.removeEventListener('selectedlanguagechange', selectedLanguageChangeHandler); - }); - - // iOS7 doesn't dispatch change events to TextTrackLists when an - // associated track's mode changes. Without something like - // Object.observe() (also not present on iOS7), it's not - // possible to detect changes to the mode attribute and polyfill - // the change event. As a poor substitute, we manually dispatch - // change events whenever the controls modify the mode. - if (tracks.onchange === undefined) { - var event = void 0; - - _this.on(['tap', 'click'], function () { - if (_typeof(window_1.Event) !== 'object') { - // Android 2.3 throws an Illegal Constructor error for window.Event - try { - event = new window_1.Event('change'); - } catch (err) { - // continue regardless of error - } - } - - if (!event) { - event = document_1.createEvent('Event'); - event.initEvent('change', true, true); - } - - tracks.dispatchEvent(event); - }); - } - return _this; - } - - /** - * This gets called when an `TextTrackMenuItem` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} event - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - TextTrackMenuItem.prototype.handleClick = function handleClick(event) { - var kind = this.track.kind; - var kinds = this.track.kinds; - var tracks = this.player_.textTracks(); - - if (!kinds) { - kinds = [kind]; - } - - _MenuItem.prototype.handleClick.call(this, event); - - if (!tracks) { - return; - } - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - if (track === this.track && kinds.indexOf(track.kind) > -1) { - if (track.mode !== 'showing') { - track.mode = 'showing'; - } - } else if (track.mode !== 'disabled') { - track.mode = 'disabled'; - } - } - }; - - /** - * Handle text track list change - * - * @param {EventTarget~Event} event - * The `change` event that caused this function to be called. - * - * @listens TextTrackList#change - */ - - - TextTrackMenuItem.prototype.handleTracksChange = function handleTracksChange(event) { - this.selected(this.track.mode === 'showing'); - }; - - TextTrackMenuItem.prototype.handleSelectedLanguageChange = function handleSelectedLanguageChange(event) { - if (this.track.mode === 'showing') { - var selectedLanguage = this.player_.cache_.selectedLanguage; - - // Don't replace the kind of track across the same language - if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) { - return; - } - - this.player_.cache_.selectedLanguage = { - enabled: true, - language: this.track.language, - kind: this.track.kind - }; - } - }; - - return TextTrackMenuItem; -}(MenuItem); - -Component.registerComponent('TextTrackMenuItem', TextTrackMenuItem); - -/** - * @file off-text-track-menu-item.js - */ -/** - * A special menu item for turning of a specific type of text track - * - * @extends TextTrackMenuItem - */ - -var OffTextTrackMenuItem = function (_TextTrackMenuItem) { - inherits(OffTextTrackMenuItem, _TextTrackMenuItem); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function OffTextTrackMenuItem(player, options) { - classCallCheck(this, OffTextTrackMenuItem); - - // Create pseudo track info - // Requires options['kind'] - options.track = { - player: player, - kind: options.kind, - kinds: options.kinds, - 'default': false, - mode: 'disabled' - }; - - if (!options.kinds) { - options.kinds = [options.kind]; - } - - if (options.label) { - options.track.label = options.label; - } else { - options.track.label = options.kinds.join(' and ') + ' off'; - } - - // MenuItem is selectable - options.selectable = true; - - var _this = possibleConstructorReturn(this, _TextTrackMenuItem.call(this, player, options)); - - _this.selected(true); - return _this; - } - - /** - * Handle text track change - * - * @param {EventTarget~Event} event - * The event that caused this function to run - */ - - - OffTextTrackMenuItem.prototype.handleTracksChange = function handleTracksChange(event) { - var tracks = this.player().textTracks(); - var selected = true; - - for (var i = 0, l = tracks.length; i < l; i++) { - var track = tracks[i]; - - if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === 'showing') { - selected = false; - break; - } - } - - this.selected(selected); - }; - - OffTextTrackMenuItem.prototype.handleSelectedLanguageChange = function handleSelectedLanguageChange(event) { - var tracks = this.player().textTracks(); - var allHidden = true; - - for (var i = 0, l = tracks.length; i < l; i++) { - var track = tracks[i]; - - if (['captions', 'descriptions', 'subtitles'].indexOf(track.kind) > -1 && track.mode === 'showing') { - allHidden = false; - break; - } - } - - if (allHidden) { - this.player_.cache_.selectedLanguage = { - enabled: false - }; - } - }; - - return OffTextTrackMenuItem; -}(TextTrackMenuItem); - -Component.registerComponent('OffTextTrackMenuItem', OffTextTrackMenuItem); - -/** - * @file text-track-button.js - */ -/** - * The base class for buttons that toggle specific text track types (e.g. subtitles) - * - * @extends MenuButton - */ - -var TextTrackButton = function (_TrackButton) { - inherits(TextTrackButton, _TrackButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options={}] - * The key/value store of player options. - */ - function TextTrackButton(player) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, TextTrackButton); - - options.tracks = player.textTracks(); - - return possibleConstructorReturn(this, _TrackButton.call(this, player, options)); - } - - /** - * Create a menu item for each text track - * - * @param {TextTrackMenuItem[]} [items=[]] - * Existing array of items to use during creation - * - * @return {TextTrackMenuItem[]} - * Array of menu items that were created - */ - - - TextTrackButton.prototype.createItems = function createItems() { - var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var TrackMenuItem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TextTrackMenuItem; - - - // Label is an overide for the [track] off label - // USed to localise captions/subtitles - var label = void 0; - - if (this.label_) { - label = this.label_ + ' off'; - } - // Add an OFF menu item to turn all tracks off - items.push(new OffTextTrackMenuItem(this.player_, { - kinds: this.kinds_, - kind: this.kind_, - label: label - })); - - this.hideThreshold_ += 1; - - var tracks = this.player_.textTracks(); - - if (!Array.isArray(this.kinds_)) { - this.kinds_ = [this.kind_]; - } - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - // only add tracks that are of an appropriate kind and have a label - if (this.kinds_.indexOf(track.kind) > -1) { - - var item = new TrackMenuItem(this.player_, { - track: track, - // MenuItem is selectable - selectable: true - }); - - item.addClass('vjs-' + track.kind + '-menu-item'); - items.push(item); - } - } - - return items; - }; - - return TextTrackButton; -}(TrackButton); - -Component.registerComponent('TextTrackButton', TextTrackButton); - -/** - * @file chapters-track-menu-item.js - */ -/** - * The chapter track menu item - * - * @extends MenuItem - */ - -var ChaptersTrackMenuItem = function (_MenuItem) { - inherits(ChaptersTrackMenuItem, _MenuItem); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function ChaptersTrackMenuItem(player, options) { - classCallCheck(this, ChaptersTrackMenuItem); - - var track = options.track; - var cue = options.cue; - var currentTime = player.currentTime(); - - // Modify options for parent MenuItem class's init. - options.selectable = true; - options.label = cue.text; - options.selected = cue.startTime <= currentTime && currentTime < cue.endTime; - - var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); - - _this.track = track; - _this.cue = cue; - track.addEventListener('cuechange', bind(_this, _this.update)); - return _this; - } - - /** - * This gets called when an `ChaptersTrackMenuItem` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - ChaptersTrackMenuItem.prototype.handleClick = function handleClick(event) { - _MenuItem.prototype.handleClick.call(this); - this.player_.currentTime(this.cue.startTime); - this.update(this.cue.startTime); - }; - - /** - * Update chapter menu item - * - * @param {EventTarget~Event} [event] - * The `cuechange` event that caused this function to run. - * - * @listens TextTrack#cuechange - */ - - - ChaptersTrackMenuItem.prototype.update = function update(event) { - var cue = this.cue; - var currentTime = this.player_.currentTime(); - - // vjs.log(currentTime, cue.startTime); - this.selected(cue.startTime <= currentTime && currentTime < cue.endTime); - }; - - return ChaptersTrackMenuItem; -}(MenuItem); - -Component.registerComponent('ChaptersTrackMenuItem', ChaptersTrackMenuItem); - -/** - * @file chapters-button.js - */ -/** - * The button component for toggling and selecting chapters - * Chapters act much differently than other text tracks - * Cues are navigation vs. other tracks of alternative languages - * - * @extends TextTrackButton - */ - -var ChaptersButton = function (_TextTrackButton) { - inherits(ChaptersButton, _TextTrackButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} [ready] - * The function to call when this function is ready. - */ - function ChaptersButton(player, options, ready) { - classCallCheck(this, ChaptersButton); - return possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - ChaptersButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-chapters-button ' + _TextTrackButton.prototype.buildCSSClass.call(this); - }; - - ChaptersButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-chapters-button ' + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); - }; - - /** - * Update the menu based on the current state of its items. - * - * @param {EventTarget~Event} [event] - * An event that triggered this function to run. - * - * @listens TextTrackList#addtrack - * @listens TextTrackList#removetrack - * @listens TextTrackList#change - */ - - - ChaptersButton.prototype.update = function update(event) { - if (!this.track_ || event && (event.type === 'addtrack' || event.type === 'removetrack')) { - this.setTrack(this.findChaptersTrack()); - } - _TextTrackButton.prototype.update.call(this); - }; - - /** - * Set the currently selected track for the chapters button. - * - * @param {TextTrack} track - * The new track to select. Nothing will change if this is the currently selected - * track. - */ - - - ChaptersButton.prototype.setTrack = function setTrack(track) { - if (this.track_ === track) { - return; - } - - if (!this.updateHandler_) { - this.updateHandler_ = this.update.bind(this); - } - - // here this.track_ refers to the old track instance - if (this.track_) { - var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_); - - if (remoteTextTrackEl) { - remoteTextTrackEl.removeEventListener('load', this.updateHandler_); - } - - this.track_ = null; - } - - this.track_ = track; - - // here this.track_ refers to the new track instance - if (this.track_) { - this.track_.mode = 'hidden'; - - var _remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_); - - if (_remoteTextTrackEl) { - _remoteTextTrackEl.addEventListener('load', this.updateHandler_); - } - } - }; - - /** - * Find the track object that is currently in use by this ChaptersButton - * - * @return {TextTrack|undefined} - * The current track or undefined if none was found. - */ - - - ChaptersButton.prototype.findChaptersTrack = function findChaptersTrack() { - var tracks = this.player_.textTracks() || []; - - for (var i = tracks.length - 1; i >= 0; i--) { - // We will always choose the last track as our chaptersTrack - var track = tracks[i]; - - if (track.kind === this.kind_) { - return track; - } - } - }; - - /** - * Get the caption for the ChaptersButton based on the track label. This will also - * use the current tracks localized kind as a fallback if a label does not exist. - * - * @return {string} - * The tracks current label or the localized track kind. - */ - - - ChaptersButton.prototype.getMenuCaption = function getMenuCaption() { - if (this.track_ && this.track_.label) { - return this.track_.label; - } - return this.localize(toTitleCase(this.kind_)); - }; - - /** - * Create menu from chapter track - * - * @return {Menu} - * New menu for the chapter buttons - */ - - - ChaptersButton.prototype.createMenu = function createMenu() { - this.options_.title = this.getMenuCaption(); - return _TextTrackButton.prototype.createMenu.call(this); - }; - - /** - * Create a menu item for each text track - * - * @return {TextTrackMenuItem[]} - * Array of menu items - */ - - - ChaptersButton.prototype.createItems = function createItems() { - var items = []; - - if (!this.track_) { - return items; - } - - var cues = this.track_.cues; - - if (!cues) { - return items; - } - - for (var i = 0, l = cues.length; i < l; i++) { - var cue = cues[i]; - var mi = new ChaptersTrackMenuItem(this.player_, { track: this.track_, cue: cue }); - - items.push(mi); - } - - return items; - }; - - return ChaptersButton; -}(TextTrackButton); - -/** - * `kind` of TextTrack to look for to associate it with this menu. - * - * @type {string} - * @private - */ - - -ChaptersButton.prototype.kind_ = 'chapters'; - -/** - * The text that should display over the `ChaptersButton`s controls. Added for localization. - * - * @type {string} - * @private - */ -ChaptersButton.prototype.controlText_ = 'Chapters'; - -Component.registerComponent('ChaptersButton', ChaptersButton); - -/** - * @file descriptions-button.js - */ -/** - * The button component for toggling and selecting descriptions - * - * @extends TextTrackButton - */ - -var DescriptionsButton = function (_TextTrackButton) { - inherits(DescriptionsButton, _TextTrackButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} [ready] - * The function to call when this component is ready. - */ - function DescriptionsButton(player, options, ready) { - classCallCheck(this, DescriptionsButton); - - var _this = possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); - - var tracks = player.textTracks(); - var changeHandler = bind(_this, _this.handleTracksChange); - - tracks.addEventListener('change', changeHandler); - _this.on('dispose', function () { - tracks.removeEventListener('change', changeHandler); - }); - return _this; - } - - /** - * Handle text track change - * - * @param {EventTarget~Event} event - * The event that caused this function to run - * - * @listens TextTrackList#change - */ - - - DescriptionsButton.prototype.handleTracksChange = function handleTracksChange(event) { - var tracks = this.player().textTracks(); - var disabled = false; - - // Check whether a track of a different kind is showing - for (var i = 0, l = tracks.length; i < l; i++) { - var track = tracks[i]; - - if (track.kind !== this.kind_ && track.mode === 'showing') { - disabled = true; - break; - } - } - - // If another track is showing, disable this menu button - if (disabled) { - this.disable(); - } else { - this.enable(); - } - }; - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - DescriptionsButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-descriptions-button ' + _TextTrackButton.prototype.buildCSSClass.call(this); - }; - - DescriptionsButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-descriptions-button ' + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); - }; - - return DescriptionsButton; -}(TextTrackButton); - -/** - * `kind` of TextTrack to look for to associate it with this menu. - * - * @type {string} - * @private - */ - - -DescriptionsButton.prototype.kind_ = 'descriptions'; - -/** - * The text that should display over the `DescriptionsButton`s controls. Added for localization. - * - * @type {string} - * @private - */ -DescriptionsButton.prototype.controlText_ = 'Descriptions'; - -Component.registerComponent('DescriptionsButton', DescriptionsButton); - -/** - * @file subtitles-button.js - */ -/** - * The button component for toggling and selecting subtitles - * - * @extends TextTrackButton - */ - -var SubtitlesButton = function (_TextTrackButton) { - inherits(SubtitlesButton, _TextTrackButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} [ready] - * The function to call when this component is ready. - */ - function SubtitlesButton(player, options, ready) { - classCallCheck(this, SubtitlesButton); - return possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - SubtitlesButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-subtitles-button ' + _TextTrackButton.prototype.buildCSSClass.call(this); - }; - - SubtitlesButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-subtitles-button ' + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); - }; - - return SubtitlesButton; -}(TextTrackButton); - -/** - * `kind` of TextTrack to look for to associate it with this menu. - * - * @type {string} - * @private - */ - - -SubtitlesButton.prototype.kind_ = 'subtitles'; - -/** - * The text that should display over the `SubtitlesButton`s controls. Added for localization. - * - * @type {string} - * @private - */ -SubtitlesButton.prototype.controlText_ = 'Subtitles'; - -Component.registerComponent('SubtitlesButton', SubtitlesButton); - -/** - * @file caption-settings-menu-item.js - */ -/** - * The menu item for caption track settings menu - * - * @extends TextTrackMenuItem - */ - -var CaptionSettingsMenuItem = function (_TextTrackMenuItem) { - inherits(CaptionSettingsMenuItem, _TextTrackMenuItem); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function CaptionSettingsMenuItem(player, options) { - classCallCheck(this, CaptionSettingsMenuItem); - - options.track = { - player: player, - kind: options.kind, - label: options.kind + ' settings', - selectable: false, - 'default': false, - mode: 'disabled' - }; - - // CaptionSettingsMenuItem has no concept of 'selected' - options.selectable = false; - - options.name = 'CaptionSettingsMenuItem'; - - var _this = possibleConstructorReturn(this, _TextTrackMenuItem.call(this, player, options)); - - _this.addClass('vjs-texttrack-settings'); - _this.controlText(', opens ' + options.kind + ' settings dialog'); - return _this; - } - - /** - * This gets called when an `CaptionSettingsMenuItem` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - CaptionSettingsMenuItem.prototype.handleClick = function handleClick(event) { - this.player().getChild('textTrackSettings').open(); - }; - - return CaptionSettingsMenuItem; -}(TextTrackMenuItem); - -Component.registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem); - -/** - * @file captions-button.js - */ -/** - * The button component for toggling and selecting captions - * - * @extends TextTrackButton - */ - -var CaptionsButton = function (_TextTrackButton) { - inherits(CaptionsButton, _TextTrackButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} [ready] - * The function to call when this component is ready. - */ - function CaptionsButton(player, options, ready) { - classCallCheck(this, CaptionsButton); - return possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - CaptionsButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-captions-button ' + _TextTrackButton.prototype.buildCSSClass.call(this); - }; - - CaptionsButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-captions-button ' + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); - }; - - /** - * Create caption menu items - * - * @return {CaptionSettingsMenuItem[]} - * The array of current menu items. - */ - - - CaptionsButton.prototype.createItems = function createItems() { - var items = []; - - if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks)) { - items.push(new CaptionSettingsMenuItem(this.player_, { kind: this.kind_ })); - - this.hideThreshold_ += 1; - } - - return _TextTrackButton.prototype.createItems.call(this, items); - }; - - return CaptionsButton; -}(TextTrackButton); - -/** - * `kind` of TextTrack to look for to associate it with this menu. - * - * @type {string} - * @private - */ - - -CaptionsButton.prototype.kind_ = 'captions'; - -/** - * The text that should display over the `CaptionsButton`s controls. Added for localization. - * - * @type {string} - * @private - */ -CaptionsButton.prototype.controlText_ = 'Captions'; - -Component.registerComponent('CaptionsButton', CaptionsButton); - -/** - * @file subs-caps-menu-item.js - */ -/** - * SubsCapsMenuItem has an [cc] icon to distinguish captions from subtitles - * in the SubsCapsMenu. - * - * @extends TextTrackMenuItem - */ - -var SubsCapsMenuItem = function (_TextTrackMenuItem) { - inherits(SubsCapsMenuItem, _TextTrackMenuItem); - - function SubsCapsMenuItem() { - classCallCheck(this, SubsCapsMenuItem); - return possibleConstructorReturn(this, _TextTrackMenuItem.apply(this, arguments)); - } - - SubsCapsMenuItem.prototype.createEl = function createEl(type, props, attrs) { - var innerHTML = '<span class="vjs-menu-item-text">' + this.localize(this.options_.label); - - if (this.options_.track.kind === 'captions') { - innerHTML += '\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> ' + this.localize('Captions') + '</span>\n '; - } - - innerHTML += '</span>'; - - var el = _TextTrackMenuItem.prototype.createEl.call(this, type, assign({ - innerHTML: innerHTML - }, props), attrs); - - return el; - }; - - return SubsCapsMenuItem; -}(TextTrackMenuItem); - -Component.registerComponent('SubsCapsMenuItem', SubsCapsMenuItem); - -/** - * @file sub-caps-button.js - */ -/** - * The button component for toggling and selecting captions and/or subtitles - * - * @extends TextTrackButton - */ - -var SubsCapsButton = function (_TextTrackButton) { - inherits(SubsCapsButton, _TextTrackButton); - - function SubsCapsButton(player) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, SubsCapsButton); - - // Although North America uses "captions" in most cases for - // "captions and subtitles" other locales use "subtitles" - var _this = possibleConstructorReturn(this, _TextTrackButton.call(this, player, options)); - - _this.label_ = 'subtitles'; - if (['en', 'en-us', 'en-ca', 'fr-ca'].indexOf(_this.player_.language_) > -1) { - _this.label_ = 'captions'; - } - _this.menuButton_.controlText(toTitleCase(_this.label_)); - return _this; - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - SubsCapsButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-subs-caps-button ' + _TextTrackButton.prototype.buildCSSClass.call(this); - }; - - SubsCapsButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-subs-caps-button ' + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); - }; - - /** - * Create caption/subtitles menu items - * - * @return {CaptionSettingsMenuItem[]} - * The array of current menu items. - */ - - - SubsCapsButton.prototype.createItems = function createItems() { - var items = []; - - if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks)) { - items.push(new CaptionSettingsMenuItem(this.player_, { kind: this.label_ })); - - this.hideThreshold_ += 1; - } - - items = _TextTrackButton.prototype.createItems.call(this, items, SubsCapsMenuItem); - return items; - }; - - return SubsCapsButton; -}(TextTrackButton); - -/** - * `kind`s of TextTrack to look for to associate it with this menu. - * - * @type {array} - * @private - */ - - -SubsCapsButton.prototype.kinds_ = ['captions', 'subtitles']; - -/** - * The text that should display over the `SubsCapsButton`s controls. - * - * - * @type {string} - * @private - */ -SubsCapsButton.prototype.controlText_ = 'Subtitles'; - -Component.registerComponent('SubsCapsButton', SubsCapsButton); - -/** - * @file audio-track-menu-item.js - */ -/** - * An {@link AudioTrack} {@link MenuItem} - * - * @extends MenuItem - */ - -var AudioTrackMenuItem = function (_MenuItem) { - inherits(AudioTrackMenuItem, _MenuItem); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function AudioTrackMenuItem(player, options) { - classCallCheck(this, AudioTrackMenuItem); - - var track = options.track; - var tracks = player.audioTracks(); - - // Modify options for parent MenuItem class's init. - options.label = track.label || track.language || 'Unknown'; - options.selected = track.enabled; - - var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); - - _this.track = track; - - var changeHandler = bind(_this, _this.handleTracksChange); - - tracks.addEventListener('change', changeHandler); - _this.on('dispose', function () { - tracks.removeEventListener('change', changeHandler); - }); - return _this; - } - - /** - * This gets called when an `AudioTrackMenuItem is "clicked". See {@link ClickableComponent} - * for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - AudioTrackMenuItem.prototype.handleClick = function handleClick(event) { - var tracks = this.player_.audioTracks(); - - _MenuItem.prototype.handleClick.call(this, event); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - track.enabled = track === this.track; - } - }; - - /** - * Handle any {@link AudioTrack} change. - * - * @param {EventTarget~Event} [event] - * The {@link AudioTrackList#change} event that caused this to run. - * - * @listens AudioTrackList#change - */ - - - AudioTrackMenuItem.prototype.handleTracksChange = function handleTracksChange(event) { - this.selected(this.track.enabled); - }; - - return AudioTrackMenuItem; -}(MenuItem); - -Component.registerComponent('AudioTrackMenuItem', AudioTrackMenuItem); - -/** - * @file audio-track-button.js - */ -/** - * The base class for buttons that toggle specific {@link AudioTrack} types. - * - * @extends TrackButton - */ - -var AudioTrackButton = function (_TrackButton) { - inherits(AudioTrackButton, _TrackButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options={}] - * The key/value store of player options. - */ - function AudioTrackButton(player) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - classCallCheck(this, AudioTrackButton); - - options.tracks = player.audioTracks(); - - return possibleConstructorReturn(this, _TrackButton.call(this, player, options)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - AudioTrackButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-audio-button ' + _TrackButton.prototype.buildCSSClass.call(this); - }; - - AudioTrackButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-audio-button ' + _TrackButton.prototype.buildWrapperCSSClass.call(this); - }; - - /** - * Create a menu item for each audio track - * - * @param {AudioTrackMenuItem[]} [items=[]] - * An array of existing menu items to use. - * - * @return {AudioTrackMenuItem[]} - * An array of menu items - */ - - - AudioTrackButton.prototype.createItems = function createItems() { - var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - // if there's only one audio track, there no point in showing it - this.hideThreshold_ = 1; - - var tracks = this.player_.audioTracks(); - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - items.push(new AudioTrackMenuItem(this.player_, { - track: track, - // MenuItem is selectable - selectable: true - })); - } - - return items; - }; - - return AudioTrackButton; -}(TrackButton); - -/** - * The text that should display over the `AudioTrackButton`s controls. Added for localization. - * - * @type {string} - * @private - */ - - -AudioTrackButton.prototype.controlText_ = 'Audio Track'; -Component.registerComponent('AudioTrackButton', AudioTrackButton); - -/** - * @file playback-rate-menu-item.js - */ -/** - * The specific menu item type for selecting a playback rate. - * - * @extends MenuItem - */ - -var PlaybackRateMenuItem = function (_MenuItem) { - inherits(PlaybackRateMenuItem, _MenuItem); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function PlaybackRateMenuItem(player, options) { - classCallCheck(this, PlaybackRateMenuItem); - - var label = options.rate; - var rate = parseFloat(label, 10); - - // Modify options for parent MenuItem class's init. - options.label = label; - options.selected = rate === 1; - options.selectable = true; - - var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); - - _this.label = label; - _this.rate = rate; - - _this.on(player, 'ratechange', _this.update); - return _this; - } - - /** - * This gets called when an `PlaybackRateMenuItem` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - PlaybackRateMenuItem.prototype.handleClick = function handleClick(event) { - _MenuItem.prototype.handleClick.call(this); - this.player().playbackRate(this.rate); - }; - - /** - * Update the PlaybackRateMenuItem when the playbackrate changes. - * - * @param {EventTarget~Event} [event] - * The `ratechange` event that caused this function to run. - * - * @listens Player#ratechange - */ - - - PlaybackRateMenuItem.prototype.update = function update(event) { - this.selected(this.player().playbackRate() === this.rate); - }; - - return PlaybackRateMenuItem; -}(MenuItem); - -/** - * The text that should display over the `PlaybackRateMenuItem`s controls. Added for localization. - * - * @type {string} - * @private - */ - - -PlaybackRateMenuItem.prototype.contentElType = 'button'; - -Component.registerComponent('PlaybackRateMenuItem', PlaybackRateMenuItem); - -/** - * @file playback-rate-menu-button.js - */ -/** - * The component for controlling the playback rate. - * - * @extends MenuButton - */ - -var PlaybackRateMenuButton = function (_MenuButton) { - inherits(PlaybackRateMenuButton, _MenuButton); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function PlaybackRateMenuButton(player, options) { - classCallCheck(this, PlaybackRateMenuButton); - - var _this = possibleConstructorReturn(this, _MenuButton.call(this, player, options)); - - _this.updateVisibility(); - _this.updateLabel(); - - _this.on(player, 'loadstart', _this.updateVisibility); - _this.on(player, 'ratechange', _this.updateLabel); - return _this; - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - PlaybackRateMenuButton.prototype.createEl = function createEl$$1() { - var el = _MenuButton.prototype.createEl.call(this); - - this.labelEl_ = createEl('div', { - className: 'vjs-playback-rate-value', - innerHTML: 1.0 - }); - - el.appendChild(this.labelEl_); - - return el; - }; - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - - - PlaybackRateMenuButton.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-playback-rate ' + _MenuButton.prototype.buildCSSClass.call(this); - }; - - PlaybackRateMenuButton.prototype.buildWrapperCSSClass = function buildWrapperCSSClass() { - return 'vjs-playback-rate ' + _MenuButton.prototype.buildWrapperCSSClass.call(this); - }; - - /** - * Create the playback rate menu - * - * @return {Menu} - * Menu object populated with {@link PlaybackRateMenuItem}s - */ - - - PlaybackRateMenuButton.prototype.createMenu = function createMenu() { - var menu = new Menu(this.player()); - var rates = this.playbackRates(); - - if (rates) { - for (var i = rates.length - 1; i >= 0; i--) { - menu.addChild(new PlaybackRateMenuItem(this.player(), { rate: rates[i] + 'x' })); - } - } - - return menu; - }; - - /** - * Updates ARIA accessibility attributes - */ - - - PlaybackRateMenuButton.prototype.updateARIAAttributes = function updateARIAAttributes() { - // Current playback rate - this.el().setAttribute('aria-valuenow', this.player().playbackRate()); - }; - - /** - * This gets called when an `PlaybackRateMenuButton` is "clicked". See - * {@link ClickableComponent} for more detailed information on what a click can be. - * - * @param {EventTarget~Event} [event] - * The `keydown`, `tap`, or `click` event that caused this function to be - * called. - * - * @listens tap - * @listens click - */ - - - PlaybackRateMenuButton.prototype.handleClick = function handleClick(event) { - // select next rate option - var currentRate = this.player().playbackRate(); - var rates = this.playbackRates(); - - // this will select first one if the last one currently selected - var newRate = rates[0]; - - for (var i = 0; i < rates.length; i++) { - if (rates[i] > currentRate) { - newRate = rates[i]; - break; - } - } - this.player().playbackRate(newRate); - }; - - /** - * Get possible playback rates - * - * @return {Array} - * All possible playback rates - */ - - - PlaybackRateMenuButton.prototype.playbackRates = function playbackRates() { - return this.options_.playbackRates || this.options_.playerOptions && this.options_.playerOptions.playbackRates; - }; - - /** - * Get whether playback rates is supported by the tech - * and an array of playback rates exists - * - * @return {boolean} - * Whether changing playback rate is supported - */ - - - PlaybackRateMenuButton.prototype.playbackRateSupported = function playbackRateSupported() { - return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0; - }; - - /** - * Hide playback rate controls when they're no playback rate options to select - * - * @param {EventTarget~Event} [event] - * The event that caused this function to run. - * - * @listens Player#loadstart - */ - - - PlaybackRateMenuButton.prototype.updateVisibility = function updateVisibility(event) { - if (this.playbackRateSupported()) { - this.removeClass('vjs-hidden'); - } else { - this.addClass('vjs-hidden'); - } - }; - - /** - * Update button label when rate changed - * - * @param {EventTarget~Event} [event] - * The event that caused this function to run. - * - * @listens Player#ratechange - */ - - - PlaybackRateMenuButton.prototype.updateLabel = function updateLabel(event) { - if (this.playbackRateSupported()) { - this.labelEl_.innerHTML = this.player().playbackRate() + 'x'; - } - }; - - return PlaybackRateMenuButton; -}(MenuButton); - -/** - * The text that should display over the `FullscreenToggle`s controls. Added for localization. - * - * @type {string} - * @private - */ - - -PlaybackRateMenuButton.prototype.controlText_ = 'Playback Rate'; - -Component.registerComponent('PlaybackRateMenuButton', PlaybackRateMenuButton); - -/** - * @file spacer.js - */ -/** - * Just an empty spacer element that can be used as an append point for plugins, etc. - * Also can be used to create space between elements when necessary. - * - * @extends Component - */ - -var Spacer = function (_Component) { - inherits(Spacer, _Component); - - function Spacer() { - classCallCheck(this, Spacer); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - Spacer.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-spacer ' + _Component.prototype.buildCSSClass.call(this); - }; - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - Spacer.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: this.buildCSSClass() - }); - }; - - return Spacer; -}(Component); - -Component.registerComponent('Spacer', Spacer); - -/** - * @file custom-control-spacer.js - */ -/** - * Spacer specifically meant to be used as an insertion point for new plugins, etc. - * - * @extends Spacer - */ - -var CustomControlSpacer = function (_Spacer) { - inherits(CustomControlSpacer, _Spacer); - - function CustomControlSpacer() { - classCallCheck(this, CustomControlSpacer); - return possibleConstructorReturn(this, _Spacer.apply(this, arguments)); - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - */ - CustomControlSpacer.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-custom-control-spacer ' + _Spacer.prototype.buildCSSClass.call(this); - }; - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - - - CustomControlSpacer.prototype.createEl = function createEl() { - var el = _Spacer.prototype.createEl.call(this, { - className: this.buildCSSClass() - }); - - // No-flex/table-cell mode requires there be some content - // in the cell to fill the remaining space of the table. - el.innerHTML = ' '; - return el; - }; - - return CustomControlSpacer; -}(Spacer); - -Component.registerComponent('CustomControlSpacer', CustomControlSpacer); - -/** - * @file control-bar.js - */ -// Required children -/** - * Container of main controls. - * - * @extends Component - */ - -var ControlBar = function (_Component) { - inherits(ControlBar, _Component); - - function ControlBar() { - classCallCheck(this, ControlBar); - return possibleConstructorReturn(this, _Component.apply(this, arguments)); - } - - /** - * Create the `Component`'s DOM element - * - * @return {Element} - * The element that was created. - */ - ControlBar.prototype.createEl = function createEl() { - return _Component.prototype.createEl.call(this, 'div', { - className: 'vjs-control-bar', - dir: 'ltr' - }, { - // The control bar is a group, but we don't aria-label it to avoid - // over-announcing by JAWS - role: 'group' - }); - }; - - return ControlBar; -}(Component); - -/** - * Default options for `ControlBar` - * - * @type {Object} - * @private - */ - - -ControlBar.prototype.options_ = { - children: ['playToggle', 'volumePanel', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'descriptionsButton', 'subsCapsButton', 'audioTrackButton', 'fullscreenToggle'] -}; - -Component.registerComponent('ControlBar', ControlBar); - -/** - * @file error-display.js - */ -/** - * A display that indicates an error has occurred. This means that the video - * is unplayable. - * - * @extends ModalDialog - */ - -var ErrorDisplay = function (_ModalDialog) { - inherits(ErrorDisplay, _ModalDialog); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function ErrorDisplay(player, options) { - classCallCheck(this, ErrorDisplay); - - var _this = possibleConstructorReturn(this, _ModalDialog.call(this, player, options)); - - _this.on(player, 'error', _this.open); - return _this; - } - - /** - * Builds the default DOM `className`. - * - * @return {string} - * The DOM `className` for this object. - * - * @deprecated Since version 5. - */ - - - ErrorDisplay.prototype.buildCSSClass = function buildCSSClass() { - return 'vjs-error-display ' + _ModalDialog.prototype.buildCSSClass.call(this); - }; - - /** - * Gets the localized error message based on the `Player`s error. - * - * @return {string} - * The `Player`s error message localized or an empty string. - */ - - - ErrorDisplay.prototype.content = function content() { - var error = this.player().error(); - - return error ? this.localize(error.message) : ''; - }; - - return ErrorDisplay; -}(ModalDialog); - -/** - * The default options for an `ErrorDisplay`. - * - * @private - */ - - -ErrorDisplay.prototype.options_ = mergeOptions(ModalDialog.prototype.options_, { - pauseOnOpen: false, - fillAlways: true, - temporary: false, - uncloseable: true -}); - -Component.registerComponent('ErrorDisplay', ErrorDisplay); - -/** - * @file text-track-settings.js - */ -var LOCAL_STORAGE_KEY = 'vjs-text-track-settings'; - -var COLOR_BLACK = ['#000', 'Black']; -var COLOR_BLUE = ['#00F', 'Blue']; -var COLOR_CYAN = ['#0FF', 'Cyan']; -var COLOR_GREEN = ['#0F0', 'Green']; -var COLOR_MAGENTA = ['#F0F', 'Magenta']; -var COLOR_RED = ['#F00', 'Red']; -var COLOR_WHITE = ['#FFF', 'White']; -var COLOR_YELLOW = ['#FF0', 'Yellow']; - -var OPACITY_OPAQUE = ['1', 'Opaque']; -var OPACITY_SEMI = ['0.5', 'Semi-Transparent']; -var OPACITY_TRANS = ['0', 'Transparent']; - -// Configuration for the various <select> elements in the DOM of this component. -// -// Possible keys include: -// -// `default`: -// The default option index. Only needs to be provided if not zero. -// `parser`: -// A function which is used to parse the value from the selected option in -// a customized way. -// `selector`: -// The selector used to find the associated <select> element. -var selectConfigs = { - backgroundColor: { - selector: '.vjs-bg-color > select', - id: 'captions-background-color-%s', - label: 'Color', - options: [COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN] - }, - - backgroundOpacity: { - selector: '.vjs-bg-opacity > select', - id: 'captions-background-opacity-%s', - label: 'Transparency', - options: [OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS] - }, - - color: { - selector: '.vjs-fg-color > select', - id: 'captions-foreground-color-%s', - label: 'Color', - options: [COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN] - }, - - edgeStyle: { - selector: '.vjs-edge-style > select', - id: '%s', - label: 'Text Edge Style', - options: [['none', 'None'], ['raised', 'Raised'], ['depressed', 'Depressed'], ['uniform', 'Uniform'], ['dropshadow', 'Dropshadow']] - }, - - fontFamily: { - selector: '.vjs-font-family > select', - id: 'captions-font-family-%s', - label: 'Font Family', - options: [['proportionalSansSerif', 'Proportional Sans-Serif'], ['monospaceSansSerif', 'Monospace Sans-Serif'], ['proportionalSerif', 'Proportional Serif'], ['monospaceSerif', 'Monospace Serif'], ['casual', 'Casual'], ['script', 'Script'], ['small-caps', 'Small Caps']] - }, - - fontPercent: { - selector: '.vjs-font-percent > select', - id: 'captions-font-size-%s', - label: 'Font Size', - options: [['0.50', '50%'], ['0.75', '75%'], ['1.00', '100%'], ['1.25', '125%'], ['1.50', '150%'], ['1.75', '175%'], ['2.00', '200%'], ['3.00', '300%'], ['4.00', '400%']], - 'default': 2, - parser: function parser(v) { - return v === '1.00' ? null : Number(v); - } - }, - - textOpacity: { - selector: '.vjs-text-opacity > select', - id: 'captions-foreground-opacity-%s', - label: 'Transparency', - options: [OPACITY_OPAQUE, OPACITY_SEMI] - }, - - // Options for this object are defined below. - windowColor: { - selector: '.vjs-window-color > select', - id: 'captions-window-color-%s', - label: 'Color' - }, - - // Options for this object are defined below. - windowOpacity: { - selector: '.vjs-window-opacity > select', - id: 'captions-window-opacity-%s', - label: 'Transparency', - options: [OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE] - } -}; - -selectConfigs.windowColor.options = selectConfigs.backgroundColor.options; - -/** - * Get the actual value of an option. - * - * @param {string} value - * The value to get - * - * @param {Function} [parser] - * Optional function to adjust the value. - * - * @return {Mixed} - * - Will be `undefined` if no value exists - * - Will be `undefined` if the given value is "none". - * - Will be the actual value otherwise. - * - * @private - */ -function parseOptionValue(value, parser) { - if (parser) { - value = parser(value); - } - - if (value && value !== 'none') { - return value; - } -} - -/** - * Gets the value of the selected <option> element within a <select> element. - * - * @param {Element} el - * the element to look in - * - * @param {Function} [parser] - * Optional function to adjust the value. - * - * @return {Mixed} - * - Will be `undefined` if no value exists - * - Will be `undefined` if the given value is "none". - * - Will be the actual value otherwise. - * - * @private - */ -function getSelectedOptionValue(el, parser) { - var value = el.options[el.options.selectedIndex].value; - - return parseOptionValue(value, parser); -} - -/** - * Sets the selected <option> element within a <select> element based on a - * given value. - * - * @param {Element} el - * The element to look in. - * - * @param {string} value - * the property to look on. - * - * @param {Function} [parser] - * Optional function to adjust the value before comparing. - * - * @private - */ -function setSelectedOption(el, value, parser) { - if (!value) { - return; - } - - for (var i = 0; i < el.options.length; i++) { - if (parseOptionValue(el.options[i].value, parser) === value) { - el.selectedIndex = i; - break; - } - } -} - -/** - * Manipulate Text Tracks settings. - * - * @extends ModalDialog - */ - -var TextTrackSettings = function (_ModalDialog) { - inherits(TextTrackSettings, _ModalDialog); - - /** - * Creates an instance of this class. - * - * @param {Player} player - * The `Player` that this class should be attached to. - * - * @param {Object} [options] - * The key/value store of player options. - */ - function TextTrackSettings(player, options) { - classCallCheck(this, TextTrackSettings); - - options.temporary = false; - - var _this = possibleConstructorReturn(this, _ModalDialog.call(this, player, options)); - - _this.updateDisplay = bind(_this, _this.updateDisplay); - - // fill the modal and pretend we have opened it - _this.fill(); - _this.hasBeenOpened_ = _this.hasBeenFilled_ = true; - - _this.endDialog = createEl('p', { - className: 'vjs-control-text', - textContent: _this.localize('End of dialog window.') - }); - _this.el().appendChild(_this.endDialog); - - _this.setDefaults(); - - // Grab `persistTextTrackSettings` from the player options if not passed in child options - if (options.persistTextTrackSettings === undefined) { - _this.options_.persistTextTrackSettings = _this.options_.playerOptions.persistTextTrackSettings; - } - - _this.on(_this.$('.vjs-done-button'), 'click', function () { - _this.saveSettings(); - _this.close(); - }); - - _this.on(_this.$('.vjs-default-button'), 'click', function () { - _this.setDefaults(); - _this.updateDisplay(); - }); - - each(selectConfigs, function (config) { - _this.on(_this.$(config.selector), 'change', _this.updateDisplay); - }); - - if (_this.options_.persistTextTrackSettings) { - _this.restoreSettings(); - } - return _this; - } - - /** - * Create a <select> element with configured options. - * - * @param {string} key - * Configuration key to use during creation. - * - * @return {Element} - * The DOM element that gets created. - * @private - */ - - - TextTrackSettings.prototype.createElSelect_ = function createElSelect_(key) { - var _this2 = this; - - var legendId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label'; - - var config = selectConfigs[key]; - var id = config.id.replace('%s', this.id_); - - return [createEl(type, { - id: id, - className: type === 'label' ? 'vjs-label' : '', - textContent: this.localize(config.label) - }, {}), createEl('select', {}, { - 'aria-labelledby': legendId + ' ' + id - }, config.options.map(function (o) { - var optionId = id + '-' + o[1]; - - return createEl('option', { - id: optionId, - textContent: _this2.localize(o[1]), - value: o[0] - }, { - 'aria-labelledby': legendId + ' ' + id + ' ' + optionId - }); - }))]; - }; - - /** - * Create foreground color element for the component - * - * @return {Element} - * The element that was created. - * - * @private - */ - - - TextTrackSettings.prototype.createElFgColor_ = function createElFgColor_() { - var legend = createEl('legend', { - id: 'captions-text-legend-' + this.id_, - textContent: this.localize('Text') - }); - - var select = this.createElSelect_('color', legend.id); - - var opacity = createEl('span', { - className: 'vjs-text-opacity vjs-opacity' - }, undefined, this.createElSelect_('textOpacity', legend.id)); - - return createEl('fieldset', { - className: 'vjs-fg-color vjs-track-setting' - }, undefined, [legend].concat(select, opacity)); - }; - - /** - * Create background color element for the component - * - * @return {Element} - * The element that was created - * - * @private - */ - - - TextTrackSettings.prototype.createElBgColor_ = function createElBgColor_() { - var legend = createEl('legend', { - id: 'captions-background-' + this.id_, - textContent: this.localize('Background') - }); - - var select = this.createElSelect_('backgroundColor', legend.id); - - var opacity = createEl('span', { - className: 'vjs-bg-opacity vjs-opacity' - }, undefined, this.createElSelect_('backgroundOpacity', legend.id)); - - return createEl('fieldset', { - className: 'vjs-bg-color vjs-track-setting' - }, undefined, [legend].concat(select, opacity)); - }; - - /** - * Create window color element for the component - * - * @return {Element} - * The element that was created - * - * @private - */ - - - TextTrackSettings.prototype.createElWinColor_ = function createElWinColor_() { - var legend = createEl('legend', { - id: 'captions-window-' + this.id_, - textContent: this.localize('Window') - }); - - var select = this.createElSelect_('windowColor', legend.id); - - var opacity = createEl('span', { - className: 'vjs-window-opacity vjs-opacity' - }, undefined, this.createElSelect_('windowOpacity', legend.id)); - - return createEl('fieldset', { - className: 'vjs-window-color vjs-track-setting' - }, undefined, [legend].concat(select, opacity)); - }; - - /** - * Create color elements for the component - * - * @return {Element} - * The element that was created - * - * @private - */ - - - TextTrackSettings.prototype.createElColors_ = function createElColors_() { - return createEl('div', { - className: 'vjs-track-settings-colors' - }, undefined, [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()]); - }; - - /** - * Create font elements for the component - * - * @return {Element} - * The element that was created. - * - * @private - */ - - - TextTrackSettings.prototype.createElFont_ = function createElFont_() { - var fontPercent = createEl('fieldset', { - className: 'vjs-font-percent vjs-track-setting' - }, undefined, this.createElSelect_('fontPercent', '', 'legend')); - - var edgeStyle = createEl('fieldset', { - className: 'vjs-edge-style vjs-track-setting' - }, undefined, this.createElSelect_('edgeStyle', '', 'legend')); - - var fontFamily = createEl('fieldset', { - className: 'vjs-font-family vjs-track-setting' - }, undefined, this.createElSelect_('fontFamily', '', 'legend')); - - return createEl('div', { - className: 'vjs-track-settings-font' - }, undefined, [fontPercent, edgeStyle, fontFamily]); - }; - - /** - * Create controls for the component - * - * @return {Element} - * The element that was created. - * - * @private - */ - - - TextTrackSettings.prototype.createElControls_ = function createElControls_() { - var defaultsDescription = this.localize('restore all settings to the default values'); - var defaultsButton = createEl('button', { - className: 'vjs-default-button', - title: defaultsDescription, - innerHTML: this.localize('Reset') + '<span class=\'vjs-control-text\'> ' + defaultsDescription + '</span>' - }); - - var doneButton = createEl('button', { - className: 'vjs-done-button', - textContent: this.localize('Done') - }); - - return createEl('div', { - className: 'vjs-track-settings-controls' - }, undefined, [defaultsButton, doneButton]); - }; - - /** - * Create the component's DOM element - * - * @return {Element} - * The element that was created. - */ - - - TextTrackSettings.prototype.createEl = function createEl$$1() { - return _ModalDialog.prototype.createEl.call(this); - }; - - TextTrackSettings.prototype.content = function content() { - return [this.createElColors_(), this.createElFont_(), this.createElControls_()]; - }; - - TextTrackSettings.prototype.label = function label() { - return this.localize('Caption Settings Dialog'); - }; - - TextTrackSettings.prototype.description = function description() { - return this.localize('Beginning of dialog window. Escape will cancel and close the window.'); - }; - - TextTrackSettings.prototype.buildCSSClass = function buildCSSClass() { - return _ModalDialog.prototype.buildCSSClass.call(this) + ' vjs-text-track-settings'; - }; - - /** - * Gets an object of text track settings (or null). - * - * @return {Object} - * An object with config values parsed from the DOM or localStorage. - */ - - - TextTrackSettings.prototype.getValues = function getValues() { - var _this3 = this; - - return reduce(selectConfigs, function (accum, config, key) { - var value = getSelectedOptionValue(_this3.$(config.selector), config.parser); - - if (value !== undefined) { - accum[key] = value; - } - - return accum; - }, {}); - }; - - /** - * Sets text track settings from an object of values. - * - * @param {Object} values - * An object with config values parsed from the DOM or localStorage. - */ - - - TextTrackSettings.prototype.setValues = function setValues(values) { - var _this4 = this; - - each(selectConfigs, function (config, key) { - setSelectedOption(_this4.$(config.selector), values[key], config.parser); - }); - }; - - /** - * Sets all `<select>` elements to their default values. - */ - - - TextTrackSettings.prototype.setDefaults = function setDefaults() { - var _this5 = this; - - each(selectConfigs, function (config) { - var index = config.hasOwnProperty('default') ? config['default'] : 0; - - _this5.$(config.selector).selectedIndex = index; - }); - }; - - /** - * Restore texttrack settings from localStorage - */ - - - TextTrackSettings.prototype.restoreSettings = function restoreSettings() { - var values = void 0; - - try { - values = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY)); - } catch (err) { - log$1.warn(err); - } - - if (values) { - this.setValues(values); - } - }; - - /** - * Save text track settings to localStorage - */ - - - TextTrackSettings.prototype.saveSettings = function saveSettings() { - if (!this.options_.persistTextTrackSettings) { - return; - } - - var values = this.getValues(); - - try { - if (Object.keys(values).length) { - window_1.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(values)); - } else { - window_1.localStorage.removeItem(LOCAL_STORAGE_KEY); - } - } catch (err) { - log$1.warn(err); - } - }; - - /** - * Update display of text track settings - */ - - - TextTrackSettings.prototype.updateDisplay = function updateDisplay() { - var ttDisplay = this.player_.getChild('textTrackDisplay'); - - if (ttDisplay) { - ttDisplay.updateDisplay(); - } - }; - - /** - * conditionally blur the element and refocus the captions button - * - * @private - */ - - - TextTrackSettings.prototype.conditionalBlur_ = function conditionalBlur_() { - this.previouslyActiveEl_ = null; - this.off(document_1, 'keydown', this.handleKeyDown); - - var cb = this.player_.controlBar; - var subsCapsBtn = cb && cb.subsCapsButton; - var ccBtn = cb && cb.captionsButton; - - if (subsCapsBtn) { - subsCapsBtn.focus(); - } else if (ccBtn) { - ccBtn.focus(); - } - }; - - return TextTrackSettings; -}(ModalDialog); - -Component.registerComponent('TextTrackSettings', TextTrackSettings); - -var _templateObject$2 = taggedTemplateLiteralLoose(['Text Tracks are being loaded from another origin but the crossorigin attribute isn\'t used.\n This may prevent text tracks from loading.'], ['Text Tracks are being loaded from another origin but the crossorigin attribute isn\'t used.\n This may prevent text tracks from loading.']); - -/** - * @file html5.js - */ -/** - * HTML5 Media Controller - Wrapper for HTML5 Media API - * - * @mixes Tech~SouceHandlerAdditions - * @extends Tech - */ - -var Html5 = function (_Tech) { - inherits(Html5, _Tech); - - /** - * Create an instance of this Tech. - * - * @param {Object} [options] - * The key/value store of player options. - * - * @param {Component~ReadyCallback} ready - * Callback function to call when the `HTML5` Tech is ready. - */ - function Html5(options, ready) { - classCallCheck(this, Html5); - - var _this = possibleConstructorReturn(this, _Tech.call(this, options, ready)); - - var source = options.source; - var crossoriginTracks = false; - - // Set the source if one is provided - // 1) Check if the source is new (if not, we want to keep the original so playback isn't interrupted) - // 2) Check to see if the network state of the tag was failed at init, and if so, reset the source - // anyway so the error gets fired. - if (source && (_this.el_.currentSrc !== source.src || options.tag && options.tag.initNetworkState_ === 3)) { - _this.setSource(source); - } else { - _this.handleLateInit_(_this.el_); - } - - if (_this.el_.hasChildNodes()) { - - var nodes = _this.el_.childNodes; - var nodesLength = nodes.length; - var removeNodes = []; - - while (nodesLength--) { - var node = nodes[nodesLength]; - var nodeName = node.nodeName.toLowerCase(); - - if (nodeName === 'track') { - if (!_this.featuresNativeTextTracks) { - // Empty video tag tracks so the built-in player doesn't use them also. - // This may not be fast enough to stop HTML5 browsers from reading the tags - // so we'll need to turn off any default tracks if we're manually doing - // captions and subtitles. videoElement.textTracks - removeNodes.push(node); - } else { - // store HTMLTrackElement and TextTrack to remote list - _this.remoteTextTrackEls().addTrackElement_(node); - _this.remoteTextTracks().addTrack(node.track); - _this.textTracks().addTrack(node.track); - if (!crossoriginTracks && !_this.el_.hasAttribute('crossorigin') && isCrossOrigin(node.src)) { - crossoriginTracks = true; - } - } - } - } - - for (var i = 0; i < removeNodes.length; i++) { - _this.el_.removeChild(removeNodes[i]); - } - } - - _this.proxyNativeTracks_(); - if (_this.featuresNativeTextTracks && crossoriginTracks) { - log$1.warn(tsml(_templateObject$2)); - } - - // Determine if native controls should be used - // Our goal should be to get the custom controls on mobile solid everywhere - // so we can remove this all together. Right now this will block custom - // controls on touch enabled laptops like the Chrome Pixel - if ((TOUCH_ENABLED || IS_IPHONE || IS_NATIVE_ANDROID) && options.nativeControlsForTouch === true) { - _this.setControls(true); - } - - // on iOS, we want to proxy `webkitbeginfullscreen` and `webkitendfullscreen` - // into a `fullscreenchange` event - _this.proxyWebkitFullscreen_(); - - _this.triggerReady(); - return _this; - } - - /** - * Dispose of `HTML5` media element and remove all tracks. - */ - - - Html5.prototype.dispose = function dispose() { - Html5.disposeMediaElement(this.el_); - // tech will handle clearing of the emulated track list - _Tech.prototype.dispose.call(this); - }; - - /** - * Proxy all native track list events to our track lists if the browser we are playing - * in supports that type of track list. - * - * @private - */ - - - Html5.prototype.proxyNativeTracks_ = function proxyNativeTracks_() { - var _this2 = this; - - NORMAL.names.forEach(function (name) { - var props = NORMAL[name]; - var elTracks = _this2.el()[props.getterName]; - var techTracks = _this2[props.getterName](); - - if (!_this2['featuresNative' + props.capitalName + 'Tracks'] || !elTracks || !elTracks.addEventListener) { - return; - } - var listeners = { - change: function change(e) { - techTracks.trigger({ - type: 'change', - target: techTracks, - currentTarget: techTracks, - srcElement: techTracks - }); - }, - addtrack: function addtrack(e) { - techTracks.addTrack(e.track); - }, - removetrack: function removetrack(e) { - techTracks.removeTrack(e.track); - } - }; - var removeOldTracks = function removeOldTracks() { - var removeTracks = []; - - for (var i = 0; i < techTracks.length; i++) { - var found = false; - - for (var j = 0; j < elTracks.length; j++) { - if (elTracks[j] === techTracks[i]) { - found = true; - break; - } - } - - if (!found) { - removeTracks.push(techTracks[i]); - } - } - - while (removeTracks.length) { - techTracks.removeTrack(removeTracks.shift()); - } - }; - - Object.keys(listeners).forEach(function (eventName) { - var listener = listeners[eventName]; - - elTracks.addEventListener(eventName, listener); - _this2.on('dispose', function (e) { - return elTracks.removeEventListener(eventName, listener); - }); - }); - - // Remove (native) tracks that are not used anymore - _this2.on('loadstart', removeOldTracks); - _this2.on('dispose', function (e) { - return _this2.off('loadstart', removeOldTracks); - }); - }); - }; - - /** - * Create the `Html5` Tech's DOM element. - * - * @return {Element} - * The element that gets created. - */ - - - Html5.prototype.createEl = function createEl$$1() { - var el = this.options_.tag; - - // Check if this browser supports moving the element into the box. - // On the iPhone video will break if you move the element, - // So we have to create a brand new element. - // If we ingested the player div, we do not need to move the media element. - if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) { - - // If the original tag is still there, clone and remove it. - if (el) { - var clone = el.cloneNode(true); - - if (el.parentNode) { - el.parentNode.insertBefore(clone, el); - } - Html5.disposeMediaElement(el); - el = clone; - } else { - el = document_1.createElement('video'); - - // determine if native controls should be used - var tagAttributes = this.options_.tag && getAttributes(this.options_.tag); - var attributes = mergeOptions({}, tagAttributes); - - if (!TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) { - delete attributes.controls; - } - - setAttributes(el, assign(attributes, { - id: this.options_.techId, - 'class': 'vjs-tech' - })); - } - - el.playerId = this.options_.playerId; - } - - // Update specific tag settings, in case they were overridden - var settingsAttrs = ['autoplay', 'preload', 'loop', 'muted', 'playsinline']; - - for (var i = settingsAttrs.length - 1; i >= 0; i--) { - var attr = settingsAttrs[i]; - var overwriteAttrs = {}; - - if (typeof this.options_[attr] !== 'undefined') { - overwriteAttrs[attr] = this.options_[attr]; - } - setAttributes(el, overwriteAttrs); - } - - return el; - }; - - /** - * This will be triggered if the loadstart event has already fired, before videojs was - * ready. Two known examples of when this can happen are: - * 1. If we're loading the playback object after it has started loading - * 2. The media is already playing the (often with autoplay on) then - * - * This function will fire another loadstart so that videojs can catchup. - * - * @fires Tech#loadstart - * - * @return {undefined} - * returns nothing. - */ - - - Html5.prototype.handleLateInit_ = function handleLateInit_(el) { - if (el.networkState === 0 || el.networkState === 3) { - // The video element hasn't started loading the source yet - // or didn't find a source - return; - } - - if (el.readyState === 0) { - // NetworkState is set synchronously BUT loadstart is fired at the - // end of the current stack, usually before setInterval(fn, 0). - // So at this point we know loadstart may have already fired or is - // about to fire, and either way the player hasn't seen it yet. - // We don't want to fire loadstart prematurely here and cause a - // double loadstart so we'll wait and see if it happens between now - // and the next loop, and fire it if not. - // HOWEVER, we also want to make sure it fires before loadedmetadata - // which could also happen between now and the next loop, so we'll - // watch for that also. - var loadstartFired = false; - var setLoadstartFired = function setLoadstartFired() { - loadstartFired = true; - }; - - this.on('loadstart', setLoadstartFired); - - var triggerLoadstart = function triggerLoadstart() { - // We did miss the original loadstart. Make sure the player - // sees loadstart before loadedmetadata - if (!loadstartFired) { - this.trigger('loadstart'); - } - }; - - this.on('loadedmetadata', triggerLoadstart); - - this.ready(function () { - this.off('loadstart', setLoadstartFired); - this.off('loadedmetadata', triggerLoadstart); - - if (!loadstartFired) { - // We did miss the original native loadstart. Fire it now. - this.trigger('loadstart'); - } - }); - - return; - } - - // From here on we know that loadstart already fired and we missed it. - // The other readyState events aren't as much of a problem if we double - // them, so not going to go to as much trouble as loadstart to prevent - // that unless we find reason to. - var eventsToTrigger = ['loadstart']; - - // loadedmetadata: newly equal to HAVE_METADATA (1) or greater - eventsToTrigger.push('loadedmetadata'); - - // loadeddata: newly increased to HAVE_CURRENT_DATA (2) or greater - if (el.readyState >= 2) { - eventsToTrigger.push('loadeddata'); - } - - // canplay: newly increased to HAVE_FUTURE_DATA (3) or greater - if (el.readyState >= 3) { - eventsToTrigger.push('canplay'); - } - - // canplaythrough: newly equal to HAVE_ENOUGH_DATA (4) - if (el.readyState >= 4) { - eventsToTrigger.push('canplaythrough'); - } - - // We still need to give the player time to add event listeners - this.ready(function () { - eventsToTrigger.forEach(function (type) { - this.trigger(type); - }, this); - }); - }; - - /** - * Set current time for the `HTML5` tech. - * - * @param {number} seconds - * Set the current time of the media to this. - */ - - - Html5.prototype.setCurrentTime = function setCurrentTime(seconds) { - try { - this.el_.currentTime = seconds; - } catch (e) { - log$1(e, 'Video is not ready. (Video.js)'); - // this.warning(VideoJS.warnings.videoNotReady); - } - }; - - /** - * Get the current duration of the HTML5 media element. - * - * @return {number} - * The duration of the media or 0 if there is no duration. - */ - - - Html5.prototype.duration = function duration() { - var _this3 = this; - - // Android Chrome will report duration as Infinity for VOD HLS until after - // playback has started, which triggers the live display erroneously. - // Return NaN if playback has not started and trigger a durationupdate once - // the duration can be reliably known. - if (this.el_.duration === Infinity && IS_ANDROID && IS_CHROME) { - if (this.el_.currentTime === 0) { - // Wait for the first `timeupdate` with currentTime > 0 - there may be - // several with 0 - var checkProgress = function checkProgress() { - if (_this3.el_.currentTime > 0) { - // Trigger durationchange for genuinely live video - if (_this3.el_.duration === Infinity) { - _this3.trigger('durationchange'); - } - _this3.off('timeupdate', checkProgress); - } - }; - - this.on('timeupdate', checkProgress); - return NaN; - } - } - return this.el_.duration || NaN; - }; - - /** - * Get the current width of the HTML5 media element. - * - * @return {number} - * The width of the HTML5 media element. - */ - - - Html5.prototype.width = function width() { - return this.el_.offsetWidth; - }; - - /** - * Get the current height of the HTML5 media element. - * - * @return {number} - * The heigth of the HTML5 media element. - */ - - - Html5.prototype.height = function height() { - return this.el_.offsetHeight; - }; - - /** - * Proxy iOS `webkitbeginfullscreen` and `webkitendfullscreen` into - * `fullscreenchange` event. - * - * @private - * @fires fullscreenchange - * @listens webkitendfullscreen - * @listens webkitbeginfullscreen - * @listens webkitbeginfullscreen - */ - - - Html5.prototype.proxyWebkitFullscreen_ = function proxyWebkitFullscreen_() { - var _this4 = this; - - if (!('webkitDisplayingFullscreen' in this.el_)) { - return; - } - - var endFn = function endFn() { - this.trigger('fullscreenchange', { isFullscreen: false }); - }; - - var beginFn = function beginFn() { - this.one('webkitendfullscreen', endFn); - - this.trigger('fullscreenchange', { isFullscreen: true }); - }; - - this.on('webkitbeginfullscreen', beginFn); - this.on('dispose', function () { - _this4.off('webkitbeginfullscreen', beginFn); - _this4.off('webkitendfullscreen', endFn); - }); - }; - - /** - * Check if fullscreen is supported on the current playback device. - * - * @return {boolean} - * - True if fullscreen is supported. - * - False if fullscreen is not supported. - */ - - - Html5.prototype.supportsFullScreen = function supportsFullScreen() { - if (typeof this.el_.webkitEnterFullScreen === 'function') { - var userAgent = window_1.navigator && window_1.navigator.userAgent || ''; - - // Seems to be broken in Chromium/Chrome && Safari in Leopard - if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) { - return true; - } - } - return false; - }; - - /** - * Request that the `HTML5` Tech enter fullscreen. - */ - - - Html5.prototype.enterFullScreen = function enterFullScreen() { - var video = this.el_; - - if (video.paused && video.networkState <= video.HAVE_METADATA) { - // attempt to prime the video element for programmatic access - // this isn't necessary on the desktop but shouldn't hurt - this.el_.play(); - - // playing and pausing synchronously during the transition to fullscreen - // can get iOS ~6.1 devices into a play/pause loop - this.setTimeout(function () { - video.pause(); - video.webkitEnterFullScreen(); - }, 0); - } else { - video.webkitEnterFullScreen(); - } - }; - - /** - * Request that the `HTML5` Tech exit fullscreen. - */ - - - Html5.prototype.exitFullScreen = function exitFullScreen() { - this.el_.webkitExitFullScreen(); - }; - - /** - * A getter/setter for the `Html5` Tech's source object. - * > Note: Please use {@link Html5#setSource} - * - * @param {Tech~SourceObject} [src] - * The source object you want to set on the `HTML5` techs element. - * - * @return {Tech~SourceObject|undefined} - * - The current source object when a source is not passed in. - * - undefined when setting - * - * @deprecated Since version 5. - */ - - - Html5.prototype.src = function src(_src) { - if (_src === undefined) { - return this.el_.src; - } - - // Setting src through `src` instead of `setSrc` will be deprecated - this.setSrc(_src); - }; - - /** - * Reset the tech by removing all sources and then calling - * {@link Html5.resetMediaElement}. - */ - - - Html5.prototype.reset = function reset() { - Html5.resetMediaElement(this.el_); - }; - - /** - * Get the current source on the `HTML5` Tech. Falls back to returning the source from - * the HTML5 media element. - * - * @return {Tech~SourceObject} - * The current source object from the HTML5 tech. With a fallback to the - * elements source. - */ - - - Html5.prototype.currentSrc = function currentSrc() { - if (this.currentSource_) { - return this.currentSource_.src; - } - return this.el_.currentSrc; - }; - - /** - * Set controls attribute for the HTML5 media Element. - * - * @param {string} val - * Value to set the controls attribute to - */ - - - Html5.prototype.setControls = function setControls(val) { - this.el_.controls = !!val; - }; - - /** - * Create and returns a remote {@link TextTrack} object. - * - * @param {string} kind - * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata) - * - * @param {string} [label] - * Label to identify the text track - * - * @param {string} [language] - * Two letter language abbreviation - * - * @return {TextTrack} - * The TextTrack that gets created. - */ - - - Html5.prototype.addTextTrack = function addTextTrack(kind, label, language) { - if (!this.featuresNativeTextTracks) { - return _Tech.prototype.addTextTrack.call(this, kind, label, language); - } - - return this.el_.addTextTrack(kind, label, language); - }; - - /** - * Creates either native TextTrack or an emulated TextTrack depending - * on the value of `featuresNativeTextTracks` - * - * @param {Object} options - * The object should contain the options to intialize the TextTrack with. - * - * @param {string} [options.kind] - * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata). - * - * @param {string} [options.label]. - * Label to identify the text track - * - * @param {string} [options.language] - * Two letter language abbreviation. - * - * @param {boolean} [options.default] - * Default this track to on. - * - * @param {string} [options.id] - * The internal id to assign this track. - * - * @param {string} [options.src] - * A source url for the track. - * - * @return {HTMLTrackElement} - * The track element that gets created. - */ - - - Html5.prototype.createRemoteTextTrack = function createRemoteTextTrack(options) { - if (!this.featuresNativeTextTracks) { - return _Tech.prototype.createRemoteTextTrack.call(this, options); - } - var htmlTrackElement = document_1.createElement('track'); - - if (options.kind) { - htmlTrackElement.kind = options.kind; - } - if (options.label) { - htmlTrackElement.label = options.label; - } - if (options.language || options.srclang) { - htmlTrackElement.srclang = options.language || options.srclang; - } - if (options['default']) { - htmlTrackElement['default'] = options['default']; - } - if (options.id) { - htmlTrackElement.id = options.id; - } - if (options.src) { - htmlTrackElement.src = options.src; - } - - return htmlTrackElement; - }; - - /** - * Creates a remote text track object and returns an html track element. - * - * @param {Object} options The object should contain values for - * kind, language, label, and src (location of the WebVTT file) - * @param {Boolean} [manualCleanup=true] if set to false, the TextTrack will be - * automatically removed from the video element whenever the source changes - * @return {HTMLTrackElement} An Html Track Element. - * This can be an emulated {@link HTMLTrackElement} or a native one. - * @deprecated The default value of the "manualCleanup" parameter will default - * to "false" in upcoming versions of Video.js - */ - - - Html5.prototype.addRemoteTextTrack = function addRemoteTextTrack(options, manualCleanup) { - var htmlTrackElement = _Tech.prototype.addRemoteTextTrack.call(this, options, manualCleanup); - - if (this.featuresNativeTextTracks) { - this.el().appendChild(htmlTrackElement); - } - - return htmlTrackElement; - }; - - /** - * Remove remote `TextTrack` from `TextTrackList` object - * - * @param {TextTrack} track - * `TextTrack` object to remove - */ - - - Html5.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) { - _Tech.prototype.removeRemoteTextTrack.call(this, track); - - if (this.featuresNativeTextTracks) { - var tracks = this.$$('track'); - - var i = tracks.length; - - while (i--) { - if (track === tracks[i] || track === tracks[i].track) { - this.el().removeChild(tracks[i]); - } - } - } - }; - - /** - * Get the value of `playsinline` from the media element. `playsinline` indicates - * to the browser that non-fullscreen playback is preferred when fullscreen - * playback is the native default, such as in iOS Safari. - * - * @method Html5#playsinline - * @return {boolean} - * - The value of `playsinline` from the media element. - * - True indicates that the media should play inline. - * - False indicates that the media should not play inline. - * - * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline} - */ - - - Html5.prototype.playsinline = function playsinline() { - return this.el_.hasAttribute('playsinline'); - }; - - /** - * Set the value of `playsinline` from the media element. `playsinline` indicates - * to the browser that non-fullscreen playback is preferred when fullscreen - * playback is the native default, such as in iOS Safari. - * - * @method Html5#setPlaysinline - * @param {boolean} playsinline - * - True indicates that the media should play inline. - * - False indicates that the media should not play inline. - * - * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline} - */ - - - Html5.prototype.setPlaysinline = function setPlaysinline(value) { - if (value) { - this.el_.setAttribute('playsinline', 'playsinline'); - } else { - this.el_.removeAttribute('playsinline'); - } - }; - - /** - * Gets available media playback quality metrics as specified by the W3C's Media - * Playback Quality API. - * - * @see [Spec]{@link https://wicg.github.io/media-playback-quality} - * - * @return {Object} - * An object with supported media playback quality metrics - */ - - - Html5.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() { - if (typeof this.el().getVideoPlaybackQuality === 'function') { - return this.el().getVideoPlaybackQuality(); - } - - var videoPlaybackQuality = {}; - - if (typeof this.el().webkitDroppedFrameCount !== 'undefined' && typeof this.el().webkitDecodedFrameCount !== 'undefined') { - videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount; - videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount; - } - - if (window_1.performance && typeof window_1.performance.now === 'function') { - videoPlaybackQuality.creationTime = window_1.performance.now(); - } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === 'number') { - videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart; - } - - return videoPlaybackQuality; - }; - - return Html5; -}(Tech); - -/* HTML5 Support Testing ---------------------------------------------------- */ - -if (isReal()) { - - /** - * Element for testing browser HTML5 media capabilities - * - * @type {Element} - * @constant - * @private - */ - Html5.TEST_VID = document_1.createElement('video'); - var track = document_1.createElement('track'); - - track.kind = 'captions'; - track.srclang = 'en'; - track.label = 'English'; - Html5.TEST_VID.appendChild(track); -} - -/** - * Check if HTML5 media is supported by this browser/device. - * - * @return {boolean} - * - True if HTML5 media is supported. - * - False if HTML5 media is not supported. - */ -Html5.isSupported = function () { - // IE9 with no Media Player is a LIAR! (#984) - try { - Html5.TEST_VID.volume = 0.5; - } catch (e) { - return false; - } - - return !!(Html5.TEST_VID && Html5.TEST_VID.canPlayType); -}; - -/** - * Check if the tech can support the given type - * - * @param {string} type - * The mimetype to check - * @return {string} 'probably', 'maybe', or '' (empty string) - */ -Html5.canPlayType = function (type) { - return Html5.TEST_VID.canPlayType(type); -}; - -/** - * Check if the tech can support the given source - * @param {Object} srcObj - * The source object - * @param {Object} options - * The options passed to the tech - * @return {string} 'probably', 'maybe', or '' (empty string) - */ -Html5.canPlaySource = function (srcObj, options) { - return Html5.canPlayType(srcObj.type); -}; - -/** - * Check if the volume can be changed in this browser/device. - * Volume cannot be changed in a lot of mobile devices. - * Specifically, it can't be changed from 1 on iOS. - * - * @return {boolean} - * - True if volume can be controlled - * - False otherwise - */ -Html5.canControlVolume = function () { - // IE will error if Windows Media Player not installed #3315 - try { - var volume = Html5.TEST_VID.volume; - - Html5.TEST_VID.volume = volume / 2 + 0.1; - return volume !== Html5.TEST_VID.volume; - } catch (e) { - return false; - } -}; - -/** - * Check if the playback rate can be changed in this browser/device. - * - * @return {boolean} - * - True if playback rate can be controlled - * - False otherwise - */ -Html5.canControlPlaybackRate = function () { - // Playback rate API is implemented in Android Chrome, but doesn't do anything - // https://github.com/videojs/video.js/issues/3180 - if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) { - return false; - } - // IE will error if Windows Media Player not installed #3315 - try { - var playbackRate = Html5.TEST_VID.playbackRate; - - Html5.TEST_VID.playbackRate = playbackRate / 2 + 0.1; - return playbackRate !== Html5.TEST_VID.playbackRate; - } catch (e) { - return false; - } -}; - -/** - * Check to see if native `TextTrack`s are supported by this browser/device. - * - * @return {boolean} - * - True if native `TextTrack`s are supported. - * - False otherwise - */ -Html5.supportsNativeTextTracks = function () { - return IS_ANY_SAFARI; -}; - -/** - * Check to see if native `VideoTrack`s are supported by this browser/device - * - * @return {boolean} - * - True if native `VideoTrack`s are supported. - * - False otherwise - */ -Html5.supportsNativeVideoTracks = function () { - return !!(Html5.TEST_VID && Html5.TEST_VID.videoTracks); -}; - -/** - * Check to see if native `AudioTrack`s are supported by this browser/device - * - * @return {boolean} - * - True if native `AudioTrack`s are supported. - * - False otherwise - */ -Html5.supportsNativeAudioTracks = function () { - return !!(Html5.TEST_VID && Html5.TEST_VID.audioTracks); -}; - -/** - * An array of events available on the Html5 tech. - * - * @private - * @type {Array} - */ -Html5.Events = ['loadstart', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'durationchange', 'timeupdate', 'progress', 'play', 'pause', 'ratechange', 'resize', 'volumechange']; - -/** - * Boolean indicating whether the `Tech` supports volume control. - * - * @type {boolean} - * @default {@link Html5.canControlVolume} - */ -Html5.prototype.featuresVolumeControl = Html5.canControlVolume(); - -/** - * Boolean indicating whether the `Tech` supports changing the speed at which the media - * plays. Examples: - * - Set player to play 2x (twice) as fast - * - Set player to play 0.5x (half) as fast - * - * @type {boolean} - * @default {@link Html5.canControlPlaybackRate} - */ -Html5.prototype.featuresPlaybackRate = Html5.canControlPlaybackRate(); - -/** - * Boolean indicating whether the `HTML5` tech currently supports the media element - * moving in the DOM. iOS breaks if you move the media element, so this is set this to - * false there. Everywhere else this should be true. - * - * @type {boolean} - * @default - */ -Html5.prototype.movingMediaElementInDOM = !IS_IOS; - -// TODO: Previous comment: No longer appears to be used. Can probably be removed. -// Is this true? -/** - * Boolean indicating whether the `HTML5` tech currently supports automatic media resize - * when going into fullscreen. - * - * @type {boolean} - * @default - */ -Html5.prototype.featuresFullscreenResize = true; - -/** - * Boolean indicating whether the `HTML5` tech currently supports the progress event. - * If this is false, manual `progress` events will be triggred instead. - * - * @type {boolean} - * @default - */ -Html5.prototype.featuresProgressEvents = true; - -/** - * Boolean indicating whether the `HTML5` tech currently supports the timeupdate event. - * If this is false, manual `timeupdate` events will be triggred instead. - * - * @default - */ -Html5.prototype.featuresTimeupdateEvents = true; - -/** - * Boolean indicating whether the `HTML5` tech currently supports native `TextTrack`s. - * - * @type {boolean} - * @default {@link Html5.supportsNativeTextTracks} - */ -Html5.prototype.featuresNativeTextTracks = Html5.supportsNativeTextTracks(); - -/** - * Boolean indicating whether the `HTML5` tech currently supports native `VideoTrack`s. - * - * @type {boolean} - * @default {@link Html5.supportsNativeVideoTracks} - */ -Html5.prototype.featuresNativeVideoTracks = Html5.supportsNativeVideoTracks(); - -/** - * Boolean indicating whether the `HTML5` tech currently supports native `AudioTrack`s. - * - * @type {boolean} - * @default {@link Html5.supportsNativeAudioTracks} - */ -Html5.prototype.featuresNativeAudioTracks = Html5.supportsNativeAudioTracks(); - -// HTML5 Feature detection and Device Fixes --------------------------------- // -var canPlayType = Html5.TEST_VID && Html5.TEST_VID.constructor.prototype.canPlayType; -var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i; -var mp4RE = /^video\/mp4/i; - -Html5.patchCanPlayType = function () { - - // Android 4.0 and above can play HLS to some extent but it reports being unable to do so - if (ANDROID_VERSION >= 4.0 && !IS_FIREFOX) { - Html5.TEST_VID.constructor.prototype.canPlayType = function (type) { - if (type && mpegurlRE.test(type)) { - return 'maybe'; - } - return canPlayType.call(this, type); - }; - - // Override Android 2.2 and less canPlayType method which is broken - } else if (IS_OLD_ANDROID) { - Html5.TEST_VID.constructor.prototype.canPlayType = function (type) { - if (type && mp4RE.test(type)) { - return 'maybe'; - } - return canPlayType.call(this, type); - }; - } -}; - -Html5.unpatchCanPlayType = function () { - var r = Html5.TEST_VID.constructor.prototype.canPlayType; - - Html5.TEST_VID.constructor.prototype.canPlayType = canPlayType; - return r; -}; - -// by default, patch the media element -Html5.patchCanPlayType(); - -Html5.disposeMediaElement = function (el) { - if (!el) { - return; - } - - if (el.parentNode) { - el.parentNode.removeChild(el); - } - - // remove any child track or source nodes to prevent their loading - while (el.hasChildNodes()) { - el.removeChild(el.firstChild); - } - - // remove any src reference. not setting `src=''` because that causes a warning - // in firefox - el.removeAttribute('src'); - - // force the media element to update its loading state by calling load() - // however IE on Windows 7N has a bug that throws an error so need a try/catch (#793) - if (typeof el.load === 'function') { - // wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473) - (function () { - try { - el.load(); - } catch (e) { - // not supported - } - })(); - } -}; - -Html5.resetMediaElement = function (el) { - if (!el) { - return; - } - - var sources = el.querySelectorAll('source'); - var i = sources.length; - - while (i--) { - el.removeChild(sources[i]); - } - - // remove any src reference. - // not setting `src=''` because that throws an error - el.removeAttribute('src'); - - if (typeof el.load === 'function') { - // wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473) - (function () { - try { - el.load(); - } catch (e) { - // satisfy linter - } - })(); - } -}; - -/* Native HTML5 element property wrapping ----------------------------------- */ -// Wrap native properties with a getter -[ -/** - * Get the value of `paused` from the media element. `paused` indicates whether the media element - * is currently paused or not. - * - * @method Html5#paused - * @return {boolean} - * The value of `paused` from the media element. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-paused} - */ -'paused', - -/** - * Get the value of `currentTime` from the media element. `currentTime` indicates - * the current second that the media is at in playback. - * - * @method Html5#currentTime - * @return {number} - * The value of `currentTime` from the media element. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-currenttime} - */ -'currentTime', - -/** - * Get the value of `buffered` from the media element. `buffered` is a `TimeRange` - * object that represents the parts of the media that are already downloaded and - * available for playback. - * - * @method Html5#buffered - * @return {TimeRange} - * The value of `buffered` from the media element. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered} - */ -'buffered', - -/** - * Get the value of `volume` from the media element. `volume` indicates - * the current playback volume of audio for a media. `volume` will be a value from 0 - * (silent) to 1 (loudest and default). - * - * @method Html5#volume - * @return {number} - * The value of `volume` from the media element. Value will be between 0-1. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume} - */ -'volume', - -/** - * Get the value of `muted` from the media element. `muted` indicates - * that the volume for the media should be set to silent. This does not actually change - * the `volume` attribute. - * - * @method Html5#muted - * @return {boolean} - * - True if the value of `volume` should be ignored and the audio set to silent. - * - False if the value of `volume` should be used. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted} - */ -'muted', - -/** - * Get the value of `defaultMuted` from the media element. `defaultMuted` indicates - * that the volume for the media should be set to silent when the video first starts. - * This does not actually change the `volume` attribute. After playback has started `muted` - * will indicate the current status of the volume and `defaultMuted` will not. - * - * @method Html5.prototype.defaultMuted - * @return {boolean} - * - True if the value of `volume` should be ignored and the audio set to silent. - * - False if the value of `volume` should be used. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted} - */ -'defaultMuted', - -/** - * Get the value of `poster` from the media element. `poster` indicates - * that the url of an image file that can/will be shown when no media data is available. - * - * @method Html5#poster - * @return {string} - * The value of `poster` from the media element. Value will be a url to an - * image. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-video-poster} - */ -'poster', - -/** - * Get the value of `preload` from the media element. `preload` indicates - * what should download before the media is interacted with. It can have the following - * values: - * - none: nothing should be downloaded - * - metadata: poster and the first few frames of the media may be downloaded to get - * media dimensions and other metadata - * - auto: allow the media and metadata for the media to be downloaded before - * interaction - * - * @method Html5#preload - * @return {string} - * The value of `preload` from the media element. Will be 'none', 'metadata', - * or 'auto'. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload} - */ -'preload', - -/** - * Get the value of `autoplay` from the media element. `autoplay` indicates - * that the media should start to play as soon as the page is ready. - * - * @method Html5#autoplay - * @return {boolean} - * - The value of `autoplay` from the media element. - * - True indicates that the media should start as soon as the page loads. - * - False indicates that the media should not start as soon as the page loads. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay} - */ -'autoplay', - -/** - * Get the value of `controls` from the media element. `controls` indicates - * whether the native media controls should be shown or hidden. - * - * @method Html5#controls - * @return {boolean} - * - The value of `controls` from the media element. - * - True indicates that native controls should be showing. - * - False indicates that native controls should be hidden. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-controls} - */ -'controls', - -/** - * Get the value of `loop` from the media element. `loop` indicates - * that the media should return to the start of the media and continue playing once - * it reaches the end. - * - * @method Html5#loop - * @return {boolean} - * - The value of `loop` from the media element. - * - True indicates that playback should seek back to start once - * the end of a media is reached. - * - False indicates that playback should not loop back to the start when the - * end of the media is reached. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop} - */ -'loop', - -/** - * Get the value of the `error` from the media element. `error` indicates any - * MediaError that may have occured during playback. If error returns null there is no - * current error. - * - * @method Html5#error - * @return {MediaError|null} - * The value of `error` from the media element. Will be `MediaError` if there - * is a current error and null otherwise. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-error} - */ -'error', - -/** - * Get the value of `seeking` from the media element. `seeking` indicates whether the - * media is currently seeking to a new position or not. - * - * @method Html5#seeking - * @return {boolean} - * - The value of `seeking` from the media element. - * - True indicates that the media is currently seeking to a new position. - * - Flase indicates that the media is not seeking to a new position at this time. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seeking} - */ -'seeking', - -/** - * Get the value of `seekable` from the media element. `seekable` returns a - * `TimeRange` object indicating ranges of time that can currently be `seeked` to. - * - * @method Html5#seekable - * @return {TimeRange} - * The value of `seekable` from the media element. A `TimeRange` object - * indicating the current ranges of time that can be seeked to. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seekable} - */ -'seekable', - -/** - * Get the value of `ended` from the media element. `ended` indicates whether - * the media has reached the end or not. - * - * @method Html5#ended - * @return {boolean} - * - The value of `ended` from the media element. - * - True indicates that the media has ended. - * - False indicates that the media has not ended. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-ended} - */ -'ended', - -/** - * Get the value of `defaultMuted` from the media element. `defaultMuted` indicates - * whether the media should start muted or not. Only changes the default state of the - * media. `muted` and `defaultMuted` can have different values. {@link Html5#muted} indicates the - * current state. - * - * @method Html5#defaultMuted - * @return {boolean} - * - The value of `defaultMuted` from the media element. - * - True indicates that the media should start muted. - * - False indicates that the media should not start muted - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted} - */ -'defaultMuted', - -/** - * Get the value of `playbackRate` from the media element. `playbackRate` indicates - * the rate at which the media is currently playing back. Examples: - * - if playbackRate is set to 2, media will play twice as fast. - * - if playbackRate is set to 0.5, media will play half as fast. - * - * @method Html5#playbackRate - * @return {number} - * The value of `playbackRate` from the media element. A number indicating - * the current playback speed of the media, where 1 is normal speed. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate} - */ -'playbackRate', - -/** - * Get the value of `defaultPlaybackRate` from the media element. `defaultPlaybackRate` indicates - * the rate at which the media is currently playing back. This value will not indicate the current - * `playbackRate` after playback has started, use {@link Html5#playbackRate} for that. - * - * Examples: - * - if defaultPlaybackRate is set to 2, media will play twice as fast. - * - if defaultPlaybackRate is set to 0.5, media will play half as fast. - * - * @method Html5.prototype.defaultPlaybackRate - * @return {number} - * The value of `defaultPlaybackRate` from the media element. A number indicating - * the current playback speed of the media, where 1 is normal speed. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate} - */ -'defaultPlaybackRate', - -/** - * Get the value of `played` from the media element. `played` returns a `TimeRange` - * object representing points in the media timeline that have been played. - * - * @method Html5#played - * @return {TimeRange} - * The value of `played` from the media element. A `TimeRange` object indicating - * the ranges of time that have been played. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-played} - */ -'played', - -/** - * Get the value of `networkState` from the media element. `networkState` indicates - * the current network state. It returns an enumeration from the following list: - * - 0: NETWORK_EMPTY - * - 1: NEWORK_IDLE - * - 2: NETWORK_LOADING - * - 3: NETWORK_NO_SOURCE - * - * @method Html5#networkState - * @return {number} - * The value of `networkState` from the media element. This will be a number - * from the list in the description. - * - * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-networkstate} - */ -'networkState', - -/** - * Get the value of `readyState` from the media element. `readyState` indicates - * the current state of the media element. It returns an enumeration from the - * following list: - * - 0: HAVE_NOTHING - * - 1: HAVE_METADATA - * - 2: HAVE_CURRENT_DATA - * - 3: HAVE_FUTURE_DATA - * - 4: HAVE_ENOUGH_DATA - * - * @method Html5#readyState - * @return {number} - * The value of `readyState` from the media element. This will be a number - * from the list in the description. - * - * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#ready-states} - */ -'readyState', - -/** - * Get the value of `videoWidth` from the video element. `videoWidth` indicates - * the current width of the video in css pixels. - * - * @method Html5#videoWidth - * @return {number} - * The value of `videoWidth` from the video element. This will be a number - * in css pixels. - * - * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth} - */ -'videoWidth', - -/** - * Get the value of `videoHeight` from the video element. `videoHeigth` indicates - * the current height of the video in css pixels. - * - * @method Html5#videoHeight - * @return {number} - * The value of `videoHeight` from the video element. This will be a number - * in css pixels. - * - * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth} - */ -'videoHeight'].forEach(function (prop) { - Html5.prototype[prop] = function () { - return this.el_[prop]; - }; -}); - -// Wrap native properties with a setter in this format: -// set + toTitleCase(name) -[ -/** - * Set the value of `volume` on the media element. `volume` indicates the current - * audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and - * so on. - * - * @method Html5#setVolume - * @param {number} percentAsDecimal - * The volume percent as a decimal. Valid range is from 0-1. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume} - */ -'volume', - -/** - * Set the value of `muted` on the media element. `muted` indicates that the current - * audio level should be silent. - * - * @method Html5#setMuted - * @param {boolean} muted - * - True if the audio should be set to silent - * - False otherwise - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted} - */ -'muted', - -/** - * Set the value of `defaultMuted` on the media element. `defaultMuted` indicates that the current - * audio level should be silent, but will only effect the muted level on intial playback.. - * - * @method Html5.prototype.setDefaultMuted - * @param {boolean} defaultMuted - * - True if the audio should be set to silent - * - False otherwise - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted} - */ -'defaultMuted', - -/** - * Set the value of `src` on the media element. `src` indicates the current - * {@link Tech~SourceObject} for the media. - * - * @method Html5#setSrc - * @param {Tech~SourceObject} src - * The source object to set as the current source. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-src} - */ -'src', - -/** - * Set the value of `poster` on the media element. `poster` is the url to - * an image file that can/will be shown when no media data is available. - * - * @method Html5#setPoster - * @param {string} poster - * The url to an image that should be used as the `poster` for the media - * element. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-poster} - */ -'poster', - -/** - * Set the value of `preload` on the media element. `preload` indicates - * what should download before the media is interacted with. It can have the following - * values: - * - none: nothing should be downloaded - * - metadata: poster and the first few frames of the media may be downloaded to get - * media dimensions and other metadata - * - auto: allow the media and metadata for the media to be downloaded before - * interaction - * - * @method Html5#setPreload - * @param {string} preload - * The value of `preload` to set on the media element. Must be 'none', 'metadata', - * or 'auto'. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload} - */ -'preload', - -/** - * Set the value of `autoplay` on the media element. `autoplay` indicates - * that the media should start to play as soon as the page is ready. - * - * @method Html5#setAutoplay - * @param {boolean} autoplay - * - True indicates that the media should start as soon as the page loads. - * - False indicates that the media should not start as soon as the page loads. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay} - */ -'autoplay', - -/** - * Set the value of `loop` on the media element. `loop` indicates - * that the media should return to the start of the media and continue playing once - * it reaches the end. - * - * @method Html5#setLoop - * @param {boolean} loop - * - True indicates that playback should seek back to start once - * the end of a media is reached. - * - False indicates that playback should not loop back to the start when the - * end of the media is reached. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop} - */ -'loop', - -/** - * Set the value of `playbackRate` on the media element. `playbackRate` indicates - * the rate at which the media should play back. Examples: - * - if playbackRate is set to 2, media will play twice as fast. - * - if playbackRate is set to 0.5, media will play half as fast. - * - * @method Html5#setPlaybackRate - * @return {number} - * The value of `playbackRate` from the media element. A number indicating - * the current playback speed of the media, where 1 is normal speed. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate} - */ -'playbackRate', - -/** - * Set the value of `defaultPlaybackRate` on the media element. `defaultPlaybackRate` indicates - * the rate at which the media should play back upon initial startup. Changing this value - * after a video has started will do nothing. Instead you should used {@link Html5#setPlaybackRate}. - * - * Example Values: - * - if playbackRate is set to 2, media will play twice as fast. - * - if playbackRate is set to 0.5, media will play half as fast. - * - * @method Html5.prototype.setDefaultPlaybackRate - * @return {number} - * The value of `defaultPlaybackRate` from the media element. A number indicating - * the current playback speed of the media, where 1 is normal speed. - * - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultplaybackrate} - */ -'defaultPlaybackRate'].forEach(function (prop) { - Html5.prototype['set' + toTitleCase(prop)] = function (v) { - this.el_[prop] = v; - }; -}); - -// wrap native functions with a function -[ -/** - * A wrapper around the media elements `pause` function. This will call the `HTML5` - * media elements `pause` function. - * - * @method Html5#pause - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-pause} - */ -'pause', - -/** - * A wrapper around the media elements `load` function. This will call the `HTML5`s - * media element `load` function. - * - * @method Html5#load - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-load} - */ -'load', - -/** - * A wrapper around the media elements `play` function. This will call the `HTML5`s - * media element `play` function. - * - * @method Html5#play - * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-play} - */ -'play'].forEach(function (prop) { - Html5.prototype[prop] = function () { - return this.el_[prop](); - }; -}); - -Tech.withSourceHandlers(Html5); - -/** - * Native source handler for Html5, simply passes the source to the media element. - * - * @proprety {Tech~SourceObject} source - * The source object - * - * @proprety {Html5} tech - * The instance of the HTML5 tech. - */ -Html5.nativeSourceHandler = {}; - -/** - * Check if the media element can play the given mime type. - * - * @param {string} type - * The mimetype to check - * - * @return {string} - * 'probably', 'maybe', or '' (empty string) - */ -Html5.nativeSourceHandler.canPlayType = function (type) { - // IE9 on Windows 7 without MediaPlayer throws an error here - // https://github.com/videojs/video.js/issues/519 - try { - return Html5.TEST_VID.canPlayType(type); - } catch (e) { - return ''; - } -}; - -/** - * Check if the media element can handle a source natively. - * - * @param {Tech~SourceObject} source - * The source object - * - * @param {Object} [options] - * Options to be passed to the tech. - * - * @return {string} - * 'probably', 'maybe', or '' (empty string). - */ -Html5.nativeSourceHandler.canHandleSource = function (source, options) { - - // If a type was provided we should rely on that - if (source.type) { - return Html5.nativeSourceHandler.canPlayType(source.type); - - // If no type, fall back to checking 'video/[EXTENSION]' - } else if (source.src) { - var ext = getFileExtension(source.src); - - return Html5.nativeSourceHandler.canPlayType('video/' + ext); - } - - return ''; -}; - -/** - * Pass the source to the native media element. - * - * @param {Tech~SourceObject} source - * The source object - * - * @param {Html5} tech - * The instance of the Html5 tech - * - * @param {Object} [options] - * The options to pass to the source - */ -Html5.nativeSourceHandler.handleSource = function (source, tech, options) { - tech.setSrc(source.src); -}; - -/** - * A noop for the native dispose function, as cleanup is not needed. - */ -Html5.nativeSourceHandler.dispose = function () {}; - -// Register the native source handler -Html5.registerSourceHandler(Html5.nativeSourceHandler); - -Tech.registerTech('Html5', Html5); - -var _templateObject$1 = taggedTemplateLiteralLoose(['\n Using the tech directly can be dangerous. I hope you know what you\'re doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n '], ['\n Using the tech directly can be dangerous. I hope you know what you\'re doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n ']); - -/** - * @file player.js - */ -// Subclasses Component -// The following imports are used only to ensure that the corresponding modules -// are always included in the video.js package. Importing the modules will -// execute them and they will register themselves with video.js. -// Import Html5 tech, at least for disposing the original video tag. -// The following tech events are simply re-triggered -// on the player when they happen -var TECH_EVENTS_RETRIGGER = [ -/** - * Fired while the user agent is downloading media data. - * - * @event Player#progress - * @type {EventTarget~Event} - */ -/** - * Retrigger the `progress` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechProgress_ - * @fires Player#progress - * @listens Tech#progress - */ -'progress', - -/** - * Fires when the loading of an audio/video is aborted. - * - * @event Player#abort - * @type {EventTarget~Event} - */ -/** - * Retrigger the `abort` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechAbort_ - * @fires Player#abort - * @listens Tech#abort - */ -'abort', - -/** - * Fires when the browser is intentionally not getting media data. - * - * @event Player#suspend - * @type {EventTarget~Event} - */ -/** - * Retrigger the `suspend` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechSuspend_ - * @fires Player#suspend - * @listens Tech#suspend - */ -'suspend', - -/** - * Fires when the current playlist is empty. - * - * @event Player#emptied - * @type {EventTarget~Event} - */ -/** - * Retrigger the `emptied` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechEmptied_ - * @fires Player#emptied - * @listens Tech#emptied - */ -'emptied', -/** - * Fires when the browser is trying to get media data, but data is not available. - * - * @event Player#stalled - * @type {EventTarget~Event} - */ -/** - * Retrigger the `stalled` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechStalled_ - * @fires Player#stalled - * @listens Tech#stalled - */ -'stalled', - -/** - * Fires when the browser has loaded meta data for the audio/video. - * - * @event Player#loadedmetadata - * @type {EventTarget~Event} - */ -/** - * Retrigger the `stalled` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechLoadedmetadata_ - * @fires Player#loadedmetadata - * @listens Tech#loadedmetadata - */ -'loadedmetadata', - -/** - * Fires when the browser has loaded the current frame of the audio/video. - * - * @event player#loadeddata - * @type {event} - */ -/** - * Retrigger the `loadeddata` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechLoaddeddata_ - * @fires Player#loadeddata - * @listens Tech#loadeddata - */ -'loadeddata', - -/** - * Fires when the current playback position has changed. - * - * @event player#timeupdate - * @type {event} - */ -/** - * Retrigger the `timeupdate` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechTimeUpdate_ - * @fires Player#timeupdate - * @listens Tech#timeupdate - */ -'timeupdate', - -/** - * Fires when the playing speed of the audio/video is changed - * - * @event player#ratechange - * @type {event} - */ -/** - * Retrigger the `ratechange` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechRatechange_ - * @fires Player#ratechange - * @listens Tech#ratechange - */ -'ratechange', - -/** - * Fires when the video's intrinsic dimensions change - * - * @event Player#resize - * @type {event} - */ -/** - * Retrigger the `resize` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechResize_ - * @fires Player#resize - * @listens Tech#resize - */ -'resize', - -/** - * Fires when the volume has been changed - * - * @event player#volumechange - * @type {event} - */ -/** - * Retrigger the `volumechange` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechVolumechange_ - * @fires Player#volumechange - * @listens Tech#volumechange - */ -'volumechange', - -/** - * Fires when the text track has been changed - * - * @event player#texttrackchange - * @type {event} - */ -/** - * Retrigger the `texttrackchange` event that was triggered by the {@link Tech}. - * - * @private - * @method Player#handleTechTexttrackchange_ - * @fires Player#texttrackchange - * @listens Tech#texttrackchange - */ -'texttrackchange']; - -/** - * An instance of the `Player` class is created when any of the Video.js setup methods - * are used to initialize a video. - * - * After an instance has been created it can be accessed globally in two ways: - * 1. By calling `videojs('example_video_1');` - * 2. By using it directly via `videojs.players.example_video_1;` - * - * @extends Component - */ - -var Player = function (_Component) { - inherits(Player, _Component); - - /** - * Create an instance of this class. - * - * @param {Element} tag - * The original video DOM element used for configuring options. - * - * @param {Object} [options] - * Object of option names and values. - * - * @param {Component~ReadyCallback} [ready] - * Ready callback function. - */ - function Player(tag, options, ready) { - classCallCheck(this, Player); - - // Make sure tag ID exists - tag.id = tag.id || 'vjs_video_' + newGUID(); - - // Set Options - // The options argument overrides options set in the video tag - // which overrides globally set options. - // This latter part coincides with the load order - // (tag must exist before Player) - options = assign(Player.getTagSettings(tag), options); - - // Delay the initialization of children because we need to set up - // player properties first, and can't use `this` before `super()` - options.initChildren = false; - - // Same with creating the element - options.createEl = false; - - // we don't want the player to report touch activity on itself - // see enableTouchActivity in Component - options.reportTouchActivity = false; - - // If language is not set, get the closest lang attribute - if (!options.language) { - if (typeof tag.closest === 'function') { - var closest = tag.closest('[lang]'); - - if (closest) { - options.language = closest.getAttribute('lang'); - } - } else { - var element = tag; - - while (element && element.nodeType === 1) { - if (getAttributes(element).hasOwnProperty('lang')) { - options.language = element.getAttribute('lang'); - break; - } - element = element.parentNode; - } - } - } - - // Run base component initializing with new options - - // Turn off API access because we're loading a new tech that might load asynchronously - var _this = possibleConstructorReturn(this, _Component.call(this, null, options, ready)); - - _this.isReady_ = false; - - // if the global option object was accidentally blown away by - // someone, bail early with an informative error - if (!_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) { - throw new Error('No techOrder specified. Did you overwrite ' + 'videojs.options instead of just changing the ' + 'properties you want to override?'); - } - - // Store the original tag used to set options - _this.tag = tag; - - // Store the tag attributes used to restore html5 element - _this.tagAttributes = tag && getAttributes(tag); - - // Update current language - _this.language(_this.options_.language); - - // Update Supported Languages - if (options.languages) { - // Normalise player option languages to lowercase - var languagesToLower = {}; - - Object.getOwnPropertyNames(options.languages).forEach(function (name$$1) { - languagesToLower[name$$1.toLowerCase()] = options.languages[name$$1]; - }); - _this.languages_ = languagesToLower; - } else { - _this.languages_ = Player.prototype.options_.languages; - } - - // Cache for video property values. - _this.cache_ = {}; - - // Set poster - _this.poster_ = options.poster || ''; - - // Set controls - _this.controls_ = !!options.controls; - - // Set default values for lastVolume - _this.cache_.lastVolume = 1; - - // Original tag settings stored in options - // now remove immediately so native controls don't flash. - // May be turned back on by HTML5 tech if nativeControlsForTouch is true - tag.controls = false; - - /* - * Store the internal state of scrubbing - * - * @private - * @return {Boolean} True if the user is scrubbing - */ - _this.scrubbing_ = false; - - _this.el_ = _this.createEl(); - - // Make this an evented object and use `el_` as its event bus. - evented(_this, { eventBusKey: 'el_' }); - - // We also want to pass the original player options to each component and plugin - // as well so they don't need to reach back into the player for options later. - // We also need to do another copy of this.options_ so we don't end up with - // an infinite loop. - var playerOptionsCopy = mergeOptions(_this.options_); - - // Load plugins - if (options.plugins) { - var plugins = options.plugins; - - Object.keys(plugins).forEach(function (name$$1) { - if (typeof this[name$$1] === 'function') { - this[name$$1](plugins[name$$1]); - } else { - throw new Error('plugin "' + name$$1 + '" does not exist'); - } - }, _this); - } - - _this.options_.playerOptions = playerOptionsCopy; - - _this.middleware_ = []; - - _this.initChildren(); - - // Set isAudio based on whether or not an audio tag was used - _this.isAudio(tag.nodeName.toLowerCase() === 'audio'); - - // Update controls className. Can't do this when the controls are initially - // set because the element doesn't exist yet. - if (_this.controls()) { - _this.addClass('vjs-controls-enabled'); - } else { - _this.addClass('vjs-controls-disabled'); - } - - // Set ARIA label and region role depending on player type - _this.el_.setAttribute('role', 'region'); - if (_this.isAudio()) { - _this.el_.setAttribute('aria-label', _this.localize('Audio Player')); - } else { - _this.el_.setAttribute('aria-label', _this.localize('Video Player')); - } - - if (_this.isAudio()) { - _this.addClass('vjs-audio'); - } - - if (_this.flexNotSupported_()) { - _this.addClass('vjs-no-flex'); - } - - // TODO: Make this smarter. Toggle user state between touching/mousing - // using events, since devices can have both touch and mouse events. - // if (browser.TOUCH_ENABLED) { - // this.addClass('vjs-touch-enabled'); - // } - - // iOS Safari has broken hover handling - if (!IS_IOS) { - _this.addClass('vjs-workinghover'); - } - - // Make player easily findable by ID - Player.players[_this.id_] = _this; - - // Add a major version class to aid css in plugins - var majorVersion = version.split('.')[0]; - - _this.addClass('vjs-v' + majorVersion); - - // When the player is first initialized, trigger activity so components - // like the control bar show themselves if needed - _this.userActive(true); - _this.reportUserActivity(); - _this.listenForUserActivity_(); - - _this.on('fullscreenchange', _this.handleFullscreenChange_); - _this.on('stageclick', _this.handleStageClick_); - - _this.changingSrc_ = false; - return _this; - } - - /** - * Destroys the video player and does any necessary cleanup. - * - * This is especially helpful if you are dynamically adding and removing videos - * to/from the DOM. - * - * @fires Player#dispose - */ - - - Player.prototype.dispose = function dispose() { - /** - * Called when the player is being disposed of. - * - * @event Player#dispose - * @type {EventTarget~Event} - */ - this.trigger('dispose'); - // prevent dispose from being called twice - this.off('dispose'); - - if (this.styleEl_ && this.styleEl_.parentNode) { - this.styleEl_.parentNode.removeChild(this.styleEl_); - } - - // Kill reference to this player - Player.players[this.id_] = null; - - if (this.tag && this.tag.player) { - this.tag.player = null; - } - - if (this.el_ && this.el_.player) { - this.el_.player = null; - } - - if (this.tech_) { - this.tech_.dispose(); - } - - _Component.prototype.dispose.call(this); - }; - - /** - * Create the `Player`'s DOM element. - * - * @return {Element} - * The DOM element that gets created. - */ - - - Player.prototype.createEl = function createEl$$1() { - var tag = this.tag; - var el = void 0; - var playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute('data-vjs-player'); - - if (playerElIngest) { - el = this.el_ = tag.parentNode; - } else { - el = this.el_ = _Component.prototype.createEl.call(this, 'div'); - } - - // set tabindex to -1 so we could focus on the player element - tag.setAttribute('tabindex', '-1'); - - // Remove width/height attrs from tag so CSS can make it 100% width/height - tag.removeAttribute('width'); - tag.removeAttribute('height'); - - // Copy over all the attributes from the tag, including ID and class - // ID will now reference player box, not the video tag - var attrs = getAttributes(tag); - - Object.getOwnPropertyNames(attrs).forEach(function (attr) { - // workaround so we don't totally break IE7 - // http://stackoverflow.com/questions/3653444/css-styles-not-applied-on-dynamic-elements-in-internet-explorer-7 - if (attr === 'class') { - el.className += ' ' + attrs[attr]; - } else { - el.setAttribute(attr, attrs[attr]); - } - }); - - // Update tag id/class for use as HTML5 playback tech - // Might think we should do this after embedding in container so .vjs-tech class - // doesn't flash 100% width/height, but class only applies with .video-js parent - tag.playerId = tag.id; - tag.id += '_html5_api'; - tag.className = 'vjs-tech'; - - // Make player findable on elements - tag.player = el.player = this; - // Default state of video is paused - this.addClass('vjs-paused'); - - // Add a style element in the player that we'll use to set the width/height - // of the player in a way that's still overrideable by CSS, just like the - // video element - if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) { - this.styleEl_ = createStyleElement('vjs-styles-dimensions'); - var defaultsStyleEl = $('.vjs-styles-defaults'); - var head = $('head'); - - head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild); - } - - // Pass in the width/height/aspectRatio options which will update the style el - this.width(this.options_.width); - this.height(this.options_.height); - this.fluid(this.options_.fluid); - this.aspectRatio(this.options_.aspectRatio); - - // Hide any links within the video/audio tag, because IE doesn't hide them completely. - var links = tag.getElementsByTagName('a'); - - for (var i = 0; i < links.length; i++) { - var linkEl = links.item(i); - - addClass(linkEl, 'vjs-hidden'); - linkEl.setAttribute('hidden', 'hidden'); - } - - // insertElFirst seems to cause the networkState to flicker from 3 to 2, so - // keep track of the original for later so we can know if the source originally failed - tag.initNetworkState_ = tag.networkState; - - // Wrap video tag in div (el/box) container - if (tag.parentNode && !playerElIngest) { - tag.parentNode.insertBefore(el, tag); - } - - // insert the tag as the first child of the player element - // then manually add it to the children array so that this.addChild - // will work properly for other components - // - // Breaks iPhone, fixed in HTML5 setup. - prependTo(tag, el); - this.children_.unshift(tag); - - // Set lang attr on player to ensure CSS :lang() in consistent with player - // if it's been set to something different to the doc - this.el_.setAttribute('lang', this.language_); - - this.el_ = el; - - return el; - }; - - /** - * A getter/setter for the `Player`'s width. - * - * @param {number} [value] - * The value to set the `Player's width to. - * - * @return {number} - * The current width of the `Player` when getting. - */ - - - Player.prototype.width = function width(value) { - return this.dimension('width', value); - }; - - /** - * A getter/setter for the `Player`'s height. - * - * @param {number} [value] - * The value to set the `Player's heigth to. - * - * @return {number} - * The current height of the `Player` when getting. - */ - - - Player.prototype.height = function height(value) { - return this.dimension('height', value); - }; - - /** - * A getter/setter for the `Player`'s width & height. - * - * @param {string} dimension - * This string can be: - * - 'width' - * - 'height' - * - * @param {number} [value] - * Value for dimension specified in the first argument. - * - * @return {number} - * The dimension arguments value when getting (width/height). - */ - - - Player.prototype.dimension = function dimension(_dimension, value) { - var privDimension = _dimension + '_'; - - if (value === undefined) { - return this[privDimension] || 0; - } - - if (value === '') { - // If an empty string is given, reset the dimension to be automatic - this[privDimension] = undefined; - } else { - var parsedVal = parseFloat(value); - - if (isNaN(parsedVal)) { - log$1.error('Improper value "' + value + '" supplied for for ' + _dimension); - return; - } - - this[privDimension] = parsedVal; - } - - this.updateStyleEl_(); - }; - - /** - * A getter/setter/toggler for the vjs-fluid `className` on the `Player`. - * - * @param {boolean} [bool] - * - A value of true adds the class. - * - A value of false removes the class. - * - No value will toggle the fluid class. - * - * @return {boolean|undefined} - * - The value of fluid when getting. - * - `undefined` when setting. - */ - - - Player.prototype.fluid = function fluid(bool) { - if (bool === undefined) { - return !!this.fluid_; - } - - this.fluid_ = !!bool; - - if (bool) { - this.addClass('vjs-fluid'); - } else { - this.removeClass('vjs-fluid'); - } - - this.updateStyleEl_(); - }; - - /** - * Get/Set the aspect ratio - * - * @param {string} [ratio] - * Aspect ratio for player - * - * @return {string|undefined} - * returns the current aspect ratio when getting - */ - - /** - * A getter/setter for the `Player`'s aspect ratio. - * - * @param {string} [ratio] - * The value to set the `Player's aspect ratio to. - * - * @return {string|undefined} - * - The current aspect ratio of the `Player` when getting. - * - undefined when setting - */ - - - Player.prototype.aspectRatio = function aspectRatio(ratio) { - if (ratio === undefined) { - return this.aspectRatio_; - } - - // Check for width:height format - if (!/^\d+\:\d+$/.test(ratio)) { - throw new Error('Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.'); - } - this.aspectRatio_ = ratio; - - // We're assuming if you set an aspect ratio you want fluid mode, - // because in fixed mode you could calculate width and height yourself. - this.fluid(true); - - this.updateStyleEl_(); - }; - - /** - * Update styles of the `Player` element (height, width and aspect ratio). - * - * @private - * @listens Tech#loadedmetadata - */ - - - Player.prototype.updateStyleEl_ = function updateStyleEl_() { - if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) { - var _width = typeof this.width_ === 'number' ? this.width_ : this.options_.width; - var _height = typeof this.height_ === 'number' ? this.height_ : this.options_.height; - var techEl = this.tech_ && this.tech_.el(); - - if (techEl) { - if (_width >= 0) { - techEl.width = _width; - } - if (_height >= 0) { - techEl.height = _height; - } - } - - return; - } - - var width = void 0; - var height = void 0; - var aspectRatio = void 0; - var idClass = void 0; - - // The aspect ratio is either used directly or to calculate width and height. - if (this.aspectRatio_ !== undefined && this.aspectRatio_ !== 'auto') { - // Use any aspectRatio that's been specifically set - aspectRatio = this.aspectRatio_; - } else if (this.videoWidth() > 0) { - // Otherwise try to get the aspect ratio from the video metadata - aspectRatio = this.videoWidth() + ':' + this.videoHeight(); - } else { - // Or use a default. The video element's is 2:1, but 16:9 is more common. - aspectRatio = '16:9'; - } - - // Get the ratio as a decimal we can use to calculate dimensions - var ratioParts = aspectRatio.split(':'); - var ratioMultiplier = ratioParts[1] / ratioParts[0]; - - if (this.width_ !== undefined) { - // Use any width that's been specifically set - width = this.width_; - } else if (this.height_ !== undefined) { - // Or calulate the width from the aspect ratio if a height has been set - width = this.height_ / ratioMultiplier; - } else { - // Or use the video's metadata, or use the video el's default of 300 - width = this.videoWidth() || 300; - } - - if (this.height_ !== undefined) { - // Use any height that's been specifically set - height = this.height_; - } else { - // Otherwise calculate the height from the ratio and the width - height = width * ratioMultiplier; - } - - // Ensure the CSS class is valid by starting with an alpha character - if (/^[^a-zA-Z]/.test(this.id())) { - idClass = 'dimensions-' + this.id(); - } else { - idClass = this.id() + '-dimensions'; - } - - // Ensure the right class is still on the player for the style element - this.addClass(idClass); - - setTextContent(this.styleEl_, '\n .' + idClass + ' {\n width: ' + width + 'px;\n height: ' + height + 'px;\n }\n\n .' + idClass + '.vjs-fluid {\n padding-top: ' + ratioMultiplier * 100 + '%;\n }\n '); - }; - - /** - * Load/Create an instance of playback {@link Tech} including element - * and API methods. Then append the `Tech` element in `Player` as a child. - * - * @param {string} techName - * name of the playback technology - * - * @param {string} source - * video source - * - * @private - */ - - - Player.prototype.loadTech_ = function loadTech_(techName, source) { - var _this2 = this; - - // Pause and remove current playback technology - if (this.tech_) { - this.unloadTech_(); - } - - var titleTechName = toTitleCase(techName); - var camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1); - - // get rid of the HTML5 video tag as soon as we are using another tech - if (titleTechName !== 'Html5' && this.tag) { - Tech.getTech('Html5').disposeMediaElement(this.tag); - this.tag.player = null; - this.tag = null; - } - - this.techName_ = titleTechName; - - // Turn off API access because we're loading a new tech that might load asynchronously - this.isReady_ = false; - - // Grab tech-specific options from player options and add source and parent element to use. - var techOptions = { - source: source, - 'nativeControlsForTouch': this.options_.nativeControlsForTouch, - 'playerId': this.id(), - 'techId': this.id() + '_' + titleTechName + '_api', - 'autoplay': this.options_.autoplay, - 'playsinline': this.options_.playsinline, - 'preload': this.options_.preload, - 'loop': this.options_.loop, - 'muted': this.options_.muted, - 'poster': this.poster(), - 'language': this.language(), - 'playerElIngest': this.playerElIngest_ || false, - 'vtt.js': this.options_['vtt.js'] - }; - - ALL.names.forEach(function (name$$1) { - var props = ALL[name$$1]; - - techOptions[props.getterName] = _this2[props.privateName]; - }); - - assign(techOptions, this.options_[titleTechName]); - assign(techOptions, this.options_[camelTechName]); - assign(techOptions, this.options_[techName.toLowerCase()]); - - if (this.tag) { - techOptions.tag = this.tag; - } - - if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) { - techOptions.startTime = this.cache_.currentTime; - } - - // Initialize tech instance - var TechClass = Tech.getTech(techName); - - if (!TechClass) { - throw new Error('No Tech named \'' + titleTechName + '\' exists! \'' + titleTechName + '\' should be registered using videojs.registerTech()\''); - } - - this.tech_ = new TechClass(techOptions); - - // player.triggerReady is always async, so don't need this to be async - this.tech_.ready(bind(this, this.handleTechReady_), true); - - textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_); - - // Listen to all HTML5-defined events and trigger them on the player - TECH_EVENTS_RETRIGGER.forEach(function (event) { - _this2.on(_this2.tech_, event, _this2['handleTech' + toTitleCase(event) + '_']); - }); - this.on(this.tech_, 'loadstart', this.handleTechLoadStart_); - this.on(this.tech_, 'waiting', this.handleTechWaiting_); - this.on(this.tech_, 'canplay', this.handleTechCanPlay_); - this.on(this.tech_, 'canplaythrough', this.handleTechCanPlayThrough_); - this.on(this.tech_, 'playing', this.handleTechPlaying_); - this.on(this.tech_, 'ended', this.handleTechEnded_); - this.on(this.tech_, 'seeking', this.handleTechSeeking_); - this.on(this.tech_, 'seeked', this.handleTechSeeked_); - this.on(this.tech_, 'play', this.handleTechPlay_); - this.on(this.tech_, 'firstplay', this.handleTechFirstPlay_); - this.on(this.tech_, 'pause', this.handleTechPause_); - this.on(this.tech_, 'durationchange', this.handleTechDurationChange_); - this.on(this.tech_, 'fullscreenchange', this.handleTechFullscreenChange_); - this.on(this.tech_, 'error', this.handleTechError_); - this.on(this.tech_, 'loadedmetadata', this.updateStyleEl_); - this.on(this.tech_, 'posterchange', this.handleTechPosterChange_); - this.on(this.tech_, 'textdata', this.handleTechTextData_); - - this.usingNativeControls(this.techGet_('controls')); - - if (this.controls() && !this.usingNativeControls()) { - this.addTechControlsListeners_(); - } - - // Add the tech element in the DOM if it was not already there - // Make sure to not insert the original video element if using Html5 - if (this.tech_.el().parentNode !== this.el() && (titleTechName !== 'Html5' || !this.tag)) { - prependTo(this.tech_.el(), this.el()); - } - - // Get rid of the original video tag reference after the first tech is loaded - if (this.tag) { - this.tag.player = null; - this.tag = null; - } - }; - - /** - * Unload and dispose of the current playback {@link Tech}. - * - * @private - */ - - - Player.prototype.unloadTech_ = function unloadTech_() { - var _this3 = this; - - // Save the current text tracks so that we can reuse the same text tracks with the next tech - ALL.names.forEach(function (name$$1) { - var props = ALL[name$$1]; - - _this3[props.privateName] = _this3[props.getterName](); - }); - this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_); - - this.isReady_ = false; - - this.tech_.dispose(); - - this.tech_ = false; - }; - - /** - * Return a reference to the current {@link Tech}. - * It will print a warning by default about the danger of using the tech directly - * but any argument that is passed in will silence the warning. - * - * @param {*} [safety] - * Anything passed in to silence the warning - * - * @return {Tech} - * The Tech - */ - - - Player.prototype.tech = function tech(safety) { - if (safety === undefined) { - log$1.warn(tsml(_templateObject$1)); - } - - return this.tech_; - }; - - /** - * Set up click and touch listeners for the playback element - * - * - On desktops: a click on the video itself will toggle playback - * - On mobile devices: a click on the video toggles controls - * which is done by toggling the user state between active and - * inactive - * - A tap can signal that a user has become active or has become inactive - * e.g. a quick tap on an iPhone movie should reveal the controls. Another - * quick tap should hide them again (signaling the user is in an inactive - * viewing state) - * - In addition to this, we still want the user to be considered inactive after - * a few seconds of inactivity. - * - * > Note: the only part of iOS interaction we can't mimic with this setup - * is a touch and hold on the video element counting as activity in order to - * keep the controls showing, but that shouldn't be an issue. A touch and hold - * on any controls will still keep the user active - * - * @private - */ - - - Player.prototype.addTechControlsListeners_ = function addTechControlsListeners_() { - // Make sure to remove all the previous listeners in case we are called multiple times. - this.removeTechControlsListeners_(); - - // Some browsers (Chrome & IE) don't trigger a click on a flash swf, but do - // trigger mousedown/up. - // http://stackoverflow.com/questions/1444562/javascript-onclick-event-over-flash-object - // Any touch events are set to block the mousedown event from happening - this.on(this.tech_, 'mousedown', this.handleTechClick_); - - // If the controls were hidden we don't want that to change without a tap event - // so we'll check if the controls were already showing before reporting user - // activity - this.on(this.tech_, 'touchstart', this.handleTechTouchStart_); - this.on(this.tech_, 'touchmove', this.handleTechTouchMove_); - this.on(this.tech_, 'touchend', this.handleTechTouchEnd_); - - // The tap listener needs to come after the touchend listener because the tap - // listener cancels out any reportedUserActivity when setting userActive(false) - this.on(this.tech_, 'tap', this.handleTechTap_); - }; - - /** - * Remove the listeners used for click and tap controls. This is needed for - * toggling to controls disabled, where a tap/touch should do nothing. - * - * @private - */ - - - Player.prototype.removeTechControlsListeners_ = function removeTechControlsListeners_() { - // We don't want to just use `this.off()` because there might be other needed - // listeners added by techs that extend this. - this.off(this.tech_, 'tap', this.handleTechTap_); - this.off(this.tech_, 'touchstart', this.handleTechTouchStart_); - this.off(this.tech_, 'touchmove', this.handleTechTouchMove_); - this.off(this.tech_, 'touchend', this.handleTechTouchEnd_); - this.off(this.tech_, 'mousedown', this.handleTechClick_); - }; - - /** - * Player waits for the tech to be ready - * - * @private - */ - - - Player.prototype.handleTechReady_ = function handleTechReady_() { - this.triggerReady(); - - // Keep the same volume as before - if (this.cache_.volume) { - this.techCall_('setVolume', this.cache_.volume); - } - - // Look if the tech found a higher resolution poster while loading - this.handleTechPosterChange_(); - - // Update the duration if available - this.handleTechDurationChange_(); - - // Chrome and Safari both have issues with autoplay. - // In Safari (5.1.1), when we move the video element into the container div, autoplay doesn't work. - // In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays) - // This fixes both issues. Need to wait for API, so it updates displays correctly - if ((this.src() || this.currentSrc()) && this.tag && this.options_.autoplay && this.paused()) { - try { - // Chrome Fix. Fixed in Chrome v16. - delete this.tag.poster; - } catch (e) { - log$1('deleting tag.poster throws in some browsers', e); - } - this.play(); - } - }; - - /** - * Retrigger the `loadstart` event that was triggered by the {@link Tech}. This - * function will also trigger {@link Player#firstplay} if it is the first loadstart - * for a video. - * - * @fires Player#loadstart - * @fires Player#firstplay - * @listens Tech#loadstart - * @private - */ - - - Player.prototype.handleTechLoadStart_ = function handleTechLoadStart_() { - // TODO: Update to use `emptied` event instead. See #1277. - - this.removeClass('vjs-ended'); - this.removeClass('vjs-seeking'); - - // reset the error state - this.error(null); - - // If it's already playing we want to trigger a firstplay event now. - // The firstplay event relies on both the play and loadstart events - // which can happen in any order for a new source - if (!this.paused()) { - /** - * Fired when the user agent begins looking for media data - * - * @event Player#loadstart - * @type {EventTarget~Event} - */ - this.trigger('loadstart'); - this.trigger('firstplay'); - } else { - // reset the hasStarted state - this.hasStarted(false); - this.trigger('loadstart'); - } - }; - - /** - * Add/remove the vjs-has-started class - * - * @fires Player#firstplay - * - * @param {boolean} hasStarted - * - true: adds the class - * - false: remove the class - * - * @return {boolean} - * the boolean value of hasStarted - */ - - - Player.prototype.hasStarted = function hasStarted(_hasStarted) { - if (_hasStarted !== undefined) { - // only update if this is a new value - if (this.hasStarted_ !== _hasStarted) { - this.hasStarted_ = _hasStarted; - if (_hasStarted) { - this.addClass('vjs-has-started'); - // trigger the firstplay event if this newly has played - this.trigger('firstplay'); - } else { - this.removeClass('vjs-has-started'); - } - } - return; - } - return !!this.hasStarted_; - }; - - /** - * Fired whenever the media begins or resumes playback - * - * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-play} - * @fires Player#play - * @listens Tech#play - * @private - */ - - - Player.prototype.handleTechPlay_ = function handleTechPlay_() { - this.removeClass('vjs-ended'); - this.removeClass('vjs-paused'); - this.addClass('vjs-playing'); - - // hide the poster when the user hits play - this.hasStarted(true); - /** - * Triggered whenever an {@link Tech#play} event happens. Indicates that - * playback has started or resumed. - * - * @event Player#play - * @type {EventTarget~Event} - */ - this.trigger('play'); - }; - - /** - * Retrigger the `waiting` event that was triggered by the {@link Tech}. - * - * @fires Player#waiting - * @listens Tech#waiting - * @private - */ - - - Player.prototype.handleTechWaiting_ = function handleTechWaiting_() { - var _this4 = this; - - this.addClass('vjs-waiting'); - /** - * A readyState change on the DOM element has caused playback to stop. - * - * @event Player#waiting - * @type {EventTarget~Event} - */ - this.trigger('waiting'); - this.one('timeupdate', function () { - return _this4.removeClass('vjs-waiting'); - }); - }; - - /** - * Retrigger the `canplay` event that was triggered by the {@link Tech}. - * > Note: This is not consistent between browsers. See #1351 - * - * @fires Player#canplay - * @listens Tech#canplay - * @private - */ - - - Player.prototype.handleTechCanPlay_ = function handleTechCanPlay_() { - this.removeClass('vjs-waiting'); - /** - * The media has a readyState of HAVE_FUTURE_DATA or greater. - * - * @event Player#canplay - * @type {EventTarget~Event} - */ - this.trigger('canplay'); - }; - - /** - * Retrigger the `canplaythrough` event that was triggered by the {@link Tech}. - * - * @fires Player#canplaythrough - * @listens Tech#canplaythrough - * @private - */ - - - Player.prototype.handleTechCanPlayThrough_ = function handleTechCanPlayThrough_() { - this.removeClass('vjs-waiting'); - /** - * The media has a readyState of HAVE_ENOUGH_DATA or greater. This means that the - * entire media file can be played without buffering. - * - * @event Player#canplaythrough - * @type {EventTarget~Event} - */ - this.trigger('canplaythrough'); - }; - - /** - * Retrigger the `playing` event that was triggered by the {@link Tech}. - * - * @fires Player#playing - * @listens Tech#playing - * @private - */ - - - Player.prototype.handleTechPlaying_ = function handleTechPlaying_() { - this.removeClass('vjs-waiting'); - /** - * The media is no longer blocked from playback, and has started playing. - * - * @event Player#playing - * @type {EventTarget~Event} - */ - this.trigger('playing'); - }; - - /** - * Retrigger the `seeking` event that was triggered by the {@link Tech}. - * - * @fires Player#seeking - * @listens Tech#seeking - * @private - */ - - - Player.prototype.handleTechSeeking_ = function handleTechSeeking_() { - this.addClass('vjs-seeking'); - /** - * Fired whenever the player is jumping to a new time - * - * @event Player#seeking - * @type {EventTarget~Event} - */ - this.trigger('seeking'); - }; - - /** - * Retrigger the `seeked` event that was triggered by the {@link Tech}. - * - * @fires Player#seeked - * @listens Tech#seeked - * @private - */ - - - Player.prototype.handleTechSeeked_ = function handleTechSeeked_() { - this.removeClass('vjs-seeking'); - /** - * Fired when the player has finished jumping to a new time - * - * @event Player#seeked - * @type {EventTarget~Event} - */ - this.trigger('seeked'); - }; - - /** - * Retrigger the `firstplay` event that was triggered by the {@link Tech}. - * - * @fires Player#firstplay - * @listens Tech#firstplay - * @deprecated As of 6.0 firstplay event is deprecated. - * @deprecated As of 6.0 passing the `starttime` option to the player and the firstplay event are deprecated. - * @private - */ - - - Player.prototype.handleTechFirstPlay_ = function handleTechFirstPlay_() { - // If the first starttime attribute is specified - // then we will start at the given offset in seconds - if (this.options_.starttime) { - log$1.warn('Passing the `starttime` option to the player will be deprecated in 6.0'); - this.currentTime(this.options_.starttime); - } - - this.addClass('vjs-has-started'); - /** - * Fired the first time a video is played. Not part of the HLS spec, and this is - * probably not the best implementation yet, so use sparingly. If you don't have a - * reason to prevent playback, use `myPlayer.one('play');` instead. - * - * @event Player#firstplay - * @deprecated As of 6.0 firstplay event is deprecated. - * @type {EventTarget~Event} - */ - this.trigger('firstplay'); - }; - - /** - * Retrigger the `pause` event that was triggered by the {@link Tech}. - * - * @fires Player#pause - * @listens Tech#pause - * @private - */ - - - Player.prototype.handleTechPause_ = function handleTechPause_() { - this.removeClass('vjs-playing'); - this.addClass('vjs-paused'); - /** - * Fired whenever the media has been paused - * - * @event Player#pause - * @type {EventTarget~Event} - */ - this.trigger('pause'); - }; - - /** - * Retrigger the `ended` event that was triggered by the {@link Tech}. - * - * @fires Player#ended - * @listens Tech#ended - * @private - */ - - - Player.prototype.handleTechEnded_ = function handleTechEnded_() { - this.addClass('vjs-ended'); - if (this.options_.loop) { - this.currentTime(0); - this.play(); - } else if (!this.paused()) { - this.pause(); - } - - /** - * Fired when the end of the media resource is reached (currentTime == duration) - * - * @event Player#ended - * @type {EventTarget~Event} - */ - this.trigger('ended'); - }; - - /** - * Fired when the duration of the media resource is first known or changed - * - * @listens Tech#durationchange - * @private - */ - - - Player.prototype.handleTechDurationChange_ = function handleTechDurationChange_() { - this.duration(this.techGet_('duration')); - }; - - /** - * Handle a click on the media element to play/pause - * - * @param {EventTarget~Event} event - * the event that caused this function to trigger - * - * @listens Tech#mousedown - * @private - */ - - - Player.prototype.handleTechClick_ = function handleTechClick_(event) { - // We're using mousedown to detect clicks thanks to Flash, but mousedown - // will also be triggered with right-clicks, so we need to prevent that - if (event.button !== 0) { - return; - } - - // When controls are disabled a click should not toggle playback because - // the click is considered a control - if (this.controls()) { - if (this.paused()) { - this.play(); - } else { - this.pause(); - } - } - }; - - /** - * Handle a tap on the media element. It will toggle the user - * activity state, which hides and shows the controls. - * - * @listens Tech#tap - * @private - */ - - - Player.prototype.handleTechTap_ = function handleTechTap_() { - this.userActive(!this.userActive()); - }; - - /** - * Handle touch to start - * - * @listens Tech#touchstart - * @private - */ - - - Player.prototype.handleTechTouchStart_ = function handleTechTouchStart_() { - this.userWasActive = this.userActive(); - }; - - /** - * Handle touch to move - * - * @listens Tech#touchmove - * @private - */ - - - Player.prototype.handleTechTouchMove_ = function handleTechTouchMove_() { - if (this.userWasActive) { - this.reportUserActivity(); - } - }; - - /** - * Handle touch to end - * - * @param {EventTarget~Event} event - * the touchend event that triggered - * this function - * - * @listens Tech#touchend - * @private - */ - - - Player.prototype.handleTechTouchEnd_ = function handleTechTouchEnd_(event) { - // Stop the mouse events from also happening - event.preventDefault(); - }; - - /** - * Fired when the player switches in or out of fullscreen mode - * - * @private - * @listens Player#fullscreenchange - */ - - - Player.prototype.handleFullscreenChange_ = function handleFullscreenChange_() { - if (this.isFullscreen()) { - this.addClass('vjs-fullscreen'); - } else { - this.removeClass('vjs-fullscreen'); - } - }; - - /** - * native click events on the SWF aren't triggered on IE11, Win8.1RT - * use stageclick events triggered from inside the SWF instead - * - * @private - * @listens stageclick - */ - - - Player.prototype.handleStageClick_ = function handleStageClick_() { - this.reportUserActivity(); - }; - - /** - * Handle Tech Fullscreen Change - * - * @param {EventTarget~Event} event - * the fullscreenchange event that triggered this function - * - * @param {Object} data - * the data that was sent with the event - * - * @private - * @listens Tech#fullscreenchange - * @fires Player#fullscreenchange - */ - - - Player.prototype.handleTechFullscreenChange_ = function handleTechFullscreenChange_(event, data) { - if (data) { - this.isFullscreen(data.isFullscreen); - } - /** - * Fired when going in and out of fullscreen. - * - * @event Player#fullscreenchange - * @type {EventTarget~Event} - */ - this.trigger('fullscreenchange'); - }; - - /** - * Fires when an error occurred during the loading of an audio/video. - * - * @private - * @listens Tech#error - */ - - - Player.prototype.handleTechError_ = function handleTechError_() { - var error = this.tech_.error(); - - this.error(error); - }; - - /** - * Retrigger the `textdata` event that was triggered by the {@link Tech}. - * - * @fires Player#textdata - * @listens Tech#textdata - * @private - */ - - - Player.prototype.handleTechTextData_ = function handleTechTextData_() { - var data = null; - - if (arguments.length > 1) { - data = arguments[1]; - } - - /** - * Fires when we get a textdata event from tech - * - * @event Player#textdata - * @type {EventTarget~Event} - */ - this.trigger('textdata', data); - }; - - /** - * Get object for cached values. - * - * @return {Object} - * get the current object cache - */ - - - Player.prototype.getCache = function getCache() { - return this.cache_; - }; - - /** - * Pass values to the playback tech - * - * @param {string} [method] - * the method to call - * - * @param {Object} arg - * the argument to pass - * - * @private - */ - - - Player.prototype.techCall_ = function techCall_(method, arg) { - // If it's not ready yet, call method when it is - - this.ready(function () { - if (method in allowedSetters) { - return set$1(this.middleware_, this.tech_, method, arg); - } - - try { - if (this.tech_) { - this.tech_[method](arg); - } - } catch (e) { - log$1(e); - throw e; - } - }, true); - }; - - /** - * Get calls can't wait for the tech, and sometimes don't need to. - * - * @param {string} method - * Tech method - * - * @return {Function|undefined} - * the method or undefined - * - * @private - */ - - - Player.prototype.techGet_ = function techGet_(method) { - if (this.tech_ && this.tech_.isReady_) { - - if (method in allowedGetters) { - return get$1(this.middleware_, this.tech_, method); - } - - // Flash likes to die and reload when you hide or reposition it. - // In these cases the object methods go away and we get errors. - // When that happens we'll catch the errors and inform tech that it's not ready any more. - try { - return this.tech_[method](); - } catch (e) { - // When building additional tech libs, an expected method may not be defined yet - if (this.tech_[method] === undefined) { - log$1('Video.js: ' + method + ' method not defined for ' + this.techName_ + ' playback technology.', e); - - // When a method isn't available on the object it throws a TypeError - } else if (e.name === 'TypeError') { - log$1('Video.js: ' + method + ' unavailable on ' + this.techName_ + ' playback technology element.', e); - this.tech_.isReady_ = false; - } else { - log$1(e); - } - throw e; - } - } - - return; - }; - - /** - * start media playback - * - * @return {Promise|undefined} - * Returns a `Promise` if the browser returns one, for most browsers this will - * return undefined. - */ - - - Player.prototype.play = function play() { - if (this.changingSrc_) { - this.ready(function () { - var retval = this.techGet_('play'); - - // silence errors (unhandled promise from play) - if (retval !== undefined && typeof retval.then === 'function') { - retval.then(null, function (e) {}); - } - }); - - // Only calls the tech's play if we already have a src loaded - } else if (this.isReady_ && (this.src() || this.currentSrc())) { - return this.techGet_('play'); - } else { - this.ready(function () { - this.tech_.one('loadstart', function () { - var retval = this.play(); - - // silence errors (unhandled promise from play) - if (retval !== undefined && typeof retval.then === 'function') { - retval.then(null, function (e) {}); - } - }); - }); - } - }; - - /** - * Pause the video playback - * - * @return {Player} - * A reference to the player object this function was called on - */ - - - Player.prototype.pause = function pause() { - this.techCall_('pause'); - }; - - /** - * Check if the player is paused or has yet to play - * - * @return {boolean} - * - false: if the media is currently playing - * - true: if media is not currently playing - */ - - - Player.prototype.paused = function paused() { - // The initial state of paused should be true (in Safari it's actually false) - return this.techGet_('paused') === false ? false : true; - }; - - /** - * Get a TimeRange object representing the current ranges of time that the user - * has played. - * - * @return {TimeRange} - * A time range object that represents all the increments of time that have - * been played. - */ - - - Player.prototype.played = function played() { - return this.techGet_('played') || createTimeRanges(0, 0); - }; - - /** - * Returns whether or not the user is "scrubbing". Scrubbing is - * when the user has clicked the progress bar handle and is - * dragging it along the progress bar. - * - * @param {boolean} [isScrubbing] - * wether the user is or is not scrubbing - * - * @return {boolean} - * The value of scrubbing when getting - */ - - - Player.prototype.scrubbing = function scrubbing(isScrubbing) { - if (typeof isScrubbing === 'undefined') { - return this.scrubbing_; - } - this.scrubbing_ = !!isScrubbing; - - if (isScrubbing) { - this.addClass('vjs-scrubbing'); - } else { - this.removeClass('vjs-scrubbing'); - } - }; - - /** - * Get or set the current time (in seconds) - * - * @param {number|string} [seconds] - * The time to seek to in seconds - * - * @return {number} - * - the current time in seconds when getting - */ - - - Player.prototype.currentTime = function currentTime(seconds) { - if (typeof seconds !== 'undefined') { - this.techCall_('setCurrentTime', seconds); - return; - } - - // cache last currentTime and return. default to 0 seconds - // - // Caching the currentTime is meant to prevent a massive amount of reads on the tech's - // currentTime when scrubbing, but may not provide much performance benefit afterall. - // Should be tested. Also something has to read the actual current time or the cache will - // never get updated. - this.cache_.currentTime = this.techGet_('currentTime') || 0; - return this.cache_.currentTime; - }; - - /** - * Normally gets the length in time of the video in seconds; - * in all but the rarest use cases an argument will NOT be passed to the method - * - * > **NOTE**: The video must have started loading before the duration can be - * known, and in the case of Flash, may not be known until the video starts - * playing. - * - * @fires Player#durationchange - * - * @param {number} [seconds] - * The duration of the video to set in seconds - * - * @return {number} - * - The duration of the video in seconds when getting - */ - - - Player.prototype.duration = function duration(seconds) { - if (seconds === undefined) { - return this.cache_.duration || 0; - } - - seconds = parseFloat(seconds) || 0; - - // Standardize on Inifity for signaling video is live - if (seconds < 0) { - seconds = Infinity; - } - - if (seconds !== this.cache_.duration) { - // Cache the last set value for optimized scrubbing (esp. Flash) - this.cache_.duration = seconds; - - if (seconds === Infinity) { - this.addClass('vjs-live'); - } else { - this.removeClass('vjs-live'); - } - /** - * @event Player#durationchange - * @type {EventTarget~Event} - */ - this.trigger('durationchange'); - } - }; - - /** - * Calculates how much time is left in the video. Not part - * of the native video API. - * - * @return {number} - * The time remaining in seconds - */ - - - Player.prototype.remainingTime = function remainingTime() { - return this.duration() - this.currentTime(); - }; - - // - // Kind of like an array of portions of the video that have been downloaded. - - /** - * Get a TimeRange object with an array of the times of the video - * that have been downloaded. If you just want the percent of the - * video that's been downloaded, use bufferedPercent. - * - * @see [Buffered Spec]{@link http://dev.w3.org/html5/spec/video.html#dom-media-buffered} - * - * @return {TimeRange} - * A mock TimeRange object (following HTML spec) - */ - - - Player.prototype.buffered = function buffered() { - var buffered = this.techGet_('buffered'); - - if (!buffered || !buffered.length) { - buffered = createTimeRanges(0, 0); - } - - return buffered; - }; - - /** - * Get the percent (as a decimal) of the video that's been downloaded. - * This method is not a part of the native HTML video API. - * - * @return {number} - * A decimal between 0 and 1 representing the percent - * that is bufferred 0 being 0% and 1 being 100% - */ - - - Player.prototype.bufferedPercent = function bufferedPercent$$1() { - return bufferedPercent(this.buffered(), this.duration()); - }; - - /** - * Get the ending time of the last buffered time range - * This is used in the progress bar to encapsulate all time ranges. - * - * @return {number} - * The end of the last buffered time range - */ - - - Player.prototype.bufferedEnd = function bufferedEnd() { - var buffered = this.buffered(); - var duration = this.duration(); - var end = buffered.end(buffered.length - 1); - - if (end > duration) { - end = duration; - } - - return end; - }; - - /** - * Get or set the current volume of the media - * - * @param {number} [percentAsDecimal] - * The new volume as a decimal percent: - * - 0 is muted/0%/off - * - 1.0 is 100%/full - * - 0.5 is half volume or 50% - * - * @return {number} - * The current volume as a percent when getting - */ - - - Player.prototype.volume = function volume(percentAsDecimal) { - var vol = void 0; - - if (percentAsDecimal !== undefined) { - // Force value to between 0 and 1 - vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); - this.cache_.volume = vol; - this.techCall_('setVolume', vol); - - if (vol > 0) { - this.lastVolume_(vol); - } - - return; - } - - // Default to 1 when returning current volume. - vol = parseFloat(this.techGet_('volume')); - return isNaN(vol) ? 1 : vol; - }; - - /** - * Get the current muted state, or turn mute on or off - * - * @param {boolean} [muted] - * - true to mute - * - false to unmute - * - * @return {boolean} - * - true if mute is on and getting - * - false if mute is off and getting - */ - - - Player.prototype.muted = function muted(_muted) { - if (_muted !== undefined) { - this.techCall_('setMuted', _muted); - return; - } - return this.techGet_('muted') || false; - }; - - /** - * Get the current defaultMuted state, or turn defaultMuted on or off. defaultMuted - * indicates the state of muted on intial playback. - * - * ```js - * var myPlayer = videojs('some-player-id'); - * - * myPlayer.src("http://www.example.com/path/to/video.mp4"); - * - * // get, should be false - * console.log(myPlayer.defaultMuted()); - * // set to true - * myPlayer.defaultMuted(true); - * // get should be true - * console.log(myPlayer.defaultMuted()); - * ``` - * - * @param {boolean} [defaultMuted] - * - true to mute - * - false to unmute - * - * @return {boolean|Player} - * - true if defaultMuted is on and getting - * - false if defaultMuted is off and getting - * - A reference to the current player when setting - */ - - - Player.prototype.defaultMuted = function defaultMuted(_defaultMuted) { - if (_defaultMuted !== undefined) { - return this.techCall_('setDefaultMuted', _defaultMuted); - } - return this.techGet_('defaultMuted') || false; - }; - - /** - * Get the last volume, or set it - * - * @param {number} [percentAsDecimal] - * The new last volume as a decimal percent: - * - 0 is muted/0%/off - * - 1.0 is 100%/full - * - 0.5 is half volume or 50% - * - * @return {number} - * the current value of lastVolume as a percent when getting - * - * @private - */ - - - Player.prototype.lastVolume_ = function lastVolume_(percentAsDecimal) { - if (percentAsDecimal !== undefined && percentAsDecimal !== 0) { - this.cache_.lastVolume = percentAsDecimal; - return; - } - return this.cache_.lastVolume; - }; - - /** - * Check if current tech can support native fullscreen - * (e.g. with built in controls like iOS, so not our flash swf) - * - * @return {boolean} - * if native fullscreen is supported - */ - - - Player.prototype.supportsFullScreen = function supportsFullScreen() { - return this.techGet_('supportsFullScreen') || false; - }; - - /** - * Check if the player is in fullscreen mode or tell the player that it - * is or is not in fullscreen mode. - * - * > NOTE: As of the latest HTML5 spec, isFullscreen is no longer an official - * property and instead document.fullscreenElement is used. But isFullscreen is - * still a valuable property for internal player workings. - * - * @param {boolean} [isFS] - * Set the players current fullscreen state - * - * @return {boolean} - * - true if fullscreen is on and getting - * - false if fullscreen is off and getting - */ - - - Player.prototype.isFullscreen = function isFullscreen(isFS) { - if (isFS !== undefined) { - this.isFullscreen_ = !!isFS; - return; - } - return !!this.isFullscreen_; - }; - - /** - * Increase the size of the video to full screen - * In some browsers, full screen is not supported natively, so it enters - * "full window mode", where the video fills the browser window. - * In browsers and devices that support native full screen, sometimes the - * browser's default controls will be shown, and not the Video.js custom skin. - * This includes most mobile devices (iOS, Android) and older versions of - * Safari. - * - * @fires Player#fullscreenchange - */ - - - Player.prototype.requestFullscreen = function requestFullscreen() { - var fsApi = FullscreenApi; - - this.isFullscreen(true); - - if (fsApi.requestFullscreen) { - // the browser supports going fullscreen at the element level so we can - // take the controls fullscreen as well as the video - - // Trigger fullscreenchange event after change - // We have to specifically add this each time, and remove - // when canceling fullscreen. Otherwise if there's multiple - // players on a page, they would all be reacting to the same fullscreen - // events - on(document_1, fsApi.fullscreenchange, bind(this, function documentFullscreenChange(e) { - this.isFullscreen(document_1[fsApi.fullscreenElement]); - - // If cancelling fullscreen, remove event listener. - if (this.isFullscreen() === false) { - off(document_1, fsApi.fullscreenchange, documentFullscreenChange); - } - /** - * @event Player#fullscreenchange - * @type {EventTarget~Event} - */ - this.trigger('fullscreenchange'); - })); - - this.el_[fsApi.requestFullscreen](); - } else if (this.tech_.supportsFullScreen()) { - // we can't take the video.js controls fullscreen but we can go fullscreen - // with native controls - this.techCall_('enterFullScreen'); - } else { - // fullscreen isn't supported so we'll just stretch the video element to - // fill the viewport - this.enterFullWindow(); - /** - * @event Player#fullscreenchange - * @type {EventTarget~Event} - */ - this.trigger('fullscreenchange'); - } - }; - - /** - * Return the video to its normal size after having been in full screen mode - * - * @fires Player#fullscreenchange - */ - - - Player.prototype.exitFullscreen = function exitFullscreen() { - var fsApi = FullscreenApi; - - this.isFullscreen(false); - - // Check for browser element fullscreen support - if (fsApi.requestFullscreen) { - document_1[fsApi.exitFullscreen](); - } else if (this.tech_.supportsFullScreen()) { - this.techCall_('exitFullScreen'); - } else { - this.exitFullWindow(); - /** - * @event Player#fullscreenchange - * @type {EventTarget~Event} - */ - this.trigger('fullscreenchange'); - } - }; - - /** - * When fullscreen isn't supported we can stretch the - * video container to as wide as the browser will let us. - * - * @fires Player#enterFullWindow - */ - - - Player.prototype.enterFullWindow = function enterFullWindow() { - this.isFullWindow = true; - - // Storing original doc overflow value to return to when fullscreen is off - this.docOrigOverflow = document_1.documentElement.style.overflow; - - // Add listener for esc key to exit fullscreen - on(document_1, 'keydown', bind(this, this.fullWindowOnEscKey)); - - // Hide any scroll bars - document_1.documentElement.style.overflow = 'hidden'; - - // Apply fullscreen styles - addClass(document_1.body, 'vjs-full-window'); - - /** - * @event Player#enterFullWindow - * @type {EventTarget~Event} - */ - this.trigger('enterFullWindow'); - }; - - /** - * Check for call to either exit full window or - * full screen on ESC key - * - * @param {string} event - * Event to check for key press - */ - - - Player.prototype.fullWindowOnEscKey = function fullWindowOnEscKey(event) { - if (event.keyCode === 27) { - if (this.isFullscreen() === true) { - this.exitFullscreen(); - } else { - this.exitFullWindow(); - } - } - }; - - /** - * Exit full window - * - * @fires Player#exitFullWindow - */ - - - Player.prototype.exitFullWindow = function exitFullWindow() { - this.isFullWindow = false; - off(document_1, 'keydown', this.fullWindowOnEscKey); - - // Unhide scroll bars. - document_1.documentElement.style.overflow = this.docOrigOverflow; - - // Remove fullscreen styles - removeClass(document_1.body, 'vjs-full-window'); - - // Resize the box, controller, and poster to original sizes - // this.positionAll(); - /** - * @event Player#exitFullWindow - * @type {EventTarget~Event} - */ - this.trigger('exitFullWindow'); - }; - - /** - * Check whether the player can play a given mimetype - * - * @see https://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-navigator-canplaytype - * - * @param {string} type - * The mimetype to check - * - * @return {string} - * 'probably', 'maybe', or '' (empty string) - */ - - - Player.prototype.canPlayType = function canPlayType(type) { - var can = void 0; - - // Loop through each playback technology in the options order - for (var i = 0, j = this.options_.techOrder; i < j.length; i++) { - var techName = j[i]; - var tech = Tech.getTech(techName); - - // Support old behavior of techs being registered as components. - // Remove once that deprecated behavior is removed. - if (!tech) { - tech = Component.getComponent(techName); - } - - // Check if the current tech is defined before continuing - if (!tech) { - log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.'); - continue; - } - - // Check if the browser supports this technology - if (tech.isSupported()) { - can = tech.canPlayType(type); - - if (can) { - return can; - } - } - } - - return ''; - }; - - /** - * Select source based on tech-order or source-order - * Uses source-order selection if `options.sourceOrder` is truthy. Otherwise, - * defaults to tech-order selection - * - * @param {Array} sources - * The sources for a media asset - * - * @return {Object|boolean} - * Object of source and tech order or false - */ - - - Player.prototype.selectSource = function selectSource(sources) { - var _this5 = this; - - // Get only the techs specified in `techOrder` that exist and are supported by the - // current platform - var techs = this.options_.techOrder.map(function (techName) { - return [techName, Tech.getTech(techName)]; - }).filter(function (_ref) { - var techName = _ref[0], - tech = _ref[1]; - - // Check if the current tech is defined before continuing - if (tech) { - // Check if the browser supports this technology - return tech.isSupported(); - } - - log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.'); - return false; - }); - - // Iterate over each `innerArray` element once per `outerArray` element and execute - // `tester` with both. If `tester` returns a non-falsy value, exit early and return - // that value. - var findFirstPassingTechSourcePair = function findFirstPassingTechSourcePair(outerArray, innerArray, tester) { - var found = void 0; - - outerArray.some(function (outerChoice) { - return innerArray.some(function (innerChoice) { - found = tester(outerChoice, innerChoice); - - if (found) { - return true; - } - }); - }); - - return found; - }; - - var foundSourceAndTech = void 0; - var flip = function flip(fn) { - return function (a, b) { - return fn(b, a); - }; - }; - var finder = function finder(_ref2, source) { - var techName = _ref2[0], - tech = _ref2[1]; - - if (tech.canPlaySource(source, _this5.options_[techName.toLowerCase()])) { - return { source: source, tech: techName }; - } - }; - - // Depending on the truthiness of `options.sourceOrder`, we swap the order of techs and sources - // to select from them based on their priority. - if (this.options_.sourceOrder) { - // Source-first ordering - foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder)); - } else { - // Tech-first ordering - foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder); - } - - return foundSourceAndTech || false; - }; - - /** - * The source function updates the video source - * There are three types of variables you can pass as the argument. - * **URL string**: A URL to the the video file. Use this method if you are sure - * the current playback technology (HTML5/Flash) can support the source you - * provide. Currently only MP4 files can be used in both HTML5 and Flash. - * - * @param {Tech~SourceObject|Tech~SourceObject[]} [source] - * One SourceObject or an array of SourceObjects - * - * @return {string} - * The current video source when getting - */ - - - Player.prototype.src = function src(source) { - var _this6 = this; - - // getter usage - if (typeof source === 'undefined') { - return this.cache_.src; - } - // filter out invalid sources and turn our source into - // an array of source objects - var sources = filterSource(source); - - // if a source was passed in then it is invalid because - // it was filtered to a zero length Array. So we have to - // show an error - if (!sources.length) { - this.setTimeout(function () { - this.error({ code: 4, message: this.localize(this.options_.notSupportedMessage) }); - }, 0); - return; - } - - // intial sources - this.cache_.sources = sources; - this.changingSrc_ = true; - - // intial source - this.cache_.source = sources[0]; - - // middlewareSource is the source after it has been changed by middleware - setSource(this, sources[0], function (middlewareSource, mws) { - _this6.middleware_ = mws; - - var err = _this6.src_(middlewareSource); - - if (err) { - if (sources.length > 1) { - return _this6.src(sources.slice(1)); - } - - // We need to wrap this in a timeout to give folks a chance to add error event handlers - _this6.setTimeout(function () { - this.error({ code: 4, message: this.localize(this.options_.notSupportedMessage) }); - }, 0); - - // we could not find an appropriate tech, but let's still notify the delegate that this is it - // this needs a better comment about why this is needed - _this6.triggerReady(); - - return; - } - - _this6.changingSrc_ = false; - // video element listed source - _this6.cache_.src = middlewareSource.src; - - setTech(mws, _this6.tech_); - }); - }; - - /** - * Set the source object on the tech, returns a boolean that indicates wether - * there is a tech that can play the source or not - * - * @param {Tech~SourceObject} source - * The source object to set on the Tech - * - * @return {Boolean} - * - True if there is no Tech to playback this source - * - False otherwise - * - * @private - */ - - - Player.prototype.src_ = function src_(source) { - var sourceTech = this.selectSource([source]); - - if (!sourceTech) { - return true; - } - - if (!titleCaseEquals(sourceTech.tech, this.techName_)) { - this.changingSrc_ = true; - - // load this technology with the chosen source - this.loadTech_(sourceTech.tech, sourceTech.source); - return false; - } - - // wait until the tech is ready to set the source - this.ready(function () { - - // The setSource tech method was added with source handlers - // so older techs won't support it - // We need to check the direct prototype for the case where subclasses - // of the tech do not support source handlers - if (this.tech_.constructor.prototype.hasOwnProperty('setSource')) { - this.techCall_('setSource', source); - } else { - this.techCall_('src', source.src); - } - - if (this.options_.preload === 'auto') { - this.load(); - } - - if (this.options_.autoplay) { - this.play(); - } - - // Set the source synchronously if possible (#2326) - }, true); - - return false; - }; - - /** - * Begin loading the src data. - */ - - - Player.prototype.load = function load() { - this.techCall_('load'); - }; - - /** - * Reset the player. Loads the first tech in the techOrder, - * and calls `reset` on the tech`. - */ - - - Player.prototype.reset = function reset() { - this.loadTech_(this.options_.techOrder[0], null); - this.techCall_('reset'); - }; - - /** - * Returns all of the current source objects. - * - * @return {Tech~SourceObject[]} - * The current source objects - */ - - - Player.prototype.currentSources = function currentSources() { - var source = this.currentSource(); - var sources = []; - - // assume `{}` or `{ src }` - if (Object.keys(source).length !== 0) { - sources.push(source); - } - - return this.cache_.sources || sources; - }; - - /** - * Returns the current source object. - * - * @return {Tech~SourceObject} - * The current source object - */ - - - Player.prototype.currentSource = function currentSource() { - return this.cache_.source || {}; - }; - - /** - * Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4 - * Can be used in conjuction with `currentType` to assist in rebuilding the current source object. - * - * @return {string} - * The current source - */ - - - Player.prototype.currentSrc = function currentSrc() { - return this.currentSource() && this.currentSource().src || ''; - }; - - /** - * Get the current source type e.g. video/mp4 - * This can allow you rebuild the current source object so that you could load the same - * source and tech later - * - * @return {string} - * The source MIME type - */ - - - Player.prototype.currentType = function currentType() { - return this.currentSource() && this.currentSource().type || ''; - }; - - /** - * Get or set the preload attribute - * - * @param {boolean} [value] - * - true means that we should preload - * - false maens that we should not preload - * - * @return {string} - * The preload attribute value when getting - */ - - - Player.prototype.preload = function preload(value) { - if (value !== undefined) { - this.techCall_('setPreload', value); - this.options_.preload = value; - return; - } - return this.techGet_('preload'); - }; - - /** - * Get or set the autoplay attribute. - * - * @param {boolean} [value] - * - true means that we should autoplay - * - false means that we should not autoplay - * - * @return {string} - * The current value of autoplay when getting - */ - - - Player.prototype.autoplay = function autoplay(value) { - if (value !== undefined) { - this.techCall_('setAutoplay', value); - this.options_.autoplay = value; - return; - } - return this.techGet_('autoplay', value); - }; - - /** - * Set or unset the playsinline attribute. - * Playsinline tells the browser that non-fullscreen playback is preferred. - * - * @param {boolean} [value] - * - true means that we should try to play inline by default - * - false means that we should use the browser's default playback mode, - * which in most cases is inline. iOS Safari is a notable exception - * and plays fullscreen by default. - * - * @return {string|Player} - * - the current value of playsinline - * - the player when setting - * - * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline} - */ - - - Player.prototype.playsinline = function playsinline(value) { - if (value !== undefined) { - this.techCall_('setPlaysinline', value); - this.options_.playsinline = value; - return this; - } - return this.techGet_('playsinline'); - }; - - /** - * Get or set the loop attribute on the video element. - * - * @param {boolean} [value] - * - true means that we should loop the video - * - false means that we should not loop the video - * - * @return {string} - * The current value of loop when getting - */ - - - Player.prototype.loop = function loop(value) { - if (value !== undefined) { - this.techCall_('setLoop', value); - this.options_.loop = value; - return; - } - return this.techGet_('loop'); - }; - - /** - * Get or set the poster image source url - * - * @fires Player#posterchange - * - * @param {string} [src] - * Poster image source URL - * - * @return {string} - * The current value of poster when getting - */ - - - Player.prototype.poster = function poster(src) { - if (src === undefined) { - return this.poster_; - } - - // The correct way to remove a poster is to set as an empty string - // other falsey values will throw errors - if (!src) { - src = ''; - } - - // update the internal poster variable - this.poster_ = src; - - // update the tech's poster - this.techCall_('setPoster', src); - - // alert components that the poster has been set - /** - * This event fires when the poster image is changed on the player. - * - * @event Player#posterchange - * @type {EventTarget~Event} - */ - this.trigger('posterchange'); - }; - - /** - * Some techs (e.g. YouTube) can provide a poster source in an - * asynchronous way. We want the poster component to use this - * poster source so that it covers up the tech's controls. - * (YouTube's play button). However we only want to use this - * source if the player user hasn't set a poster through - * the normal APIs. - * - * @fires Player#posterchange - * @listens Tech#posterchange - * @private - */ - - - Player.prototype.handleTechPosterChange_ = function handleTechPosterChange_() { - if (!this.poster_ && this.tech_ && this.tech_.poster) { - this.poster_ = this.tech_.poster() || ''; - - // Let components know the poster has changed - this.trigger('posterchange'); - } - }; - - /** - * Get or set whether or not the controls are showing. - * - * @fires Player#controlsenabled - * - * @param {boolean} [bool] - * - true to turn controls on - * - false to turn controls off - * - * @return {boolean} - * The current value of controls when getting - */ - - - Player.prototype.controls = function controls(bool) { - if (bool !== undefined) { - bool = !!bool; - - // Don't trigger a change event unless it actually changed - if (this.controls_ !== bool) { - this.controls_ = bool; - - if (this.usingNativeControls()) { - this.techCall_('setControls', bool); - } - - if (bool) { - this.removeClass('vjs-controls-disabled'); - this.addClass('vjs-controls-enabled'); - /** - * @event Player#controlsenabled - * @type {EventTarget~Event} - */ - this.trigger('controlsenabled'); - - if (!this.usingNativeControls()) { - this.addTechControlsListeners_(); - } - } else { - this.removeClass('vjs-controls-enabled'); - this.addClass('vjs-controls-disabled'); - /** - * @event Player#controlsdisabled - * @type {EventTarget~Event} - */ - this.trigger('controlsdisabled'); - - if (!this.usingNativeControls()) { - this.removeTechControlsListeners_(); - } - } - } - return; - } - return !!this.controls_; - }; - - /** - * Toggle native controls on/off. Native controls are the controls built into - * devices (e.g. default iPhone controls), Flash, or other techs - * (e.g. Vimeo Controls) - * **This should only be set by the current tech, because only the tech knows - * if it can support native controls** - * - * @fires Player#usingnativecontrols - * @fires Player#usingcustomcontrols - * - * @param {boolean} [bool] - * - true to turn native controls on - * - false to turn native controls off - * - * @return {boolean} - * The current value of native controls when getting - */ - - - Player.prototype.usingNativeControls = function usingNativeControls(bool) { - if (bool !== undefined) { - bool = !!bool; - - // Don't trigger a change event unless it actually changed - if (this.usingNativeControls_ !== bool) { - this.usingNativeControls_ = bool; - if (bool) { - this.addClass('vjs-using-native-controls'); - - /** - * player is using the native device controls - * - * @event Player#usingnativecontrols - * @type {EventTarget~Event} - */ - this.trigger('usingnativecontrols'); - } else { - this.removeClass('vjs-using-native-controls'); - - /** - * player is using the custom HTML controls - * - * @event Player#usingcustomcontrols - * @type {EventTarget~Event} - */ - this.trigger('usingcustomcontrols'); - } - } - return; - } - return !!this.usingNativeControls_; - }; - - /** - * Set or get the current MediaError - * - * @fires Player#error - * - * @param {MediaError|string|number} [err] - * A MediaError or a string/number to be turned - * into a MediaError - * - * @return {MediaError|null} - * The current MediaError when getting (or null) - */ - - - Player.prototype.error = function error(err) { - if (err === undefined) { - return this.error_ || null; - } - - // restoring to default - if (err === null) { - this.error_ = err; - this.removeClass('vjs-error'); - if (this.errorDisplay) { - this.errorDisplay.close(); - } - return; - } - - this.error_ = new MediaError(err); - - // add the vjs-error classname to the player - this.addClass('vjs-error'); - - // log the name of the error type and any message - // ie8 just logs "[object object]" if you just log the error object - log$1.error('(CODE:' + this.error_.code + ' ' + MediaError.errorTypes[this.error_.code] + ')', this.error_.message, this.error_); - - /** - * @event Player#error - * @type {EventTarget~Event} - */ - this.trigger('error'); - - return; - }; - - /** - * Report user activity - * - * @param {Object} event - * Event object - */ - - - Player.prototype.reportUserActivity = function reportUserActivity(event) { - this.userActivity_ = true; - }; - - /** - * Get/set if user is active - * - * @fires Player#useractive - * @fires Player#userinactive - * - * @param {boolean} [bool] - * - true if the user is active - * - false if the user is inactive - * - * @return {boolean} - * The current value of userActive when getting - */ - - - Player.prototype.userActive = function userActive(bool) { - if (bool !== undefined) { - bool = !!bool; - if (bool !== this.userActive_) { - this.userActive_ = bool; - if (bool) { - // If the user was inactive and is now active we want to reset the - // inactivity timer - this.userActivity_ = true; - this.removeClass('vjs-user-inactive'); - this.addClass('vjs-user-active'); - /** - * @event Player#useractive - * @type {EventTarget~Event} - */ - this.trigger('useractive'); - } else { - // We're switching the state to inactive manually, so erase any other - // activity - this.userActivity_ = false; - - // Chrome/Safari/IE have bugs where when you change the cursor it can - // trigger a mousemove event. This causes an issue when you're hiding - // the cursor when the user is inactive, and a mousemove signals user - // activity. Making it impossible to go into inactive mode. Specifically - // this happens in fullscreen when we really need to hide the cursor. - // - // When this gets resolved in ALL browsers it can be removed - // https://code.google.com/p/chromium/issues/detail?id=103041 - if (this.tech_) { - this.tech_.one('mousemove', function (e) { - e.stopPropagation(); - e.preventDefault(); - }); - } - - this.removeClass('vjs-user-active'); - this.addClass('vjs-user-inactive'); - /** - * @event Player#userinactive - * @type {EventTarget~Event} - */ - this.trigger('userinactive'); - } - } - return; - } - return this.userActive_; - }; - - /** - * Listen for user activity based on timeout value - * - * @private - */ - - - Player.prototype.listenForUserActivity_ = function listenForUserActivity_() { - var mouseInProgress = void 0; - var lastMoveX = void 0; - var lastMoveY = void 0; - var handleActivity = bind(this, this.reportUserActivity); - - var handleMouseMove = function handleMouseMove(e) { - // #1068 - Prevent mousemove spamming - // Chrome Bug: https://code.google.com/p/chromium/issues/detail?id=366970 - if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) { - lastMoveX = e.screenX; - lastMoveY = e.screenY; - handleActivity(); - } - }; - - var handleMouseDown = function handleMouseDown() { - handleActivity(); - // For as long as the they are touching the device or have their mouse down, - // we consider them active even if they're not moving their finger or mouse. - // So we want to continue to update that they are active - this.clearInterval(mouseInProgress); - // Setting userActivity=true now and setting the interval to the same time - // as the activityCheck interval (250) should ensure we never miss the - // next activityCheck - mouseInProgress = this.setInterval(handleActivity, 250); - }; - - var handleMouseUp = function handleMouseUp(event) { - handleActivity(); - // Stop the interval that maintains activity if the mouse/touch is down - this.clearInterval(mouseInProgress); - }; - - // Any mouse movement will be considered user activity - this.on('mousedown', handleMouseDown); - this.on('mousemove', handleMouseMove); - this.on('mouseup', handleMouseUp); - - // Listen for keyboard navigation - // Shouldn't need to use inProgress interval because of key repeat - this.on('keydown', handleActivity); - this.on('keyup', handleActivity); - - // Run an interval every 250 milliseconds instead of stuffing everything into - // the mousemove/touchmove function itself, to prevent performance degradation. - // `this.reportUserActivity` simply sets this.userActivity_ to true, which - // then gets picked up by this loop - // http://ejohn.org/blog/learning-from-twitter/ - var inactivityTimeout = void 0; - - this.setInterval(function () { - // Check to see if mouse/touch activity has happened - if (this.userActivity_) { - // Reset the activity tracker - this.userActivity_ = false; - - // If the user state was inactive, set the state to active - this.userActive(true); - - // Clear any existing inactivity timeout to start the timer over - this.clearTimeout(inactivityTimeout); - - var timeout = this.options_.inactivityTimeout; - - if (timeout > 0) { - // In <timeout> milliseconds, if no more activity has occurred the - // user will be considered inactive - inactivityTimeout = this.setTimeout(function () { - // Protect against the case where the inactivityTimeout can trigger just - // before the next user activity is picked up by the activity check loop - // causing a flicker - if (!this.userActivity_) { - this.userActive(false); - } - }, timeout); - } - } - }, 250); - }; - - /** - * Gets or sets the current playback rate. A playback rate of - * 1.0 represents normal speed and 0.5 would indicate half-speed - * playback, for instance. - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-playbackrate - * - * @param {number} [rate] - * New playback rate to set. - * - * @return {number} - * The current playback rate when getting or 1.0 - */ - - - Player.prototype.playbackRate = function playbackRate(rate) { - if (rate !== undefined) { - this.techCall_('setPlaybackRate', rate); - return; - } - - if (this.tech_ && this.tech_.featuresPlaybackRate) { - return this.techGet_('playbackRate'); - } - return 1.0; - }; - - /** - * Gets or sets the current default playback rate. A default playback rate of - * 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance. - * defaultPlaybackRate will only represent what the intial playbackRate of a video was, not - * not the current playbackRate. - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-defaultplaybackrate - * - * @param {number} [rate] - * New default playback rate to set. - * - * @return {number|Player} - * - The default playback rate when getting or 1.0 - * - the player when setting - */ - - - Player.prototype.defaultPlaybackRate = function defaultPlaybackRate(rate) { - if (rate !== undefined) { - return this.techCall_('setDefaultPlaybackRate', rate); - } - - if (this.tech_ && this.tech_.featuresPlaybackRate) { - return this.techGet_('defaultPlaybackRate'); - } - return 1.0; - }; - - /** - * Gets or sets the audio flag - * - * @param {boolean} bool - * - true signals that this is an audio player - * - false signals that this is not an audio player - * - * @return {boolean} - * The current value of isAudio when getting - */ - - - Player.prototype.isAudio = function isAudio(bool) { - if (bool !== undefined) { - this.isAudio_ = !!bool; - return; - } - - return !!this.isAudio_; - }; - - /** - * A helper method for adding a {@link TextTrack} to our - * {@link TextTrackList}. - * - * In addition to the W3C settings we allow adding additional info through options. - * - * @see http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack - * - * @param {string} [kind] - * the kind of TextTrack you are adding - * - * @param {string} [label] - * the label to give the TextTrack label - * - * @param {string} [language] - * the language to set on the TextTrack - * - * @return {TextTrack|undefined} - * the TextTrack that was added or undefined - * if there is no tech - */ - - - Player.prototype.addTextTrack = function addTextTrack(kind, label, language) { - if (this.tech_) { - return this.tech_.addTextTrack(kind, label, language); - } - }; - - /** - * Create a remote {@link TextTrack} and an {@link HTMLTrackElement}. It will - * automatically removed from the video element whenever the source changes, unless - * manualCleanup is set to false. - * - * @param {Object} options - * Options to pass to {@link HTMLTrackElement} during creation. See - * {@link HTMLTrackElement} for object properties that you should use. - * - * @param {boolean} [manualCleanup=true] if set to false, the TextTrack will be - * - * @return {HtmlTrackElement} - * the HTMLTrackElement that was created and added - * to the HtmlTrackElementList and the remote - * TextTrackList - * - * @deprecated The default value of the "manualCleanup" parameter will default - * to "false" in upcoming versions of Video.js - */ - - - Player.prototype.addRemoteTextTrack = function addRemoteTextTrack(options, manualCleanup) { - if (this.tech_) { - return this.tech_.addRemoteTextTrack(options, manualCleanup); - } - }; - - /** - * Remove a remote {@link TextTrack} from the respective - * {@link TextTrackList} and {@link HtmlTrackElementList}. - * - * @param {Object} track - * Remote {@link TextTrack} to remove - * - * @return {undefined} - * does not return anything - */ - - - Player.prototype.removeRemoteTextTrack = function removeRemoteTextTrack() { - var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref3$track = _ref3.track, - track = _ref3$track === undefined ? arguments[0] : _ref3$track; - - // destructure the input into an object with a track argument, defaulting to arguments[0] - // default the whole argument to an empty object if nothing was passed in - - if (this.tech_) { - return this.tech_.removeRemoteTextTrack(track); - } - }; - - /** - * Gets available media playback quality metrics as specified by the W3C's Media - * Playback Quality API. - * - * @see [Spec]{@link https://wicg.github.io/media-playback-quality} - * - * @return {Object|undefined} - * An object with supported media playback quality metrics or undefined if there - * is no tech or the tech does not support it. - */ - - - Player.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() { - return this.techGet_('getVideoPlaybackQuality'); - }; - - /** - * Get video width - * - * @return {number} - * current video width - */ - - - Player.prototype.videoWidth = function videoWidth() { - return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0; - }; - - /** - * Get video height - * - * @return {number} - * current video height - */ - - - Player.prototype.videoHeight = function videoHeight() { - return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0; - }; - - /** - * The player's language code - * NOTE: The language should be set in the player options if you want the - * the controls to be built with a specific language. Changing the lanugage - * later will not update controls text. - * - * @param {string} [code] - * the language code to set the player to - * - * @return {string} - * The current language code when getting - */ - - - Player.prototype.language = function language(code) { - if (code === undefined) { - return this.language_; - } - - this.language_ = String(code).toLowerCase(); - }; - - /** - * Get the player's language dictionary - * Merge every time, because a newly added plugin might call videojs.addLanguage() at any time - * Languages specified directly in the player options have precedence - * - * @return {Array} - * An array of of supported languages - */ - - - Player.prototype.languages = function languages() { - return mergeOptions(Player.prototype.options_.languages, this.languages_); - }; - - /** - * returns a JavaScript object reperesenting the current track - * information. **DOES not return it as JSON** - * - * @return {Object} - * Object representing the current of track info - */ - - - Player.prototype.toJSON = function toJSON() { - var options = mergeOptions(this.options_); - var tracks = options.tracks; - - options.tracks = []; - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - // deep merge tracks and null out player so no circular references - track = mergeOptions(track); - track.player = undefined; - options.tracks[i] = track; - } - - return options; - }; - - /** - * Creates a simple modal dialog (an instance of the {@link ModalDialog} - * component) that immediately overlays the player with arbitrary - * content and removes itself when closed. - * - * @param {string|Function|Element|Array|null} content - * Same as {@link ModalDialog#content}'s param of the same name. - * The most straight-forward usage is to provide a string or DOM - * element. - * - * @param {Object} [options] - * Extra options which will be passed on to the {@link ModalDialog}. - * - * @return {ModalDialog} - * the {@link ModalDialog} that was created - */ - - - Player.prototype.createModal = function createModal(content, options) { - var _this7 = this; - - options = options || {}; - options.content = content || ''; - - var modal = new ModalDialog(this, options); - - this.addChild(modal); - modal.on('dispose', function () { - _this7.removeChild(modal); - }); - - modal.open(); - return modal; - }; - - /** - * Gets tag settings - * - * @param {Element} tag - * The player tag - * - * @return {Object} - * An object containing all of the settings - * for a player tag - */ - - - Player.getTagSettings = function getTagSettings(tag) { - var baseOptions = { - sources: [], - tracks: [] - }; - - var tagOptions = getAttributes(tag); - var dataSetup = tagOptions['data-setup']; - - if (hasClass(tag, 'vjs-fluid')) { - tagOptions.fluid = true; - } - - // Check if data-setup attr exists. - if (dataSetup !== null) { - // Parse options JSON - // If empty string, make it a parsable json object. - var _safeParseTuple = tuple(dataSetup || '{}'), - err = _safeParseTuple[0], - data = _safeParseTuple[1]; - - if (err) { - log$1.error(err); - } - assign(tagOptions, data); - } - - assign(baseOptions, tagOptions); - - // Get tag children settings - if (tag.hasChildNodes()) { - var children = tag.childNodes; - - for (var i = 0, j = children.length; i < j; i++) { - var child = children[i]; - // Change case needed: http://ejohn.org/blog/nodename-case-sensitivity/ - var childName = child.nodeName.toLowerCase(); - - if (childName === 'source') { - baseOptions.sources.push(getAttributes(child)); - } else if (childName === 'track') { - baseOptions.tracks.push(getAttributes(child)); - } - } - } - - return baseOptions; - }; - - /** - * Determine wether or not flexbox is supported - * - * @return {boolean} - * - true if flexbox is supported - * - false if flexbox is not supported - */ - - - Player.prototype.flexNotSupported_ = function flexNotSupported_() { - var elem = document_1.createElement('i'); - - // Note: We don't actually use flexBasis (or flexOrder), but it's one of the more - // common flex features that we can rely on when checking for flex support. - return !('flexBasis' in elem.style || 'webkitFlexBasis' in elem.style || 'mozFlexBasis' in elem.style || 'msFlexBasis' in elem.style || - // IE10-specific (2012 flex spec) - 'msFlexOrder' in elem.style); - }; - - return Player; -}(Component); - -/** - * Get the {@link VideoTrackList} - * @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist - * - * @return {VideoTrackList} - * the current video track list - * - * @method Player.prototype.videoTracks - */ - -/** - * Get the {@link AudioTrackList} - * @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist - * - * @return {AudioTrackList} - * the current audio track list - * - * @method Player.prototype.audioTracks - */ - -/** - * Get the {@link TextTrackList} - * - * @link http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks - * - * @return {TextTrackList} - * the current text track list - * - * @method Player.prototype.textTracks - */ - -/** - * Get the remote {@link TextTrackList} - * - * @return {TextTrackList} - * The current remote text track list - * - * @method Player.prototype.textTracks - */ - -/** - * Get the remote {@link HtmlTrackElementList} tracks. - * - * @return {HtmlTrackElementList} - * The current remote text track element list - * - * @method Player.prototype.remoteTextTrackEls - */ - -ALL.names.forEach(function (name$$1) { - var props = ALL[name$$1]; - - Player.prototype[props.getterName] = function () { - if (this.tech_) { - return this.tech_[props.getterName](); - } - - // if we have not yet loadTech_, we create {video,audio,text}Tracks_ - // these will be passed to the tech during loading - this[props.privateName] = this[props.privateName] || new props.ListClass(); - return this[props.privateName]; - }; -}); - -/** - * Global player list - * - * @type {Object} - */ -Player.players = {}; - -var navigator$1 = window_1.navigator; - -/* - * Player instance options, surfaced using options - * options = Player.prototype.options_ - * Make changes in options, not here. - * - * @type {Object} - * @private - */ -Player.prototype.options_ = { - // Default order of fallback technology - techOrder: Tech.defaultTechOrder_, - - html5: {}, - flash: {}, - - // default inactivity timeout - inactivityTimeout: 2000, - - // default playback rates - playbackRates: [], - // Add playback rate selection by adding rates - // 'playbackRates': [0.5, 1, 1.5, 2], - - // Included control sets - children: ['mediaLoader', 'posterImage', 'textTrackDisplay', 'loadingSpinner', 'bigPlayButton', 'controlBar', 'errorDisplay', 'textTrackSettings'], - - language: navigator$1 && (navigator$1.languages && navigator$1.languages[0] || navigator$1.userLanguage || navigator$1.language) || 'en', - - // locales and their language translations - languages: {}, - - // Default message to show when a video cannot be played. - notSupportedMessage: 'No compatible source was found for this media.' -}; - -[ -/** - * Returns whether or not the player is in the "ended" state. - * - * @return {Boolean} True if the player is in the ended state, false if not. - * @method Player#ended - */ -'ended', -/** - * Returns whether or not the player is in the "seeking" state. - * - * @return {Boolean} True if the player is in the seeking state, false if not. - * @method Player#seeking - */ -'seeking', -/** - * Returns the TimeRanges of the media that are currently available - * for seeking to. - * - * @return {TimeRanges} the seekable intervals of the media timeline - * @method Player#seekable - */ -'seekable', -/** - * Returns the current state of network activity for the element, from - * the codes in the list below. - * - NETWORK_EMPTY (numeric value 0) - * The element has not yet been initialised. All attributes are in - * their initial states. - * - NETWORK_IDLE (numeric value 1) - * The element's resource selection algorithm is active and has - * selected a resource, but it is not actually using the network at - * this time. - * - NETWORK_LOADING (numeric value 2) - * The user agent is actively trying to download data. - * - NETWORK_NO_SOURCE (numeric value 3) - * The element's resource selection algorithm is active, but it has - * not yet found a resource to use. - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#network-states - * @return {number} the current network activity state - * @method Player#networkState - */ -'networkState', -/** - * Returns a value that expresses the current state of the element - * with respect to rendering the current playback position, from the - * codes in the list below. - * - HAVE_NOTHING (numeric value 0) - * No information regarding the media resource is available. - * - HAVE_METADATA (numeric value 1) - * Enough of the resource has been obtained that the duration of the - * resource is available. - * - HAVE_CURRENT_DATA (numeric value 2) - * Data for the immediate current playback position is available. - * - HAVE_FUTURE_DATA (numeric value 3) - * Data for the immediate current playback position is available, as - * well as enough data for the user agent to advance the current - * playback position in the direction of playback. - * - HAVE_ENOUGH_DATA (numeric value 4) - * The user agent estimates that enough data is available for - * playback to proceed uninterrupted. - * - * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-readystate - * @return {number} the current playback rendering state - * @method Player#readyState - */ -'readyState'].forEach(function (fn) { - Player.prototype[fn] = function () { - return this.techGet_(fn); - }; -}); - -TECH_EVENTS_RETRIGGER.forEach(function (event) { - Player.prototype['handleTech' + toTitleCase(event) + '_'] = function () { - return this.trigger(event); - }; -}); - -/** - * Fired when the player has initial duration and dimension information - * - * @event Player#loadedmetadata - * @type {EventTarget~Event} - */ - -/** - * Fired when the player has downloaded data at the current playback position - * - * @event Player#loadeddata - * @type {EventTarget~Event} - */ - -/** - * Fired when the current playback position has changed * - * During playback this is fired every 15-250 milliseconds, depending on the - * playback technology in use. - * - * @event Player#timeupdate - * @type {EventTarget~Event} - */ - -/** - * Fired when the volume changes - * - * @event Player#volumechange - * @type {EventTarget~Event} - */ - -/** - * Reports whether or not a player has a plugin available. - * - * This does not report whether or not the plugin has ever been initialized - * on this player. For that, [usingPlugin]{@link Player#usingPlugin}. - * - * @method Player#hasPlugin - * @param {string} name - * The name of a plugin. - * - * @return {boolean} - * Whether or not this player has the requested plugin available. - */ - -/** - * Reports whether or not a player is using a plugin by name. - * - * For basic plugins, this only reports whether the plugin has _ever_ been - * initialized on this player. - * - * @method Player#usingPlugin - * @param {string} name - * The name of a plugin. - * - * @return {boolean} - * Whether or not this player is using the requested plugin. - */ - -Component.registerComponent('Player', Player); - -/** - * @file plugin.js - */ -/** - * The base plugin name. - * - * @private - * @constant - * @type {string} - */ -var BASE_PLUGIN_NAME = 'plugin'; - -/** - * The key on which a player's active plugins cache is stored. - * - * @private - * @constant - * @type {string} - */ -var PLUGIN_CACHE_KEY = 'activePlugins_'; - -/** - * Stores registered plugins in a private space. - * - * @private - * @type {Object} - */ -var pluginStorage = {}; - -/** - * Reports whether or not a plugin has been registered. - * - * @private - * @param {string} name - * The name of a plugin. - * - * @returns {boolean} - * Whether or not the plugin has been registered. - */ -var pluginExists = function pluginExists(name) { - return pluginStorage.hasOwnProperty(name); -}; - -/** - * Get a single registered plugin by name. - * - * @private - * @param {string} name - * The name of a plugin. - * - * @returns {Function|undefined} - * The plugin (or undefined). - */ -var getPlugin = function getPlugin(name) { - return pluginExists(name) ? pluginStorage[name] : undefined; -}; - -/** - * Marks a plugin as "active" on a player. - * - * Also, ensures that the player has an object for tracking active plugins. - * - * @private - * @param {Player} player - * A Video.js player instance. - * - * @param {string} name - * The name of a plugin. - */ -var markPluginAsActive = function markPluginAsActive(player, name) { - player[PLUGIN_CACHE_KEY] = player[PLUGIN_CACHE_KEY] || {}; - player[PLUGIN_CACHE_KEY][name] = true; -}; - -/** - * Triggers a pair of plugin setup events. - * - * @private - * @param {Player} player - * A Video.js player instance. - * - * @param {Plugin~PluginEventHash} hash - * A plugin event hash. - * - * @param {Boolean} [before] - * If true, prefixes the event name with "before". In other words, - * use this to trigger "beforepluginsetup" instead of "pluginsetup". - */ -var triggerSetupEvent = function triggerSetupEvent(player, hash, before) { - var eventName = (before ? 'before' : '') + 'pluginsetup'; - - player.trigger(eventName, hash); - player.trigger(eventName + ':' + hash.name, hash); -}; - -/** - * Takes a basic plugin function and returns a wrapper function which marks - * on the player that the plugin has been activated. - * - * @private - * @param {string} name - * The name of the plugin. - * - * @param {Function} plugin - * The basic plugin. - * - * @returns {Function} - * A wrapper function for the given plugin. - */ -var createBasicPlugin = function createBasicPlugin(name, plugin) { - var basicPluginWrapper = function basicPluginWrapper() { - - // We trigger the "beforepluginsetup" and "pluginsetup" events on the player - // regardless, but we want the hash to be consistent with the hash provided - // for advanced plugins. - // - // The only potentially counter-intuitive thing here is the `instance` in - // the "pluginsetup" event is the value returned by the `plugin` function. - triggerSetupEvent(this, { name: name, plugin: plugin, instance: null }, true); - - var instance = plugin.apply(this, arguments); - - markPluginAsActive(this, name); - triggerSetupEvent(this, { name: name, plugin: plugin, instance: instance }); - - return instance; - }; - - Object.keys(plugin).forEach(function (prop) { - basicPluginWrapper[prop] = plugin[prop]; - }); - - return basicPluginWrapper; -}; - -/** - * Takes a plugin sub-class and returns a factory function for generating - * instances of it. - * - * This factory function will replace itself with an instance of the requested - * sub-class of Plugin. - * - * @private - * @param {string} name - * The name of the plugin. - * - * @param {Plugin} PluginSubClass - * The advanced plugin. - * - * @returns {Function} - */ -var createPluginFactory = function createPluginFactory(name, PluginSubClass) { - - // Add a `name` property to the plugin prototype so that each plugin can - // refer to itself by name. - PluginSubClass.prototype.name = name; - - return function () { - triggerSetupEvent(this, { name: name, plugin: PluginSubClass, instance: null }, true); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var instance = new (Function.prototype.bind.apply(PluginSubClass, [null].concat([this].concat(args))))(); - - // The plugin is replaced by a function that returns the current instance. - this[name] = function () { - return instance; - }; - - triggerSetupEvent(this, instance.getEventHash()); - - return instance; - }; -}; - -/** - * Parent class for all advanced plugins. - * - * @mixes module:evented~EventedMixin - * @mixes module:stateful~StatefulMixin - * @fires Player#beforepluginsetup - * @fires Player#beforepluginsetup:$name - * @fires Player#pluginsetup - * @fires Player#pluginsetup:$name - * @listens Player#dispose - * @throws {Error} - * If attempting to instantiate the base {@link Plugin} class - * directly instead of via a sub-class. - */ - -var Plugin = function () { - - /** - * Creates an instance of this class. - * - * Sub-classes should call `super` to ensure plugins are properly initialized. - * - * @param {Player} player - * A Video.js player instance. - */ - function Plugin(player) { - classCallCheck(this, Plugin); - - if (this.constructor === Plugin) { - throw new Error('Plugin must be sub-classed; not directly instantiated.'); - } - - this.player = player; - - // Make this object evented, but remove the added `trigger` method so we - // use the prototype version instead. - evented(this); - delete this.trigger; - - stateful(this, this.constructor.defaultState); - markPluginAsActive(player, this.name); - - // Auto-bind the dispose method so we can use it as a listener and unbind - // it later easily. - this.dispose = bind(this, this.dispose); - - // If the player is disposed, dispose the plugin. - player.on('dispose', this.dispose); - } - - /** - * Each event triggered by plugins includes a hash of additional data with - * conventional properties. - * - * This returns that object or mutates an existing hash. - * - * @param {Object} [hash={}] - * An object to be used as event an event hash. - * - * @returns {Plugin~PluginEventHash} - * An event hash object with provided properties mixed-in. - */ - - - Plugin.prototype.getEventHash = function getEventHash() { - var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - hash.name = this.name; - hash.plugin = this.constructor; - hash.instance = this; - return hash; - }; - - /** - * Triggers an event on the plugin object and overrides - * {@link module:evented~EventedMixin.trigger|EventedMixin.trigger}. - * - * @param {string|Object} event - * An event type or an object with a type property. - * - * @param {Object} [hash={}] - * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. - * - * @returns {boolean} - * Whether or not default was prevented. - */ - - - Plugin.prototype.trigger = function trigger$$1(event) { - var hash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - return trigger(this.eventBusEl_, event, this.getEventHash(hash)); - }; - - /** - * Handles "statechanged" events on the plugin. No-op by default, override by - * subclassing. - * - * @abstract - * @param {Event} e - * An event object provided by a "statechanged" event. - * - * @param {Object} e.changes - * An object describing changes that occurred with the "statechanged" - * event. - */ - - - Plugin.prototype.handleStateChanged = function handleStateChanged(e) {}; - - /** - * Disposes a plugin. - * - * Subclasses can override this if they want, but for the sake of safety, - * it's probably best to subscribe the "dispose" event. - * - * @fires Plugin#dispose - */ - - - Plugin.prototype.dispose = function dispose() { - var name = this.name, - player = this.player; - - /** - * Signals that a advanced plugin is about to be disposed. - * - * @event Plugin#dispose - * @type {EventTarget~Event} - */ - - this.trigger('dispose'); - this.off(); - player.off('dispose', this.dispose); - - // Eliminate any possible sources of leaking memory by clearing up - // references between the player and the plugin instance and nulling out - // the plugin's state and replacing methods with a function that throws. - player[PLUGIN_CACHE_KEY][name] = false; - this.player = this.state = null; - - // Finally, replace the plugin name on the player with a new factory - // function, so that the plugin is ready to be set up again. - player[name] = createPluginFactory(name, pluginStorage[name]); - }; - - /** - * Determines if a plugin is a basic plugin (i.e. not a sub-class of `Plugin`). - * - * @param {string|Function} plugin - * If a string, matches the name of a plugin. If a function, will be - * tested directly. - * - * @returns {boolean} - * Whether or not a plugin is a basic plugin. - */ - - - Plugin.isBasic = function isBasic(plugin) { - var p = typeof plugin === 'string' ? getPlugin(plugin) : plugin; - - return typeof p === 'function' && !Plugin.prototype.isPrototypeOf(p.prototype); - }; - - /** - * Register a Video.js plugin. - * - * @param {string} name - * The name of the plugin to be registered. Must be a string and - * must not match an existing plugin or a method on the `Player` - * prototype. - * - * @param {Function} plugin - * A sub-class of `Plugin` or a function for basic plugins. - * - * @returns {Function} - * For advanced plugins, a factory function for that plugin. For - * basic plugins, a wrapper function that initializes the plugin. - */ - - - Plugin.registerPlugin = function registerPlugin(name, plugin) { - if (typeof name !== 'string') { - throw new Error('Illegal plugin name, "' + name + '", must be a string, was ' + (typeof name === 'undefined' ? 'undefined' : _typeof(name)) + '.'); - } - - if (pluginExists(name)) { - log$1.warn('A plugin named "' + name + '" already exists. You may want to avoid re-registering plugins!'); - } else if (Player.prototype.hasOwnProperty(name)) { - throw new Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!'); - } - - if (typeof plugin !== 'function') { - throw new Error('Illegal plugin for "' + name + '", must be a function, was ' + (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) + '.'); - } - - pluginStorage[name] = plugin; - - // Add a player prototype method for all sub-classed plugins (but not for - // the base Plugin class). - if (name !== BASE_PLUGIN_NAME) { - if (Plugin.isBasic(plugin)) { - Player.prototype[name] = createBasicPlugin(name, plugin); - } else { - Player.prototype[name] = createPluginFactory(name, plugin); - } - } - - return plugin; - }; - - /** - * De-register a Video.js plugin. - * - * @param {string} name - * The name of the plugin to be deregistered. - */ - - - Plugin.deregisterPlugin = function deregisterPlugin(name) { - if (name === BASE_PLUGIN_NAME) { - throw new Error('Cannot de-register base plugin.'); - } - if (pluginExists(name)) { - delete pluginStorage[name]; - delete Player.prototype[name]; - } - }; - - /** - * Gets an object containing multiple Video.js plugins. - * - * @param {Array} [names] - * If provided, should be an array of plugin names. Defaults to _all_ - * plugin names. - * - * @returns {Object|undefined} - * An object containing plugin(s) associated with their name(s) or - * `undefined` if no matching plugins exist). - */ - - - Plugin.getPlugins = function getPlugins() { - var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Object.keys(pluginStorage); - - var result = void 0; - - names.forEach(function (name) { - var plugin = getPlugin(name); - - if (plugin) { - result = result || {}; - result[name] = plugin; - } - }); - - return result; - }; - - /** - * Gets a plugin's version, if available - * - * @param {string} name - * The name of a plugin. - * - * @returns {string} - * The plugin's version or an empty string. - */ - - - Plugin.getPluginVersion = function getPluginVersion(name) { - var plugin = getPlugin(name); - - return plugin && plugin.VERSION || ''; - }; - - return Plugin; -}(); - -/** - * Gets a plugin by name if it exists. - * - * @static - * @method getPlugin - * @memberOf Plugin - * @param {string} name - * The name of a plugin. - * - * @returns {Function|undefined} - * The plugin (or `undefined`). - */ - - -Plugin.getPlugin = getPlugin; - -/** - * The name of the base plugin class as it is registered. - * - * @type {string} - */ -Plugin.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME; - -Plugin.registerPlugin(BASE_PLUGIN_NAME, Plugin); - -/** - * Documented in player.js - * - * @ignore - */ -Player.prototype.usingPlugin = function (name) { - return !!this[PLUGIN_CACHE_KEY] && this[PLUGIN_CACHE_KEY][name] === true; -}; - -/** - * Documented in player.js - * - * @ignore - */ -Player.prototype.hasPlugin = function (name) { - return !!pluginExists(name); -}; - -/** - * Signals that a plugin is about to be set up on a player. - * - * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} - */ - -/** - * Signals that a plugin is about to be set up on a player - by name. The name - * is the name of the plugin. - * - * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} - */ - -/** - * Signals that a plugin has just been set up on a player. - * - * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} - */ - -/** - * Signals that a plugin has just been set up on a player - by name. The name - * is the name of the plugin. - * - * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} - */ - -/** - * @typedef {Object} Plugin~PluginEventHash - * - * @property {string} instance - * For basic plugins, the return value of the plugin function. For - * advanced plugins, the plugin instance on which the event is fired. - * - * @property {string} name - * The name of the plugin. - * - * @property {string} plugin - * For basic plugins, the plugin function. For advanced plugins, the - * plugin class/constructor. - */ - -/** - * @file extend.js - * @module extend - */ - -/** - * A combination of node inherits and babel's inherits (after transpile). - * Both work the same but node adds `super_` to the subClass - * and Bable adds the superClass as __proto__. Both seem useful. - * - * @param {Object} subClass - * The class to inherit to - * - * @param {Object} superClass - * The class to inherit from - * - * @private - */ -var _inherits = function _inherits(subClass, superClass) { - if (typeof superClass !== 'function' && superClass !== null) { - throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass))); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - - if (superClass) { - // node - subClass.super_ = superClass; - } -}; - -/** - * Function for subclassing using the same inheritance that - * videojs uses internally - * - * @static - * @const - * - * @param {Object} superClass - * The class to inherit from - * - * @param {Object} [subClassMethods={}] - * The class to inherit to - * - * @return {Object} - * The new object with subClassMethods that inherited superClass. - */ -var extendFn = function extendFn(superClass) { - var subClassMethods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var subClass = function subClass() { - superClass.apply(this, arguments); - }; - - var methods = {}; - - if ((typeof subClassMethods === 'undefined' ? 'undefined' : _typeof(subClassMethods)) === 'object') { - if (subClassMethods.constructor !== Object.prototype.constructor) { - subClass = subClassMethods.constructor; - } - methods = subClassMethods; - } else if (typeof subClassMethods === 'function') { - subClass = subClassMethods; - } - - _inherits(subClass, superClass); - - // Extend subObj's prototype with functions and other properties from props - for (var name in methods) { - if (methods.hasOwnProperty(name)) { - subClass.prototype[name] = methods[name]; - } - } - - return subClass; -}; - -/** - * @file video.js - * @module videojs - */ -// Include the built-in techs -// HTML5 Element Shim for IE8 -if (typeof HTMLVideoElement === 'undefined' && isReal()) { - document_1.createElement('video'); - document_1.createElement('audio'); - document_1.createElement('track'); -} - -/** - * Doubles as the main function for users to create a player instance and also - * the main library object. - * The `videojs` function can be used to initialize or retrieve a player. - * - * @param {string|Element} id - * Video element or video element ID - * - * @param {Object} [options] - * Optional options object for config/settings - * - * @param {Component~ReadyCallback} [ready] - * Optional ready callback - * - * @return {Player} - * A player instance - */ -function videojs(id, options, ready) { - var tag = void 0; - - // Allow for element or ID to be passed in - // String ID - if (typeof id === 'string') { - var players = videojs.getPlayers(); - - // Adjust for jQuery ID syntax - if (id.indexOf('#') === 0) { - id = id.slice(1); - } - - // If a player instance has already been created for this ID return it. - if (players[id]) { - - // If options or ready function are passed, warn - if (options) { - log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.'); - } - - if (ready) { - players[id].ready(ready); - } - - return players[id]; - } - - // Otherwise get element for ID - tag = $('#' + id); - - // ID is a media element - } else { - tag = id; - } - - // Check for a useable element - // re: nodeName, could be a box div also - if (!tag || !tag.nodeName) { - throw new TypeError('The element or ID supplied is not valid. (videojs)'); - } - - // Element may have a player attr referring to an already created player instance. - // If so return that otherwise set up a new player below - if (tag.player || Player.players[tag.playerId]) { - return tag.player || Player.players[tag.playerId]; - } - - options = options || {}; - - videojs.hooks('beforesetup').forEach(function (hookFunction) { - var opts = hookFunction(tag, mergeOptions(options)); - - if (!isObject(opts) || Array.isArray(opts)) { - log$1.error('please return an object in beforesetup hooks'); - return; - } - - options = mergeOptions(options, opts); - }); - - var PlayerComponent = Component.getComponent('Player'); - // If not, set up a new player - var player = new PlayerComponent(tag, options, ready); - - videojs.hooks('setup').forEach(function (hookFunction) { - return hookFunction(player); - }); - - return player; -} - -/** - * An Object that contains lifecycle hooks as keys which point to an array - * of functions that are run when a lifecycle is triggered - */ -videojs.hooks_ = {}; - -/** - * Get a list of hooks for a specific lifecycle - * @function videojs.hooks - * - * @param {string} type - * the lifecyle to get hooks from - * - * @param {Function} [fn] - * Optionally add a hook to the lifecycle that your are getting. - * - * @return {Array} - * an array of hooks, or an empty array if there are none. - */ -videojs.hooks = function (type, fn) { - videojs.hooks_[type] = videojs.hooks_[type] || []; - if (fn) { - videojs.hooks_[type] = videojs.hooks_[type].concat(fn); - } - return videojs.hooks_[type]; -}; - -/** - * Add a function hook to a specific videojs lifecycle. - * - * @param {string} type - * the lifecycle to hook the function to. - * - * @param {Function|Function[]} - * The function or array of functions to attach. - */ -videojs.hook = function (type, fn) { - videojs.hooks(type, fn); -}; - -/** - * Remove a hook from a specific videojs lifecycle. - * - * @param {string} type - * the lifecycle that the function hooked to - * - * @param {Function} fn - * The hooked function to remove - * - * @return {boolean} - * The function that was removed or undef - */ -videojs.removeHook = function (type, fn) { - var index$$1 = videojs.hooks(type).indexOf(fn); - - if (index$$1 <= -1) { - return false; - } - - videojs.hooks_[type] = videojs.hooks_[type].slice(); - videojs.hooks_[type].splice(index$$1, 1); - - return true; -}; - -// Add default styles -if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal()) { - var style$$1 = $('.vjs-styles-defaults'); - - if (!style$$1) { - style$$1 = createStyleElement('vjs-styles-defaults'); - var head = $('head'); - - if (head) { - head.insertBefore(style$$1, head.firstChild); - } - setTextContent(style$$1, '\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n '); - } -} - -// Run Auto-load players -// You have to wait at least once in case this script is loaded after your -// video in the DOM (weird behavior only with minified version) -autoSetupTimeout(1, videojs); - -/** - * Current software version. Follows semver. - * - * @type {string} - */ -videojs.VERSION = version; - -/** - * The global options object. These are the settings that take effect - * if no overrides are specified when the player is created. - * - * @type {Object} - */ -videojs.options = Player.prototype.options_; - -/** - * Get an object with the currently created players, keyed by player ID - * - * @return {Object} - * The created players - */ -videojs.getPlayers = function () { - return Player.players; -}; - -/** - * Expose players object. - * - * @memberOf videojs - * @property {Object} players - */ -videojs.players = Player.players; - -/** - * Get a component class object by name - * - * @borrows Component.getComponent as videojs.getComponent - */ -videojs.getComponent = Component.getComponent; - -/** - * Register a component so it can referred to by name. Used when adding to other - * components, either through addChild `component.addChild('myComponent')` or through - * default children options `{ children: ['myComponent'] }`. - * - * > NOTE: You could also just initialize the component before adding. - * `component.addChild(new MyComponent());` - * - * @param {string} name - * The class name of the component - * - * @param {Component} comp - * The component class - * - * @return {Component} - * The newly registered component - */ -videojs.registerComponent = function (name$$1, comp) { - if (Tech.isTech(comp)) { - log$1.warn('The ' + name$$1 + ' tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)'); - } - - Component.registerComponent.call(Component, name$$1, comp); -}; - -/** - * Get a Tech class object by name - * - * @borrows Tech.getTech as videojs.getTech - */ -videojs.getTech = Tech.getTech; - -/** - * Register a Tech so it can referred to by name. - * This is used in the tech order for the player. - * - * @borrows Tech.registerTech as videojs.registerTech - */ -videojs.registerTech = Tech.registerTech; - -videojs.use = use; - -/** - * A suite of browser and device tests from {@link browser}. - * - * @type {Object} - * @private - */ -videojs.browser = browser; - -/** - * Whether or not the browser supports touch events. Included for backward - * compatibility with 4.x, but deprecated. Use `videojs.browser.TOUCH_ENABLED` - * instead going forward. - * - * @deprecated since version 5.0 - * @type {boolean} - */ -videojs.TOUCH_ENABLED = TOUCH_ENABLED; - -/** - * Subclass an existing class - * Mimics ES6 subclassing with the `extend` keyword - * - * @borrows extend:extendFn as videojs.extend - */ -videojs.extend = extendFn; - -/** - * Merge two options objects recursively - * Performs a deep merge like lodash.merge but **only merges plain objects** - * (not arrays, elements, anything else) - * Other values will be copied directly from the second object. - * - * @borrows merge-options:mergeOptions as videojs.mergeOptions - */ -videojs.mergeOptions = mergeOptions; - -/** - * Change the context (this) of a function - * - * > NOTE: as of v5.0 we require an ES5 shim, so you should use the native - * `function() {}.bind(newContext);` instead of this. - * - * @borrows fn:bind as videojs.bind - */ -videojs.bind = bind; - -/** - * Register a Video.js plugin. - * - * @borrows plugin:registerPlugin as videojs.registerPlugin - * @method registerPlugin - * - * @param {string} name - * The name of the plugin to be registered. Must be a string and - * must not match an existing plugin or a method on the `Player` - * prototype. - * - * @param {Function} plugin - * A sub-class of `Plugin` or a function for basic plugins. - * - * @return {Function} - * For advanced plugins, a factory function for that plugin. For - * basic plugins, a wrapper function that initializes the plugin. - */ -videojs.registerPlugin = Plugin.registerPlugin; - -/** - * Deprecated method to register a plugin with Video.js - * - * @deprecated - * videojs.plugin() is deprecated; use videojs.registerPlugin() instead - * - * @param {string} name - * The plugin name - * - * @param {Plugin|Function} plugin - * The plugin sub-class or function - */ -videojs.plugin = function (name$$1, plugin) { - log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); - return Plugin.registerPlugin(name$$1, plugin); -}; - -/** - * Gets an object containing multiple Video.js plugins. - * - * @param {Array} [names] - * If provided, should be an array of plugin names. Defaults to _all_ - * plugin names. - * - * @return {Object|undefined} - * An object containing plugin(s) associated with their name(s) or - * `undefined` if no matching plugins exist). - */ -videojs.getPlugins = Plugin.getPlugins; - -/** - * Gets a plugin by name if it exists. - * - * @param {string} name - * The name of a plugin. - * - * @return {Function|undefined} - * The plugin (or `undefined`). - */ -videojs.getPlugin = Plugin.getPlugin; - -/** - * Gets a plugin's version, if available - * - * @param {string} name - * The name of a plugin. - * - * @return {string} - * The plugin's version or an empty string. - */ -videojs.getPluginVersion = Plugin.getPluginVersion; - -/** - * Adding languages so that they're available to all players. - * Example: `videojs.addLanguage('es', { 'Hello': 'Hola' });` - * - * @param {string} code - * The language code or dictionary property - * - * @param {Object} data - * The data values to be translated - * - * @return {Object} - * The resulting language dictionary object - */ -videojs.addLanguage = function (code, data) { - var _mergeOptions; - - code = ('' + code).toLowerCase(); - - videojs.options.languages = mergeOptions(videojs.options.languages, (_mergeOptions = {}, _mergeOptions[code] = data, _mergeOptions)); - - return videojs.options.languages[code]; -}; - -/** - * Log messages - * - * @borrows log:log as videojs.log - */ -videojs.log = log$1; - -/** - * Creates an emulated TimeRange object. - * - * @borrows time-ranges:createTimeRanges as videojs.createTimeRange - */ -/** - * @borrows time-ranges:createTimeRanges as videojs.createTimeRanges - */ -videojs.createTimeRange = videojs.createTimeRanges = createTimeRanges; - -/** - * Format seconds as a time string, H:MM:SS or M:SS - * Supplying a guide (in seconds) will force a number of leading zeros - * to cover the length of the guide - * - * @borrows format-time:formatTime as videojs.formatTime - */ -videojs.formatTime = formatTime; - -/** - * Resolve and parse the elements of a URL - * - * @borrows url:parseUrl as videojs.parseUrl - */ -videojs.parseUrl = parseUrl; - -/** - * Returns whether the url passed is a cross domain request or not. - * - * @borrows url:isCrossOrigin as videojs.isCrossOrigin - */ -videojs.isCrossOrigin = isCrossOrigin; - -/** - * Event target class. - * - * @borrows EventTarget as videojs.EventTarget - */ -videojs.EventTarget = EventTarget; - -/** - * Add an event listener to element - * It stores the handler function in a separate cache object - * and adds a generic handler to the element's event, - * along with a unique id (guid) to the element. - * - * @borrows events:on as videojs.on - */ -videojs.on = on; - -/** - * Trigger a listener only once for an event - * - * @borrows events:one as videojs.one - */ -videojs.one = one; - -/** - * Removes event listeners from an element - * - * @borrows events:off as videojs.off - */ -videojs.off = off; - -/** - * Trigger an event for an element - * - * @borrows events:trigger as videojs.trigger - */ -videojs.trigger = trigger; - -/** - * A cross-browser XMLHttpRequest wrapper. Here's a simple example: - * - * @param {Object} options - * settings for the request. - * - * @return {XMLHttpRequest|XDomainRequest} - * The request object. - * - * @see https://github.com/Raynos/xhr - */ -videojs.xhr = index; - -/** - * TextTrack class - * - * @borrows TextTrack as videojs.TextTrack - */ -videojs.TextTrack = TextTrack; - -/** - * export the AudioTrack class so that source handlers can create - * AudioTracks and then add them to the players AudioTrackList - * - * @borrows AudioTrack as videojs.AudioTrack - */ -videojs.AudioTrack = AudioTrack; - -/** - * export the VideoTrack class so that source handlers can create - * VideoTracks and then add them to the players VideoTrackList - * - * @borrows VideoTrack as videojs.VideoTrack - */ -videojs.VideoTrack = VideoTrack; - -/** - * Determines, via duck typing, whether or not a value is a DOM element. - * - * @borrows dom:isEl as videojs.isEl - * @deprecated Use videojs.dom.isEl() instead - */ - -/** - * Determines, via duck typing, whether or not a value is a text node. - * - * @borrows dom:isTextNode as videojs.isTextNode - * @deprecated Use videojs.dom.isTextNode() instead - */ - -/** - * Creates an element and applies properties. - * - * @borrows dom:createEl as videojs.createEl - * @deprecated Use videojs.dom.createEl() instead - */ - -/** - * Check if an element has a CSS class - * - * @borrows dom:hasElClass as videojs.hasClass - * @deprecated Use videojs.dom.hasClass() instead - */ - -/** - * Add a CSS class name to an element - * - * @borrows dom:addElClass as videojs.addClass - * @deprecated Use videojs.dom.addClass() instead - */ - -/** - * Remove a CSS class name from an element - * - * @borrows dom:removeElClass as videojs.removeClass - * @deprecated Use videojs.dom.removeClass() instead - */ - -/** - * Adds or removes a CSS class name on an element depending on an optional - * condition or the presence/absence of the class name. - * - * @borrows dom:toggleElClass as videojs.toggleClass - * @deprecated Use videojs.dom.toggleClass() instead - */ - -/** - * Apply attributes to an HTML element. - * - * @borrows dom:setElAttributes as videojs.setAttribute - * @deprecated Use videojs.dom.setAttributes() instead - */ - -/** - * Get an element's attribute values, as defined on the HTML tag - * Attributes are not the same as properties. They're defined on the tag - * or with setAttribute (which shouldn't be used with HTML) - * This will return true or false for boolean attributes. - * - * @borrows dom:getElAttributes as videojs.getAttributes - * @deprecated Use videojs.dom.getAttributes() instead - */ - -/** - * Empties the contents of an element. - * - * @borrows dom:emptyEl as videojs.emptyEl - * @deprecated Use videojs.dom.emptyEl() instead - */ - -/** - * Normalizes and appends content to an element. - * - * The content for an element can be passed in multiple types and - * combinations, whose behavior is as follows: - * - * - String - * Normalized into a text node. - * - * - Element, TextNode - * Passed through. - * - * - Array - * A one-dimensional array of strings, elements, nodes, or functions (which - * return single strings, elements, or nodes). - * - * - Function - * If the sole argument, is expected to produce a string, element, - * node, or array. - * - * @borrows dom:appendContents as videojs.appendContet - * @deprecated Use videojs.dom.appendContent() instead - */ - -/** - * Normalizes and inserts content into an element; this is identical to - * `appendContent()`, except it empties the element first. - * - * The content for an element can be passed in multiple types and - * combinations, whose behavior is as follows: - * - * - String - * Normalized into a text node. - * - * - Element, TextNode - * Passed through. - * - * - Array - * A one-dimensional array of strings, elements, nodes, or functions (which - * return single strings, elements, or nodes). - * - * - Function - * If the sole argument, is expected to produce a string, element, - * node, or array. - * - * @borrows dom:insertContent as videojs.insertContent - * @deprecated Use videojs.dom.insertContent() instead - */ -['isEl', 'isTextNode', 'createEl', 'hasClass', 'addClass', 'removeClass', 'toggleClass', 'setAttributes', 'getAttributes', 'emptyEl', 'appendContent', 'insertContent'].forEach(function (k) { - videojs[k] = function () { - log$1.warn('videojs.' + k + '() is deprecated; use videojs.dom.' + k + '() instead'); - return Dom[k].apply(null, arguments); - }; -}); - -/** - * A safe getComputedStyle with an IE8 fallback. - * - * This is because in Firefox, if the player is loaded in an iframe with `display:none`, - * then `getComputedStyle` returns `null`, so, we do a null-check to make sure - * that the player doesn't break in these cases. - * See https://bugzilla.mozilla.org/show_bug.cgi?id=548397 for more details. - * - * @borrows computed-style:computedStyle as videojs.computedStyle - */ -videojs.computedStyle = computedStyle; - -/** - * Export the Dom utilities for use in external plugins - * and Tech's - */ -videojs.dom = Dom; - -/** - * Export the Url utilities for use in external plugins - * and Tech's - */ -videojs.url = Url; - -return videojs; - -}))); - -!function(){!function(a){var b=a&&a.videojs;b&&(b.CDN_VERSION="6.2.0")}(window),function(a,b,c,d,e,f,g){b&&b.HELP_IMPROVE_VIDEOJS!==!1&&(e.random()>.01||(f=b.location,g=b.videojs||{},a.src="//www.google-analytics.com/__utm.gif?utmwv=5.4.2&utmac=UA-16505296-3&utmn=1&utmhn="+d(f.hostname)+"&utmsr="+b.screen.availWidth+"x"+b.screen.availHeight+"&utmul="+(c.language||c.userLanguage||"").toLowerCase()+"&utmr="+d(f.href)+"&utmp="+d(f.hostname+f.pathname)+"&utmcc=__utma%3D1."+e.floor(1e10*e.random())+".1.1.1.1%3B&utme=8(vjsv*cdnv)9("+g.VERSION+"*"+g.CDN_VERSION+")"))}(new Image,window,navigator,encodeURIComponent,Math)}(); \ No newline at end of file diff --git a/embed/players/video.min.js b/embed/players/video.min.js index d08f0e51..2b801560 100644 --- a/embed/players/video.min.js +++ b/embed/players/video.min.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 6.2.0 <http://videojs.com/> + * Video.js 7.3.0 <http://videojs.com/> * Copyright Brightcove, Inc. <https://www.brightcove.com/> * Available under Apache License Version 2.0 * <https://github.com/videojs/video.js/blob/master/LICENSE> @@ -9,12 +9,5 @@ * Available under Apache License Version 2.0 * <https://github.com/mozilla/vtt.js/blob/master/LICENSE> */ - -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.videojs=e()}(this,function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t,e){Fe(t).forEach(function(n){return e(t[n],n)})}function n(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Fe(t).reduce(function(n,r){return e(n,t[r],r)},n)}function r(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Object.assign?Object.assign.apply(Object,[t].concat(r)):(r.forEach(function(n){n&&e(n,function(e,n){t[n]=e})}),t)}function i(t){return!!t&&"object"===(void 0===t?"undefined":Me(t))}function o(t){return i(t)&&"[object Object]"===Be.call(t)&&t.constructor===Object}function s(t){return t.replace(/\n\r?\s*/g,"")}function a(t,e){if(!t||!e)return"";if("function"==typeof ie.getComputedStyle){var n=ie.getComputedStyle(t);return n?n[e]:""}return t.currentStyle[e]||""}function l(t){return"string"==typeof t&&/\S/.test(t)}function c(t){if(/\s/.test(t))throw new Error("class has illegal whitespace characters")}function u(t){return new RegExp("(^|\\s)"+t+"($|\\s)")}function h(){return ce===ie.document&&void 0!==ce.createElement}function p(t){return i(t)&&1===t.nodeType}function d(t){return function(e,n){if(!l(e))return ce[t](null);l(n)&&(n=ce.querySelector(n));var r=p(n)?n:ce;return r[t]&&r[t](e)}}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3],i=ce.createElement(t);return Object.getOwnPropertyNames(e).forEach(function(t){var n=e[t];-1!==t.indexOf("aria-")||"role"===t||"type"===t?(Ue.warn(Xe(qe,t,n)),i.setAttribute(t,n)):"textContent"===t?v(i,n):i[t]=n}),Object.getOwnPropertyNames(n).forEach(function(t){i.setAttribute(t,n[t])}),r&&I(i,r),i}function v(t,e){return void 0===t.textContent?t.innerText=e:t.textContent=e,t}function y(t,e){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}function g(t,e){return c(e),t.classList?t.classList.contains(e):u(e).test(t.className)}function m(t,e){return t.classList?t.classList.add(e):g(t,e)||(t.className=(t.className+" "+e).trim()),t}function _(t,e){return t.classList?t.classList.remove(e):(c(e),t.className=t.className.split(/\s+/).filter(function(t){return t!==e}).join(" ")),t}function b(t,e,n){var r=g(t,e);if("function"==typeof n&&(n=n(t,e)),"boolean"!=typeof n&&(n=!r),n!==r)return n?m(t,e):_(t,e),t}function T(t,e){Object.getOwnPropertyNames(e).forEach(function(n){var r=e[n];null===r||void 0===r||!1===r?t.removeAttribute(n):t.setAttribute(n,!0===r?"":r)})}function C(t){var e={};if(t&&t.attributes&&t.attributes.length>0)for(var n=t.attributes,r=n.length-1;r>=0;r--){var i=n[r].name,o=n[r].value;"boolean"!=typeof t[i]&&-1===",autoplay,controls,loop,muted,default,".indexOf(","+i+",")||(o=null!==o),e[i]=o}return e}function k(t,e){return t.getAttribute(e)}function w(t,e,n){t.setAttribute(e,n)}function E(t,e){t.removeAttribute(e)}function S(){ce.body.focus(),ce.onselectstart=function(){return!1}}function x(){ce.onselectstart=function(){return!0}}function j(t){if(t&&t.getBoundingClientRect&&t.parentNode){var e=t.getBoundingClientRect(),n={};return["bottom","height","left","right","top","width"].forEach(function(t){void 0!==e[t]&&(n[t]=e[t])}),n.height||(n.height=parseFloat(a(t,"height"))),n.width||(n.width=parseFloat(a(t,"width"))),n}}function A(t){var e=void 0;if(t.getBoundingClientRect&&t.parentNode&&(e=t.getBoundingClientRect()),!e)return{left:0,top:0};var n=ce.documentElement,r=ce.body,i=n.clientLeft||r.clientLeft||0,o=ie.pageXOffset||r.scrollLeft,s=e.left+o-i,a=n.clientTop||r.clientTop||0,l=ie.pageYOffset||r.scrollTop,c=e.top+l-a;return{left:Math.round(s),top:Math.round(c)}}function P(t,e){var n={},r=A(t),i=t.offsetWidth,o=t.offsetHeight,s=r.top,a=r.left,l=e.pageY,c=e.pageX;return e.changedTouches&&(c=e.changedTouches[0].pageX,l=e.changedTouches[0].pageY),n.y=Math.max(0,Math.min(1,(s-l+o)/o)),n.x=Math.max(0,Math.min(1,(c-a)/i)),n}function N(t){return i(t)&&3===t.nodeType}function O(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function M(t){return"function"==typeof t&&(t=t()),(Array.isArray(t)?t:[t]).map(function(t){return"function"==typeof t&&(t=t()),p(t)||N(t)?t:"string"==typeof t&&/\S/.test(t)?ce.createTextNode(t):void 0}).filter(function(t){return t})}function I(t,e){return M(e).forEach(function(e){return t.appendChild(e)}),t}function D(t,e){return I(O(t),e)}function R(){return $e++}function L(t){var e=t[Qe];return e||(e=t[Qe]=R()),Je[e]||(Je[e]={}),Je[e]}function B(t){var e=t[Qe];return!!e&&!!Object.getOwnPropertyNames(Je[e]).length}function F(t){var e=t[Qe];if(e){delete Je[e];try{delete t[Qe]}catch(e){t.removeAttribute?t.removeAttribute(Qe):t[Qe]=null}}}function H(t,e){var n=L(t);0===n.handlers[e].length&&(delete n.handlers[e],t.removeEventListener?t.removeEventListener(e,n.dispatcher,!1):t.detachEvent&&t.detachEvent("on"+e,n.dispatcher)),Object.getOwnPropertyNames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===Object.getOwnPropertyNames(n).length&&F(t)}function V(t,e,n,r){n.forEach(function(n){t(e,n,r)})}function z(t){function e(){return!0}function n(){return!1}if(!t||!t.isPropagationStopped){var r=t||ie.event;t={};for(var i in r)"layerX"!==i&&"layerY"!==i&&"keyLocation"!==i&&"webkitMovementX"!==i&&"webkitMovementY"!==i&&("returnValue"===i&&r.preventDefault||(t[i]=r[i]));if(t.target||(t.target=t.srcElement||ce),t.relatedTarget||(t.relatedTarget=t.fromElement===t.target?t.toElement:t.fromElement),t.preventDefault=function(){r.preventDefault&&r.preventDefault(),t.returnValue=!1,r.returnValue=!1,t.defaultPrevented=!0},t.defaultPrevented=!1,t.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),t.cancelBubble=!0,r.cancelBubble=!0,t.isPropagationStopped=e},t.isPropagationStopped=n,t.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),t.isImmediatePropagationStopped=e,t.stopPropagation()},t.isImmediatePropagationStopped=n,null!==t.clientX&&void 0!==t.clientX){var o=ce.documentElement,s=ce.body;t.pageX=t.clientX+(o&&o.scrollLeft||s&&s.scrollLeft||0)-(o&&o.clientLeft||s&&s.clientLeft||0),t.pageY=t.clientY+(o&&o.scrollTop||s&&s.scrollTop||0)-(o&&o.clientTop||s&&s.clientTop||0)}t.which=t.charCode||t.keyCode,null!==t.button&&void 0!==t.button&&(t.button=1&t.button?0:4&t.button?1:2&t.button?2:0)}return t}function W(t,e,n){if(Array.isArray(e))return V(W,t,e,n);var r=L(t);r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),n.guid||(n.guid=R()),r.handlers[e].push(n),r.dispatcher||(r.disabled=!1,r.dispatcher=function(e,n){if(!r.disabled){e=z(e);var i=r.handlers[e.type];if(i)for(var o=i.slice(0),s=0,a=o.length;s<a&&!e.isImmediatePropagationStopped();s++)try{o[s].call(t,e,n)}catch(t){Ue.error(t)}}}),1===r.handlers[e].length&&(t.addEventListener?t.addEventListener(e,r.dispatcher,!1):t.attachEvent&&t.attachEvent("on"+e,r.dispatcher))}function U(t,e,n){if(B(t)){var r=L(t);if(r.handlers){if(Array.isArray(e))return V(U,t,e,n);var i=function(e){r.handlers[e]=[],H(t,e)};if(e){var o=r.handlers[e];if(o){if(!n)return void i(e);if(n.guid)for(var s=0;s<o.length;s++)o[s].guid===n.guid&&o.splice(s--,1);H(t,e)}}else for(var a in r.handlers)i(a)}}}function X(t,e,n){var r=B(t)?L(t):{},i=t.parentNode||t.ownerDocument;if("string"==typeof e&&(e={type:e,target:t}),e=z(e),r.dispatcher&&r.dispatcher.call(t,e,n),i&&!e.isPropagationStopped()&&!0===e.bubbles)X.call(null,i,e,n);else if(!i&&!e.defaultPrevented){var o=L(e.target);e.target[e.type]&&(o.disabled=!0,"function"==typeof e.target[e.type]&&e.target[e.type](),o.disabled=!1)}return!e.defaultPrevented}function q(t,e,n){if(Array.isArray(e))return V(q,t,e,n);var r=function r(){U(t,e,r),n.apply(this,arguments)};r.guid=n.guid=n.guid||R(),W(t,e,r)}function K(t,e){e&&(en=e),ie.setTimeout(nn,t)}function G(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.eventBusKey;if(n){if(!t[n].nodeName)throw new Error('The eventBusKey "'+n+'" does not refer to an element.');t.eventBusEl_=t[n]}else t.eventBusEl_=f("span",{className:"vjs-event-bus"});return r(t,yn),t.on("dispose",function(){return t.off()}),t}function Y(t,e){return r(t,gn),t.state=r({},t.state,e),"function"==typeof t.handleStateChanged&&cn(t)&&t.on("statechanged",t.handleStateChanged),t}function $(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function J(t,e){return $(t)===$(e)}function Q(){for(var t={},n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return r.forEach(function(n){n&&e(n,function(e,n){if(!o(e))return void(t[n]=e);o(t[n])||(t[n]={}),t[n]=Q(t[n],e)})}),t}function Z(t,e,n){if("number"!=typeof e||e<0||e>n)throw new Error("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+e+") is non-numeric or out of bounds (0-"+n+").")}function tt(t,e,n,r){return Z(t,r,n.length-1),n[r][e]}function et(t){return void 0===t||0===t.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:t.length,start:tt.bind(null,"start",0,t),end:tt.bind(null,"end",1,t)}}function nt(t,e){return Array.isArray(t)?et(t):void 0===t||void 0===e?et():et([[t,e]])}function rt(t,e){var n=0,r=void 0,i=void 0;if(!e)return 0;t&&t.length||(t=nt(0,0));for(var o=0;o<t.length;o++)r=t.start(o),i=t.end(o),i>e&&(i=e),n+=i-r;return n/e}function it(t){if(t instanceof it)return t;"number"==typeof t?this.code=t:"string"==typeof t?this.message=t:i(t)&&("number"==typeof t.code&&(this.code=t.code),r(this,t)),this.message||(this.message=it.defaultMessages[this.code]||"")}function ot(t,e){var n,r=null;try{n=JSON.parse(t,e)}catch(t){r=t}return[r,n]}function st(t){var e=Zn.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}function at(t,e,n){if(!Qn(e))throw new TypeError("iterator must be a function");arguments.length<3&&(n=this),"[object Array]"===nr.call(t)?lt(t,e,n):"string"==typeof t?ct(t,e,n):ut(t,e,n)}function lt(t,e,n){for(var r=0,i=t.length;r<i;r++)rr.call(t,r)&&e.call(n,t[r],r,t)}function ct(t,e,n){for(var r=0,i=t.length;r<i;r++)e.call(n,t.charAt(r),r,t)}function ut(t,e,n){for(var r in t)rr.call(t,r)&&e.call(n,t[r],r,t)}function ht(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var r in n)ar.call(n,r)&&(t[r]=n[r])}return t}function pt(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function dt(t,e,n){var r=t;return Qn(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=sr(e,{uri:t}),r.callback=n,r}function ft(t,e,n){return e=dt(t,e,n),vt(e)}function vt(t){function e(){4===a.readyState&&setTimeout(i,0)}function n(){var t=void 0;if(t=a.response?a.response:a.responseText||yt(a),y)try{t=JSON.parse(t)}catch(t){}return t}function r(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,s(t,g)}function i(){if(!c){var e;clearTimeout(u),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,i=null;return 0!==e?(r={body:n(),statusCode:e,method:p,headers:{},url:h,rawRequest:a},a.getAllResponseHeaders&&(r.headers=or(a.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),s(i,r,r.body)}}if(void 0===t.callback)throw new Error("callback argument missing");var o=!1,s=function(e,n,r){o||(o=!0,t.callback(e,n,r))},a=t.xhr||null;a||(a=t.cors||t.useXDR?new ft.XDomainRequest:new ft.XMLHttpRequest);var l,c,u,h=a.url=t.uri||t.url,p=a.method=t.method||"GET",d=t.body||t.data,f=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:p,url:h,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),d=JSON.stringify(!0===t.json?d:t.json))),a.onreadystatechange=e,a.onload=i,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(p,h,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(u=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(l in f)f.hasOwnProperty(l)&&a.setRequestHeader(l,f[l]);else if(t.headers&&!pt(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(d||null),a}function yt(t){if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function gt(){}function mt(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}function _t(t){function e(t,e,n,r){return 3600*(0|t)+60*(0|e)+(0|n)+(0|r)/1e3}var n=t.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return n?n[3]?e(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?e(n[1],n[2],0,n[4]):e(0,n[1],n[2],n[4]):null}function bt(){this.values=br(null)}function Tt(t,e,n,r){var i=r?t.split(r):[t];for(var o in i)if("string"==typeof i[o]){var s=i[o].split(n);if(2===s.length){var a=s[0],l=s[1];e(a,l)}}}function Ct(t,e,n){function r(){var e=_t(t);if(null===e)throw new mt(mt.Errors.BadTimeStamp,"Malformed timestamp: "+o);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function i(){t=t.replace(/^\s+/,"")}var o=t;if(i(),e.startTime=r(),i(),"--\x3e"!==t.substr(0,3))throw new mt(mt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+o);t=t.substr(3),i(),e.endTime=r(),i(),function(t,e){var r=new bt;Tt(t,function(t,e){switch(t){case"region":for(var i=n.length-1;i>=0;i--)if(n[i].id===e){r.set(t,n[i].region);break}break;case"vertical":r.alt(t,e,["rl","lr"]);break;case"line":var o=e.split(","),s=o[0];r.integer(t,s),r.percent(t,s)&&r.set("snapToLines",!1),r.alt(t,s,["auto"]),2===o.length&&r.alt("lineAlign",o[1],["start","middle","end"]);break;case"position":o=e.split(","),r.percent(t,o[0]),2===o.length&&r.alt("positionAlign",o[1],["start","middle","end"]);break;case"size":r.percent(t,e);break;case"align":r.alt(t,e,["start","middle","end","left","right"])}},/:/,/\s/),e.region=r.get("region",null),e.vertical=r.get("vertical",""),e.line=r.get("line","auto"),e.lineAlign=r.get("lineAlign","start"),e.snapToLines=r.get("snapToLines",!0),e.size=r.get("size",100),e.align=r.get("align","middle"),e.position=r.get("position",{start:0,left:0,middle:50,end:100,right:100},e.align),e.positionAlign=r.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},e.align)}(t,e)}function kt(t,e){function n(t){return Tr[t]}for(var r,i=t.document.createElement("div"),o=i,s=[];null!==(r=function(){if(!e)return null;var t=e.match(/^([^<]*)(<[^>]+>?)?/);return function(t){return e=e.substr(t.length),t}(t[1]?t[1]:t[2])}());)if("<"!==r[0])o.appendChild(t.document.createTextNode(function(t){for(;c=t.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)t=t.replace(c[0],n);return t}(r)));else{if("/"===r[1]){s.length&&s[s.length-1]===r.substr(2).replace(">","")&&(s.pop(),o=o.parentNode);continue}var a,l=_t(r.substr(1,r.length-2));if(l){a=t.document.createProcessingInstruction("timestamp",l),o.appendChild(a);continue}var c=r.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!c)continue;if(!(a=function(e,n){var r=Cr[e];if(!r)return null;var i=t.document.createElement(r);i.localName=r;var o=kr[e];return o&&n&&(i[o]=n.trim()),i}(c[1],c[3])))continue;if(!function(t,e){return!wr[e.localName]||wr[e.localName]===t.localName}(o,a))continue;c[2]&&(a.className=c[2].substr(1).replace("."," ")),s.push(c[1]),o.appendChild(a),o=a}return i}function wt(t){for(var e=0;e<Er.length;e++){var n=Er[e];if(t>=n[0]&&t<=n[1])return!0}return!1}function Et(t){function e(t,e){for(var n=e.childNodes.length-1;n>=0;n--)t.push(e.childNodes[n])}function n(t){if(!t||!t.length)return null;var r=t.pop(),i=r.textContent||r.innerText;if(i){var o=i.match(/^.*(\n|\r)/);return o?(t.length=0,o[0]):i}return"ruby"===r.tagName?n(t):r.childNodes?(e(t,r),n(t)):void 0}var r,i=[],o="";if(!t||!t.childNodes)return"ltr";for(e(i,t);o=n(i);)for(var s=0;s<o.length;s++)if(r=o.charCodeAt(s),wt(r))return"rtl";return"ltr"}function St(t){if("number"==typeof t.line&&(t.snapToLines||t.line>=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;for(var e=t.track,n=e.textTrackList,r=0,i=0;i<n.length&&n[i]!==e;i++)"showing"===n[i].mode&&r++;return-1*++r}function xt(){}function jt(t,e,n){var r=/MSIE\s8\.0/.test(navigator.userAgent),i="rgba(255, 255, 255, 1)",o="rgba(0, 0, 0, 0.8)";r&&(i="rgb(255, 255, 255)",o="rgb(0, 0, 0)"),xt.call(this),this.cue=e,this.cueDiv=kt(t,e.text);var s={color:i,backgroundColor:o,position:"relative",left:0,right:0,top:0,bottom:0,display:"inline"};r||(s.writingMode=""===e.vertical?"horizontal-tb":"lr"===e.vertical?"vertical-lr":"vertical-rl",s.unicodeBidi="plaintext"),this.applyStyles(s,this.cueDiv),this.div=t.document.createElement("div"),s={textAlign:"middle"===e.align?"center":e.align,font:n.font,whiteSpace:"pre-line",position:"absolute"},r||(s.direction=Et(this.cueDiv),s.writingMode=""===e.vertical?"horizontal-tb":"lr"===e.vertical?"vertical-lr":"vertical-rl".stylesunicodeBidi="plaintext"),this.applyStyles(s),this.div.appendChild(this.cueDiv);var a=0;switch(e.positionAlign){case"start":a=e.position;break;case"middle":a=e.position-e.size/2;break;case"end":a=e.position-e.size}""===e.vertical?this.applyStyles({left:this.formatStyle(a,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(a,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(t){this.applyStyles({top:this.formatStyle(t.top,"px"),bottom:this.formatStyle(t.bottom,"px"),left:this.formatStyle(t.left,"px"),right:this.formatStyle(t.right,"px"),height:this.formatStyle(t.height,"px"),width:this.formatStyle(t.width,"px")})}}function At(t){var e,n,r,i,o=/MSIE\s8\.0/.test(navigator.userAgent);if(t.div){n=t.div.offsetHeight,r=t.div.offsetWidth,i=t.div.offsetTop;var s=(s=t.div.childNodes)&&(s=s[0])&&s.getClientRects&&s.getClientRects();t=t.div.getBoundingClientRect(),e=s?Math.max(s[0]&&s[0].height||0,t.height/s.length):0}this.left=t.left,this.right=t.right,this.top=t.top||i,this.height=t.height||n,this.bottom=t.bottom||i+(t.height||n),this.width=t.width||r,this.lineHeight=void 0!==e?e:t.lineHeight,o&&!this.lineHeight&&(this.lineHeight=13)}function Pt(t,e,n,r){var i=new At(e),o=e.cue,s=St(o),a=[];if(o.snapToLines){var l;switch(o.vertical){case"":a=["+y","-y"],l="height";break;case"rl":a=["+x","-x"],l="width";break;case"lr":a=["-x","+x"],l="width"}var c=i.lineHeight,u=c*Math.round(s),h=n[l]+c,p=a[0];Math.abs(u)>h&&(u=u<0?-1:1,u*=Math.ceil(h/c)*c),s<0&&(u+=""===o.vertical?n.height:n.width,a=a.reverse()),i.move(p,u)}else{var d=i.lineHeight/n.height*100;switch(o.lineAlign){case"middle":s-=d/2;break;case"end":s-=d}switch(o.vertical){case"":e.applyStyles({top:e.formatStyle(s,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(s,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(s,"%")})}a=["+y","-x","+x","-y"],i=new At(e)}var f=function(t,e){for(var i,o=new At(t),s=1,a=0;a<e.length;a++){for(;t.overlapsOppositeAxis(n,e[a])||t.within(n)&&t.overlapsAny(r);)t.move(e[a]);if(t.within(n))return t;var l=t.intersectPercentage(n);s>l&&(i=new At(t),s=l),t=new At(o)}return i||o}(i,a);e.move(f.toCSSCompatValues(n))}function Nt(){}function Ot(t){return"string"==typeof t&&(!!jr[t.toLowerCase()]&&t.toLowerCase())}function Mt(t){return"string"==typeof t&&(!!Ar[t.toLowerCase()]&&t.toLowerCase())}function It(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function Dt(t,e,n){var r=this,i=/MSIE\s8\.0/.test(navigator.userAgent),o={};i?r=document.createElement("custom"):o.enumerable=!0,r.hasBeenReset=!1;var s="",a=!1,l=t,c=e,u=n,h=null,p="",d=!0,f="auto",v="start",y=50,g="middle",m=50,_="middle";if(Object.defineProperty(r,"id",It({},o,{get:function(){return s},set:function(t){s=""+t}})),Object.defineProperty(r,"pauseOnExit",It({},o,{get:function(){return a},set:function(t){a=!!t}})),Object.defineProperty(r,"startTime",It({},o,{get:function(){return l},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");l=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"endTime",It({},o,{get:function(){return c},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");c=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"text",It({},o,{get:function(){return u},set:function(t){u=""+t,this.hasBeenReset=!0}})),Object.defineProperty(r,"region",It({},o,{get:function(){return h},set:function(t){h=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"vertical",It({},o,{get:function(){return p},set:function(t){var e=Ot(t);if(!1===e)throw new SyntaxError("An invalid or illegal string was specified.");p=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"snapToLines",It({},o,{get:function(){return d},set:function(t){d=!!t,this.hasBeenReset=!0}})),Object.defineProperty(r,"line",It({},o,{get:function(){return f},set:function(t){if("number"!=typeof t&&t!==xr)throw new SyntaxError("An invalid number or illegal string was specified.");f=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"lineAlign",It({},o,{get:function(){return v},set:function(t){var e=Mt(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"position",It({},o,{get:function(){return y},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"positionAlign",It({},o,{get:function(){return g},set:function(t){var e=Mt(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"size",It({},o,{get:function(){return m},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"align",It({},o,{get:function(){return _},set:function(t){var e=Mt(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");_=e,this.hasBeenReset=!0}})),r.displayState=void 0,i)return r}function Rt(t){return"string"==typeof t&&(!!Nr[t.toLowerCase()]&&t.toLowerCase())}function Lt(t){return"number"==typeof t&&t>=0&&t<=100}function Bt(){var t=100,e=3,n=0,r=100,i=0,o=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(e){if(!Lt(e))throw new Error("Width must be between 0 and 100.");t=e}},lines:{enumerable:!0,get:function(){return e},set:function(t){if("number"!=typeof t)throw new TypeError("Lines must be set to a number.");e=t}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(t){if(!Lt(t))throw new Error("RegionAnchorX must be between 0 and 100.");r=t}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(t){if(!Lt(t))throw new Error("RegionAnchorY must be between 0 and 100.");n=t}},viewportAnchorY:{enumerable:!0,get:function(){return o},set:function(t){if(!Lt(t))throw new Error("ViewportAnchorY must be between 0 and 100.");o=t}},viewportAnchorX:{enumerable:!0,get:function(){return i},set:function(t){if(!Lt(t))throw new Error("ViewportAnchorX must be between 0 and 100.");i=t}},scroll:{enumerable:!0,get:function(){return s},set:function(t){var e=Rt(t);if(!1===e)throw new SyntaxError("An invalid or illegal string was specified.");s=e}}})}function Ft(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=t.textTracks();i.kind=e,n&&(i.label=n),r&&(i.language=r),i.tech=t;var s=new _r.text.TrackClass(i);return o.addTrack(s),s}function Ht(t,e){Dr[t]=Dr[t]||[],Dr[t].push(e)}function Vt(t,e,n){t.setTimeout(function(){return qt(e,Dr[e.type],n,t)},1)}function zt(t,e){t.forEach(function(t){return t.setTech&&t.setTech(e)})}function Wt(t,e,n){return t.reduceRight(Xt(n),e[n]())}function Ut(t,e,n,r){return e[n](t.reduce(Xt(n),r))}function Xt(t){return function(e,n){return n[t]?n[t](e):e}}function qt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments[2],i=arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=e[0],l=e.slice(1);if("string"==typeof a)qt(t,Dr[a],n,i,o,s);else if(a){var c=a(i);c.setSource(r({},t),function(e,r){if(e)return qt(t,l,n,i,o,s);o.push(c),qt(r,t.type===r.type?l:Dr[r.type],n,i,o,s)})}else l.length?qt(t,l,n,i,o,s):s?n(t,o):qt(t,Dr["*"],n,i,o,!0)}function Kt(t,e){return"rgba("+parseInt(t[1]+t[1],16)+","+parseInt(t[2]+t[2],16)+","+parseInt(t[3]+t[3],16)+","+e+")"}function Gt(t,e,n){try{t.style[e]=n}catch(t){return}}function Yt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;t=t<0?0:t;var n=Math.floor(t%60),r=Math.floor(t/60%60),i=Math.floor(t/3600),o=Math.floor(e/60%60),s=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(i=r=n="-"),i=i>0||s>0?i+":":"",r=((i||o>=10)&&r<10?"0"+r:r)+":",n=n<10?"0"+n:n,i+r+n}function $t(t,e){if(e&&(t=e(t)),t&&"none"!==t)return t}function Jt(t,e){return $t(t.options[t.options.selectedIndex].value,e)}function Qt(t,e,n){if(e)for(var r=0;r<t.options.length;r++)if($t(t.options[r].value,n)===e){t.selectedIndex=r;break}}function Zt(t,e,n){var r=void 0;if("string"==typeof t){var o=Zt.getPlayers();if(0===t.indexOf("#")&&(t=t.slice(1)),o[t])return e&&Ue.warn('Player "'+t+'" is already initialised. Options will not be applied.'),n&&o[t].ready(n),o[t];r=Ke("#"+t)}else r=t;if(!r||!r.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");if(r.player||io.players[r.playerId])return r.player||io.players[r.playerId];e=e||{},Zt.hooks("beforesetup").forEach(function(t){var n=t(r,Q(e));if(!i(n)||Array.isArray(n))return void Ue.error("please return an object in beforesetup hooks");e=Q(e,n)});var s=mn.getComponent("Player"),a=new s(r,e,n);return Zt.hooks("setup").forEach(function(t){return t(a)}),a}var te,ee="6.2.0",ne="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};te="undefined"!=typeof window?window:void 0!==ne?ne:"undefined"!=typeof self?self:{};var re,ie=te,oe={},se=(Object.freeze||Object)({default:oe}),ae=se&&oe||se,le=void 0!==ne?ne:"undefined"!=typeof window?window:{};"undefined"!=typeof document?re=document:(re=le["__GLOBAL_DOCUMENT_CACHE@4"])||(re=le["__GLOBAL_DOCUMENT_CACHE@4"]=ae);var ce=re,ue=ie.navigator&&ie.navigator.userAgent||"",he=/AppleWebKit\/([\d.]+)/i.exec(ue),pe=he?parseFloat(he.pop()):null,de=/iPad/i.test(ue),fe=/iPhone/i.test(ue)&&!de,ve=/iPod/i.test(ue),ye=fe||de||ve,ge=function(){var t=ue.match(/OS (\d+)_/i);return t&&t[1]?t[1]:null}(),me=/Android/i.test(ue),_e=function(){var t=ue.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;var e=t[1]&&parseFloat(t[1]),n=t[2]&&parseFloat(t[2]);return e&&n?parseFloat(t[1]+"."+t[2]):e||null}(),be=me&&/webkit/i.test(ue)&&_e<2.3,Te=me&&_e<5&&pe<537,Ce=/Firefox/i.test(ue),ke=/Edge/i.test(ue),we=!ke&&/Chrome/i.test(ue),Ee=function(){var t=ue.match(/Chrome\/(\d+)/);return t&&t[1]?parseFloat(t[1]):null}(),Se=/MSIE\s8\.0/.test(ue),xe=function(){var t=/MSIE\s(\d+)\.\d/.exec(ue),e=t&&parseFloat(t[1]);return!e&&/Trident\/7.0/i.test(ue)&&/rv:11.0/.test(ue)&&(e=11),e}(),je=/Safari/i.test(ue)&&!we&&!me&&!ke,Ae=je||ye,Pe=h()&&("ontouchstart"in ie||ie.DocumentTouch&&ie.document instanceof ie.DocumentTouch),Ne=h()&&"backgroundSize"in ie.document.createElement("video").style,Oe=(Object.freeze||Object)({IS_IPAD:de,IS_IPHONE:fe,IS_IPOD:ve,IS_IOS:ye,IOS_VERSION:ge,IS_ANDROID:me,ANDROID_VERSION:_e,IS_OLD_ANDROID:be,IS_NATIVE_ANDROID:Te,IS_FIREFOX:Ce,IS_EDGE:ke,IS_CHROME:we,CHROME_VERSION:Ee,IS_IE8:Se,IE_VERSION:xe,IS_SAFARI:je,IS_ANY_SAFARI:Ae,TOUCH_ENABLED:Pe,BACKGROUND_SIZE_SUPPORTED:Ne}),Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},De=function(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)},Re=function(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},Le=function(t,e){return t.raw=e,t},Be=Object.prototype.toString,Fe=function(t){return i(t)?Object.keys(t):[]},He=void 0,Ve="all",ze=[],We=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!!xe&&xe<11,r=He.levels[Ve],o=new RegExp("^("+r+")$");"log"!==t&&e.unshift(t.toUpperCase()+":"),ze&&ze.push([].concat(e)),e.unshift("VIDEOJS:");var s=ie.console&&ie.console[t];s&&r&&o.test(t)&&(n&&(e=e.map(function(t){if(i(t)||Array.isArray(t))try{return JSON.stringify(t)}catch(e){return String(t)}return String(t)}).join(" ")),s.apply?s[Array.isArray(e)?"apply":"call"](ie.console,e):s(e))};He=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];We("log",e)},He.levels={all:"log|warn|error",error:"error",off:"",warn:"warn|error",DEFAULT:Ve},He.level=function(t){if("string"==typeof t){if(!He.levels.hasOwnProperty(t))throw new Error('"'+t+'" in not a valid log level');Ve=t}return Ve},He.history=function(){return ze?[].concat(ze):[]},He.history.clear=function(){ze&&(ze.length=0)},He.history.disable=function(){null!==ze&&(ze.length=0,ze=null)},He.history.enable=function(){null===ze&&(ze=[])},He.error=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return We("error",e)},He.warn=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return We("warn",e)};var Ue=He,Xe=function(t){for(var e="",n=0;n<arguments.length;n++)e+=s(t[n])+(arguments[n+1]||"");return e},qe=Le(["Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set "," to ","."],["Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set "," to ","."]),Ke=d("querySelector"),Ge=d("querySelectorAll"),Ye=(Object.freeze||Object)({isReal:h,isEl:p,createEl:f,textContent:v,prependTo:y,hasClass:g,addClass:m,removeClass:_,toggleClass:b,setAttributes:T,getAttributes:C,getAttribute:k,setAttribute:w,removeAttribute:E,blockTextSelection:S,unblockTextSelection:x,getBoundingClientRect:j,findPosition:A,getPointerPosition:P,isTextNode:N,emptyEl:O,normalizeContent:M,appendContent:I,insertContent:D,$:Ke,$$:Ge}),$e=1,Je={},Qe="vdata"+(new Date).getTime(),Ze=(Object.freeze||Object)({fixEvent:z,on:W,off:U,trigger:X,one:q}),tn=!1,en=void 0,nn=function(){if(h()){var t=ce.getElementsByTagName("video"),e=ce.getElementsByTagName("audio"),n=[];if(t&&t.length>0)for(var r=0,i=t.length;r<i;r++)n.push(t[r]);if(e&&e.length>0)for(var o=0,s=e.length;o<s;o++)n.push(e[o]);if(n&&n.length>0)for(var a=0,l=n.length;a<l;a++){var c=n[a];if(!c||!c.getAttribute){K(1);break}if(void 0===c.player){var u=c.getAttribute("data-setup");null!==u&&en(c)}}else tn||K(1)}};h()&&"complete"===ce.readyState?tn=!0:q(ie,"load",function(){tn=!0});var rn=function(t){var e=ce.createElement("style") - ;return e.className=t,e},on=function(t,e){t.styleSheet?t.styleSheet.cssText=e:t.textContent=e},sn=function(t,e,n){e.guid||(e.guid=R());var r=function(){return e.apply(t,arguments)};return r.guid=n?n+"_"+e.guid:e.guid,r},an=function(t,e){var n=Date.now();return function(){var r=Date.now();r-n>=e&&(t.apply(void 0,arguments),n=r)}},ln=function(){};ln.prototype.allowedEvents_={},ln.prototype.on=function(t,e){var n=this.addEventListener;this.addEventListener=function(){},W(this,t,e),this.addEventListener=n},ln.prototype.addEventListener=ln.prototype.on,ln.prototype.off=function(t,e){U(this,t,e)},ln.prototype.removeEventListener=ln.prototype.off,ln.prototype.one=function(t,e){var n=this.addEventListener;this.addEventListener=function(){},q(this,t,e),this.addEventListener=n},ln.prototype.trigger=function(t){var e=t.type||t;"string"==typeof t&&(t={type:e}),t=z(t),this.allowedEvents_[e]&&this["on"+e]&&this["on"+e](t),X(this,t)},ln.prototype.dispatchEvent=ln.prototype.trigger;var cn=function(t){return t instanceof ln||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},un=function(t){return"string"==typeof t&&/\S/.test(t)||Array.isArray(t)&&!!t.length},hn=function(t){if(!t.nodeName&&!cn(t))throw new Error("Invalid target; must be a DOM node or evented object.")},pn=function(t){if(!un(t))throw new Error("Invalid event type; must be a non-empty string or array.")},dn=function(t){if("function"!=typeof t)throw new Error("Invalid listener; must be a function.")},fn=function(t,e){var n=e.length<3||e[0]===t||e[0]===t.eventBusEl_,r=void 0,i=void 0,o=void 0;return n?(r=t.eventBusEl_,e.length>=3&&e.shift(),i=e[0],o=e[1]):(r=e[0],i=e[1],o=e[2]),hn(r),pn(i),dn(o),o=sn(t,o),{isTargetingSelf:n,target:r,type:i,listener:o}},vn=function(t,e,n,r){hn(t),t.nodeName?Ze[e](t,n,r):t[e](n,r)},yn={on:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=fn(this,n),o=i.isTargetingSelf,s=i.target,a=i.type,l=i.listener;if(vn(s,"on",a,l),!o){var c=function(){return t.off(s,a,l)};c.guid=l.guid;var u=function(){return t.off("dispose",c)};u.guid=l.guid,vn(this,"on","dispose",c),vn(s,"on","dispose",u)}},one:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=fn(this,n),o=i.isTargetingSelf,s=i.target,a=i.type,l=i.listener;if(o)vn(s,"one",a,l);else{var c=function e(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t.off(s,a,e),l.apply(null,r)};c.guid=l.guid,vn(s,"one",a,c)}},off:function(t,e,n){if(!t||un(t))U(this.eventBusEl_,t,e);else{var r=t,i=e;hn(r),pn(i),dn(n),n=sn(this,n),this.off("dispose",n),r.nodeName?(U(r,i,n),U(r,"dispose",n)):cn(r)&&(r.off(i,n),r.off("dispose",n))}},trigger:function(t,e){return X(this.eventBusEl_,t,e)}},gn={state:{},setState:function(t){var n=this;"function"==typeof t&&(t=t());var r=void 0;return e(t,function(t,e){n.state[e]!==t&&(r=r||{},r[e]={from:n.state[e],to:t}),n.state[e]=t}),r&&cn(this)&&this.trigger({changes:r,type:"statechanged"}),r}},mn=function(){function t(e,n,r){if(Ie(this,t),!e&&this.play?this.player_=e=this:this.player_=e,this.options_=Q({},this.options_),n=this.options_=Q(this.options_,n),this.id_=n.id||n.el&&n.el.id,!this.id_){var i=e&&e.id&&e.id()||"no_player";this.id_=i+"_component_"+R()}this.name_=n.name||null,n.el?this.el_=n.el:!1!==n.createEl&&(this.el_=this.createEl()),G(this,{eventBusKey:this.el_?"el_":null}),Y(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},!1!==n.initChildren&&this.initChildren(),this.ready(r),!1!==n.reportTouchActivity&&this.enableTouchActivity()}return t.prototype.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),F(this.el_),this.el_=null)},t.prototype.player=function(){return this.player_},t.prototype.options=function(t){return Ue.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),t?(this.options_=Q(this.options_,t),this.options_):this.options_},t.prototype.el=function(){return this.el_},t.prototype.createEl=function(t,e,n){return f(t,e,n)},t.prototype.localize=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),o=i&&i[r],s=r&&r.split("-")[0],a=i&&i[s],l=n;return o&&o[t]?l=o[t]:a&&a[t]&&(l=a[t]),e&&(l=l.replace(/\{(\d+)\}/g,function(t,n){var r=e[n-1],i=r;return void 0===r&&(i=t),i})),l},t.prototype.contentEl=function(){return this.contentEl_||this.el_},t.prototype.id=function(){return this.id_},t.prototype.name=function(){return this.name_},t.prototype.children=function(){return this.children_},t.prototype.getChildById=function(t){return this.childIndex_[t]},t.prototype.getChild=function(t){if(t)return t=$(t),this.childNameIndex_[t]},t.prototype.addChild=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length,i=void 0,o=void 0;if("string"==typeof e){o=$(e);var s=n.componentClass||o;n.name=o;var a=t.getComponent(s);if(!a)throw new Error("Component "+s+" does not exist");if("function"!=typeof a)return null;i=new a(this.player_||this,n)}else i=e;if(this.children_.splice(r,0,i),"function"==typeof i.id&&(this.childIndex_[i.id()]=i),o=o||i.name&&$(i.name()),o&&(this.childNameIndex_[o]=i),"function"==typeof i.el&&i.el()){var l=this.contentEl().children,c=l[r]||null;this.contentEl().insertBefore(i.el(),c)}return i},t.prototype.removeChild=function(t){if("string"==typeof t&&(t=this.getChild(t)),t&&this.children_){for(var e=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===t){e=!0,this.children_.splice(n,1);break}if(e){this.childIndex_[t.id()]=null,this.childNameIndex_[t.name()]=null;var r=t.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(t.el())}}},t.prototype.initChildren=function(){var e=this,n=this.options_.children;if(n){var r=this.options_,i=function(t){var n=t.name,i=t.opts;if(void 0!==r[n]&&(i=r[n]),!1!==i){!0===i&&(i={}),i.playerOptions=e.options_.playerOptions;var o=e.addChild(n,i);o&&(e[n]=o)}},o=void 0,s=t.getComponent("Tech");o=Array.isArray(n)?n:Object.keys(n),o.concat(Object.keys(this.options_).filter(function(t){return!o.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(function(t){var r=void 0,i=void 0;return"string"==typeof t?(r=t,i=n[r]||e.options_[r]||{}):(r=t.name,i=t),{name:r,opts:i}}).filter(function(e){var n=t.getComponent(e.opts.componentClass||$(e.name));return n&&!s.isTech(n)}).forEach(i)}},t.prototype.buildCSSClass=function(){return""},t.prototype.ready=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&(this.isReady_?e?t.call(this):this.setTimeout(t,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(t)))},t.prototype.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var t=this.readyQueue_;this.readyQueue_=[],t&&t.length>0&&t.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)},t.prototype.$=function(t,e){return Ke(t,e||this.contentEl())},t.prototype.$$=function(t,e){return Ge(t,e||this.contentEl())},t.prototype.hasClass=function(t){return g(this.el_,t)},t.prototype.addClass=function(t){m(this.el_,t)},t.prototype.removeClass=function(t){_(this.el_,t)},t.prototype.toggleClass=function(t,e){b(this.el_,t,e)},t.prototype.show=function(){this.removeClass("vjs-hidden")},t.prototype.hide=function(){this.addClass("vjs-hidden")},t.prototype.lockShowing=function(){this.addClass("vjs-lock-showing")},t.prototype.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.prototype.getAttribute=function(t){return k(this.el_,t)},t.prototype.setAttribute=function(t,e){w(this.el_,t,e)},t.prototype.removeAttribute=function(t){E(this.el_,t)},t.prototype.width=function(t,e){return this.dimension("width",t,e)},t.prototype.height=function(t,e){return this.dimension("height",t,e)},t.prototype.dimensions=function(t,e){this.width(t,!0),this.height(e)},t.prototype.dimension=function(t,e,n){if(void 0!==e)return null!==e&&e===e||(e=0),-1!==(""+e).indexOf("%")||-1!==(""+e).indexOf("px")?this.el_.style[t]=e:this.el_.style[t]="auto"===e?"":e+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var r=this.el_.style[t],i=r.indexOf("px");return-1!==i?parseInt(r.slice(0,i),10):parseInt(this.el_["offset"+$(t)],10)},t.prototype.currentDimension=function(t){var e=0;if("width"!==t&&"height"!==t)throw new Error("currentDimension only accepts width or height value");if("function"==typeof ie.getComputedStyle){var n=ie.getComputedStyle(this.el_);e=n.getPropertyValue(t)||n[t]}if(0===(e=parseFloat(e))){var r="offset"+$(t);e=this.el_[r]}return e},t.prototype.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.prototype.currentWidth=function(){return this.currentDimension("width")},t.prototype.currentHeight=function(){return this.currentDimension("height")},t.prototype.focus=function(){this.el_.focus()},t.prototype.blur=function(){this.el_.blur()},t.prototype.emitTapEvents=function(){var t=0,e=null,n=void 0;this.on("touchstart",function(r){1===r.touches.length&&(e={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},t=(new Date).getTime(),n=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)n=!1;else if(e){var r=t.touches[0].pageX-e.pageX,i=t.touches[0].pageY-e.pageY,o=Math.sqrt(r*r+i*i);o>10&&(n=!1)}});var r=function(){n=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){if(e=null,!0===n){(new Date).getTime()-t<200&&(r.preventDefault(),this.trigger("tap"))}})},t.prototype.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var t=sn(this.player(),this.player().reportUserActivity),e=void 0;this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var n=function(n){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}},t.prototype.setTimeout=function(t,e){t=sn(this,t);var n=ie.setTimeout(t,e),r=function(){this.clearTimeout(n)};return r.guid="vjs-timeout-"+n,this.on("dispose",r),n},t.prototype.clearTimeout=function(t){ie.clearTimeout(t);var e=function(){};return e.guid="vjs-timeout-"+t,this.off("dispose",e),t},t.prototype.setInterval=function(t,e){t=sn(this,t);var n=ie.setInterval(t,e),r=function(){this.clearInterval(n)};return r.guid="vjs-interval-"+n,this.on("dispose",r),n},t.prototype.clearInterval=function(t){ie.clearInterval(t);var e=function(){};return e.guid="vjs-interval-"+t,this.off("dispose",e),t},t.prototype.requestAnimationFrame=function(t){var e=this;if(this.supportsRaf_){t=sn(this,t);var n=ie.requestAnimationFrame(t),r=function(){return e.cancelAnimationFrame(n)};return r.guid="vjs-raf-"+n,this.on("dispose",r),n}return this.setTimeout(t,1e3/60)},t.prototype.cancelAnimationFrame=function(t){if(this.supportsRaf_){ie.cancelAnimationFrame(t);var e=function(){};return e.guid="vjs-raf-"+t,this.off("dispose",e),t}return this.clearTimeout(t)},t.registerComponent=function(e,n){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var r=t.getComponent("Tech"),i=r&&r.isTech(n),o=t===n||t.prototype.isPrototypeOf(n.prototype);if(i||!o){var s=void 0;throw s=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+s+".")}e=$(e),t.components_||(t.components_={});var a=t.getComponent("Player");if("Player"===e&&a&&a.players){var l=a.players,c=Object.keys(l);if(l&&c.length>0&&c.map(function(t){return l[t]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=n,n},t.getComponent=function(e){if(e)return e=$(e),t.components_&&t.components_[e]?t.components_[e]:void 0},t}();mn.prototype.supportsRaf_="function"==typeof ie.requestAnimationFrame&&"function"==typeof ie.cancelAnimationFrame,mn.registerComponent("Component",mn);for(var _n={},bn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tn=bn[0],Cn=void 0,kn=0;kn<bn.length;kn++)if(bn[kn][1]in ce){Cn=bn[kn];break}if(Cn)for(var wn=0;wn<Cn.length;wn++)_n[Tn[wn]]=Cn[wn];it.prototype.code=0,it.prototype.message="",it.prototype.status=null,it.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],it.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var En=0;En<it.errorTypes.length;En++)it[it.errorTypes[En]]=En,it.prototype[it.errorTypes[En]]=En;var Sn=ot,xn=function(t){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(e,n,r){return t[n]&&(e[n]=t[n]),e},{cues:t.cues&&Array.prototype.map.call(t.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},jn=function(t){var e=t.$$("track"),n=Array.prototype.map.call(e,function(t){return t.track});return Array.prototype.map.call(e,function(t){var e=xn(t.track);return t.src&&(e.src=t.src),e}).concat(Array.prototype.filter.call(t.textTracks(),function(t){return-1===n.indexOf(t)}).map(xn))},An=function(t,e){return t.forEach(function(t){var n=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(function(t){return n.addCue(t)})}),e.textTracks()},Pn={textTracksToJson:jn,jsonToTextTracks:An,trackToJson_:xn},Nn="vjs-modal-dialog",On=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.opened_=i.hasBeenOpened_=i.hasBeenFilled_=!1,i.closeable(!i.options_.uncloseable),i.content(i.options_.content),i.contentEl_=f("div",{className:Nn+"-content"},{role:"document"}),i.descEl_=f("p",{className:Nn+"-description vjs-control-text",id:i.el().getAttribute("aria-describedby")}),v(i.descEl_,i.description()),i.el_.appendChild(i.descEl_),i.el_.appendChild(i.contentEl_),i}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},e.prototype.buildCSSClass=function(){return Nn+" vjs-hidden "+t.prototype.buildCSSClass.call(this)},e.prototype.handleKeyPress=function(t){27===t.which&&this.closeable()&&this.close()},e.prototype.label=function(){return this.localize(this.options_.label||"Modal Window")},e.prototype.description=function(){var t=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(t+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),t},e.prototype.open=function(){if(!this.opened_){var t=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!t.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&t.pause(),this.closeable()&&this.on(this.el_.ownerDocument,"keydown",sn(this,this.handleKeyPress)),t.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},e.prototype.opened=function(t){return"boolean"==typeof t&&this[t?"open":"close"](),this.opened_},e.prototype.close=function(){if(this.opened_){var t=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&t.play(),this.closeable()&&this.off(this.el_.ownerDocument,"keydown",sn(this,this.handleKeyPress)),t.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},e.prototype.closeable=function(t){if("boolean"==typeof t){var e=this.closeable_=!!t,n=this.getChild("closeButton");if(e&&!n){var r=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(n,"close",this.close)}!e&&n&&(this.off(n,"close",this.close),this.removeChild(n),n.dispose())}return this.closeable_},e.prototype.fill=function(){this.fillWith(this.content())},e.prototype.fillWith=function(t){var e=this.contentEl(),n=e.parentNode,r=e.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(e),this.empty(),D(e,t),this.trigger("modalfill"),r?n.insertBefore(e,r):n.appendChild(e);var i=this.getChild("closeButton");i&&n.appendChild(i.el_)},e.prototype.empty=function(){this.trigger("beforemodalempty"),O(this.contentEl()),this.trigger("modalempty")},e.prototype.content=function(t){return void 0!==t&&(this.content_=t),this.content_},e.prototype.conditionalFocus_=function(){var t=ce.activeElement,e=this.player_.el_;this.previouslyActiveEl_=null,(e.contains(t)||e===t)&&(this.previouslyActiveEl_=t,this.focus(),this.on(ce,"keydown",this.handleKeyDown))},e.prototype.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null),this.off(ce,"keydown",this.handleKeyDown)},e.prototype.handleKeyDown=function(t){if(9===t.which){for(var e=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=void 0,i=0;i<e.length;i++)if(n===e[i]){r=i;break}ce.activeElement===this.el_&&(r=0),t.shiftKey&&0===r?(e[e.length-1].focus(),t.preventDefault()):t.shiftKey||r!==e.length-1||(e[0].focus(),t.preventDefault())}},e.prototype.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,function(t){return(t instanceof ie.HTMLAnchorElement||t instanceof ie.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof ie.HTMLInputElement||t instanceof ie.HTMLSelectElement||t instanceof ie.HTMLTextAreaElement||t instanceof ie.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof ie.HTMLIFrameElement||t instanceof ie.HTMLObjectElement||t instanceof ie.HTMLEmbedElement||t.hasAttribute("tabindex")&&-1!==t.getAttribute("tabindex")||t.hasAttribute("contenteditable")})},e}(mn);On.prototype.options_={pauseOnOpen:!0,temporary:!0},mn.registerComponent("ModalDialog",On);var Mn=function(t){function e(){var n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Ie(this,e);var o=Re(this,t.call(this));if(!i&&(i=o,Se)){i=ce.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(i[s]=e.prototype[s])}i.tracks_=[],Object.defineProperty(i,"length",{get:function(){return this.tracks_.length}});for(var a=0;a<r.length;a++)i.addTrack(r[a]);return n=i,Re(o,n)}return De(e,t),e.prototype.addTrack=function(t){var e=this.tracks_.length;""+e in this||Object.defineProperty(this,e,{get:function(){return this.tracks_[e]}}),-1===this.tracks_.indexOf(t)&&(this.tracks_.push(t),this.trigger({track:t,type:"addtrack"}))},e.prototype.removeTrack=function(t){for(var e=void 0,n=0,r=this.length;n<r;n++)if(this[n]===t){e=this[n],e.off&&e.off(),this.tracks_.splice(n,1);break}e&&this.trigger({track:e,type:"removetrack"})},e.prototype.getTrackById=function(t){for(var e=null,n=0,r=this.length;n<r;n++){var i=this[n];if(i.id===t){e=i;break}}return e},e}(ln);Mn.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"};for(var In in Mn.prototype.allowedEvents_)Mn.prototype["on"+In]=null;var Dn=function(t,e){for(var n=0;n<t.length;n++)e.id!==t[n].id&&(t[n].enabled=!1)},Rn=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Ie(this,e);for(var o=void 0,s=i.length-1;s>=0;s--)if(i[s].enabled){Dn(i,i[s]);break}if(Se){o=ce.createElement("custom");for(var a in Mn.prototype)"constructor"!==a&&(o[a]=Mn.prototype[a]);for(var l in e.prototype)"constructor"!==l&&(o[l]=e.prototype[l])}return o=n=Re(this,t.call(this,i,o)),o.changing_=!1,r=o,Re(n,r)}return De(e,t),e.prototype.addTrack=function(e){var n=this;e.enabled&&Dn(this,e),t.prototype.addTrack.call(this,e),e.addEventListener&&e.addEventListener("enabledchange",function(){n.changing_||(n.changing_=!0,Dn(n,e),n.changing_=!1,n.trigger("change"))})},e}(Mn),Ln=function(t,e){for(var n=0;n<t.length;n++)e.id!==t[n].id&&(t[n].selected=!1)},Bn=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Ie(this,e);for(var o=void 0,s=i.length-1;s>=0;s--)if(i[s].selected){Ln(i,i[s]);break}if(Se){o=ce.createElement("custom");for(var a in Mn.prototype)"constructor"!==a&&(o[a]=Mn.prototype[a]);for(var l in e.prototype)"constructor"!==l&&(o[l]=e.prototype[l])}return o=n=Re(this,t.call(this,i,o)),o.changing_=!1,Object.defineProperty(o,"selectedIndex",{get:function(){for(var t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set:function(){}}),r=o,Re(n,r)}return De(e,t),e.prototype.addTrack=function(e){var n=this;e.selected&&Ln(this,e),t.prototype.addTrack.call(this,e),e.addEventListener&&e.addEventListener("selectedchange",function(){n.changing_||(n.changing_=!0,Ln(n,e),n.changing_=!1,n.trigger("change"))})},e}(Mn),Fn=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Ie(this,e);var o=void 0;if(Se){o=ce.createElement("custom");for(var s in Mn.prototype)"constructor"!==s&&(o[s]=Mn.prototype[s]);for(var a in e.prototype)"constructor"!==a&&(o[a]=e.prototype[a])}return o=n=Re(this,t.call(this,i,o)),r=o,Re(n,r)}return De(e,t),e.prototype.addTrack=function(e){t.prototype.addTrack.call(this,e),e.addEventListener("modechange",sn(this,function(){this.trigger("change")})),-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",sn(this,function(){this.trigger("selectedlanguagechange")}))},e}(Mn),Hn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Ie(this,t);var n=this;if(Se){n=ce.createElement("custom");for(var r in t.prototype)"constructor"!==r&&(n[r]=t.prototype[r])}n.trackElements_=[],Object.defineProperty(n,"length",{get:function(){return this.trackElements_.length}});for(var i=0,o=e.length;i<o;i++)n.addTrackElement_(e[i]);if(Se)return n}return t.prototype.addTrackElement_=function(t){var e=this.trackElements_.length;""+e in this||Object.defineProperty(this,e,{get:function(){return this.trackElements_[e]}}),-1===this.trackElements_.indexOf(t)&&this.trackElements_.push(t)},t.prototype.getTrackElementByTrack_=function(t){for(var e=void 0,n=0,r=this.trackElements_.length;n<r;n++)if(t===this.trackElements_[n].track){e=this.trackElements_[n];break}return e},t.prototype.removeTrackElement_=function(t){for(var e=0,n=this.trackElements_.length;e<n;e++)if(t===this.trackElements_[e]){this.trackElements_.splice(e,1);break}},t}(),Vn=function(){function t(e){Ie(this,t);var n=this;if(Se){n=ce.createElement("custom");for(var r in t.prototype)"constructor"!==r&&(n[r]=t.prototype[r])}if(t.prototype.setCues_.call(n,e),Object.defineProperty(n,"length",{get:function(){return this.length_}}),Se)return n}return t.prototype.setCues_=function(t){var e=this.length||0,n=0,r=t.length;this.cues_=t,this.length_=t.length;var i=function(t){""+t in this||Object.defineProperty(this,""+t,{get:function(){return this.cues_[t]}})};if(e<r)for(n=e;n<r;n++)i.call(this,n)},t.prototype.getCueById=function(t){for(var e=null,n=0,r=this.length;n<r;n++){var i=this[n];if(i.id===t){e=i;break}}return e},t}(),zn={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Wn={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Un={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Xn={disabled:"disabled",hidden:"hidden",showing:"showing"},qn=function(t){function e(){var n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ie(this,e);var i=Re(this,t.call(this)),o=i;if(Se){o=ce.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a={id:r.id||"vjs_track_"+R(),kind:r.kind||"",label:r.label||"",language:r.language||""};for(var l in a)!function(t){Object.defineProperty(o,t,{get:function(){return a[t]},set:function(){}})}(l);return n=o,Re(i,n)}return De(e,t),e}(ln),Kn=function(t){var e=["protocol","hostname","port","pathname","search","hash","host"],n=ce.createElement("a");n.href=t;var r=""===n.host&&"file:"!==n.protocol,i=void 0;r&&(i=ce.createElement("div"),i.innerHTML='<a href="'+t+'"></a>',n=i.firstChild,i.setAttribute("style","display:none; position:absolute;"),ce.body.appendChild(i));for(var o={},s=0;s<e.length;s++)o[e[s]]=n[e[s]];return"http:"===o.protocol&&(o.host=o.host.replace(/:80$/,"")),"https:"===o.protocol&&(o.host=o.host.replace(/:443$/,"")),r&&ce.body.removeChild(i),o},Gn=function(t){if(!t.match(/^https?:\/\//)){var e=ce.createElement("div");e.innerHTML='<a href="'+t+'">x</a>',t=e.firstChild.href}return t},Yn=function(t){if("string"==typeof t){var e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i,n=e.exec(t);if(n)return n.pop().toLowerCase()}return""},$n=function(t){var e=ie.location,n=Kn(t);return(":"===n.protocol?e.protocol:n.protocol)+n.host!==e.protocol+e.host},Jn=(Object.freeze||Object)({parseUrl:Kn,getAbsoluteURL:Gn,getFileExtension:Yn,isCrossOrigin:$n}),Qn=st,Zn=Object.prototype.toString,tr=t(function(t,e){function n(t){return t.replace(/^\s*|\s*$/g,"")}e=t.exports=n,e.left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}}),er=at,nr=Object.prototype.toString,rr=Object.prototype.hasOwnProperty,ir=function(t){return"[object Array]"===Object.prototype.toString.call(t)},or=function(t){if(!t)return{};var e={};return er(tr(t).split("\n"),function(t){var n=t.indexOf(":"),r=tr(t.slice(0,n)).toLowerCase(),i=tr(t.slice(n+1));void 0===e[r]?e[r]=i:ir(e[r])?e[r].push(i):e[r]=[e[r],i]}),e},sr=ht,ar=Object.prototype.hasOwnProperty,lr=ft;ft.XMLHttpRequest=ie.XMLHttpRequest||gt,ft.XDomainRequest="withCredentials"in new ft.XMLHttpRequest?ft.XMLHttpRequest:ie.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){ft["delete"===t?"del":t]=function(e,n,r){return n=dt(e,n,r),n.method=t.toUpperCase(),vt(n)}});var cr=function(t,e){var n=new ie.WebVTT.Parser(ie,ie.vttjs,ie.WebVTT.StringDecoder()),r=[];n.oncue=function(t){e.addCue(t)},n.onparsingerror=function(t){r.push(t)},n.onflush=function(){e.trigger({type:"loadeddata",target:e})},n.parse(t),r.length>0&&(ie.console&&ie.console.groupCollapsed&&ie.console.groupCollapsed("Text Track parsing errors for "+e.src),r.forEach(function(t){return Ue.error(t)}),ie.console&&ie.console.groupEnd&&ie.console.groupEnd()),n.flush()},ur=function(t,e){var n={uri:t},r=$n(t);r&&(n.cors=r),lr(n,sn(this,function(t,n,r){if(t)return Ue.error(t,n);if(e.loaded_=!0,"function"!=typeof ie.WebVTT){if(e.tech_){var i=function(){return cr(r,e)};e.tech_.on("vttjsloaded",i),e.tech_.on("vttjserror",function(){Ue.error("vttjs failed to load, stopping trying to process "+e.src),e.tech_.off("vttjsloaded",i)})}}else cr(r,e)}))},hr=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Ie(this,e),!i.tech)throw new Error("A tech was not provided.");var o=Q(i,{kind:Un[i.kind]||"subtitles",language:i.language||i.srclang||""}),s=Xn[o.mode]||"disabled",a=o.default;"metadata"!==o.kind&&"chapters"!==o.kind||(s="hidden");var l=n=Re(this,t.call(this,o));if(l.tech_=o.tech,Se)for(var c in e.prototype)"constructor"!==c&&(l[c]=e.prototype[c]);l.cues_=[],l.activeCues_=[];var u=new Vn(l.cues_),h=new Vn(l.activeCues_),p=!1,d=sn(l,function(){this.activeCues,p&&(this.trigger("cuechange"),p=!1)});return"disabled"!==s&&l.tech_.ready(function(){l.tech_.on("timeupdate",d)},!0),Object.defineProperty(l,"default",{get:function(){return a},set:function(){}}),Object.defineProperty(l,"mode",{get:function(){return s},set:function(t){var e=this;Xn[t]&&(s=t,"showing"===s&&this.tech_.ready(function(){e.tech_.on("timeupdate",d)},!0),this.trigger("modechange"))}}),Object.defineProperty(l,"cues",{get:function(){return this.loaded_?u:null},set:function(){}}),Object.defineProperty(l,"activeCues",{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return h;for(var t=this.tech_.currentTime(),e=[],n=0,r=this.cues.length;n<r;n++){var i=this.cues[n];i.startTime<=t&&i.endTime>=t?e.push(i):i.startTime===i.endTime&&i.startTime<=t&&i.startTime+.5>=t&&e.push(i)}if(p=!1,e.length!==this.activeCues_.length)p=!0;else for(var o=0;o<e.length;o++)-1===this.activeCues_.indexOf(e[o])&&(p=!0);return this.activeCues_=e,h.setCues_(this.activeCues_),h},set:function(){}}),o.src?(l.src=o.src,ur(o.src,l)):l.loaded_=!0,r=l,Re(n,r)}return De(e,t),e.prototype.addCue=function(t){var e=t;if(ie.vttjs&&!(t instanceof ie.vttjs.VTTCue)){e=new ie.vttjs.VTTCue(t.startTime,t.endTime,t.text);for(var n in t)n in e||(e[n]=t[n]);e.id=t.id,e.originalCue_=t}for(var r=this.tech_.textTracks(),i=0;i<r.length;i++)r[i]!==this&&r[i].removeCue(e);this.cues_.push(e),this.cues.setCues_(this.cues_)},e.prototype.removeCue=function(t){for(var e=this.cues_.length;e--;){var n=this.cues_[e];if(n===t||n.originalCue_&&n.originalCue_===t){this.cues_.splice(e,1),this.cues.setCues_(this.cues_);break}}},e}(qn);hr.prototype.allowedEvents_={cuechange:"cuechange"};var pr=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ie(this,e);var o=Q(i,{kind:Wn[i.kind]||""}),s=n=Re(this,t.call(this,o)),a=!1;if(Se)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return Object.defineProperty(s,"enabled",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("enabledchange"))}}),o.enabled&&(s.enabled=o.enabled),s.loaded_=!0,r=s,Re(n,r)}return De(e,t),e}(qn),dr=function(t){function e(){var n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ie(this,e);var o=Q(i,{kind:zn[i.kind]||""}),s=n=Re(this,t.call(this,o)),a=!1;if(Se)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return Object.defineProperty(s,"selected",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("selectedchange"))}}),o.selected&&(s.selected=o.selected),r=s,Re(n,r)}return De(e,t),e}(qn),fr=0,vr=2,yr=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ie(this,e);var r=Re(this,t.call(this)),i=void 0,o=r;if(Se){o=ce.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a=new hr(n);if(o.kind=a.kind,o.src=a.src,o.srclang=a.language,o.label=a.label,o.default=a.default,Object.defineProperty(o,"readyState",{get:function(){return i}}),Object.defineProperty(o,"track",{get:function(){return a}}),i=fr,a.addEventListener("loadeddata",function(){i=vr, - o.trigger({type:"load",target:o})}),Se){var l;return l=o,Re(r,l)}return r}return De(e,t),e}(ln);yr.prototype.allowedEvents_={load:"load"},yr.NONE=fr,yr.LOADING=1,yr.LOADED=vr,yr.ERROR=3;var gr={audio:{ListClass:Rn,TrackClass:pr,capitalName:"Audio"},video:{ListClass:Bn,TrackClass:dr,capitalName:"Video"},text:{ListClass:Fn,TrackClass:hr,capitalName:"Text"}};Object.keys(gr).forEach(function(t){gr[t].getterName=t+"Tracks",gr[t].privateName=t+"Tracks_"});var mr={remoteText:{ListClass:Fn,TrackClass:hr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Hn,TrackClass:yr,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},_r=Q(gr,mr);mr.names=Object.keys(mr),gr.names=Object.keys(gr),_r.names=[].concat(mr.names).concat(gr.names);var br=Object.create||function(){function t(){}return function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();mt.prototype=br(Error.prototype),mt.prototype.constructor=mt,mt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},bt.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,n){return n?this.has(t)?this.values[t]:e[n]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,n){for(var r=0;r<n.length;++r)if(e===n[r]){this.set(t,e);break}},integer:function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},percent:function(t,e){return!!(e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e))>=0&&e<=100)&&(this.set(t,e),!0)}};var Tr={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},Cr={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},kr={v:"title",lang:"lang"},wr={rt:"ruby"},Er=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];xt.prototype.applyStyles=function(t,e){e=e||this.div;for(var n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])},xt.prototype.formatStyle=function(t,e){return 0===t?0:t+e},jt.prototype=br(xt.prototype),jt.prototype.constructor=jt,At.prototype.move=function(t,e){switch(e=void 0!==e?e:this.lineHeight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e}},At.prototype.overlaps=function(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top},At.prototype.overlapsAny=function(t){for(var e=0;e<t.length;e++)if(this.overlaps(t[e]))return!0;return!1},At.prototype.within=function(t){return this.top>=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right},At.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.left<t.left;case"-x":return this.right>t.right;case"+y":return this.top<t.top;case"-y":return this.bottom>t.bottom}},At.prototype.intersectPercentage=function(t){return Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left))*Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top))/(this.height*this.width)},At.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}},At.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,n=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,r=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;return t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t,{left:t.left,right:t.right,top:t.top||r,height:t.height||e,bottom:t.bottom||r+(t.height||e),width:t.width||n}},Nt.StringDecoder=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}},Nt.convertCueToDOMTree=function(t,e){return t&&e?kt(t,e):null};Nt.processCues=function(t,e,n){if(!t||!e||!n)return null;for(;n.firstChild;)n.removeChild(n.firstChild);var r=t.document.createElement("div");if(r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin="1.5%",n.appendChild(r),function(t){for(var e=0;e<t.length;e++)if(t[e].hasBeenReset||!t[e].displayState)return!0;return!1}(e)){var i=[],o=At.getSimpleBoxPosition(r),s=Math.round(.05*o.height*100)/100,a={font:s+"px sans-serif"};!function(){for(var n,s,l=0;l<e.length;l++)s=e[l],n=new jt(t,s,a),r.appendChild(n.div),Pt(t,n,o,i),s.displayState=n.div,i.push(At.getSimpleBoxPosition(n))}()}else for(var l=0;l<e.length;l++)r.appendChild(e[l].displayState)},Nt.Parser=function(t,e,n){n||(n=e,e={}),e||(e={}),this.window=t,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=n||new TextDecoder("utf8"),this.regionList=[]},Nt.Parser.prototype={reportOrThrowError:function(t){if(!(t instanceof mt))throw t;this.onparsingerror&&this.onparsingerror(t)},parse:function(t){function e(){for(var t=i.buffer,e=0;e<t.length&&"\r"!==t[e]&&"\n"!==t[e];)++e;var n=t.substr(0,e);return"\r"===t[e]&&++e,"\n"===t[e]&&++e,i.buffer=t.substr(e),n}function n(t){var e=new bt;if(Tt(t,function(t,n){switch(t){case"id":e.set(t,n);break;case"width":e.percent(t,n);break;case"lines":e.integer(t,n);break;case"regionanchor":case"viewportanchor":var r=n.split(",");if(2!==r.length)break;var i=new bt;if(i.percent("x",r[0]),i.percent("y",r[1]),!i.has("x")||!i.has("y"))break;e.set(t+"X",i.get("x")),e.set(t+"Y",i.get("y"));break;case"scroll":e.alt(t,n,["up"])}},/=/,/\s/),e.has("id")){var n=new(i.vttjs.VTTRegion||i.window.VTTRegion);n.width=e.get("width",100),n.lines=e.get("lines",3),n.regionAnchorX=e.get("regionanchorX",0),n.regionAnchorY=e.get("regionanchorY",100),n.viewportAnchorX=e.get("viewportanchorX",0),n.viewportAnchorY=e.get("viewportanchorY",100),n.scroll=e.get("scroll",""),i.onregion&&i.onregion(n),i.regionList.push({id:e.get("id"),region:n})}}function r(t){var e=new bt;Tt(t,function(t,n){switch(t){case"MPEGT":e.integer(t+"S",n);break;case"LOCA":e.set(t+"L",_t(n))}},/[^\d]:/,/,/),i.ontimestampmap&&i.ontimestampmap({MPEGTS:e.get("MPEGTS"),LOCAL:e.get("LOCAL")})}var i=this;t&&(i.buffer+=i.decoder.decode(t,{stream:!0}));try{var o;if("INITIAL"===i.state){if(!/\r\n|\n/.test(i.buffer))return this;o=e();var s=o.match(/^WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new mt(mt.Errors.BadSignature);i.state="HEADER"}for(var a=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;switch(a?a=!1:o=e(),i.state){case"HEADER":/:/.test(o)?function(t){t.match(/X-TIMESTAMP-MAP/)?Tt(t,function(t,e){switch(t){case"X-TIMESTAMP-MAP":r(e)}},/=/):Tt(t,function(t,e){switch(t){case"Region":n(e)}},/:/)}(o):o||(i.state="ID");continue;case"NOTE":o||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(o)){i.state="NOTE";break}if(!o)continue;if(i.cue=new(i.vttjs.VTTCue||i.window.VTTCue)(0,0,""),i.state="CUE",-1===o.indexOf("--\x3e")){i.cue.id=o;continue}case"CUE":try{Ct(o,i.cue,i.regionList)}catch(t){i.reportOrThrowError(t),i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var l=-1!==o.indexOf("--\x3e");if(!o||l&&(a=!0)){i.oncue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}i.cue.text&&(i.cue.text+="\n"),i.cue.text+=o;continue;case"BADCUE":o||(i.state="ID");continue}}}catch(t){i.reportOrThrowError(t),"CUETEXT"===i.state&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),(t.cue||"HEADER"===t.state)&&(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state)throw new mt(mt.Errors.BadSignature)}catch(e){t.reportOrThrowError(e)}return t.onflush&&t.onflush(),this}};var Sr=Nt,xr="auto",jr={"":!0,lr:!0,rl:!0},Ar={start:!0,middle:!0,end:!0,left:!0,right:!0};Dt.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Pr=Dt,Nr={"":!0,up:!0},Or=Bt,Mr=t(function(t){var e=t.exports={WebVTT:Sr,VTTCue:Pr,VTTRegion:Or};ie.vttjs=e,ie.WebVTT=e.WebVTT;var n=e.VTTCue,r=e.VTTRegion,i=ie.VTTCue,o=ie.VTTRegion;e.shim=function(){ie.VTTCue=n,ie.VTTRegion=r},e.restore=function(){ie.VTTCue=i,ie.VTTRegion=o},ie.VTTCue||e.shim()}),Ir=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};Ie(this,e),n.reportTouchActivity=!1;var i=Re(this,t.call(this,null,n,r));return i.hasStarted_=!1,i.on("playing",function(){this.hasStarted_=!0}),i.on("loadstart",function(){this.hasStarted_=!1}),_r.names.forEach(function(t){var e=_r[t];n&&n[e.getterName]&&(i[e.privateName]=n[e.getterName])}),i.featuresProgressEvents||i.manualProgressOn(),i.featuresTimeupdateEvents||i.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===n["native"+t+"Tracks"]&&(i["featuresNative"+t+"Tracks"]=!1)}),!1===n.nativeCaptions||!1===n.nativeTextTracks?i.featuresNativeTextTracks=!1:!0!==n.nativeCaptions&&!0!==n.nativeTextTracks||(i.featuresNativeTextTracks=!0),i.featuresNativeTextTracks||i.emulateTextTracks(),i.autoRemoteTextTracks_=new _r.text.ListClass,i.initTrackListeners(),n.nativeControlsForTouch||i.emitTapEvents(),i.constructor&&(i.name_=i.constructor.name||"Unknown Tech"),i}return De(e,t),e.prototype.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},e.prototype.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},e.prototype.trackProgress=function(t){this.stopTrackingProgress(),this.progressInterval=this.setInterval(sn(this,function(){var t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,1===t&&this.stopTrackingProgress()}),500)},e.prototype.onDurationChange=function(t){this.duration_=this.duration()},e.prototype.buffered=function(){return nt(0,0)},e.prototype.bufferedPercent=function(){return rt(this.buffered(),this.duration_)},e.prototype.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},e.prototype.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},e.prototype.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},e.prototype.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},e.prototype.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.prototype.dispose=function(){this.clearTracks(gr.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),t.prototype.dispose.call(this)},e.prototype.clearTracks=function(t){var e=this;t=[].concat(t),t.forEach(function(t){for(var n=e[t+"Tracks"]()||[],r=n.length;r--;){var i=n[r];"text"===t&&e.removeRemoteTextTrack(i),n.removeTrack(i)}})},e.prototype.cleanupAutoTextTracks=function(){for(var t=this.autoRemoteTextTracks_||[],e=t.length;e--;){var n=t[e];this.removeRemoteTextTrack(n)}},e.prototype.reset=function(){},e.prototype.error=function(t){return void 0!==t&&(this.error_=new it(t),this.trigger("error")),this.error_},e.prototype.played=function(){return this.hasStarted_?nt(0,0):nt()},e.prototype.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.prototype.initTrackListeners=function(){var t=this;gr.names.forEach(function(e){var n=gr[e],r=function(){t.trigger(e+"trackchange")},i=t[n.getterName]();i.addEventListener("removetrack",r),i.addEventListener("addtrack",r),t.on("dispose",function(){i.removeEventListener("removetrack",r),i.removeEventListener("addtrack",r)})})},e.prototype.addWebVttScript_=function(){var t=this;if(!ie.WebVTT)if(ce.body.contains(this.el())){if(!this.options_["vtt.js"]&&o(Mr)&&Object.keys(Mr).length>0)return void this.trigger("vttjsloaded");var e=ce.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js",e.onload=function(){t.trigger("vttjsloaded")},e.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){e.onload=null,e.onerror=null}),ie.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)},e.prototype.emulateTextTracks=function(){var t=this,e=this.textTracks(),n=this.remoteTextTracks(),r=function(t){return e.addTrack(t.track)},i=function(t){return e.removeTrack(t.track)};n.on("addtrack",r),n.on("removetrack",i),this.addWebVttScript_();var o=function(){return t.trigger("texttrackchange")},s=function(){o();for(var t=0;t<e.length;t++){var n=e[t];n.removeEventListener("cuechange",o),"showing"===n.mode&&n.addEventListener("cuechange",o)}};s(),e.addEventListener("change",s),e.addEventListener("addtrack",s),e.addEventListener("removetrack",s),this.on("dispose",function(){n.off("addtrack",r),n.off("removetrack",i),e.removeEventListener("change",s),e.removeEventListener("addtrack",s),e.removeEventListener("removetrack",s);for(var t=0;t<e.length;t++){e[t].removeEventListener("cuechange",o)}})},e.prototype.addTextTrack=function(t,e,n){if(!t)throw new Error("TextTrack kind is required but was not provided");return Ft(this,t,e,n)},e.prototype.createRemoteTextTrack=function(t){var e=Q(t,{tech:this});return new mr.remoteTextEl.TrackClass(e)},e.prototype.addRemoteTextTrack=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],n=this.createRemoteTextTrack(t);return!0!==e&&!1!==e&&(Ue.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),e=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==e&&this.autoRemoteTextTracks_.addTrack(n.track),n},e.prototype.removeRemoteTextTrack=function(t){var e=this.remoteTextTrackEls().getTrackElementByTrack_(t);this.remoteTextTrackEls().removeTrackElement_(e),this.remoteTextTracks().removeTrack(t),this.autoRemoteTextTracks_.removeTrack(t)},e.prototype.getVideoPlaybackQuality=function(){return{}},e.prototype.setPoster=function(){},e.prototype.playsinline=function(){},e.prototype.setPlaysinline=function(){},e.prototype.canPlayType=function(){return""},e.canPlayType=function(){return""},e.canPlaySource=function(t,n){return e.canPlayType(t.type)},e.isTech=function(t){return t.prototype instanceof e||t instanceof e||t===e},e.registerTech=function(t,n){if(e.techs_||(e.techs_={}),!e.isTech(n))throw new Error("Tech "+t+" must be a Tech");if(!e.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!e.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=$(t),e.techs_[t]=n,"Tech"!==t&&e.defaultTechOrder_.push(t),n},e.getTech=function(t){if(t)return t=$(t),e.techs_&&e.techs_[t]?e.techs_[t]:ie&&ie.videojs&&ie.videojs[t]?(Ue.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),ie.videojs[t]):void 0},e}(mn);_r.names.forEach(function(t){var e=_r[t];Ir.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}}),Ir.prototype.featuresVolumeControl=!0,Ir.prototype.featuresFullscreenResize=!1,Ir.prototype.featuresPlaybackRate=!1,Ir.prototype.featuresProgressEvents=!1,Ir.prototype.featuresTimeupdateEvents=!1,Ir.prototype.featuresNativeTextTracks=!1,Ir.withSourceHandlers=function(t){t.registerSourceHandler=function(e,n){var r=t.sourceHandlers;r||(r=t.sourceHandlers=[]),void 0===n&&(n=r.length),r.splice(n,0,e)},t.canPlayType=function(e){for(var n=t.sourceHandlers||[],r=void 0,i=0;i<n.length;i++)if(r=n[i].canPlayType(e))return r;return""},t.selectSourceHandler=function(e,n){for(var r=t.sourceHandlers||[],i=0;i<r.length;i++)if(r[i].canHandleSource(e,n))return r[i];return null},t.canPlaySource=function(e,n){var r=t.selectSourceHandler(e,n);return r?r.canHandleSource(e,n):""},["seekable","duration"].forEach(function(t){var e=this[t];"function"==typeof e&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):e.apply(this,arguments)})},t.prototype),t.prototype.setSource=function(e){var n=t.selectSourceHandler(e,this.options_);n||(t.nativeSourceHandler?n=t.nativeSourceHandler:Ue.error("No source hander found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),n!==t.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=n.handleSource(e,this,this.options_),this.on("dispose",this.disposeSourceHandler)},t.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},mn.registerComponent("Tech",Ir),Ir.registerTech("Tech",Ir),Ir.defaultTechOrder_=[];var Dr={},Rr={buffered:1,currentTime:1,duration:1,seekable:1,played:1},Lr={setCurrentTime:1},Br=function t(e){if(Array.isArray(e)){var n=[];e.forEach(function(e){e=t(e),Array.isArray(e)?n=n.concat(e):i(e)&&n.push(e)}),e=n}else e="string"==typeof e&&e.trim()?[{src:e}]:i(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[e]:[];return e},Fr=function(t){function e(n,r,i){Ie(this,e);var o=Q({createEl:!1},r),s=Re(this,t.call(this,n,o,i));if(r.playerOptions.sources&&0!==r.playerOptions.sources.length)n.src(r.playerOptions.sources);else for(var a=0,l=r.playerOptions.techOrder;a<l.length;a++){var c=$(l[a]),u=Ir.getTech(c);if(c||(u=mn.getComponent(c)),u&&u.isSupported()){n.loadTech_(c);break}}return s}return De(e,t),e}(mn);mn.registerComponent("MediaLoader",Fr);var Hr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.emitTapEvents(),i.enable(),i}return De(e,t),e.prototype.createEl=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=r({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},n),"button"===e&&Ue.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=r({role:"button","aria-live":"polite"},i),this.tabIndex_=n.tabIndex;var o=t.prototype.createEl.call(this,e,n,i);return this.createControlTextEl(o),o},e.prototype.createControlTextEl=function(t){return this.controlTextEl_=f("span",{className:"vjs-control-text"}),t&&t.appendChild(this.controlTextEl_),this.controlText(this.controlText_,t),this.controlTextEl_},e.prototype.controlText=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(!t)return this.controlText_||"Need Text";var n=this.localize(t);this.controlText_=t,this.controlTextEl_.innerHTML=n,this.nonIconControl||e.setAttribute("title",n)},e.prototype.buildCSSClass=function(){return"vjs-control vjs-button "+t.prototype.buildCSSClass.call(this)},e.prototype.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur))},e.prototype.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur)},e.prototype.handleClick=function(t){},e.prototype.handleFocus=function(t){W(ce,"keydown",sn(this,this.handleKeyPress))},e.prototype.handleKeyPress=function(e){32===e.which||13===e.which?(e.preventDefault(),this.trigger("click")):t.prototype.handleKeyPress&&t.prototype.handleKeyPress.call(this,e)},e.prototype.handleBlur=function(t){U(ce,"keydown",sn(this,this.handleKeyPress))},e}(mn);mn.registerComponent("ClickableComponent",Hr);var Vr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.update(),n.on("posterchange",sn(i,i.update)),i}return De(e,t),e.prototype.dispose=function(){this.player().off("posterchange",this.update),t.prototype.dispose.call(this)},e.prototype.createEl=function(){var t=f("div",{className:"vjs-poster",tabIndex:-1});return Ne||(this.fallbackImg_=f("img"),t.appendChild(this.fallbackImg_)),t},e.prototype.update=function(t){var e=this.player().poster();this.setSrc(e),e?this.show():this.hide()},e.prototype.setSrc=function(t){if(this.fallbackImg_)this.fallbackImg_.src=t;else{var e="";t&&(e='url("'+t+'")'),this.el_.style.backgroundImage=e}},e.prototype.handleClick=function(t){this.player_.controls()&&(this.player_.paused()?this.player_.play():this.player_.pause())},e}(Hr);mn.registerComponent("PosterImage",Vr);var zr={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'},Wr=function(t){function e(n,r,i){Ie(this,e);var o=Re(this,t.call(this,n,r,i));return n.on("loadstart",sn(o,o.toggleDisplay)),n.on("texttrackchange",sn(o,o.updateDisplay)),n.on("loadstart",sn(o,o.preselectTrack)),n.ready(sn(o,function(){if(n.tech_&&n.tech_.featuresNativeTextTracks)return void this.hide();n.on("fullscreenchange",sn(this,this.updateDisplay));for(var t=this.options_.playerOptions.tracks||[],e=0;e<t.length;e++)this.player_.addRemoteTextTrack(t[e],!0);this.preselectTrack()})),o}return De(e,t),e.prototype.preselectTrack=function(){for(var t={captions:1,subtitles:1},e=this.player_.textTracks(),n=this.player_.cache_.selectedLanguage,r=void 0,i=void 0,o=void 0,s=0;s<e.length;s++){var a=e[s];n&&n.enabled&&n.language===a.language?a.kind===n.kind?o=a:o||(o=a):n&&!n.enabled?(o=null,r=null,i=null):a.default&&("descriptions"!==a.kind||r?a.kind in t&&!i&&(i=a):r=a)}o?o.mode="showing":i?i.mode="showing":r&&(r.mode="showing")},e.prototype.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},e.prototype.clearDisplay=function(){"function"==typeof ie.WebVTT&&ie.WebVTT.processCues(ie,[],this.el_)},e.prototype.updateDisplay=function(){var t=this.player_.textTracks();this.clearDisplay();for(var e=null,n=null,r=t.length;r--;){var i=t[r];"showing"===i.mode&&("descriptions"===i.kind?e=i:n=i)}n?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(n)):e&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(e))},e.prototype.updateForTrack=function(t){if("function"==typeof ie.WebVTT&&t.activeCues){for(var e=this.player_.textTrackSettings.getValues(),n=[],r=0;r<t.activeCues.length;r++)n.push(t.activeCues[r]);ie.WebVTT.processCues(ie,n,this.el_);for(var i=n.length;i--;){var o=n[i];if(o){var s=o.displayState;if(e.color&&(s.firstChild.style.color=e.color),e.textOpacity&&Gt(s.firstChild,"color",Kt(e.color||"#fff",e.textOpacity)),e.backgroundColor&&(s.firstChild.style.backgroundColor=e.backgroundColor),e.backgroundOpacity&&Gt(s.firstChild,"backgroundColor",Kt(e.backgroundColor||"#000",e.backgroundOpacity)),e.windowColor&&(e.windowOpacity?Gt(s,"backgroundColor",Kt(e.windowColor,e.windowOpacity)):s.style.backgroundColor=e.windowColor),e.edgeStyle&&("dropshadow"===e.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===e.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===e.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===e.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),e.fontPercent&&1!==e.fontPercent){var a=ie.parseFloat(s.style.fontSize);s.style.fontSize=a*e.fontPercent+"px",s.style.height="auto",s.style.top="auto",s.style.bottom="2px"}e.fontFamily&&"default"!==e.fontFamily&&("small-caps"===e.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=zr[e.fontFamily])}}}},e}(mn);mn.registerComponent("TextTrackDisplay",Wr);var Ur=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"})},e}(mn);mn.registerComponent("LoadingSpinner",Ur);var Xr=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t="button",e=r({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},e),n=r({type:"button","aria-live":"polite"},n);var i=mn.prototype.createEl.call(this,t,e,n);return this.createControlTextEl(i),i},e.prototype.addChild=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.constructor.name;return Ue.warn("Adding an actionable (user controllable) child to a Button ("+n+") is not supported; use a ClickableComponent instead."),mn.prototype.addChild.call(this,t,e)},e.prototype.enable=function(){t.prototype.enable.call(this),this.el_.removeAttribute("disabled")},e.prototype.disable=function(){t.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},e.prototype.handleKeyPress=function(e){32!==e.which&&13!==e.which&&t.prototype.handleKeyPress.call(this,e)},e}(Hr);mn.registerComponent("Button",Xr);var qr=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-big-play-button"},e.prototype.handleClick=function(t){var e=this.player_.play(),n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r)return void this.player_.focus();e?e.then(function(){return r.focus()}):this.setTimeout(function(){r.focus()},1)},e}(Xr);qr.prototype.controlText_="Play Video",mn.registerComponent("BigPlayButton",qr);var Kr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.controlText(r&&r.controlText||i.localize("Close")),i}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-close-button "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){this.trigger({type:"close",bubbles:!1})},e}(Xr);mn.registerComponent("CloseButton",Kr);var Gr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on(n,"play",i.handlePlay),i.on(n,"pause",i.handlePause),i.on(n,"ended",i.handleEnded),i}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-play-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handlePlay=function(t){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},e.prototype.handlePause=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},e.prototype.handleEnded=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay")},e}(Xr);Gr.prototype.controlText_="Play",mn.registerComponent("PlayToggle",Gr);var Yr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on(n,"timeupdate",i.updateContent),i}return De(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"div",{className:"vjs-current-time vjs-time-control vjs-control"});return this.contentEl_=f("div",{className:"vjs-current-time-display",innerHTML:'<span class="vjs-control-text">Current Time </span>0:00'},{"aria-live":"off"}),e.appendChild(this.contentEl_),e},e.prototype.updateContent=function(t){var e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),n=this.localize("Current Time"),r=Yt(e,this.player_.duration());r!==this.formattedTime_&&(this.formattedTime_=r,this.contentEl_.innerHTML='<span class="vjs-control-text">'+n+"</span> "+r)},e}(mn);mn.registerComponent("CurrentTimeDisplay",Yr);var $r=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on(n,"durationchange",i.updateContent),i.on(n,"timeupdate",i.updateContent),i.on(n,"loadedmetadata",i.updateContent),i}return De(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"div",{className:"vjs-duration vjs-time-control vjs-control"});return this.contentEl_=f("div",{className:"vjs-duration-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Duration Time")+"</span> 0:00"},{"aria-live":"off"}),e.appendChild(this.contentEl_),e},e.prototype.updateContent=function(t){var e=this.player_.duration();if(e&&this.duration_!==e){this.duration_=e;var n=this.localize("Duration Time"),r=Yt(e);this.contentEl_.innerHTML='<span class="vjs-control-text">'+n+"</span> "+r}},e}(mn);mn.registerComponent("DurationDisplay",$r);var Jr=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"})},e}(mn);mn.registerComponent("TimeDivider",Jr);var Qr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on(n,"timeupdate",i.updateContent),i.on(n,"durationchange",i.updateContent),i}return De(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"div",{className:"vjs-remaining-time vjs-time-control vjs-control"});return this.contentEl_=f("div",{ - className:"vjs-remaining-time-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Remaining Time")+"</span> -0:00"},{"aria-live":"off"}),e.appendChild(this.contentEl_),e},e.prototype.updateContent=function(t){if(this.player_.duration()){var e=this.localize("Remaining Time"),n=Yt(this.player_.remainingTime());n!==this.formattedTime_&&(this.formattedTime_=n,this.contentEl_.innerHTML='<span class="vjs-control-text">'+e+"</span> -"+n)}},e}(mn);mn.registerComponent("RemainingTimeDisplay",Qr);var Zr=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.updateShowing(),i.on(i.player(),"durationchange",i.updateShowing),i}return De(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=f("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+"</span>"+this.localize("LIVE")},{"aria-live":"off"}),e.appendChild(this.contentEl_),e},e.prototype.updateShowing=function(t){this.player().duration()===1/0?this.show():this.hide()},e}(mn);mn.registerComponent("LiveDisplay",Zr);var ti=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.on("mousedown",i.handleMouseDown),i.on("touchstart",i.handleMouseDown),i.on("focus",i.handleFocus),i.on("blur",i.handleBlur),i.on("click",i.handleClick),i.on(n,"controlsvisible",i.update),i.playerEvent&&i.on(n,i.playerEvent,i.update),i}return De(e,t),e.prototype.createEl=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.className=n.className+" vjs-slider",n=r({tabIndex:0},n),i=r({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},i),t.prototype.createEl.call(this,e,n,i)},e.prototype.handleMouseDown=function(t){var e=this.bar.el_.ownerDocument;t.preventDefault(),S(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(e,"mousemove",this.handleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchmove",this.handleMouseMove),this.on(e,"touchend",this.handleMouseUp),this.handleMouseMove(t)},e.prototype.handleMouseMove=function(t){},e.prototype.handleMouseUp=function(){var t=this.bar.el_.ownerDocument;x(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.update()},e.prototype.update=function(){if(this.el_){var t=this.getPercent(),e=this.bar;if(e){("number"!=typeof t||t!==t||t<0||t===1/0)&&(t=0);var n=(100*t).toFixed(2)+"%",r=e.el().style;return this.vertical()?r.height=n:r.width=n,t}}},e.prototype.calculateDistance=function(t){var e=P(this.el_,t);return this.vertical()?e.y:e.x},e.prototype.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepBack()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepForward())},e.prototype.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.prototype.handleClick=function(t){t.stopImmediatePropagation(),t.preventDefault()},e.prototype.vertical=function(t){if(void 0===t)return this.vertical_||!1;this.vertical_=!!t,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},e}(mn);mn.registerComponent("Slider",ti);var ei=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.partEls_=[],i.on(n,"progress",i.update),i}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+"</span>: 0%</span>"})},e.prototype.update=function(t){var e=this.player_.buffered(),n=this.player_.duration(),r=this.player_.bufferedEnd(),i=this.partEls_,o=function(t,e){var n=t/e||0;return 100*(n>=1?1:n)+"%"};this.el_.style.width=o(r,n);for(var s=0;s<e.length;s++){var a=e.start(s),l=e.end(s),c=i[s];c||(c=this.el_.appendChild(f()),i[s]=c),c.style.left=o(a,r),c.style.width=o(l-a,r)}for(var u=i.length;u>e.length;u--)this.el_.removeChild(i[u-1]);i.length=e.length},e}(mn);mn.registerComponent("LoadProgressBar",ei);var ni=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"})},e.prototype.update=function(t,e,n){var r=j(this.el_),i=j(this.player_.el()),o=t.width*e;if(i&&r){var s=t.left-i.left+o,a=t.width-o+(i.right-t.right),l=r.width/2;s<l?l+=l-s:a<l&&(l=a),l<0?l=0:l>r.width&&(l=r.width),this.el_.style.right="-"+l+"px",v(this.el_,n)}},e}(mn);mn.registerComponent("TimeTooltip",ni);var ri=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 0%</span>"})},e.prototype.update=function(t,e){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var r=n.player_.scrubbing()?n.player_.getCache().currentTime:n.player_.currentTime(),i=Yt(r,n.player_.duration()),o=n.getChild("timeTooltip");o&&o.update(t,e,i)})},e}(mn);ri.prototype.options_={children:[]},xe&&!(xe>8)||ye||me||ri.prototype.options_.children.push("timeTooltip"),mn.registerComponent("PlayProgressBar",ri);var ii=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.update=an(sn(i,i.update),25),i}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},e.prototype.update=function(t,e){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var r=n.player_.duration(),i=Yt(e*r,r);n.el_.style.left=t.width*e+"px",n.getChild("timeTooltip").update(t,e,i)})},e}(mn);ii.prototype.options_={children:["timeTooltip"]},mn.registerComponent("MouseTimeDisplay",ii);var oi=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.update=an(sn(i,i.update),50),i.on(n,["timeupdate","ended"],i.update),i}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.prototype.update=function(){var e=t.prototype.update.call(this),n=this.player_.duration(),r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();return this.el_.setAttribute("aria-valuenow",(100*e).toFixed(2)),this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Yt(r,n),Yt(n,n)],"{1} of {2}")),this.bar.update(j(this.el_),e),e},e.prototype.getPercent=function(){var t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),e=t/this.player_.duration();return e>=1?1:e},e.prototype.handleMouseDown=function(e){this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),t.prototype.handleMouseDown.call(this,e)},e.prototype.handleMouseMove=function(t){var e=this.calculateDistance(t)*this.player_.duration();e===this.player_.duration()&&(e-=.1),this.player_.currentTime(e)},e.prototype.handleMouseUp=function(e){t.prototype.handleMouseUp.call(this,e),this.player_.scrubbing(!1),this.videoWasPlaying&&this.player_.play()},e.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},e.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},e.prototype.handleAction=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handleKeyPress=function(e){32===e.which||13===e.which?(e.preventDefault(),this.handleAction(e)):t.prototype.handleKeyPress&&t.prototype.handleKeyPress.call(this,e)},e}(ti);oi.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},xe&&!(xe>8)||ye||me||oi.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),oi.prototype.playerEvent="timeupdate",mn.registerComponent("SeekBar",oi);var si=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.handleMouseMove=an(sn(i,i.handleMouseMove),25),i.on(i.el_,"mousemove",i.handleMouseMove),i.throttledHandleMouseSeek=an(sn(i,i.handleMouseSeek),25),i.on(["mousedown","touchstart"],i.handleMouseDown),i}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},e.prototype.handleMouseMove=function(t){var e=this.getChild("seekBar"),n=e.getChild("mouseTimeDisplay"),r=e.el(),i=j(r),o=P(r,t).x;o>1?o=1:o<0&&(o=0),n&&n.update(i,o)},e.prototype.handleMouseSeek=function(t){this.getChild("seekBar").handleMouseMove(t)},e.prototype.handleMouseDown=function(t){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseSeek),this.on(e,"touchmove",this.throttledHandleMouseSeek),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseUp=function(t){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e}(mn);si.prototype.options_={children:["seekBar"]},mn.registerComponent("ProgressControl",si);var ai=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on(n,"fullscreenchange",i.handleFullscreenChange),i}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleFullscreenChange=function(t){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},e.prototype.handleClick=function(t){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},e}(Xr);ai.prototype.controlText_="Fullscreen",mn.registerComponent("FullscreenToggle",ai);var li=function(t,e){e.tech_&&!e.tech_.featuresVolumeControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},ci=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},e}(mn);mn.registerComponent("VolumeLevel",ci);var ui=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on("slideractive",i.updateLastVolume_),i.on(n,"volumechange",i.updateARIAAttributes),n.ready(function(){return i.updateARIAAttributes()}),i}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},e.prototype.handleMouseMove=function(t){this.checkMuted(),this.player_.volume(this.calculateDistance(t))},e.prototype.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},e.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},e.prototype.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},e.prototype.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},e.prototype.updateARIAAttributes=function(t){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e),this.el_.setAttribute("aria-valuetext",e+"%")},e.prototype.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},e.prototype.updateLastVolume_=function(){var t=this,e=this.player_.volume();this.one("sliderinactive",function(){0===t.player_.volume()&&t.player_.lastVolume_(e)})},e}(ti);ui.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},ui.prototype.playerEvent="volumechange",mn.registerComponent("VolumeBar",ui);var hi=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie(this,e),r.vertical=r.vertical||!1,(void 0===r.volumeBar||o(r.volumeBar))&&(r.volumeBar=r.volumeBar||{},r.volumeBar.vertical=r.vertical);var i=Re(this,t.call(this,n,r));return li(i,n),i.throttledHandleMouseMove=an(sn(i,i.handleMouseMove),25),i.on("mousedown",i.handleMouseDown),i.on("touchstart",i.handleMouseDown),i.on(i.volumeBar,["focus","slideractive"],function(){i.volumeBar.addClass("vjs-slider-active"),i.addClass("vjs-slider-active"),i.trigger("slideractive")}),i.on(i.volumeBar,["blur","sliderinactive"],function(){i.volumeBar.removeClass("vjs-slider-active"),i.removeClass("vjs-slider-active"),i.trigger("sliderinactive")}),i}return De(e,t),e.prototype.createEl=function(){var e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+e})},e.prototype.handleMouseDown=function(t){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove),this.on(e,"touchmove",this.throttledHandleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseUp=function(t){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove),this.off(e,"touchmove",this.throttledHandleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseMove=function(t){this.volumeBar.handleMouseMove(t)},e}(mn);hi.prototype.options_={children:["volumeBar"]},mn.registerComponent("VolumeControl",hi);var pi=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return li(i,n),i.on(n,["loadstart","volumechange"],i.update),i}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-mute-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){var e=this.player_.volume(),n=this.player_.lastVolume_();if(0===e){var r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},e.prototype.update=function(t){this.updateIcon_(),this.updateControlText_()},e.prototype.updateIcon_=function(){var t=this.player_.volume(),e=3;0===t||this.player_.muted()?e=0:t<.33?e=1:t<.67&&(e=2);for(var n=0;n<4;n++)_(this.el_,"vjs-vol-"+n);m(this.el_,"vjs-vol-"+e)},e.prototype.updateControlText_=function(){var t=this.player_.muted()||0===this.player_.volume(),e=t?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},e}(Xr);pi.prototype.controlText_="Mute",mn.registerComponent("MuteToggle",pi);var di=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie(this,e),void 0!==r.inline?r.inline=r.inline:r.inline=!0,(void 0===r.volumeControl||o(r.volumeControl))&&(r.volumeControl=r.volumeControl||{},r.volumeControl.vertical=!r.inline);var i=Re(this,t.call(this,n,r));return li(i,n),i.on(i.volumeControl,["slideractive"],i.sliderActive_),i.on(i.muteToggle,"focus",i.sliderActive_),i.on(i.volumeControl,["sliderinactive"],i.sliderInactive_),i.on(i.muteToggle,"blur",i.sliderInactive_),i}return De(e,t),e.prototype.sliderActive_=function(){this.addClass("vjs-slider-active")},e.prototype.sliderInactive_=function(){this.removeClass("vjs-slider-active")},e.prototype.createEl=function(){var e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+e})},e}(mn);di.prototype.options_={children:["muteToggle","volumeControl"]},mn.registerComponent("VolumePanel",di);var fi=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return r&&(i.menuButton_=r.menuButton),i.focusedChild_=-1,i.on("keydown",i.handleKeyPress),i}return De(e,t),e.prototype.addItem=function(t){this.addChild(t),t.on("click",sn(this,function(e){this.menuButton_&&(this.menuButton_.unpressButton(),"CaptionSettingsMenuItem"!==t.name()&&this.menuButton_.focus())}))},e.prototype.createEl=function(){var e=this.options_.contentElType||"ul";this.contentEl_=f(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var n=t.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),W(n,"click",function(t){t.preventDefault(),t.stopImmediatePropagation()}),n},e.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepForward()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepBack())},e.prototype.stepForward=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_+1),this.focus(t)},e.prototype.stepBack=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_-1),this.focus(t)},e.prototype.focus=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.children().slice();e.length&&e[0].className&&/vjs-menu-title/.test(e[0].className)&&e.shift(),e.length>0&&(t<0?t=0:t>=e.length&&(t=e.length-1),this.focusedChild_=t,e[t].el_.focus())},e}(mn);mn.registerComponent("Menu",fi);var vi=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie(this,e);var i=Re(this,t.call(this,n,r));i.menuButton_=new Xr(n,r),i.menuButton_.controlText(i.controlText_),i.menuButton_.el_.setAttribute("aria-haspopup","true");var o=Xr.prototype.buildCSSClass();return i.menuButton_.el_.className=i.buildCSSClass()+" "+o,i.menuButton_.removeClass("vjs-control"),i.addChild(i.menuButton_),i.update(),i.enabled_=!0,i.on(i.menuButton_,"tap",i.handleClick),i.on(i.menuButton_,"click",i.handleClick),i.on(i.menuButton_,"focus",i.handleFocus),i.on(i.menuButton_,"blur",i.handleBlur),i.on("keydown",i.handleSubmenuKeyPress),i}return De(e,t),e.prototype.update=function(){var t=this.createMenu();this.menu&&this.removeChild(this.menu),this.menu=t,this.addChild(t),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},e.prototype.createMenu=function(){var t=new fi(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var e=f("li",{className:"vjs-menu-title",innerHTML:$(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,t.children_.unshift(e),y(e,t.contentEl())}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)t.addItem(this.items[n]);return t},e.prototype.createItems=function(){},e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},e.prototype.buildWrapperCSSClass=function(){var e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup","vjs-menu-button "+e+" "+Xr.prototype.buildCSSClass()+" "+t.prototype.buildCSSClass.call(this)},e.prototype.buildCSSClass=function(){var e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup","vjs-menu-button "+e+" "+t.prototype.buildCSSClass.call(this)},e.prototype.controlText=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(t,e)},e.prototype.handleClick=function(t){this.one(this.menu.contentEl(),"mouseleave",sn(this,function(t){this.unpressButton(),this.el_.blur()})),this.buttonPressed_?this.unpressButton():this.pressButton()},e.prototype.focus=function(){this.menuButton_.focus()},e.prototype.blur=function(){this.menuButton_.blur()},e.prototype.handleFocus=function(){W(ce,"keydown",sn(this,this.handleKeyPress))},e.prototype.handleBlur=function(){U(ce,"keydown",sn(this,this.handleKeyPress))},e.prototype.handleKeyPress=function(t){27===t.which||9===t.which?(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus())):38!==t.which&&40!==t.which||this.buttonPressed_||(this.pressButton(),t.preventDefault())},e.prototype.handleSubmenuKeyPress=function(t){27!==t.which&&9!==t.which||(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus()))},e.prototype.pressButton=function(){this.enabled_&&(this.buttonPressed_=!0,this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),this.menu.focus())},e.prototype.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},e.prototype.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},e.prototype.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},e}(mn);mn.registerComponent("MenuButton",vi);var yi=function(t){function e(n,r){Ie(this,e);var i=r.tracks,o=Re(this,t.call(this,n,r));if(o.items.length<=1&&o.hide(),!i)return Re(o);var s=sn(o,o.update);return i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),o.player_.on("ready",s),o.player_.on("dispose",function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)}),o}return De(e,t),e}(vi);mn.registerComponent("TrackButton",yi);var gi=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.selectable=r.selectable,i.selected(r.selected),i.selectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitem"),i}return De(e,t),e.prototype.createEl=function(e,n,i){return this.nonIconControl=!0,t.prototype.createEl.call(this,"li",r({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},n),i)},e.prototype.handleClick=function(t){this.selected(!0)},e.prototype.selected=function(t){this.selectable&&(t?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected")):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(" ")))},e}(Hr);mn.registerComponent("MenuItem",gi);var mi=function(t){function e(n,r){Ie(this,e);var i=r.track,o=n.textTracks();r.label=i.label||i.language||"Unknown",r.selected="showing"===i.mode;var s=Re(this,t.call(this,n,r));s.track=i;var a=sn(s,s.handleTracksChange),l=sn(s,s.handleSelectedLanguageChange);if(n.on(["loadstart","texttrackchange"],a),o.addEventListener("change",a),o.addEventListener("selectedlanguagechange",l),s.on("dispose",function(){o.removeEventListener("change",a),o.removeEventListener("selectedlanguagechange",l)}),void 0===o.onchange){var c=void 0;s.on(["tap","click"],function(){if("object"!==Me(ie.Event))try{c=new ie.Event("change")}catch(t){}c||(c=ce.createEvent("Event"),c.initEvent("change",!0,!0)),o.dispatchEvent(c)})}return s}return De(e,t),e.prototype.handleClick=function(e){var n=this.track.kind,r=this.track.kinds,i=this.player_.textTracks();if(r||(r=[n]),t.prototype.handleClick.call(this,e),i)for(var o=0;o<i.length;o++){var s=i[o];s===this.track&&r.indexOf(s.kind)>-1?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled")}},e.prototype.handleTracksChange=function(t){this.selected("showing"===this.track.mode)},e.prototype.handleSelectedLanguageChange=function(t){if("showing"===this.track.mode){var e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},e}(gi);mn.registerComponent("TextTrackMenuItem",mi);var _i=function(t){function e(n,r){Ie(this,e),r.track={player:n,kind:r.kind,kinds:r.kinds,default:!1,mode:"disabled"},r.kinds||(r.kinds=[r.kind]),r.label?r.track.label=r.label:r.track.label=r.kinds.join(" and ")+" off",r.selectable=!0;var i=Re(this,t.call(this,n,r));return i.selected(!0),i}return De(e,t),e.prototype.handleTracksChange=function(t){for(var e=this.player().textTracks(),n=!0,r=0,i=e.length;r<i;r++){var o=e[r];if(this.options_.kinds.indexOf(o.kind)>-1&&"showing"===o.mode){n=!1;break}}this.selected(n)},e.prototype.handleSelectedLanguageChange=function(t){for(var e=this.player().textTracks(),n=!0,r=0,i=e.length;r<i;r++){var o=e[r];if(["captions","descriptions","subtitles"].indexOf(o.kind)>-1&&"showing"===o.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})},e}(mi);mn.registerComponent("OffTextTrackMenuItem",_i);var bi=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ie(this,e),r.tracks=n.textTracks(),Re(this,t.call(this,n,r))}return De(e,t),e.prototype.createItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mi,n=void 0;this.label_&&(n=this.label_+" off"),t.push(new _i(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;var r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var i=0;i<r.length;i++){var o=r[i];if(this.kinds_.indexOf(o.kind)>-1){var s=new e(this.player_,{track:o,selectable:!0});s.addClass("vjs-"+o.kind+"-menu-item"),t.push(s)}}return t},e}(yi);mn.registerComponent("TextTrackButton",bi);var Ti=function(t){function e(n,r){Ie(this,e);var i=r.track,o=r.cue,s=n.currentTime();r.selectable=!0,r.label=o.text,r.selected=o.startTime<=s&&s<o.endTime;var a=Re(this,t.call(this,n,r));return a.track=i,a.cue=o,i.addEventListener("cuechange",sn(a,a.update)),a}return De(e,t),e.prototype.handleClick=function(e){t.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},e.prototype.update=function(t){var e=this.cue,n=this.player_.currentTime();this.selected(e.startTime<=n&&n<e.endTime)},e}(gi);mn.registerComponent("ChaptersTrackMenuItem",Ti);var Ci=function(t){function e(n,r,i){return Ie(this,e),Re(this,t.call(this,n,r,i))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-chapters-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-chapters-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.update=function(e){this.track_&&(!e||"addtrack"!==e.type&&"removetrack"!==e.type)||this.setTrack(this.findChaptersTrack()),t.prototype.update.call(this)},e.prototype.setTrack=function(t){if(this.track_!==t){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=t,this.track_){this.track_.mode="hidden";var n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);n&&n.addEventListener("load",this.updateHandler_)}}},e.prototype.findChaptersTrack=function(){for(var t=this.player_.textTracks()||[],e=t.length-1;e>=0;e--){var n=t[e];if(n.kind===this.kind_)return n}},e.prototype.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize($(this.kind_))},e.prototype.createMenu=function(){return this.options_.title=this.getMenuCaption(),t.prototype.createMenu.call(this)},e.prototype.createItems=function(){var t=[];if(!this.track_)return t;var e=this.track_.cues;if(!e)return t;for(var n=0,r=e.length;n<r;n++){var i=e[n],o=new Ti(this.player_,{track:this.track_,cue:i});t.push(o)}return t},e}(bi);Ci.prototype.kind_="chapters",Ci.prototype.controlText_="Chapters",mn.registerComponent("ChaptersButton",Ci);var ki=function(t){function e(n,r,i){Ie(this,e);var o=Re(this,t.call(this,n,r,i)),s=n.textTracks(),a=sn(o,o.handleTracksChange);return s.addEventListener("change",a),o.on("dispose",function(){s.removeEventListener("change",a)}),o}return De(e,t),e.prototype.handleTracksChange=function(t){for(var e=this.player().textTracks(),n=!1,r=0,i=e.length;r<i;r++){var o=e[r];if(o.kind!==this.kind_&&"showing"===o.mode){n=!0;break}}n?this.disable():this.enable()},e.prototype.buildCSSClass=function(){return"vjs-descriptions-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+t.prototype.buildWrapperCSSClass.call(this)},e}(bi);ki.prototype.kind_="descriptions",ki.prototype.controlText_="Descriptions",mn.registerComponent("DescriptionsButton",ki);var wi=function(t){function e(n,r,i){return Ie(this,e),Re(this,t.call(this,n,r,i))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-subtitles-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+t.prototype.buildWrapperCSSClass.call(this)},e}(bi);wi.prototype.kind_="subtitles",wi.prototype.controlText_="Subtitles",mn.registerComponent("SubtitlesButton",wi);var Ei=function(t){function e(n,r){Ie(this,e),r.track={player:n,kind:r.kind,label:r.kind+" settings",selectable:!1,default:!1,mode:"disabled"},r.selectable=!1,r.name="CaptionSettingsMenuItem";var i=Re(this,t.call(this,n,r));return i.addClass("vjs-texttrack-settings"),i.controlText(", opens "+r.kind+" settings dialog"),i}return De(e,t),e.prototype.handleClick=function(t){this.player().getChild("textTrackSettings").open()},e}(mi);mn.registerComponent("CaptionSettingsMenuItem",Ei);var Si=function(t){function e(n,r,i){return Ie(this,e),Re(this,t.call(this,n,r,i))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-captions-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-captions-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createItems=function(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||(e.push(new Ei(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),t.prototype.createItems.call(this,e)},e}(bi);Si.prototype.kind_="captions",Si.prototype.controlText_="Captions",mn.registerComponent("CaptionsButton",Si);var xi=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(e,n,i){var o='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(o+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),o+="</span>",t.prototype.createEl.call(this,e,r({innerHTML:o},n),i)},e}(mi);mn.registerComponent("SubsCapsMenuItem",xi);var ji=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie(this,e);var i=Re(this,t.call(this,n,r));return i.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(i.player_.language_)>-1&&(i.label_="captions"),i.menuButton_.controlText($(i.label_)),i}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-subs-caps-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createItems=function(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||(e.push(new Ei(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=t.prototype.createItems.call(this,e,xi)},e}(bi);ji.prototype.kinds_=["captions","subtitles"],ji.prototype.controlText_="Subtitles",mn.registerComponent("SubsCapsButton",ji);var Ai=function(t){function e(n,r){Ie(this,e);var i=r.track,o=n.audioTracks();r.label=i.label||i.language||"Unknown",r.selected=i.enabled;var s=Re(this,t.call(this,n,r));s.track=i;var a=sn(s,s.handleTracksChange);return o.addEventListener("change",a),s.on("dispose",function(){ - o.removeEventListener("change",a)}),s}return De(e,t),e.prototype.handleClick=function(e){var n=this.player_.audioTracks();t.prototype.handleClick.call(this,e);for(var r=0;r<n.length;r++){var i=n[r];i.enabled=i===this.track}},e.prototype.handleTracksChange=function(t){this.selected(this.track.enabled)},e}(gi);mn.registerComponent("AudioTrackMenuItem",Ai);var Pi=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ie(this,e),r.tracks=n.audioTracks(),Re(this,t.call(this,n,r))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-audio-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-audio-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.hideThreshold_=1;for(var e=this.player_.audioTracks(),n=0;n<e.length;n++){var r=e[n];t.push(new Ai(this.player_,{track:r,selectable:!0}))}return t},e}(yi);Pi.prototype.controlText_="Audio Track",mn.registerComponent("AudioTrackButton",Pi);var Ni=function(t){function e(n,r){Ie(this,e);var i=r.rate,o=parseFloat(i,10);r.label=i,r.selected=1===o,r.selectable=!0;var s=Re(this,t.call(this,n,r));return s.label=i,s.rate=o,s.on(n,"ratechange",s.update),s}return De(e,t),e.prototype.handleClick=function(e){t.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},e.prototype.update=function(t){this.selected(this.player().playbackRate()===this.rate)},e}(gi);Ni.prototype.contentElType="button",mn.registerComponent("PlaybackRateMenuItem",Ni);var Oi=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.updateVisibility(),i.updateLabel(),i.on(n,"loadstart",i.updateVisibility),i.on(n,"ratechange",i.updateLabel),i}return De(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this);return this.labelEl_=f("div",{className:"vjs-playback-rate-value",innerHTML:1}),e.appendChild(this.labelEl_),e},e.prototype.buildCSSClass=function(){return"vjs-playback-rate "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-playback-rate "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createMenu=function(){var t=new fi(this.player()),e=this.playbackRates();if(e)for(var n=e.length-1;n>=0;n--)t.addChild(new Ni(this.player(),{rate:e[n]+"x"}));return t},e.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},e.prototype.handleClick=function(t){for(var e=this.player().playbackRate(),n=this.playbackRates(),r=n[0],i=0;i<n.length;i++)if(n[i]>e){r=n[i];break}this.player().playbackRate(r)},e.prototype.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},e.prototype.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},e.prototype.updateVisibility=function(t){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},e.prototype.updateLabel=function(t){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},e}(vi);Oi.prototype.controlText_="Playback Rate",mn.registerComponent("PlaybackRateMenuButton",Oi);var Mi=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-spacer "+t.prototype.buildCSSClass.call(this)},e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},e}(mn);mn.registerComponent("Spacer",Mi);var Ii=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-custom-control-spacer "+t.prototype.buildCSSClass.call(this)},e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,{className:this.buildCSSClass()});return e.innerHTML=" ",e},e}(Mi);mn.registerComponent("CustomControlSpacer",Ii);var Di=function(t){function e(){return Ie(this,e),Re(this,t.apply(this,arguments))}return De(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"},{role:"group"})},e}(mn);Di.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},mn.registerComponent("ControlBar",Di);var Ri=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r));return i.on(n,"error",i.open),i}return De(e,t),e.prototype.buildCSSClass=function(){return"vjs-error-display "+t.prototype.buildCSSClass.call(this)},e.prototype.content=function(){var t=this.player().error();return t?this.localize(t.message):""},e}(On);Ri.prototype.options_=Q(On.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),mn.registerComponent("ErrorDisplay",Ri);var Li=["#000","Black"],Bi=["#00F","Blue"],Fi=["#0FF","Cyan"],Hi=["#0F0","Green"],Vi=["#F0F","Magenta"],zi=["#F00","Red"],Wi=["#FFF","White"],Ui=["#FF0","Yellow"],Xi=["1","Opaque"],qi=["0.5","Semi-Transparent"],Ki=["0","Transparent"],Gi={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Li,Wi,zi,Hi,Bi,Ui,Vi,Fi]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Xi,qi,Ki]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Wi,Li,zi,Hi,Bi,Ui,Vi,Fi]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(t){return"1.00"===t?null:Number(t)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Xi,qi]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[Ki,qi,Xi]}};Gi.windowColor.options=Gi.backgroundColor.options;var Yi=function(t){function r(n,i){Ie(this,r),i.temporary=!1;var o=Re(this,t.call(this,n,i));return o.updateDisplay=sn(o,o.updateDisplay),o.fill(),o.hasBeenOpened_=o.hasBeenFilled_=!0,o.endDialog=f("p",{className:"vjs-control-text",textContent:o.localize("End of dialog window.")}),o.el().appendChild(o.endDialog),o.setDefaults(),void 0===i.persistTextTrackSettings&&(o.options_.persistTextTrackSettings=o.options_.playerOptions.persistTextTrackSettings),o.on(o.$(".vjs-done-button"),"click",function(){o.saveSettings(),o.close()}),o.on(o.$(".vjs-default-button"),"click",function(){o.setDefaults(),o.updateDisplay()}),e(Gi,function(t){o.on(o.$(t.selector),"change",o.updateDisplay)}),o.options_.persistTextTrackSettings&&o.restoreSettings(),o}return De(r,t),r.prototype.createElSelect_=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"label",i=Gi[t],o=i.id.replace("%s",this.id_);return[f(r,{id:o,className:"label"===r?"vjs-label":"",textContent:this.localize(i.label)},{}),f("select",{},{"aria-labelledby":n+" "+o},i.options.map(function(t){var r=o+"-"+t[1];return f("option",{id:r,textContent:e.localize(t[1]),value:t[0]},{"aria-labelledby":n+" "+o+" "+r})}))]},r.prototype.createElFgColor_=function(){var t=f("legend",{id:"captions-text-legend-"+this.id_,textContent:this.localize("Text")});return f("fieldset",{className:"vjs-fg-color vjs-track-setting"},void 0,[t].concat(this.createElSelect_("color",t.id),f("span",{className:"vjs-text-opacity vjs-opacity"},void 0,this.createElSelect_("textOpacity",t.id))))},r.prototype.createElBgColor_=function(){var t=f("legend",{id:"captions-background-"+this.id_,textContent:this.localize("Background")});return f("fieldset",{className:"vjs-bg-color vjs-track-setting"},void 0,[t].concat(this.createElSelect_("backgroundColor",t.id),f("span",{className:"vjs-bg-opacity vjs-opacity"},void 0,this.createElSelect_("backgroundOpacity",t.id))))},r.prototype.createElWinColor_=function(){var t=f("legend",{id:"captions-window-"+this.id_,textContent:this.localize("Window")});return f("fieldset",{className:"vjs-window-color vjs-track-setting"},void 0,[t].concat(this.createElSelect_("windowColor",t.id),f("span",{className:"vjs-window-opacity vjs-opacity"},void 0,this.createElSelect_("windowOpacity",t.id))))},r.prototype.createElColors_=function(){return f("div",{className:"vjs-track-settings-colors"},void 0,[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()])},r.prototype.createElFont_=function(){return f("div",{className:"vjs-track-settings-font"},void 0,[f("fieldset",{className:"vjs-font-percent vjs-track-setting"},void 0,this.createElSelect_("fontPercent","","legend")),f("fieldset",{className:"vjs-edge-style vjs-track-setting"},void 0,this.createElSelect_("edgeStyle","","legend")),f("fieldset",{className:"vjs-font-family vjs-track-setting"},void 0,this.createElSelect_("fontFamily","","legend"))])},r.prototype.createElControls_=function(){var t=this.localize("restore all settings to the default values");return f("div",{className:"vjs-track-settings-controls"},void 0,[f("button",{className:"vjs-default-button",title:t,innerHTML:this.localize("Reset")+"<span class='vjs-control-text'> "+t+"</span>"}),f("button",{className:"vjs-done-button",textContent:this.localize("Done")})])},r.prototype.createEl=function(){return t.prototype.createEl.call(this)},r.prototype.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},r.prototype.label=function(){return this.localize("Caption Settings Dialog")},r.prototype.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},r.prototype.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},r.prototype.getValues=function(){var t=this;return n(Gi,function(e,n,r){var i=Jt(t.$(n.selector),n.parser);return void 0!==i&&(e[r]=i),e},{})},r.prototype.setValues=function(t){var n=this;e(Gi,function(e,r){Qt(n.$(e.selector),t[r],e.parser)})},r.prototype.setDefaults=function(){var t=this;e(Gi,function(e){var n=e.hasOwnProperty("default")?e.default:0;t.$(e.selector).selectedIndex=n})},r.prototype.restoreSettings=function(){var t=void 0;try{t=JSON.parse(ie.localStorage.getItem("vjs-text-track-settings"))}catch(t){Ue.warn(t)}t&&this.setValues(t)},r.prototype.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?ie.localStorage.setItem("vjs-text-track-settings",JSON.stringify(t)):ie.localStorage.removeItem("vjs-text-track-settings")}catch(t){Ue.warn(t)}}},r.prototype.updateDisplay=function(){var t=this.player_.getChild("textTrackDisplay");t&&t.updateDisplay()},r.prototype.conditionalBlur_=function(){this.previouslyActiveEl_=null,this.off(ce,"keydown",this.handleKeyDown);var t=this.player_.controlBar,e=t&&t.subsCapsButton,n=t&&t.captionsButton;e?e.focus():n&&n.focus()},r}(On);mn.registerComponent("TextTrackSettings",Yi);var $i=Le(["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."],["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."]),Ji=function(t){function e(n,r){Ie(this,e);var i=Re(this,t.call(this,n,r)),o=n.source,s=!1;if(o&&(i.el_.currentSrc!==o.src||n.tag&&3===n.tag.initNetworkState_)?i.setSource(o):i.handleLateInit_(i.el_),i.el_.hasChildNodes()){for(var a=i.el_.childNodes,l=a.length,c=[];l--;){var u=a[l];"track"===u.nodeName.toLowerCase()&&(i.featuresNativeTextTracks?(i.remoteTextTrackEls().addTrackElement_(u),i.remoteTextTracks().addTrack(u.track),i.textTracks().addTrack(u.track),s||i.el_.hasAttribute("crossorigin")||!$n(u.src)||(s=!0)):c.push(u))}for(var h=0;h<c.length;h++)i.el_.removeChild(c[h])}return i.proxyNativeTracks_(),i.featuresNativeTextTracks&&s&&Ue.warn(Xe($i)),(Pe||fe||Te)&&!0===n.nativeControlsForTouch&&i.setControls(!0),i.proxyWebkitFullscreen_(),i.triggerReady(),i}return De(e,t),e.prototype.dispose=function(){e.disposeMediaElement(this.el_),t.prototype.dispose.call(this)},e.prototype.proxyNativeTracks_=function(){var t=this;gr.names.forEach(function(e){var n=gr[e],r=t.el()[n.getterName],i=t[n.getterName]();if(t["featuresNative"+n.capitalName+"Tracks"]&&r&&r.addEventListener){var o={change:function(t){i.trigger({type:"change",target:i,currentTarget:i,srcElement:i})},addtrack:function(t){i.addTrack(t.track)},removetrack:function(t){i.removeTrack(t.track)}},s=function(){for(var t=[],e=0;e<i.length;e++){for(var n=!1,o=0;o<r.length;o++)if(r[o]===i[e]){n=!0;break}n||t.push(i[e])}for(;t.length;)i.removeTrack(t.shift())};Object.keys(o).forEach(function(e){var n=o[e];r.addEventListener(e,n),t.on("dispose",function(t){return r.removeEventListener(e,n)})}),t.on("loadstart",s),t.on("dispose",function(e){return t.off("loadstart",s)})}})},e.prototype.createEl=function(){var t=this.options_.tag;if(!t||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(t){var n=t.cloneNode(!0);t.parentNode&&t.parentNode.insertBefore(n,t),e.disposeMediaElement(t),t=n}else{t=ce.createElement("video");var i=this.options_.tag&&C(this.options_.tag),o=Q({},i);Pe&&!0===this.options_.nativeControlsForTouch||delete o.controls,T(t,r(o,{id:this.options_.techId,class:"vjs-tech"}))}t.playerId=this.options_.playerId}for(var s=["autoplay","preload","loop","muted","playsinline"],a=s.length-1;a>=0;a--){var l=s[a],c={};void 0!==this.options_[l]&&(c[l]=this.options_[l]),T(t,c)}return t},e.prototype.handleLateInit_=function(t){if(0!==t.networkState&&3!==t.networkState){if(0===t.readyState){var e=!1,n=function(){e=!0};this.on("loadstart",n);var r=function(){e||this.trigger("loadstart")};return this.on("loadedmetadata",r),void this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",r),e||this.trigger("loadstart")})}var i=["loadstart"];i.push("loadedmetadata"),t.readyState>=2&&i.push("loadeddata"),t.readyState>=3&&i.push("canplay"),t.readyState>=4&&i.push("canplaythrough"),this.ready(function(){i.forEach(function(t){this.trigger(t)},this)})}},e.prototype.setCurrentTime=function(t){try{this.el_.currentTime=t}catch(t){Ue(t,"Video is not ready. (Video.js)")}},e.prototype.duration=function(){var t=this;if(this.el_.duration===1/0&&me&&we&&0===this.el_.currentTime){var e=function e(){t.el_.currentTime>0&&(t.el_.duration===1/0&&t.trigger("durationchange"),t.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN},e.prototype.width=function(){return this.el_.offsetWidth},e.prototype.height=function(){return this.el_.offsetHeight},e.prototype.proxyWebkitFullscreen_=function(){var t=this;if("webkitDisplayingFullscreen"in this.el_){var e=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},n=function(){this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0})};this.on("webkitbeginfullscreen",n),this.on("dispose",function(){t.off("webkitbeginfullscreen",n),t.off("webkitendfullscreen",e)})}},e.prototype.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var t=ie.navigator&&ie.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},e.prototype.enterFullScreen=function(){var t=this.el_;t.paused&&t.networkState<=t.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){t.pause(),t.webkitEnterFullScreen()},0)):t.webkitEnterFullScreen()},e.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()},e.prototype.src=function(t){if(void 0===t)return this.el_.src;this.setSrc(t)},e.prototype.reset=function(){e.resetMediaElement(this.el_)},e.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},e.prototype.setControls=function(t){this.el_.controls=!!t},e.prototype.addTextTrack=function(e,n,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,n,r):t.prototype.addTextTrack.call(this,e,n,r)},e.prototype.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return t.prototype.createRemoteTextTrack.call(this,e);var n=ce.createElement("track");return e.kind&&(n.kind=e.kind),e.label&&(n.label=e.label),(e.language||e.srclang)&&(n.srclang=e.language||e.srclang),e.default&&(n.default=e.default),e.id&&(n.id=e.id),e.src&&(n.src=e.src),n},e.prototype.addRemoteTextTrack=function(e,n){var r=t.prototype.addRemoteTextTrack.call(this,e,n);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},e.prototype.removeRemoteTextTrack=function(e){if(t.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var n=this.$$("track"),r=n.length;r--;)e!==n[r]&&e!==n[r].track||this.el().removeChild(n[r])},e.prototype.playsinline=function(){return this.el_.hasAttribute("playsinline")},e.prototype.setPlaysinline=function(t){t?this.el_.setAttribute("playsinline","playsinline"):this.el_.removeAttribute("playsinline")},e.prototype.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),ie.performance&&"function"==typeof ie.performance.now?t.creationTime=ie.performance.now():ie.performance&&ie.performance.timing&&"number"==typeof ie.performance.timing.navigationStart&&(t.creationTime=ie.Date.now()-ie.performance.timing.navigationStart),t},e}(Ir);if(h()){Ji.TEST_VID=ce.createElement("video");var Qi=ce.createElement("track");Qi.kind="captions",Qi.srclang="en",Qi.label="English",Ji.TEST_VID.appendChild(Qi)}Ji.isSupported=function(){try{Ji.TEST_VID.volume=.5}catch(t){return!1}return!(!Ji.TEST_VID||!Ji.TEST_VID.canPlayType)},Ji.canPlayType=function(t){return Ji.TEST_VID.canPlayType(t)},Ji.canPlaySource=function(t,e){return Ji.canPlayType(t.type)},Ji.canControlVolume=function(){try{var t=Ji.TEST_VID.volume;return Ji.TEST_VID.volume=t/2+.1,t!==Ji.TEST_VID.volume}catch(t){return!1}},Ji.canControlPlaybackRate=function(){if(me&&we&&Ee<58)return!1;try{var t=Ji.TEST_VID.playbackRate;return Ji.TEST_VID.playbackRate=t/2+.1,t!==Ji.TEST_VID.playbackRate}catch(t){return!1}},Ji.supportsNativeTextTracks=function(){return Ae},Ji.supportsNativeVideoTracks=function(){return!(!Ji.TEST_VID||!Ji.TEST_VID.videoTracks)},Ji.supportsNativeAudioTracks=function(){return!(!Ji.TEST_VID||!Ji.TEST_VID.audioTracks)},Ji.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],Ji.prototype.featuresVolumeControl=Ji.canControlVolume(),Ji.prototype.featuresPlaybackRate=Ji.canControlPlaybackRate(),Ji.prototype.movingMediaElementInDOM=!ye,Ji.prototype.featuresFullscreenResize=!0,Ji.prototype.featuresProgressEvents=!0,Ji.prototype.featuresTimeupdateEvents=!0,Ji.prototype.featuresNativeTextTracks=Ji.supportsNativeTextTracks(),Ji.prototype.featuresNativeVideoTracks=Ji.supportsNativeVideoTracks(),Ji.prototype.featuresNativeAudioTracks=Ji.supportsNativeAudioTracks();var Zi=Ji.TEST_VID&&Ji.TEST_VID.constructor.prototype.canPlayType,to=/^application\/(?:x-|vnd\.apple\.)mpegurl/i,eo=/^video\/mp4/i;Ji.patchCanPlayType=function(){_e>=4&&!Ce?Ji.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&to.test(t)?"maybe":Zi.call(this,t)}:be&&(Ji.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&eo.test(t)?"maybe":Zi.call(this,t)})},Ji.unpatchCanPlayType=function(){var t=Ji.TEST_VID.constructor.prototype.canPlayType;return Ji.TEST_VID.constructor.prototype.canPlayType=Zi,t},Ji.patchCanPlayType(),Ji.disposeMediaElement=function(t){if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(t){}}()}},Ji.resetMediaElement=function(t){if(t){for(var e=t.querySelectorAll("source"),n=e.length;n--;)t.removeChild(e[n]);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(t){}}()}},["paused","currentTime","buffered","volume","muted","defaultMuted","poster","preload","autoplay","controls","loop","error","seeking","seekable","ended","defaultMuted","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(t){Ji.prototype[t]=function(){return this.el_[t]}}),["volume","muted","defaultMuted","src","poster","preload","autoplay","loop","playbackRate","defaultPlaybackRate"].forEach(function(t){Ji.prototype["set"+$(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(t){Ji.prototype[t]=function(){return this.el_[t]()}}),Ir.withSourceHandlers(Ji),Ji.nativeSourceHandler={},Ji.nativeSourceHandler.canPlayType=function(t){try{return Ji.TEST_VID.canPlayType(t)}catch(t){return""}},Ji.nativeSourceHandler.canHandleSource=function(t,e){if(t.type)return Ji.nativeSourceHandler.canPlayType(t.type);if(t.src){var n=Yn(t.src);return Ji.nativeSourceHandler.canPlayType("video/"+n)}return""},Ji.nativeSourceHandler.handleSource=function(t,e,n){e.setSrc(t.src)},Ji.nativeSourceHandler.dispose=function(){},Ji.registerSourceHandler(Ji.nativeSourceHandler),Ir.registerTech("Html5",Ji);var no=Le(["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "],["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "]),ro=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","ratechange","resize","volumechange","texttrackchange"],io=function(t){function e(n,i,o){if(Ie(this,e),n.id=n.id||"vjs_video_"+R(),i=r(e.getTagSettings(n),i),i.initChildren=!1,i.createEl=!1,i.reportTouchActivity=!1,!i.language)if("function"==typeof n.closest){var s=n.closest("[lang]");s&&(i.language=s.getAttribute("lang"))}else for(var a=n;a&&1===a.nodeType;){if(C(a).hasOwnProperty("lang")){i.language=a.getAttribute("lang");break}a=a.parentNode}var l=Re(this,t.call(this,null,i,o));if(l.isReady_=!1,!l.options_||!l.options_.techOrder||!l.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(l.tag=n,l.tagAttributes=n&&C(n),l.language(l.options_.language),i.languages){var c={};Object.getOwnPropertyNames(i.languages).forEach(function(t){c[t.toLowerCase()]=i.languages[t]}),l.languages_=c}else l.languages_=e.prototype.options_.languages;l.cache_={},l.poster_=i.poster||"",l.controls_=!!i.controls,l.cache_.lastVolume=1,n.controls=!1,l.scrubbing_=!1,l.el_=l.createEl(),G(l,{eventBusKey:"el_"});var u=Q(l.options_);if(i.plugins){var h=i.plugins;Object.keys(h).forEach(function(t){if("function"!=typeof this[t])throw new Error('plugin "'+t+'" does not exist');this[t](h[t])},l)}l.options_.playerOptions=u,l.middleware_=[],l.initChildren(),l.isAudio("audio"===n.nodeName.toLowerCase()),l.controls()?l.addClass("vjs-controls-enabled"):l.addClass("vjs-controls-disabled"),l.el_.setAttribute("role","region"),l.isAudio()?l.el_.setAttribute("aria-label",l.localize("Audio Player")):l.el_.setAttribute("aria-label",l.localize("Video Player")),l.isAudio()&&l.addClass("vjs-audio"),l.flexNotSupported_()&&l.addClass("vjs-no-flex"),ye||l.addClass("vjs-workinghover"),e.players[l.id_]=l;var p=ee.split(".")[0];return l.addClass("vjs-v"+p),l.userActive(!0),l.reportUserActivity(),l.listenForUserActivity_(),l.on("fullscreenchange",l.handleFullscreenChange_),l.on("stageclick",l.handleStageClick_),l.changingSrc_=!1,l}return De(e,t),e.prototype.dispose=function(){this.trigger("dispose"),this.off("dispose"),this.styleEl_&&this.styleEl_.parentNode&&this.styleEl_.parentNode.removeChild(this.styleEl_),e.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&this.tech_.dispose(),t.prototype.dispose.call(this)},e.prototype.createEl=function(){var e=this.tag,n=void 0,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");n=this.el_=r?e.parentNode:t.prototype.createEl.call(this,"div"),e.setAttribute("tabindex","-1"),e.removeAttribute("width"),e.removeAttribute("height");var i=C(e);if(Object.getOwnPropertyNames(i).forEach(function(t){"class"===t?n.className+=" "+i[t]:n.setAttribute(t,i[t])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=n.player=this,this.addClass("vjs-paused"),!0!==ie.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=rn("vjs-styles-dimensions");var o=Ke(".vjs-styles-defaults"),s=Ke("head");s.insertBefore(this.styleEl_,o?o.nextSibling:s.firstChild)}this.width(this.options_.width),this.height(this.options_.height),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var a=e.getElementsByTagName("a"),l=0;l<a.length;l++){var c=a.item(l);m(c,"vjs-hidden"),c.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!r&&e.parentNode.insertBefore(n,e),y(e,n),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_=n,n},e.prototype.width=function(t){return this.dimension("width",t)},e.prototype.height=function(t){return this.dimension("height",t)},e.prototype.dimension=function(t,e){var n=t+"_";if(void 0===e)return this[n]||0;if(""===e)this[n]=void 0;else{var r=parseFloat(e);if(isNaN(r))return void Ue.error('Improper value "'+e+'" supplied for for '+t);this[n]=r}this.updateStyleEl_()},e.prototype.fluid=function(t){if(void 0===t)return!!this.fluid_;this.fluid_=!!t,t?this.addClass("vjs-fluid"):this.removeClass("vjs-fluid"),this.updateStyleEl_()},e.prototype.aspectRatio=function(t){if(void 0===t)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(t))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=t,this.fluid(!0),this.updateStyleEl_()},e.prototype.updateStyleEl_=function(){if(!0===ie.VIDEOJS_NO_DYNAMIC_STYLE){var t="number"==typeof this.width_?this.width_:this.options_.width,e="number"==typeof this.height_?this.height_:this.options_.height,n=this.tech_&&this.tech_.el();return void(n&&(t>=0&&(n.width=t),e>=0&&(n.height=e)))}var r=void 0,i=void 0,o=void 0,s=void 0;o=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";var a=o.split(":"),l=a[1]/a[0];r=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/l:this.videoWidth()||300,i=void 0!==this.height_?this.height_:r*l,s=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(s),on(this.styleEl_,"\n ."+s+" {\n width: "+r+"px;\n height: "+i+"px;\n }\n\n ."+s+".vjs-fluid {\n padding-top: "+100*l+"%;\n }\n ")},e.prototype.loadTech_=function(t,e){var n=this;this.tech_&&this.unloadTech_();var i=$(t),o=t.charAt(0).toLowerCase()+t.slice(1);"Html5"!==i&&this.tag&&(Ir.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;var s={source:e,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+i+"_api",autoplay:this.options_.autoplay,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"]};_r.names.forEach(function(t){var e=_r[t];s[e.getterName]=n[e.privateName]}),r(s,this.options_[i]),r(s,this.options_[o]),r(s,this.options_[t.toLowerCase()]),this.tag&&(s.tag=this.tag),e&&e.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var a=Ir.getTech(t);if(!a)throw new Error("No Tech named '"+i+"' exists! '"+i+"' should be registered using videojs.registerTech()'");this.tech_=new a(s),this.tech_.ready(sn(this,this.handleTechReady_),!0),Pn.jsonToTextTracks(this.textTracksJson_||[],this.tech_),ro.forEach(function(t){n.on(n.tech_,t,n["handleTech"+$(t)+"_"])}),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"canplay",this.handleTechCanPlay_),this.on(this.tech_,"canplaythrough",this.handleTechCanPlayThrough_),this.on(this.tech_,"playing",this.handleTechPlaying_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"seeked",this.handleTechSeeked_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||y(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},e.prototype.unloadTech_=function(){var t=this;_r.names.forEach(function(e){var n=_r[e];t[n.privateName]=t[n.getterName]()}),this.textTracksJson_=Pn.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1},e.prototype.tech=function(t){return void 0===t&&Ue.warn(Xe(no)),this.tech_},e.prototype.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mousedown",this.handleTechClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},e.prototype.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mousedown",this.handleTechClick_)},e.prototype.handleTechReady_=function(){if(this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume), - this.handleTechPosterChange_(),this.handleTechDurationChange_(),(this.src()||this.currentSrc())&&this.tag&&this.options_.autoplay&&this.paused()){try{delete this.tag.poster}catch(t){Ue("deleting tag.poster throws in some browsers",t)}this.play()}},e.prototype.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay"))},e.prototype.hasStarted=function(t){return void 0!==t?void(this.hasStarted_!==t&&(this.hasStarted_=t,t?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))):!!this.hasStarted_},e.prototype.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},e.prototype.handleTechWaiting_=function(){var t=this;this.addClass("vjs-waiting"),this.trigger("waiting"),this.one("timeupdate",function(){return t.removeClass("vjs-waiting")})},e.prototype.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},e.prototype.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},e.prototype.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},e.prototype.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},e.prototype.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.trigger("seeked")},e.prototype.handleTechFirstPlay_=function(){this.options_.starttime&&(Ue.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},e.prototype.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},e.prototype.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},e.prototype.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},e.prototype.handleTechClick_=function(t){0===t.button&&this.controls()&&(this.paused()?this.play():this.pause())},e.prototype.handleTechTap_=function(){this.userActive(!this.userActive())},e.prototype.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},e.prototype.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},e.prototype.handleTechTouchEnd_=function(t){t.preventDefault()},e.prototype.handleFullscreenChange_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},e.prototype.handleStageClick_=function(){this.reportUserActivity()},e.prototype.handleTechFullscreenChange_=function(t,e){e&&this.isFullscreen(e.isFullscreen),this.trigger("fullscreenchange")},e.prototype.handleTechError_=function(){var t=this.tech_.error();this.error(t)},e.prototype.handleTechTextData_=function(){var t=null;arguments.length>1&&(t=arguments[1]),this.trigger("textdata",t)},e.prototype.getCache=function(){return this.cache_},e.prototype.techCall_=function(t,e){this.ready(function(){if(t in Lr)return Ut(this.middleware_,this.tech_,t,e);try{this.tech_&&this.tech_[t](e)}catch(t){throw Ue(t),t}},!0)},e.prototype.techGet_=function(t){if(this.tech_&&this.tech_.isReady_){if(t in Rr)return Wt(this.middleware_,this.tech_,t);try{return this.tech_[t]()}catch(e){throw void 0===this.tech_[t]?Ue("Video.js: "+t+" method not defined for "+this.techName_+" playback technology.",e):"TypeError"===e.name?(Ue("Video.js: "+t+" unavailable on "+this.techName_+" playback technology element.",e),this.tech_.isReady_=!1):Ue(e),e}}},e.prototype.play=function(){if(this.changingSrc_)this.ready(function(){var t=this.techGet_("play");void 0!==t&&"function"==typeof t.then&&t.then(null,function(t){})});else{if(this.isReady_&&(this.src()||this.currentSrc()))return this.techGet_("play");this.ready(function(){this.tech_.one("loadstart",function(){var t=this.play();void 0!==t&&"function"==typeof t.then&&t.then(null,function(t){})})})}},e.prototype.pause=function(){this.techCall_("pause")},e.prototype.paused=function(){return!1!==this.techGet_("paused")},e.prototype.played=function(){return this.techGet_("played")||nt(0,0)},e.prototype.scrubbing=function(t){if(void 0===t)return this.scrubbing_;this.scrubbing_=!!t,t?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},e.prototype.currentTime=function(t){return void 0!==t?void this.techCall_("setCurrentTime",t):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},e.prototype.duration=function(t){if(void 0===t)return this.cache_.duration||0;t=parseFloat(t)||0,t<0&&(t=1/0),t!==this.cache_.duration&&(this.cache_.duration=t,t===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),this.trigger("durationchange"))},e.prototype.remainingTime=function(){return this.duration()-this.currentTime()},e.prototype.buffered=function(){var t=this.techGet_("buffered");return t&&t.length||(t=nt(0,0)),t},e.prototype.bufferedPercent=function(){return rt(this.buffered(),this.duration())},e.prototype.bufferedEnd=function(){var t=this.buffered(),e=this.duration(),n=t.end(t.length-1);return n>e&&(n=e),n},e.prototype.volume=function(t){var e=void 0;return void 0!==t?(e=Math.max(0,Math.min(1,parseFloat(t))),this.cache_.volume=e,this.techCall_("setVolume",e),void(e>0&&this.lastVolume_(e))):(e=parseFloat(this.techGet_("volume")),isNaN(e)?1:e)},e.prototype.muted=function(t){return void 0!==t?void this.techCall_("setMuted",t):this.techGet_("muted")||!1},e.prototype.defaultMuted=function(t){return void 0!==t?this.techCall_("setDefaultMuted",t):this.techGet_("defaultMuted")||!1},e.prototype.lastVolume_=function(t){return void 0!==t&&0!==t?void(this.cache_.lastVolume=t):this.cache_.lastVolume},e.prototype.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},e.prototype.isFullscreen=function(t){return void 0!==t?void(this.isFullscreen_=!!t):!!this.isFullscreen_},e.prototype.requestFullscreen=function(){var t=_n;this.isFullscreen(!0),t.requestFullscreen?(W(ce,t.fullscreenchange,sn(this,function e(n){this.isFullscreen(ce[t.fullscreenElement]),!1===this.isFullscreen()&&U(ce,t.fullscreenchange,e),this.trigger("fullscreenchange")})),this.el_[t.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},e.prototype.exitFullscreen=function(){var t=_n;this.isFullscreen(!1),t.requestFullscreen?ce[t.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},e.prototype.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=ce.documentElement.style.overflow,W(ce,"keydown",sn(this,this.fullWindowOnEscKey)),ce.documentElement.style.overflow="hidden",m(ce.body,"vjs-full-window"),this.trigger("enterFullWindow")},e.prototype.fullWindowOnEscKey=function(t){27===t.keyCode&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},e.prototype.exitFullWindow=function(){this.isFullWindow=!1,U(ce,"keydown",this.fullWindowOnEscKey),ce.documentElement.style.overflow=this.docOrigOverflow,_(ce.body,"vjs-full-window"),this.trigger("exitFullWindow")},e.prototype.canPlayType=function(t){for(var e=void 0,n=0,r=this.options_.techOrder;n<r.length;n++){var i=r[n],o=Ir.getTech(i);if(o||(o=mn.getComponent(i)),o){if(o.isSupported()&&(e=o.canPlayType(t)))return e}else Ue.error('The "'+i+'" tech is undefined. Skipped browser support check for that tech.')}return""},e.prototype.selectSource=function(t){var e=this,n=this.options_.techOrder.map(function(t){return[t,Ir.getTech(t)]}).filter(function(t){var e=t[0],n=t[1];return n?n.isSupported():(Ue.error('The "'+e+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),r=function(t,e,n){var r=void 0;return t.some(function(t){return e.some(function(e){if(r=n(t,e))return!0})}),r},i=function(t,n){var r=t[0];if(t[1].canPlaySource(n,e.options_[r.toLowerCase()]))return{source:n,tech:r}};return(this.options_.sourceOrder?r(t,n,function(t){return function(e,n){return t(n,e)}}(i)):r(n,t,i))||!1},e.prototype.src=function(t){var e=this;if(void 0===t)return this.cache_.src;var n=Br(t);if(!n.length)return void this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);this.cache_.sources=n,this.changingSrc_=!0,this.cache_.source=n[0],Vt(this,n[0],function(t,r){if(e.middleware_=r,e.src_(t))return n.length>1?e.src(n.slice(1)):(e.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void e.triggerReady());e.changingSrc_=!1,e.cache_.src=t.src,zt(r,e.tech_)})},e.prototype.src_=function(t){var e=this.selectSource([t]);return!e||(J(e.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",t):this.techCall_("src",t.src),"auto"===this.options_.preload&&this.load(),this.options_.autoplay&&this.play()},!0),!1):(this.changingSrc_=!0,this.loadTech_(e.tech,e.source),!1))},e.prototype.load=function(){this.techCall_("load")},e.prototype.reset=function(){this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset")},e.prototype.currentSources=function(){var t=this.currentSource(),e=[];return 0!==Object.keys(t).length&&e.push(t),this.cache_.sources||e},e.prototype.currentSource=function(){return this.cache_.source||{}},e.prototype.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},e.prototype.currentType=function(){return this.currentSource()&&this.currentSource().type||""},e.prototype.preload=function(t){return void 0!==t?(this.techCall_("setPreload",t),void(this.options_.preload=t)):this.techGet_("preload")},e.prototype.autoplay=function(t){return void 0!==t?(this.techCall_("setAutoplay",t),void(this.options_.autoplay=t)):this.techGet_("autoplay",t)},e.prototype.playsinline=function(t){return void 0!==t?(this.techCall_("setPlaysinline",t),this.options_.playsinline=t,this):this.techGet_("playsinline")},e.prototype.loop=function(t){return void 0!==t?(this.techCall_("setLoop",t),void(this.options_.loop=t)):this.techGet_("loop")},e.prototype.poster=function(t){if(void 0===t)return this.poster_;t||(t=""),this.poster_=t,this.techCall_("setPoster",t),this.trigger("posterchange")},e.prototype.handleTechPosterChange_=function(){!this.poster_&&this.tech_&&this.tech_.poster&&(this.poster_=this.tech_.poster()||"",this.trigger("posterchange"))},e.prototype.controls=function(t){return void 0!==t?(t=!!t,void(this.controls_!==t&&(this.controls_=t,this.usingNativeControls()&&this.techCall_("setControls",t),t?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_())))):!!this.controls_},e.prototype.usingNativeControls=function(t){return void 0!==t?(t=!!t,void(this.usingNativeControls_!==t&&(this.usingNativeControls_=t,t?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols"))))):!!this.usingNativeControls_},e.prototype.error=function(t){return void 0===t?this.error_||null:null===t?(this.error_=t,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close())):(this.error_=new it(t),this.addClass("vjs-error"),Ue.error("(CODE:"+this.error_.code+" "+it.errorTypes[this.error_.code]+")",this.error_.message,this.error_),void this.trigger("error"))},e.prototype.reportUserActivity=function(t){this.userActivity_=!0},e.prototype.userActive=function(t){return void 0!==t?void((t=!!t)!==this.userActive_&&(this.userActive_=t,t?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.userActivity_=!1,this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))):this.userActive_},e.prototype.listenForUserActivity_=function(){var t=void 0,e=void 0,n=void 0,r=sn(this,this.reportUserActivity),i=function(t){t.screenX===e&&t.screenY===n||(e=t.screenX,n=t.screenY,r())},o=function(){r(),this.clearInterval(t),t=this.setInterval(r,250)},s=function(e){r(),this.clearInterval(t)};this.on("mousedown",o),this.on("mousemove",i),this.on("mouseup",s),this.on("keydown",r),this.on("keyup",r);var a=void 0;this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var t=this.options_.inactivityTimeout;t>0&&(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},t))}},250)},e.prototype.playbackRate=function(t){return void 0!==t?void this.techCall_("setPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("playbackRate"):1},e.prototype.defaultPlaybackRate=function(t){return void 0!==t?this.techCall_("setDefaultPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},e.prototype.isAudio=function(t){return void 0!==t?void(this.isAudio_=!!t):!!this.isAudio_},e.prototype.addTextTrack=function(t,e,n){if(this.tech_)return this.tech_.addTextTrack(t,e,n)},e.prototype.addRemoteTextTrack=function(t,e){if(this.tech_)return this.tech_.addRemoteTextTrack(t,e)},e.prototype.removeRemoteTextTrack=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.track,n=void 0===e?arguments[0]:e;if(this.tech_)return this.tech_.removeRemoteTextTrack(n)},e.prototype.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},e.prototype.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},e.prototype.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},e.prototype.language=function(t){if(void 0===t)return this.language_;this.language_=String(t).toLowerCase()},e.prototype.languages=function(){return Q(e.prototype.options_.languages,this.languages_)},e.prototype.toJSON=function(){var t=Q(this.options_),e=t.tracks;t.tracks=[];for(var n=0;n<e.length;n++){var r=e[n];r=Q(r),r.player=void 0,t.tracks[n]=r}return t},e.prototype.createModal=function(t,e){var n=this;e=e||{},e.content=t||"";var r=new On(this,e);return this.addChild(r),r.on("dispose",function(){n.removeChild(r)}),r.open(),r},e.getTagSettings=function(t){var e={sources:[],tracks:[]},n=C(t),i=n["data-setup"];if(g(t,"vjs-fluid")&&(n.fluid=!0),null!==i){var o=Sn(i||"{}"),s=o[0],a=o[1];s&&Ue.error(s),r(n,a)}if(r(e,n),t.hasChildNodes())for(var l=t.childNodes,c=0,u=l.length;c<u;c++){var h=l[c],p=h.nodeName.toLowerCase();"source"===p?e.sources.push(C(h)):"track"===p&&e.tracks.push(C(h))}return e},e.prototype.flexNotSupported_=function(){var t=ce.createElement("i");return!("flexBasis"in t.style||"webkitFlexBasis"in t.style||"mozFlexBasis"in t.style||"msFlexBasis"in t.style||"msFlexOrder"in t.style)},e}(mn);_r.names.forEach(function(t){var e=_r[t];io.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),io.players={};var oo=ie.navigator;io.prototype.options_={techOrder:Ir.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","controlBar","errorDisplay","textTrackSettings"],language:oo&&(oo.languages&&oo.languages[0]||oo.userLanguage||oo.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media."},["ended","seeking","seekable","networkState","readyState"].forEach(function(t){io.prototype[t]=function(){return this.techGet_(t)}}),ro.forEach(function(t){io.prototype["handleTech"+$(t)+"_"]=function(){return this.trigger(t)}}),mn.registerComponent("Player",io);var so={},ao=function(t){return so.hasOwnProperty(t)},lo=function(t){return ao(t)?so[t]:void 0},co=function(t,e){t.activePlugins_=t.activePlugins_||{},t.activePlugins_[e]=!0},uo=function(t,e,n){var r=(n?"before":"")+"pluginsetup";t.trigger(r,e),t.trigger(r+":"+e.name,e)},ho=function(t,e){var n=function(){uo(this,{name:t,plugin:e,instance:null},!0);var n=e.apply(this,arguments);return co(this,t),uo(this,{name:t,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(t){n[t]=e[t]}),n},po=function(t,e){return e.prototype.name=t,function(){uo(this,{name:t,plugin:e,instance:null},!0);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=new(Function.prototype.bind.apply(e,[null].concat([this].concat(r))));return this[t]=function(){return o},uo(this,o.getEventHash()),o}},fo=function(){function t(e){if(Ie(this,t),this.constructor===t)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,G(this),delete this.trigger,Y(this,this.constructor.defaultState),co(e,this.name),this.dispose=sn(this,this.dispose),e.on("dispose",this.dispose)}return t.prototype.getEventHash=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.name=this.name,t.plugin=this.constructor,t.instance=this,t},t.prototype.trigger=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return X(this.eventBusEl_,t,this.getEventHash(e))},t.prototype.handleStateChanged=function(t){},t.prototype.dispose=function(){var t=this.name,e=this.player;this.trigger("dispose"),this.off(),e.off("dispose",this.dispose),e.activePlugins_[t]=!1,this.player=this.state=null,e[t]=po(t,so[t])},t.isBasic=function(e){var n="string"==typeof e?lo(e):e;return"function"==typeof n&&!t.prototype.isPrototypeOf(n.prototype)},t.registerPlugin=function(e,n){if("string"!=typeof e)throw new Error('Illegal plugin name, "'+e+'", must be a string, was '+(void 0===e?"undefined":Me(e))+".");if(ao(e))Ue.warn('A plugin named "'+e+'" already exists. You may want to avoid re-registering plugins!');else if(io.prototype.hasOwnProperty(e))throw new Error('Illegal plugin name, "'+e+'", cannot share a name with an existing player method!');if("function"!=typeof n)throw new Error('Illegal plugin for "'+e+'", must be a function, was '+(void 0===n?"undefined":Me(n))+".");return so[e]=n,"plugin"!==e&&(t.isBasic(n)?io.prototype[e]=ho(e,n):io.prototype[e]=po(e,n)),n},t.deregisterPlugin=function(t){if("plugin"===t)throw new Error("Cannot de-register base plugin.");ao(t)&&(delete so[t],delete io.prototype[t])},t.getPlugins=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object.keys(so),e=void 0;return t.forEach(function(t){var n=lo(t);n&&(e=e||{},e[t]=n)}),e},t.getPluginVersion=function(t){var e=lo(t);return e&&e.VERSION||""},t}();fo.getPlugin=lo,fo.BASE_PLUGIN_NAME="plugin",fo.registerPlugin("plugin",fo),io.prototype.usingPlugin=function(t){return!!this.activePlugins_&&!0===this.activePlugins_[t]},io.prototype.hasPlugin=function(t){return!!ao(t)};var vo=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":Me(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.super_=e)},yo=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(){t.apply(this,arguments)},r={};"object"===(void 0===e?"undefined":Me(e))?(e.constructor!==Object.prototype.constructor&&(n=e.constructor),r=e):"function"==typeof e&&(n=e),vo(n,t);for(var i in r)r.hasOwnProperty(i)&&(n.prototype[i]=r[i]);return n};if("undefined"==typeof HTMLVideoElement&&h()&&(ce.createElement("video"),ce.createElement("audio"),ce.createElement("track")),Zt.hooks_={},Zt.hooks=function(t,e){return Zt.hooks_[t]=Zt.hooks_[t]||[],e&&(Zt.hooks_[t]=Zt.hooks_[t].concat(e)),Zt.hooks_[t]},Zt.hook=function(t,e){Zt.hooks(t,e)},Zt.removeHook=function(t,e){var n=Zt.hooks(t).indexOf(e);return!(n<=-1)&&(Zt.hooks_[t]=Zt.hooks_[t].slice(),Zt.hooks_[t].splice(n,1),!0)},!0!==ie.VIDEOJS_NO_DYNAMIC_STYLE&&h()){var go=Ke(".vjs-styles-defaults");if(!go){go=rn("vjs-styles-defaults");var mo=Ke("head");mo&&mo.insertBefore(go,mo.firstChild),on(go,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}return K(1,Zt),Zt.VERSION=ee,Zt.options=io.prototype.options_,Zt.getPlayers=function(){return io.players},Zt.players=io.players,Zt.getComponent=mn.getComponent,Zt.registerComponent=function(t,e){Ir.isTech(e)&&Ue.warn("The "+t+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),mn.registerComponent.call(mn,t,e)},Zt.getTech=Ir.getTech,Zt.registerTech=Ir.registerTech,Zt.use=Ht,Zt.browser=Oe,Zt.TOUCH_ENABLED=Pe,Zt.extend=yo,Zt.mergeOptions=Q,Zt.bind=sn,Zt.registerPlugin=fo.registerPlugin,Zt.plugin=function(t,e){return Ue.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),fo.registerPlugin(t,e)},Zt.getPlugins=fo.getPlugins,Zt.getPlugin=fo.getPlugin,Zt.getPluginVersion=fo.getPluginVersion,Zt.addLanguage=function(t,e){var n;return t=(""+t).toLowerCase(),Zt.options.languages=Q(Zt.options.languages,(n={},n[t]=e,n)),Zt.options.languages[t]},Zt.log=Ue,Zt.createTimeRange=Zt.createTimeRanges=nt,Zt.formatTime=Yt,Zt.parseUrl=Kn,Zt.isCrossOrigin=$n,Zt.EventTarget=ln,Zt.on=W,Zt.one=q,Zt.off=U,Zt.trigger=X,Zt.xhr=lr,Zt.TextTrack=hr,Zt.AudioTrack=pr,Zt.VideoTrack=dr,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){Zt[t]=function(){return Ue.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),Ye[t].apply(null,arguments)}}),Zt.computedStyle=a,Zt.dom=Ye,Zt.url=Jn,Zt}); - -!function(){!function(a){var b=a&&a.videojs;b&&(b.CDN_VERSION="6.2.0")}(window),function(a,b,c,d,e,f,g){b&&b.HELP_IMPROVE_VIDEOJS!==!1&&(e.random()>.01||(f=b.location,g=b.videojs||{},a.src="//www.google-analytics.com/__utm.gif?utmwv=5.4.2&utmac=UA-16505296-3&utmn=1&utmhn="+d(f.hostname)+"&utmsr="+b.screen.availWidth+"x"+b.screen.availHeight+"&utmul="+(c.language||c.userLanguage||"").toLowerCase()+"&utmr="+d(f.href)+"&utmp="+d(f.hostname+f.pathname)+"&utmcc=__utma%3D1."+e.floor(1e10*e.random())+".1.1.1.1%3B&utme=8(vjsv*cdnv)9("+g.VERSION+"*"+g.CDN_VERSION+")"))}(new Image,window,navigator,encodeURIComponent,Math)}(); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],e):t.videojs=e(t.window,t.document)}(this,function(v,d){v=v&&v.hasOwnProperty("default")?v.default:v,d=d&&d.hasOwnProperty("default")?d.default:d;var p="7.3.0";function f(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t,e,i){return(s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&a(r,i.prototype),r}).apply(null,arguments)}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(t,e){return e||(e=t.slice(0)),t.raw=e,t}var u=[],t=function(s,o){return function(t,e,i){var n=o.levels[e],r=new RegExp("^("+n+")$");if("log"!==t&&i.unshift(t.toUpperCase()+":"),i.unshift(s+":"),u&&u.push([].concat(i)),v.console){var a=v.console[t];a||"debug"!==t||(a=v.console.info||v.console.log),a&&n&&r.test(t)&&a[Array.isArray(i)?"apply":"call"](v.console,i)}}};var g=function e(i){var n,r="info",a=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];n("log",r,e)};return n=t(i,a),a.createLogger=function(t){return e(i+": "+t)},a.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},a.level=function(t){if("string"==typeof t){if(!a.levels.hasOwnProperty(t))throw new Error('"'+t+'" in not a valid log level');r=t}return r},(a.history=function(){return u?[].concat(u):[]}).filter=function(e){return(u||[]).filter(function(t){return new RegExp(".*"+e+".*").test(t[0])})},a.history.clear=function(){u&&(u.length=0)},a.history.disable=function(){null!==u&&(u.length=0,u=null)},a.history.enable=function(){null===u&&(u=[])},a.error=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return n("error",r,e)},a.warn=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return n("warn",r,e)},a.debug=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return n("debug",r,e)},a}("VIDEOJS"),y=g.createLogger;var _=function(t){for(var e="",i=0;i<arguments.length;i++)e+=t[i].replace(/\n\r?\s*/g,"")+(arguments[i+1]||"");return e},i=Object.prototype.toString,r=function(t){return l(t)?Object.keys(t):[]};function o(e,i){r(e).forEach(function(t){return i(e[t],t)})}function b(i){for(var t=arguments.length,e=new Array(1<t?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return Object.assign?Object.assign.apply(Object,[i].concat(e)):(e.forEach(function(t){t&&o(t,function(t,e){i[e]=t})}),i)}function l(t){return!!t&&"object"==typeof t}function c(t){return l(t)&&"[object Object]"===i.call(t)&&t.constructor===Object}function n(t,e){if(!t||!e)return"";if("function"!=typeof v.getComputedStyle)return"";var i=v.getComputedStyle(t);return i?i[e]:""}function h(){var t=e(["Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set "," to ","."]);return h=function(){return t},t}function T(t){return"string"==typeof t&&/\S/.test(t)}function S(t){if(/\s/.test(t))throw new Error("class has illegal whitespace characters")}function k(){return d===v.document}function w(t){return l(t)&&1===t.nodeType}function C(){try{return v.parent!==v.self}catch(t){return!0}}function E(n){return function(t,e){if(!T(t))return d[n](null);T(e)&&(e=d.querySelector(e));var i=w(e)?e:d;return i[n]&&i[n](t)}}function A(t,i,e,n){void 0===t&&(t="div"),void 0===i&&(i={}),void 0===e&&(e={});var r=d.createElement(t);return Object.getOwnPropertyNames(i).forEach(function(t){var e=i[t];-1!==t.indexOf("aria-")||"role"===t||"type"===t?(g.warn(_(h(),t,e)),r.setAttribute(t,e)):"textContent"===t?L(r,e):r[t]=e}),Object.getOwnPropertyNames(e).forEach(function(t){r.setAttribute(t,e[t])}),n&&X(r,n),r}function L(t,e){return"undefined"==typeof t.textContent?t.innerText=e:t.textContent=e,t}function O(t,e){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}function P(t,e){return S(e),t.classList?t.classList.contains(e):(i=e,new RegExp("(^|\\s)"+i+"($|\\s)")).test(t.className);var i}function U(t,e){return t.classList?t.classList.add(e):P(t,e)||(t.className=(t.className+" "+e).trim()),t}function x(t,e){return t.classList?t.classList.remove(e):(S(e),t.className=t.className.split(/\s+/).filter(function(t){return t!==e}).join(" ")),t}function I(t,e,i){var n=P(t,e);if("function"==typeof i&&(i=i(t,e)),"boolean"!=typeof i&&(i=!n),i!==n)return i?U(t,e):x(t,e),t}function D(i,n){Object.getOwnPropertyNames(n).forEach(function(t){var e=n[t];null===e||"undefined"==typeof e||!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})}function R(t){var e={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(t&&t.attributes&&0<t.attributes.length)for(var n=t.attributes,r=n.length-1;0<=r;r--){var a=n[r].name,s=n[r].value;"boolean"!=typeof t[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),e[a]=s}return e}function M(t,e){return t.getAttribute(e)}function B(t,e,i){t.setAttribute(e,i)}function N(t,e){t.removeAttribute(e)}function j(){d.body.focus(),d.onselectstart=function(){return!1}}function F(){d.onselectstart=function(){return!0}}function V(t){if(t&&t.getBoundingClientRect&&t.parentNode){var e=t.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(function(t){void 0!==e[t]&&(i[t]=e[t])}),i.height||(i.height=parseFloat(n(t,"height"))),i.width||(i.width=parseFloat(n(t,"width"))),i}}function H(t){var e;if(t.getBoundingClientRect&&t.parentNode&&(e=t.getBoundingClientRect()),!e)return{left:0,top:0};var i=d.documentElement,n=d.body,r=i.clientLeft||n.clientLeft||0,a=v.pageXOffset||n.scrollLeft,s=e.left+a-r,o=i.clientTop||n.clientTop||0,u=v.pageYOffset||n.scrollTop,l=e.top+u-o;return{left:Math.round(s),top:Math.round(l)}}function q(t,e){var i={},n=H(t),r=t.offsetWidth,a=t.offsetHeight,s=n.top,o=n.left,u=e.pageY,l=e.pageX;return e.changedTouches&&(l=e.changedTouches[0].pageX,u=e.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(s-u+a)/a)),i.x=Math.max(0,Math.min(1,(l-o)/r)),i}function z(t){return l(t)&&3===t.nodeType}function W(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function G(t){return"function"==typeof t&&(t=t()),(Array.isArray(t)?t:[t]).map(function(t){return"function"==typeof t&&(t=t()),w(t)||z(t)?t:"string"==typeof t&&/\S/.test(t)?d.createTextNode(t):void 0}).filter(function(t){return t})}function X(e,t){return G(t).forEach(function(t){return e.appendChild(t)}),e}function Y(t,e){return X(W(t),e)}function $(t){return void 0===t.button&&void 0===t.buttons||(0===t.button&&void 0===t.buttons||0===t.button&&1===t.buttons)}var K=E("querySelector"),Q=E("querySelectorAll"),J=Object.freeze({isReal:k,isEl:w,isInFrame:C,createEl:A,textContent:L,prependTo:O,hasClass:P,addClass:U,removeClass:x,toggleClass:I,setAttributes:D,getAttributes:R,getAttribute:M,setAttribute:B,removeAttribute:N,blockTextSelection:j,unblockTextSelection:F,getBoundingClientRect:V,findPosition:H,getPointerPosition:q,isTextNode:z,emptyEl:W,normalizeContent:G,appendContent:X,insertContent:Y,isSingleLeftClick:$,$:K,$$:Q}),Z=1;function tt(){return Z++}var et={},it="vdata"+(new Date).getTime();function nt(t){var e=t[it];return e||(e=t[it]=tt()),et[e]||(et[e]={}),et[e]}function rt(t){var e=t[it];return!!e&&!!Object.getOwnPropertyNames(et[e]).length}function at(e){var t=e[it];if(t){delete et[t];try{delete e[it]}catch(t){e.removeAttribute?e.removeAttribute(it):e[it]=null}}}function st(t,e){var i=nt(t);0===i.handlers[e].length&&(delete i.handlers[e],t.removeEventListener?t.removeEventListener(e,i.dispatcher,!1):t.detachEvent&&t.detachEvent("on"+e,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&at(t)}function ot(e,i,t,n){t.forEach(function(t){e(i,t,n)})}function ut(t){function e(){return!0}function i(){return!1}if(!t||!t.isPropagationStopped){var n=t||v.event;for(var r in t={},n)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&("returnValue"===r&&n.preventDefault||(t[r]=n[r]));if(t.target||(t.target=t.srcElement||d),t.relatedTarget||(t.relatedTarget=t.fromElement===t.target?t.toElement:t.fromElement),t.preventDefault=function(){n.preventDefault&&n.preventDefault(),t.returnValue=!1,n.returnValue=!1,t.defaultPrevented=!0},t.defaultPrevented=!1,t.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),t.cancelBubble=!0,n.cancelBubble=!0,t.isPropagationStopped=e},t.isPropagationStopped=i,t.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),t.isImmediatePropagationStopped=e,t.stopPropagation()},t.isImmediatePropagationStopped=i,null!==t.clientX&&void 0!==t.clientX){var a=d.documentElement,s=d.body;t.pageX=t.clientX+(a&&a.scrollLeft||s&&s.scrollLeft||0)-(a&&a.clientLeft||s&&s.clientLeft||0),t.pageY=t.clientY+(a&&a.scrollTop||s&&s.scrollTop||0)-(a&&a.clientTop||s&&s.clientTop||0)}t.which=t.charCode||t.keyCode,null!==t.button&&void 0!==t.button&&(t.button=1&t.button?0:4&t.button?1:2&t.button?2:0)}return t}var lt=!1;!function(){try{var t=Object.defineProperty({},"passive",{get:function(){lt=!0}});v.addEventListener("test",null,t),v.removeEventListener("test",null,t)}catch(t){}}();var ct=["touchstart","touchmove"];function ht(s,t,e){if(Array.isArray(t))return ot(ht,s,t,e);var o=nt(s);if(o.handlers||(o.handlers={}),o.handlers[t]||(o.handlers[t]=[]),e.guid||(e.guid=tt()),o.handlers[t].push(e),o.dispatcher||(o.disabled=!1,o.dispatcher=function(t,e){if(!o.disabled){t=ut(t);var i=o.handlers[t.type];if(i)for(var n=i.slice(0),r=0,a=n.length;r<a&&!t.isImmediatePropagationStopped();r++)try{n[r].call(s,t,e)}catch(t){g.error(t)}}}),1===o.handlers[t].length)if(s.addEventListener){var i=!1;lt&&-1<ct.indexOf(t)&&(i={passive:!0}),s.addEventListener(t,o.dispatcher,i)}else s.attachEvent&&s.attachEvent("on"+t,o.dispatcher)}function dt(t,e,i){if(rt(t)){var n=nt(t);if(n.handlers){if(Array.isArray(e))return ot(dt,t,e,i);var r=function(t,e){n.handlers[e]=[],st(t,e)};if(void 0!==e){var a=n.handlers[e];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);st(t,e)}else r(t,e)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(t,o)}}}function pt(t,e,i){var n=rt(t)?nt(t):{},r=t.parentNode||t.ownerDocument;if("string"==typeof e?e={type:e,target:t}:e.target||(e.target=t),e=ut(e),n.dispatcher&&n.dispatcher.call(t,e,i),r&&!e.isPropagationStopped()&&!0===e.bubbles)pt.call(null,r,e,i);else if(!r&&!e.defaultPrevented){var a=nt(e.target);e.target[e.type]&&(a.disabled=!0,"function"==typeof e.target[e.type]&&e.target[e.type](),a.disabled=!1)}return!e.defaultPrevented}function ft(e,i,n){if(Array.isArray(i))return ot(ft,e,i,n);var t=function t(){dt(e,i,t),n.apply(this,arguments)};t.guid=n.guid=n.guid||tt(),ht(e,i,t)}var mt,gt=Object.freeze({fixEvent:ut,on:ht,off:dt,trigger:pt,one:ft}),yt=!1,vt=function(){if(k()&&!1!==mt.options.autoSetup){var t=Array.prototype.slice.call(d.getElementsByTagName("video")),e=Array.prototype.slice.call(d.getElementsByTagName("audio")),i=Array.prototype.slice.call(d.getElementsByTagName("video-js")),n=t.concat(e,i);if(n&&0<n.length)for(var r=0,a=n.length;r<a;r++){var s=n[r];if(!s||!s.getAttribute){_t(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&mt(s)}else yt||_t(1)}};function _t(t,e){e&&(mt=e),v.setTimeout(vt,t)}k()&&"complete"===d.readyState?yt=!0:ft(v,"load",function(){yt=!0});var bt,Tt=function(t){var e=d.createElement("style");return e.className=t,e},St=function(t,e){t.styleSheet?t.styleSheet.cssText=e:t.textContent=e},kt=function(t,e,i){e.guid||(e.guid=tt());var n=function(){return e.apply(t,arguments)};return n.guid=i?i+"_"+e.guid:e.guid,n},wt=function(e,i){var n=Date.now();return function(){var t=Date.now();i<=t-n&&(e.apply(void 0,arguments),n=t)}},Ct=function(){};Ct.prototype.allowedEvents_={},Ct.prototype.addEventListener=Ct.prototype.on=function(t,e){var i=this.addEventListener;this.addEventListener=function(){},ht(this,t,e),this.addEventListener=i},Ct.prototype.removeEventListener=Ct.prototype.off=function(t,e){dt(this,t,e)},Ct.prototype.one=function(t,e){var i=this.addEventListener;this.addEventListener=function(){},ft(this,t,e),this.addEventListener=i},Ct.prototype.dispatchEvent=Ct.prototype.trigger=function(t){var e=t.type||t;"string"==typeof t&&(t={type:e}),t=ut(t),this.allowedEvents_[e]&&this["on"+e]&&this["on"+e](t),pt(this,t)},Ct.prototype.queueTrigger=function(t){var e=this;bt||(bt=new Map);var i=t.type||t,n=bt.get(this);n||(n=new Map,bt.set(this,n));var r=n.get(i);n.delete(i),v.clearTimeout(r);var a=v.setTimeout(function(){0===n.size&&(n=null,bt.delete(e)),e.trigger(t)},0);n.set(i,a)};var Et=function(e){return e instanceof Ct||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},At=function(t){return"string"==typeof t&&/\S/.test(t)||Array.isArray(t)&&!!t.length},Lt=function(t){if(!t.nodeName&&!Et(t))throw new Error("Invalid target; must be a DOM node or evented object.")},Ot=function(t){if(!At(t))throw new Error("Invalid event type; must be a non-empty string or array.")},Pt=function(t){if("function"!=typeof t)throw new Error("Invalid listener; must be a function.")},Ut=function(t,e){var i,n,r,a=e.length<3||e[0]===t||e[0]===t.eventBusEl_;return r=a?(i=t.eventBusEl_,3<=e.length&&e.shift(),n=e[0],e[1]):(i=e[0],n=e[1],e[2]),Lt(i),Ot(n),Pt(r),{isTargetingSelf:a,target:i,type:n,listener:r=kt(t,r)}},xt=function(t,e,i,n){Lt(t),t.nodeName?gt[e](t,i,n):t[e](i,n)},It={on:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=Ut(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(xt(s,"on",o,u),!a){var l=function(){return t.off(s,o,u)};l.guid=u.guid;var c=function(){return t.off("dispose",l)};c.guid=u.guid,xt(this,"on","dispose",l),xt(s,"on","dispose",c)}},one:function(){for(var r=this,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=Ut(this,e),a=n.isTargetingSelf,s=n.target,o=n.type,u=n.listener;if(a)xt(s,"one",o,u);else{var l=function t(){r.off(s,o,t);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];u.apply(null,i)};l.guid=u.guid,xt(s,"one",o,l)}},off:function(t,e,i){if(!t||At(t))dt(this.eventBusEl_,t,e);else{var n=t,r=e;Lt(n),Ot(r),Pt(i),i=kt(this,i),this.off("dispose",i),n.nodeName?(dt(n,r,i),dt(n,"dispose",i)):Et(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(t,e){return pt(this.eventBusEl_,t,e)}};function Dt(t,e){void 0===e&&(e={});var i=e.eventBusKey;if(i){if(!t[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');t.eventBusEl_=t[i]}else t.eventBusEl_=A("span",{className:"vjs-event-bus"});return b(t,It),t.on("dispose",function(){t.off(),v.setTimeout(function(){t.eventBusEl_=null},0)}),t}var Rt={state:{},setState:function(t){var i,n=this;return"function"==typeof t&&(t=t()),o(t,function(t,e){n.state[e]!==t&&((i=i||{})[e]={from:n.state[e],to:t}),n.state[e]=t}),i&&Et(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Mt(t,e){return b(t,Rt),t.state=b({},t.state,e),"function"==typeof t.handleStateChanged&&Et(t)&&t.on("statechanged",t.handleStateChanged),t}function Bt(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function Nt(){for(var i={},t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.forEach(function(t){t&&o(t,function(t,e){c(t)?(c(i[e])||(i[e]={}),i[e]=Nt(i[e],t)):i[e]=t})}),i}var jt=function(){function l(t,e,i){if(!t&&this.play?this.player_=t=this:this.player_=t,this.options_=Nt({},this.options_),e=this.options_=Nt(this.options_,e),this.id_=e.id||e.el&&e.el.id,!this.id_){var n=t&&t.id&&t.id()||"no_player";this.id_=n+"_component_"+tt()}this.name_=e.name||null,e.el?this.el_=e.el:!1!==e.createEl&&(this.el_=this.createEl()),!1!==e.evented&&Dt(this,{eventBusKey:this.el_?"el_":null}),Mt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},!(this.childNameIndex_={})!==e.initChildren&&this.initChildren(),this.ready(i),!1!==e.reportTouchActivity&&this.enableTouchActivity()}var t=l.prototype;return t.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var t=this.children_.length-1;0<=t;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),at(this.el_),this.el_=null),this.player_=null},t.player=function(){return this.player_},t.options=function(t){return g.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),t&&(this.options_=Nt(this.options_,t)),this.options_},t.el=function(){return this.el_},t.createEl=function(t,e,i){return A(t,e,i)},t.localize=function(t,r,e){void 0===e&&(e=t);var i=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[i],s=i&&i.split("-")[0],o=n&&n[s],u=e;return a&&a[t]?u=a[t]:o&&o[t]&&(u=o[t]),r&&(u=u.replace(/\{(\d+)\}/g,function(t,e){var i=r[e-1],n=i;return"undefined"==typeof i&&(n=t),n})),u},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(t){return this.childIndex_[t]},t.getChild=function(t){if(t)return t=Bt(t),this.childNameIndex_[t]},t.addChild=function(t,e,i){var n,r;if(void 0===e&&(e={}),void 0===i&&(i=this.children_.length),"string"==typeof t){r=Bt(t);var a=e.componentClass||r;e.name=r;var s=l.getComponent(a);if(!s)throw new Error("Component "+a+" does not exist");if("function"!=typeof s)return null;n=new s(this.player_||this,e)}else n=t;if(this.children_.splice(i,0,n),"function"==typeof n.id&&(this.childIndex_[n.id()]=n),(r=r||n.name&&Bt(n.name()))&&(this.childNameIndex_[r]=n),"function"==typeof n.el&&n.el()){var o=this.contentEl().children[i]||null;this.contentEl().insertBefore(n.el(),o)}return n},t.removeChild=function(t){if("string"==typeof t&&(t=this.getChild(t)),t&&this.children_){for(var e=!1,i=this.children_.length-1;0<=i;i--)if(this.children_[i]===t){e=!0,this.children_.splice(i,1);break}if(e){this.childIndex_[t.id()]=null,this.childNameIndex_[t.name()]=null;var n=t.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(t.el())}}},t.initChildren=function(){var r=this,n=this.options_.children;if(n){var t,a=this.options_,i=l.getComponent("Tech");(t=Array.isArray(n)?n:Object.keys(n)).concat(Object.keys(this.options_).filter(function(e){return!t.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(t){var e,i;return i="string"==typeof t?n[e=t]||r.options_[e]||{}:(e=t.name,t),{name:e,opts:i}}).filter(function(t){var e=l.getComponent(t.opts.componentClass||Bt(t.name));return e&&!i.isTech(e)}).forEach(function(t){var e=t.name,i=t.opts;if(void 0!==a[e]&&(i=a[e]),!1!==i){!0===i&&(i={}),i.playerOptions=r.options_.playerOptions;var n=r.addChild(e,i);n&&(r[e]=n)}})}},t.buildCSSClass=function(){return""},t.ready=function(t,e){if(void 0===e&&(e=!1),t)return this.isReady_?void(e?t.call(this):this.setTimeout(t,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(t))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var t=this.readyQueue_;this.readyQueue_=[],t&&0<t.length&&t.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)},t.$=function(t,e){return K(t,e||this.contentEl())},t.$$=function(t,e){return Q(t,e||this.contentEl())},t.hasClass=function(t){return P(this.el_,t)},t.addClass=function(t){U(this.el_,t)},t.removeClass=function(t){x(this.el_,t)},t.toggleClass=function(t,e){I(this.el_,t,e)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(t){return M(this.el_,t)},t.setAttribute=function(t,e){B(this.el_,t,e)},t.removeAttribute=function(t){N(this.el_,t)},t.width=function(t,e){return this.dimension("width",t,e)},t.height=function(t,e){return this.dimension("height",t,e)},t.dimensions=function(t,e){this.width(t,!0),this.height(e)},t.dimension=function(t,e,i){if(void 0!==e)return null!==e&&e==e||(e=0),-1!==(""+e).indexOf("%")||-1!==(""+e).indexOf("px")?this.el_.style[t]=e:this.el_.style[t]="auto"===e?"":e+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[t],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Bt(t)],10)},t.currentDimension=function(t){var e=0;if("width"!==t&&"height"!==t)throw new Error("currentDimension only accepts width or height value");if("function"==typeof v.getComputedStyle){var i=v.getComputedStyle(this.el_);e=i.getPropertyValue(t)||i[t]}if(0===(e=parseFloat(e))){var n="offset"+Bt(t);e=this.el_[n]}return e},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.emitTapEvents=function(){var n,e=0,r=null;this.on("touchstart",function(t){1===t.touches.length&&(r={pageX:t.touches[0].pageX,pageY:t.touches[0].pageY},e=(new Date).getTime(),n=!0)}),this.on("touchmove",function(t){if(1<t.touches.length)n=!1;else if(r){var e=t.touches[0].pageX-r.pageX,i=t.touches[0].pageY-r.pageY;10<Math.sqrt(e*e+i*i)&&(n=!1)}});var t=function(){n=!1};this.on("touchleave",t),this.on("touchcancel",t),this.on("touchend",function(t){!(r=null)===n&&((new Date).getTime()-e<200&&(t.preventDefault(),this.trigger("tap")))})},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,i=kt(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){i(),this.clearInterval(e),e=this.setInterval(i,250)});var t=function(t){i(),this.clearInterval(e)};this.on("touchmove",i),this.on("touchend",t),this.on("touchcancel",t)}},t.setTimeout=function(t,e){var i,n,r=this;return t=kt(this,t),i=v.setTimeout(function(){r.off("dispose",n),t()},e),(n=function(){return r.clearTimeout(i)}).guid="vjs-timeout-"+i,this.on("dispose",n),i},t.clearTimeout=function(t){v.clearTimeout(t);var e=function(){};return e.guid="vjs-timeout-"+t,this.off("dispose",e),t},t.setInterval=function(t,e){var i=this;t=kt(this,t);var n=v.setInterval(t,e),r=function(){return i.clearInterval(n)};return r.guid="vjs-interval-"+n,this.on("dispose",r),n},t.clearInterval=function(t){v.clearInterval(t);var e=function(){};return e.guid="vjs-interval-"+t,this.off("dispose",e),t},t.requestAnimationFrame=function(t){var e,i,n=this;return this.supportsRaf_?(t=kt(this,t),e=v.requestAnimationFrame(function(){n.off("dispose",i),t()}),(i=function(){return n.cancelAnimationFrame(e)}).guid="vjs-raf-"+e,this.on("dispose",i),e):this.setTimeout(t,1e3/60)},t.cancelAnimationFrame=function(t){if(this.supportsRaf_){v.cancelAnimationFrame(t);var e=function(){};return e.guid="vjs-raf-"+t,this.off("dispose",e),t}return this.clearTimeout(t)},l.registerComponent=function(t,e){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var i,n=l.getComponent("Tech"),r=n&&n.isTech(e),a=l===e||l.prototype.isPrototypeOf(e.prototype);if(r||!a)throw i=r?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+i+".");t=Bt(t),l.components_||(l.components_={});var s=l.getComponent("Player");if("Player"===t&&s&&s.players){var o=s.players,u=Object.keys(o);if(o&&0<u.length&&u.map(function(t){return o[t]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return l.components_[t]=e},l.getComponent=function(t){if(t)return t=Bt(t),l.components_&&l.components_[t]?l.components_[t]:void 0},l}();jt.prototype.supportsRaf_="function"==typeof v.requestAnimationFrame&&"function"==typeof v.cancelAnimationFrame,jt.registerComponent("Component",jt);var Ft,Vt,Ht,qt,zt=v.navigator&&v.navigator.userAgent||"",Wt=/AppleWebKit\/([\d.]+)/i.exec(zt),Gt=Wt?parseFloat(Wt.pop()):null,Xt=/iPad/i.test(zt),Yt=/iPhone/i.test(zt)&&!Xt,$t=/iPod/i.test(zt),Kt=Yt||Xt||$t,Qt=(Ft=zt.match(/OS (\d+)_/i))&&Ft[1]?Ft[1]:null,Jt=/Android/i.test(zt),Zt=function(){var t=zt.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;var e=t[1]&&parseFloat(t[1]),i=t[2]&&parseFloat(t[2]);return e&&i?parseFloat(t[1]+"."+t[2]):e||null}(),te=Jt&&Zt<5&&Gt<537,ee=/Firefox/i.test(zt),ie=/Edge/i.test(zt),ne=!ie&&(/Chrome/i.test(zt)||/CriOS/i.test(zt)),re=(Vt=zt.match(/(Chrome|CriOS)\/(\d+)/))&&Vt[2]?parseFloat(Vt[2]):null,ae=(Ht=/MSIE\s(\d+)\.\d/.exec(zt),!(qt=Ht&&parseFloat(Ht[1]))&&/Trident\/7.0/i.test(zt)&&/rv:11.0/.test(zt)&&(qt=11),qt),se=/Safari/i.test(zt)&&!ne&&!Jt&&!ie,oe=(se||Kt)&&!ne,ue=k()&&("ontouchstart"in v||v.navigator.maxTouchPoints||v.DocumentTouch&&v.document instanceof v.DocumentTouch),le=Object.freeze({IS_IPAD:Xt,IS_IPHONE:Yt,IS_IPOD:$t,IS_IOS:Kt,IOS_VERSION:Qt,IS_ANDROID:Jt,ANDROID_VERSION:Zt,IS_NATIVE_ANDROID:te,IS_FIREFOX:ee,IS_EDGE:ie,IS_CHROME:ne,CHROME_VERSION:re,IE_VERSION:ae,IS_SAFARI:se,IS_ANY_SAFARI:oe,TOUCH_ENABLED:ue});function ce(t,e,i,n){return function(t,e,i){if("number"!=typeof e||e<0||i<e)throw new Error("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+e+") is non-numeric or out of bounds (0-"+i+").")}(t,n,i.length-1),i[n][e]}function he(t){return void 0===t||0===t.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:t.length,start:ce.bind(null,"start",0,t),end:ce.bind(null,"end",1,t)}}function de(t,e){return Array.isArray(t)?he(t):void 0===t||void 0===e?he():he([[t,e]])}function pe(t,e){var i,n,r=0;if(!e)return 0;t&&t.length||(t=de(0,0));for(var a=0;a<t.length;a++)i=t.start(a),e<(n=t.end(a))&&(n=e),r+=n-i;return r/e}for(var fe,me={},ge=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],ye=ge[0],ve=0;ve<ge.length;ve++)if(ge[ve][1]in d){fe=ge[ve];break}if(fe)for(var _e=0;_e<fe.length;_e++)me[ye[_e]]=fe[_e];function be(t){if(t instanceof be)return t;"number"==typeof t?this.code=t:"string"==typeof t?this.message=t:l(t)&&("number"==typeof t.code&&(this.code=t.code),b(this,t)),this.message||(this.message=be.defaultMessages[this.code]||"")}be.prototype.code=0,be.prototype.message="",be.prototype.status=null,be.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],be.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var Te=0;Te<be.errorTypes.length;Te++)be[be.errorTypes[Te]]=Te,be.prototype[be.errorTypes[Te]]=Te;var Se=function(t,e){var i,n=null;try{i=JSON.parse(t,e)}catch(t){n=t}return[n,i]};function ke(t){return null!=t&&"function"==typeof t.then}function we(t){ke(t)&&t.then(null,function(t){})}var Ce=function(n){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,e,i){return n[e]&&(t[e]=n[e]),t},{cues:n.cues&&Array.prototype.map.call(n.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},Ee=function(t){var e=t.$$("track"),i=Array.prototype.map.call(e,function(t){return t.track});return Array.prototype.map.call(e,function(t){var e=Ce(t.track);return t.src&&(e.src=t.src),e}).concat(Array.prototype.filter.call(t.textTracks(),function(t){return-1===i.indexOf(t)}).map(Ce))},Ae=function(t,i){return t.forEach(function(t){var e=i.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(function(t){return e.addCue(t)})}),i.textTracks()},Le="vjs-modal-dialog",Oe=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).opened_=i.hasBeenOpened_=i.hasBeenFilled_=!1,i.closeable(!i.options_.uncloseable),i.content(i.options_.content),i.contentEl_=A("div",{className:Le+"-content"},{role:"document"}),i.descEl_=A("p",{className:Le+"-description vjs-control-text",id:i.el().getAttribute("aria-describedby")}),L(i.descEl_,i.description()),i.el_.appendChild(i.descEl_),i.el_.appendChild(i.contentEl_),i}f(t,n);var e=t.prototype;return e.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},e.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,n.prototype.dispose.call(this)},e.buildCSSClass=function(){return Le+" vjs-hidden "+n.prototype.buildCSSClass.call(this)},e.handleKeyPress=function(t){27===t.which&&this.closeable()&&this.close()},e.label=function(){return this.localize(this.options_.label||"Modal Window")},e.description=function(){var t=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(t+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),t},e.open=function(){if(!this.opened_){var t=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!t.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&t.pause(),this.closeable()&&this.on(this.el_.ownerDocument,"keydown",kt(this,this.handleKeyPress)),this.hadControls_=t.controls(),t.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},e.opened=function(t){return"boolean"==typeof t&&this[t?"open":"close"](),this.opened_},e.close=function(){if(this.opened_){var t=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&t.play(),this.closeable()&&this.off(this.el_.ownerDocument,"keydown",kt(this,this.handleKeyPress)),this.hadControls_&&t.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},e.closeable=function(t){if("boolean"==typeof t){var e=this.closeable_=!!t,i=this.getChild("closeButton");if(e&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close)}!e&&i&&(this.off(i,"close",this.close),this.removeChild(i),i.dispose())}return this.closeable_},e.fill=function(){this.fillWith(this.content())},e.fillWith=function(t){var e=this.contentEl(),i=e.parentNode,n=e.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(e),this.empty(),Y(e,t),this.trigger("modalfill"),n?i.insertBefore(e,n):i.appendChild(e);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},e.empty=function(){this.trigger("beforemodalempty"),W(this.contentEl()),this.trigger("modalempty")},e.content=function(t){return"undefined"!=typeof t&&(this.content_=t),this.content_},e.conditionalFocus_=function(){var t=d.activeElement,e=this.player_.el_;this.previouslyActiveEl_=null,(e.contains(t)||e===t)&&(this.previouslyActiveEl_=t,this.focus(),this.on(d,"keydown",this.handleKeyDown))},e.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null),this.off(d,"keydown",this.handleKeyDown)},e.handleKeyDown=function(t){if(9===t.which){for(var e,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){e=r;break}d.activeElement===this.el_&&(e=0),t.shiftKey&&0===e?(i[i.length-1].focus(),t.preventDefault()):t.shiftKey||e!==i.length-1||(i[0].focus(),t.preventDefault())}},e.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,function(t){return(t instanceof v.HTMLAnchorElement||t instanceof v.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof v.HTMLInputElement||t instanceof v.HTMLSelectElement||t instanceof v.HTMLTextAreaElement||t instanceof v.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof v.HTMLIFrameElement||t instanceof v.HTMLObjectElement||t instanceof v.HTMLEmbedElement||t.hasAttribute("tabindex")&&-1!==t.getAttribute("tabindex")||t.hasAttribute("contenteditable")})},t}(jt);Oe.prototype.options_={pauseOnOpen:!0,temporary:!0},jt.registerComponent("ModalDialog",Oe);var Pe=function(n){function t(t){var e;void 0===t&&(t=[]),(e=n.call(this)||this).tracks_=[],Object.defineProperty(m(m(e)),"length",{get:function(){return this.tracks_.length}});for(var i=0;i<t.length;i++)e.addTrack(t[i]);return e}f(t,n);var e=t.prototype;return e.addTrack=function(t){var e=this.tracks_.length;""+e in this||Object.defineProperty(this,e,{get:function(){return this.tracks_[e]}}),-1===this.tracks_.indexOf(t)&&(this.tracks_.push(t),this.trigger({track:t,type:"addtrack"}))},e.removeTrack=function(t){for(var e,i=0,n=this.length;i<n;i++)if(this[i]===t){(e=this[i]).off&&e.off(),this.tracks_.splice(i,1);break}e&&this.trigger({track:e,type:"removetrack"})},e.getTrackById=function(t){for(var e=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===t){e=r;break}}return e},t}(Ct);for(var Ue in Pe.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},Pe.prototype.allowedEvents_)Pe.prototype["on"+Ue]=null;var xe=function(t,e){for(var i=0;i<t.length;i++)Object.keys(t[i]).length&&e.id!==t[i].id&&(t[i].enabled=!1)},Ie=function(n){function t(t){var e;void 0===t&&(t=[]);for(var i=t.length-1;0<=i;i--)if(t[i].enabled){xe(t,t[i]);break}return(e=n.call(this,t)||this).changing_=!1,e}return f(t,n),t.prototype.addTrack=function(t){var e=this;t.enabled&&xe(this,t),n.prototype.addTrack.call(this,t),t.addEventListener&&t.addEventListener("enabledchange",function(){e.changing_||(e.changing_=!0,xe(e,t),e.changing_=!1,e.trigger("change"))})},t}(Pe),De=function(t,e){for(var i=0;i<t.length;i++)Object.keys(t[i]).length&&e.id!==t[i].id&&(t[i].selected=!1)},Re=function(n){function t(t){var e;void 0===t&&(t=[]);for(var i=t.length-1;0<=i;i--)if(t[i].selected){De(t,t[i]);break}return(e=n.call(this,t)||this).changing_=!1,Object.defineProperty(m(m(e)),"selectedIndex",{get:function(){for(var t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set:function(){}}),e}return f(t,n),t.prototype.addTrack=function(t){var e=this;t.selected&&De(this,t),n.prototype.addTrack.call(this,t),t.addEventListener&&t.addEventListener("selectedchange",function(){e.changing_||(e.changing_=!0,De(e,t),e.changing_=!1,e.trigger("change"))})},t}(Pe),Me=function(e){function t(){return e.apply(this,arguments)||this}return f(t,e),t.prototype.addTrack=function(t){e.prototype.addTrack.call(this,t),t.addEventListener("modechange",kt(this,function(){this.queueTrigger("change")}));-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",kt(this,function(){this.trigger("selectedlanguagechange")}))},t}(Pe),Be=function(){function t(t){void 0===t&&(t=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var e=0,i=t.length;e<i;e++)this.addTrackElement_(t[e])}var e=t.prototype;return e.addTrackElement_=function(t){var e=this.trackElements_.length;""+e in this||Object.defineProperty(this,e,{get:function(){return this.trackElements_[e]}}),-1===this.trackElements_.indexOf(t)&&this.trackElements_.push(t)},e.getTrackElementByTrack_=function(t){for(var e,i=0,n=this.trackElements_.length;i<n;i++)if(t===this.trackElements_[i].track){e=this.trackElements_[i];break}return e},e.removeTrackElement_=function(t){for(var e=0,i=this.trackElements_.length;e<i;e++)if(t===this.trackElements_[e]){this.trackElements_.splice(e,1);break}},t}(),Ne=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(t){var e=this.length||0,i=0,n=t.length;this.cues_=t,this.length_=t.length;var r=function(t){""+t in this||Object.defineProperty(this,""+t,{get:function(){return this.cues_[t]}})};if(e<n)for(i=e;i<n;i++)r.call(this,i)},t.getCueById=function(t){for(var e=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===t){e=r;break}}return e},e}(),je={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Fe={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Ve={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},He={disabled:"disabled",hidden:"hidden",showing:"showing"},qe=function(a){function t(t){var e;void 0===t&&(t={}),e=a.call(this)||this;var i={id:t.id||"vjs_track_"+tt(),kind:t.kind||"",label:t.label||"",language:t.language||""},n=function(t){Object.defineProperty(m(m(e)),t,{get:function(){return i[t]},set:function(){}})};for(var r in i)n(r);return e}return f(t,a),t}(Ct),ze=function(t){var e=["protocol","hostname","port","pathname","search","hash","host"],i=d.createElement("a");i.href=t;var n,r=""===i.host&&"file:"!==i.protocol;r&&((n=d.createElement("div")).innerHTML='<a href="'+t+'"></a>',i=n.firstChild,n.setAttribute("style","display:none; position:absolute;"),d.body.appendChild(n));for(var a={},s=0;s<e.length;s++)a[e[s]]=i[e[s]];return"http:"===a.protocol&&(a.host=a.host.replace(/:80$/,"")),"https:"===a.protocol&&(a.host=a.host.replace(/:443$/,"")),a.protocol||(a.protocol=v.location.protocol),r&&d.body.removeChild(n),a},We=function(t){if(!t.match(/^https?:\/\//)){var e=d.createElement("div");e.innerHTML='<a href="'+t+'">x</a>',t=e.firstChild.href}return t},Ge=function(t){if("string"==typeof t){var e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(t);if(e)return e.pop().toLowerCase()}return""},Xe=function(t){var e=v.location,i=ze(t);return(":"===i.protocol?e.protocol:i.protocol)+i.host!==e.protocol+e.host},Ye=Object.freeze({parseUrl:ze,getAbsoluteURL:We,getFileExtension:Ge,isCrossOrigin:Xe}),$e=function(t){var e=Ke.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)},Ke=Object.prototype.toString;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Qe(t,e){return t(e={exports:{}},e.exports),e.exports}var Je=Qe(function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}}),Ze=(Je.left,Je.right,Function.prototype.toString),ti=/^\s*class\b/,ei=function(t){try{var e=Ze.call(t);return ti.test(e)}catch(t){return!1}},ii=Object.prototype.toString,ni="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,ri=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;if(ni)return function(t){try{return!ei(t)&&(Ze.call(t),!0)}catch(t){return!1}}(t);if(ei(t))return!1;var e=ii.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e},ai=Object.prototype.toString,si=Object.prototype.hasOwnProperty,oi=function(t,e,i){if(!ri(e))throw new TypeError("iterator must be a function");var n;3<=arguments.length&&(n=i),"[object Array]"===ai.call(t)?function(t,e,i){for(var n=0,r=t.length;n<r;n++)si.call(t,n)&&(null==i?e(t[n],n,t):e.call(i,t[n],n,t))}(t,e,n):"string"==typeof t?function(t,e,i){for(var n=0,r=t.length;n<r;n++)null==i?e(t.charAt(n),n,t):e.call(i,t.charAt(n),n,t)}(t,e,n):function(t,e,i){for(var n in t)si.call(t,n)&&(null==i?e(t[n],n,t):e.call(i,t[n],n,t))}(t,e,n)},ui=function(t){if(!t)return{};var a={};return oi(Je(t).split("\n"),function(t){var e,i=t.indexOf(":"),n=Je(t.slice(0,i)).toLowerCase(),r=Je(t.slice(i+1));"undefined"==typeof a[n]?a[n]=r:(e=a[n],"[object Array]"===Object.prototype.toString.call(e)?a[n].push(r):a[n]=[a[n],r])}),a},li=function(){for(var t={},e=0;e<arguments.length;e++){var i=arguments[e];for(var n in i)ci.call(i,n)&&(t[n]=i[n])}return t},ci=Object.prototype.hasOwnProperty;var hi=pi;function di(t,e,i){var n=t;return $e(e)?(i=e,"string"==typeof t&&(n={uri:t})):n=li(e,{uri:t}),n.callback=i,n}function pi(t,e,i){return fi(e=di(t,e,i))}function fi(n){if("undefined"==typeof n.callback)throw new Error("callback argument missing");var r=!1,a=function(t,e,i){r||(r=!0,n.callback(t,e,i))};function e(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,a(t,m)}function t(){if(!s){var t;clearTimeout(u),t=n.useXDR&&void 0===o.status?200:1223===o.status?204:o.status;var e=m,i=null;return 0!==t?(e={body:function(){var t=void 0;if(t=o.response?o.response:o.responseText||function(t){if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}(o),f)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:t,method:c,headers:{},url:l,rawRequest:o},o.getAllResponseHeaders&&(e.headers=ui(o.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),a(i,e,e.body)}}var i,s,o=n.xhr||null;o||(o=n.cors||n.useXDR?new pi.XDomainRequest:new pi.XMLHttpRequest);var u,l=o.url=n.uri||n.url,c=o.method=n.method||"GET",h=n.body||n.data,d=o.headers=n.headers||{},p=!!n.sync,f=!1,m={body:void 0,headers:{},statusCode:0,method:c,url:l,rawRequest:o};if("json"in n&&!1!==n.json&&(f=!0,d.accept||d.Accept||(d.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(d["content-type"]||d["Content-Type"]||(d["Content-Type"]="application/json"),h=JSON.stringify(!0===n.json?h:n.json))),o.onreadystatechange=function(){4===o.readyState&&setTimeout(t,0)},o.onload=t,o.onerror=e,o.onprogress=function(){},o.onabort=function(){s=!0},o.ontimeout=e,o.open(c,l,!p,n.username,n.password),p||(o.withCredentials=!!n.withCredentials),!p&&0<n.timeout&&(u=setTimeout(function(){if(!s){s=!0,o.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",e(t)}},n.timeout)),o.setRequestHeader)for(i in d)d.hasOwnProperty(i)&&o.setRequestHeader(i,d[i]);else if(n.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(o.responseType=n.responseType),"beforeSend"in n&&"function"==typeof n.beforeSend&&n.beforeSend(o),o.send(h||null),o}pi.XMLHttpRequest=v.XMLHttpRequest||function(){},pi.XDomainRequest="withCredentials"in new pi.XMLHttpRequest?pi.XMLHttpRequest:v.XDomainRequest,function(t,e){for(var i=0;i<t.length;i++)e(t[i])}(["get","put","post","patch","head","delete"],function(n){pi["delete"===n?"del":n]=function(t,e,i){return(e=di(t,e,i)).method=n.toUpperCase(),fi(e)}});var mi=function(t,e){var i=new v.WebVTT.Parser(v,v.vttjs,v.WebVTT.StringDecoder()),n=[];i.oncue=function(t){e.addCue(t)},i.onparsingerror=function(t){n.push(t)},i.onflush=function(){e.trigger({type:"loadeddata",target:e})},i.parse(t),0<n.length&&(v.console&&v.console.groupCollapsed&&v.console.groupCollapsed("Text Track parsing errors for "+e.src),n.forEach(function(t){return g.error(t)}),v.console&&v.console.groupEnd&&v.console.groupEnd()),i.flush()},gi=function(l){function t(t){var e;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var i=Nt(t,{kind:Ve[t.kind]||"subtitles",language:t.language||t.srclang||""}),n=He[i.mode]||"disabled",r=i.default;"metadata"!==i.kind&&"chapters"!==i.kind||(n="hidden"),(e=l.call(this,i)||this).tech_=i.tech,e.cues_=[],e.activeCues_=[];var a=new Ne(e.cues_),s=new Ne(e.activeCues_),o=!1,u=kt(m(m(e)),function(){this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1)});return"disabled"!==n&&e.tech_.ready(function(){e.tech_.on("timeupdate",u)},!0),Object.defineProperties(m(m(e)),{default:{get:function(){return r},set:function(){}},mode:{get:function(){return n},set:function(t){var e=this;He[t]&&("disabled"!==(n=t)?this.tech_.ready(function(){e.tech_.on("timeupdate",u)},!0):this.tech_.off("timeupdate",u),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?a:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return s;for(var t=this.tech_.currentTime(),e=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];r.startTime<=t&&r.endTime>=t?e.push(r):r.startTime===r.endTime&&r.startTime<=t&&r.startTime+.5>=t&&e.push(r)}if(o=!1,e.length!==this.activeCues_.length)o=!0;else for(var a=0;a<e.length;a++)-1===this.activeCues_.indexOf(e[a])&&(o=!0);return this.activeCues_=e,s.setCues_(this.activeCues_),s},set:function(){}}}),i.src?(e.src=i.src,function(t,r){var e={uri:t},i=Xe(t);i&&(e.cors=i),hi(e,kt(this,function(t,e,i){if(t)return g.error(t,e);if(r.loaded_=!0,"function"!=typeof v.WebVTT){if(r.tech_){var n=function(){return mi(i,r)};r.tech_.on("vttjsloaded",n),r.tech_.on("vttjserror",function(){g.error("vttjs failed to load, stopping trying to process "+r.src),r.tech_.off("vttjsloaded",n)})}}else mi(i,r)}))}(i.src,m(m(e)))):e.loaded_=!0,e}f(t,l);var e=t.prototype;return e.addCue=function(t){var e=t;if(v.vttjs&&!(t instanceof v.vttjs.VTTCue)){for(var i in e=new v.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)i in e||(e[i]=t[i]);e.id=t.id,e.originalCue_=t}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(e);this.cues_.push(e),this.cues.setCues_(this.cues_)},e.removeCue=function(t){for(var e=this.cues_.length;e--;){var i=this.cues_[e];if(i===t||i.originalCue_&&i.originalCue_===t){this.cues_.splice(e,1),this.cues.setCues_(this.cues_);break}}},t}(qe);gi.prototype.allowedEvents_={cuechange:"cuechange"};var yi=function(r){function t(t){var e;void 0===t&&(t={});var i=Nt(t,{kind:Fe[t.kind]||""});e=r.call(this,i)||this;var n=!1;return Object.defineProperty(m(m(e)),"enabled",{get:function(){return n},set:function(t){"boolean"==typeof t&&t!==n&&(n=t,this.trigger("enabledchange"))}}),i.enabled&&(e.enabled=i.enabled),e.loaded_=!0,e}return f(t,r),t}(qe),vi=function(r){function t(t){var e;void 0===t&&(t={});var i=Nt(t,{kind:je[t.kind]||""});e=r.call(this,i)||this;var n=!1;return Object.defineProperty(m(m(e)),"selected",{get:function(){return n},set:function(t){"boolean"==typeof t&&t!==n&&(n=t,this.trigger("selectedchange"))}}),i.selected&&(e.selected=i.selected),e}return f(t,r),t}(qe),_i=function(r){function t(t){var e,i;void 0===t&&(t={}),e=r.call(this)||this;var n=new gi(t);return e.kind=n.kind,e.src=n.src,e.srclang=n.language,e.label=n.label,e.default=n.default,Object.defineProperties(m(m(e)),{readyState:{get:function(){return i}},track:{get:function(){return n}}}),i=0,n.addEventListener("loadeddata",function(){i=2,e.trigger({type:"load",target:m(m(e))})}),e}return f(t,r),t}(Ct);_i.prototype.allowedEvents_={load:"load"},_i.NONE=0,_i.LOADING=1,_i.LOADED=2,_i.ERROR=3;var bi={audio:{ListClass:Ie,TrackClass:yi,capitalName:"Audio"},video:{ListClass:Re,TrackClass:vi,capitalName:"Video"},text:{ListClass:Me,TrackClass:gi,capitalName:"Text"}};Object.keys(bi).forEach(function(t){bi[t].getterName=t+"Tracks",bi[t].privateName=t+"Tracks_"});var Ti={remoteText:{ListClass:Me,TrackClass:gi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Be,TrackClass:_i,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Si=Nt(bi,Ti);Ti.names=Object.keys(Ti),bi.names=Object.keys(bi),Si.names=[].concat(Ti.names).concat(bi.names);var ki=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function wi(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}function Ci(t){function e(t,e,i,n){return 3600*(0|t)+60*(0|e)+(0|i)+(0|n)/1e3}var i=t.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return i?i[3]?e(i[1],i[2],i[3].replace(":",""),i[4]):59<i[1]?e(i[1],i[2],0,i[4]):e(0,i[1],i[2],i[4]):null}function Ei(){this.values=ki(null)}function Ai(t,e,i,n){var r=n?t.split(n):[t];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);if(2===s.length)e(s[0],s[1])}}function Li(e,t,a){var i,n,s,r=e;function o(){var t=Ci(e);if(null===t)throw new wi(wi.Errors.BadTimeStamp,"Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function u(){e=e.replace(/^\s+/,"")}if(u(),t.startTime=o(),u(),"--\x3e"!==e.substr(0,3))throw new wi(wi.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);e=e.substr(3),u(),t.endTime=o(),u(),i=e,n=t,s=new Ei,Ai(i,function(t,e){switch(t){case"region":for(var i=a.length-1;0<=i;i--)if(a[i].id===e){s.set(t,a[i].region);break}break;case"vertical":s.alt(t,e,["rl","lr"]);break;case"line":var n=e.split(","),r=n[0];s.integer(t,r),s.percent(t,r)&&s.set("snapToLines",!1),s.alt(t,r,["auto"]),2===n.length&&s.alt("lineAlign",n[1],["start","middle","end"]);break;case"position":n=e.split(","),s.percent(t,n[0]),2===n.length&&s.alt("positionAlign",n[1],["start","middle","end"]);break;case"size":s.percent(t,e);break;case"align":s.alt(t,e,["start","middle","end","left","right"])}},/:/,/\s/),n.region=s.get("region",null),n.vertical=s.get("vertical",""),n.line=s.get("line","auto"),n.lineAlign=s.get("lineAlign","start"),n.snapToLines=s.get("snapToLines",!0),n.size=s.get("size",100),n.align=s.get("align","middle"),n.position=s.get("position",{start:0,left:0,middle:50,end:100,right:100},n.align),n.positionAlign=s.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},n.align)}((wi.prototype=ki(Error.prototype)).constructor=wi).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Ei.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,i){return i?this.has(t)?this.values[t]:e[i]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,i){for(var n=0;n<i.length;++n)if(e===i[n]){this.set(t,e);break}},integer:function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},percent:function(t,e){return!!(e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(e=parseFloat(e))&&e<=100)&&(this.set(t,e),!0)}};var Oi={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},Pi={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Ui={v:"title",lang:"lang"},xi={rt:"ruby"};function Ii(a,i){function t(){if(!i)return null;var t,e=i.match(/^([^<]*)(<[^>]*>?)?/);return t=e[1]?e[1]:e[2],i=i.substr(t.length),t}function e(t){return Oi[t]}function n(t){for(;f=t.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)t=t.replace(f[0],e);return t}function r(t,e){var i=Pi[t];if(!i)return null;var n=a.document.createElement(i);n.localName=i;var r=Ui[t];return r&&e&&(n[r]=e.trim()),n}for(var s,o,u,l=a.document.createElement("div"),c=l,h=[];null!==(s=t());)if("<"!==s[0])c.appendChild(a.document.createTextNode(n(s)));else{if("/"===s[1]){h.length&&h[h.length-1]===s.substr(2).replace(">","")&&(h.pop(),c=c.parentNode);continue}var d,p=Ci(s.substr(1,s.length-2));if(p){d=a.document.createProcessingInstruction("timestamp",p),c.appendChild(d);continue}var f=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!f)continue;if(!(d=r(f[1],f[3])))continue;if(o=c,xi[(u=d).localName]&&xi[u.localName]!==o.localName)continue;f[2]&&(d.className=f[2].substr(1).replace("."," ")),h.push(f[1]),c.appendChild(d),c=d}return l}var Di=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Ri(t){for(var e=0;e<Di.length;e++){var i=Di[e];if(t>=i[0]&&t<=i[1])return!0}return!1}function Mi(){}function Bi(t,e,i){Mi.call(this),this.cue=e,this.cueDiv=Ii(t,e.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===e.vertical?"horizontal-tb":"lr"===e.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=t.document.createElement("div"),n={direction:function(t){var e=[],i="";if(!t||!t.childNodes)return"ltr";function r(t,e){for(var i=e.childNodes.length-1;0<=i;i--)t.push(e.childNodes[i])}function a(t){if(!t||!t.length)return null;var e=t.pop(),i=e.textContent||e.innerText;if(i){var n=i.match(/^.*(\n|\r)/);return n?n[t.length=0]:i}return"ruby"===e.tagName?a(t):e.childNodes?(r(t,e),a(t)):void 0}for(r(e,t);i=a(e);)for(var n=0;n<i.length;n++)if(Ri(i.charCodeAt(n)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===e.vertical?"horizontal-tb":"lr"===e.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===e.align?"center":e.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(e.positionAlign){case"start":r=e.position;break;case"middle":r=e.position-e.size/2;break;case"end":r=e.position-e.size}""===e.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(t){this.applyStyles({top:this.formatStyle(t.top,"px"),bottom:this.formatStyle(t.bottom,"px"),left:this.formatStyle(t.left,"px"),right:this.formatStyle(t.right,"px"),height:this.formatStyle(t.height,"px"),width:this.formatStyle(t.width,"px")})}}function Ni(t){var e,i,n,r;if(t.div){i=t.div.offsetHeight,n=t.div.offsetWidth,r=t.div.offsetTop;var a=(a=t.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();t=t.div.getBoundingClientRect(),e=a?Math.max(a[0]&&a[0].height||0,t.height/a.length):0}this.left=t.left,this.right=t.right,this.top=t.top||r,this.height=t.height||i,this.bottom=t.bottom||r+(t.height||i),this.width=t.width||n,this.lineHeight=void 0!==e?e:t.lineHeight}function ji(t,e,o,u){var i=new Ni(e),n=e.cue,r=function(t){if("number"==typeof t.line&&(t.snapToLines||0<=t.line&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;for(var e=t.track,i=e.textTrackList,n=0,r=0;r<i.length&&i[r]!==e;r++)"showing"===i[r].mode&&n++;return-1*++n}(n),a=[];if(n.snapToLines){var s;switch(n.vertical){case"":a=["+y","-y"],s="height";break;case"rl":a=["+x","-x"],s="width";break;case"lr":a=["-x","+x"],s="width"}var l=i.lineHeight,c=l*Math.round(r),h=o[s]+l,d=a[0];Math.abs(c)>h&&(c=c<0?-1:1,c*=Math.ceil(h/l)*l),r<0&&(c+=""===n.vertical?o.height:o.width,a=a.reverse()),i.move(d,c)}else{var p=i.lineHeight/o.height*100;switch(n.lineAlign){case"middle":r-=p/2;break;case"end":r-=p}switch(n.vertical){case"":e.applyStyles({top:e.formatStyle(r,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(r,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(r,"%")})}a=["+y","-x","+x","-y"],i=new Ni(e)}var f=function(t,e){for(var i,n=new Ni(t),r=1,a=0;a<e.length;a++){for(;t.overlapsOppositeAxis(o,e[a])||t.within(o)&&t.overlapsAny(u);)t.move(e[a]);if(t.within(o))return t;var s=t.intersectPercentage(o);s<r&&(i=new Ni(t),r=s),t=new Ni(n)}return i||n}(i,a);e.move(f.toCSSCompatValues(o))}function Fi(){}Mi.prototype.applyStyles=function(t,e){for(var i in e=e||this.div,t)t.hasOwnProperty(i)&&(e.style[i]=t[i])},Mi.prototype.formatStyle=function(t,e){return 0===t?0:t+e},(Bi.prototype=ki(Mi.prototype)).constructor=Bi,Ni.prototype.move=function(t,e){switch(e=void 0!==e?e:this.lineHeight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e}},Ni.prototype.overlaps=function(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top},Ni.prototype.overlapsAny=function(t){for(var e=0;e<t.length;e++)if(this.overlaps(t[e]))return!0;return!1},Ni.prototype.within=function(t){return this.top>=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right},Ni.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.left<t.left;case"-x":return this.right>t.right;case"+y":return this.top<t.top;case"-y":return this.bottom>t.bottom}},Ni.prototype.intersectPercentage=function(t){return Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left))*Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top))/(this.height*this.width)},Ni.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}},Ni.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,i=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,n=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;return{left:(t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t).left,right:t.right,top:t.top||n,height:t.height||e,bottom:t.bottom||n+(t.height||e),width:t.width||i}},Fi.StringDecoder=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}},Fi.convertCueToDOMTree=function(t,e){return t&&e?Ii(t,e):null};Fi.processCues=function(n,r,t){if(!n||!r||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var a=n.document.createElement("div");if(a.style.position="absolute",a.style.left="0",a.style.right="0",a.style.top="0",a.style.bottom="0",a.style.margin="1.5%",t.appendChild(a),function(t){for(var e=0;e<t.length;e++)if(t[e].hasBeenReset||!t[e].displayState)return!0;return!1}(r)){var s=[],o=Ni.getSimpleBoxPosition(a),u={font:Math.round(.05*o.height*100)/100+"px sans-serif"};!function(){for(var t,e,i=0;i<r.length;i++)e=r[i],t=new Bi(n,e,u),a.appendChild(t.div),ji(0,t,o,s),e.displayState=t.div,s.push(Ni.getSimpleBoxPosition(t))}()}else for(var e=0;e<r.length;e++)a.appendChild(r[e].displayState)},(Fi.Parser=function(t,e,i){i||(i=e,e={}),e||(e={}),this.window=t,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]}).prototype={reportOrThrowError:function(t){if(!(t instanceof wi))throw t;this.onparsingerror&&this.onparsingerror(t)},parse:function(t){var a=this;function e(){for(var t=a.buffer,e=0;e<t.length&&"\r"!==t[e]&&"\n"!==t[e];)++e;var i=t.substr(0,e);return"\r"===t[e]&&++e,"\n"===t[e]&&++e,a.buffer=t.substr(e),i}function i(t){t.match(/X-TIMESTAMP-MAP/)?Ai(t,function(t,e){switch(t){case"X-TIMESTAMP-MAP":i=e,n=new Ei,Ai(i,function(t,e){switch(t){case"MPEGT":n.integer(t+"S",e);break;case"LOCA":n.set(t+"L",Ci(e))}},/[^\d]:/,/,/),a.ontimestampmap&&a.ontimestampmap({MPEGTS:n.get("MPEGTS"),LOCAL:n.get("LOCAL")})}var i,n},/=/):Ai(t,function(t,e){switch(t){case"Region":!function(t){var r=new Ei;if(Ai(t,function(t,e){switch(t){case"id":r.set(t,e);break;case"width":r.percent(t,e);break;case"lines":r.integer(t,e);break;case"regionanchor":case"viewportanchor":var i=e.split(",");if(2!==i.length)break;var n=new Ei;if(n.percent("x",i[0]),n.percent("y",i[1]),!n.has("x")||!n.has("y"))break;r.set(t+"X",n.get("x")),r.set(t+"Y",n.get("y"));break;case"scroll":r.alt(t,e,["up"])}},/=/,/\s/),r.has("id")){var e=new(a.vttjs.VTTRegion||a.window.VTTRegion);e.width=r.get("width",100),e.lines=r.get("lines",3),e.regionAnchorX=r.get("regionanchorX",0),e.regionAnchorY=r.get("regionanchorY",100),e.viewportAnchorX=r.get("viewportanchorX",0),e.viewportAnchorY=r.get("viewportanchorY",100),e.scroll=r.get("scroll",""),a.onregion&&a.onregion(e),a.regionList.push({id:r.get("id"),region:e})}}(e)}},/:/)}t&&(a.buffer+=a.decoder.decode(t,{stream:!0}));try{var n;if("INITIAL"===a.state){if(!/\r\n|\n/.test(a.buffer))return this;var r=(n=e()).match(/^WEBVTT([ \t].*)?$/);if(!r||!r[0])throw new wi(wi.Errors.BadSignature);a.state="HEADER"}for(var s=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;switch(s?s=!1:n=e(),a.state){case"HEADER":/:/.test(n)?i(n):n||(a.state="ID");continue;case"NOTE":n||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){a.state="NOTE";break}if(!n)continue;if(a.cue=new(a.vttjs.VTTCue||a.window.VTTCue)(0,0,""),a.state="CUE",-1===n.indexOf("--\x3e")){a.cue.id=n;continue}case"CUE":try{Li(n,a.cue,a.regionList)}catch(t){a.reportOrThrowError(t),a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":var o=-1!==n.indexOf("--\x3e");if(!n||o&&(s=!0)){a.oncue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}a.cue.text&&(a.cue.text+="\n"),a.cue.text+=n;continue;case"BADCUE":n||(a.state="ID");continue}}}catch(t){a.reportOrThrowError(t),"CUETEXT"===a.state&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state="INITIAL"===a.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new wi(wi.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var Vi=Fi,Hi={"":1,lr:1,rl:1},qi={start:1,middle:1,end:1,left:1,right:1};function zi(t){return"string"==typeof t&&(!!qi[t.toLowerCase()]&&t.toLowerCase())}function Wi(t,e,i){this.hasBeenReset=!1;var n="",r=!1,a=t,s=e,o=i,u=null,l="",c=!0,h="auto",d="start",p=50,f="middle",m=50,g="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(t){n=""+t}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(t){r=!!t}},startTime:{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");a=t,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");s=t,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(t){o=""+t,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(t){u=t,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(t){var e,i="string"==typeof(e=t)&&!!Hi[e.toLowerCase()]&&e.toLowerCase();if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");l=i,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(t){c=!!t,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");h=t,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return d},set:function(t){var e=zi(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");d=e,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return p},set:function(t){if(t<0||100<t)throw new Error("Position must be between 0 and 100.");p=t,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(t){var e=zi(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");f=e,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return m},set:function(t){if(t<0||100<t)throw new Error("Size must be between 0 and 100.");m=t,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(t){var e=zi(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");g=e,this.hasBeenReset=!0}}}),this.displayState=void 0}Wi.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Gi=Wi,Xi={"":!0,up:!0};function Yi(t){return"number"==typeof t&&0<=t&&t<=100}var $i=function(){var e=100,i=3,n=0,r=100,a=0,s=100,o="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Yi(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return i},set:function(t){if("number"!=typeof t)throw new TypeError("Lines must be set to a number.");i=t}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(t){if(!Yi(t))throw new Error("RegionAnchorX must be between 0 and 100.");r=t}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(t){if(!Yi(t))throw new Error("RegionAnchorY must be between 0 and 100.");n=t}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(t){if(!Yi(t))throw new Error("ViewportAnchorY must be between 0 and 100.");s=t}},viewportAnchorX:{enumerable:!0,get:function(){return a},set:function(t){if(!Yi(t))throw new Error("ViewportAnchorX must be between 0 and 100.");a=t}},scroll:{enumerable:!0,get:function(){return o},set:function(t){var e,i="string"==typeof(e=t)&&!!Xi[e.toLowerCase()]&&e.toLowerCase();if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");o=i}}})},Ki=Qe(function(t){var e=t.exports={WebVTT:Vi,VTTCue:Gi,VTTRegion:$i};v.vttjs=e,v.WebVTT=e.WebVTT;var i=e.VTTCue,n=e.VTTRegion,r=v.VTTCue,a=v.VTTRegion;e.shim=function(){v.VTTCue=i,v.VTTRegion=n},e.restore=function(){v.VTTCue=r,v.VTTRegion=a},v.VTTCue||e.shim()});Ki.WebVTT,Ki.VTTCue,Ki.VTTRegion;var Qi=function(e){function i(i,t){var n;return void 0===i&&(i={}),void 0===t&&(t=function(){}),i.reportTouchActivity=!1,(n=e.call(this,null,i,t)||this).hasStarted_=!1,n.on("playing",function(){this.hasStarted_=!0}),n.on("loadstart",function(){this.hasStarted_=!1}),Si.names.forEach(function(t){var e=Si[t];i&&i[e.getterName]&&(n[e.privateName]=i[e.getterName])}),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===i["native"+t+"Tracks"]&&(n["featuresNative"+t+"Tracks"]=!1)}),!1===i.nativeCaptions||!1===i.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==i.nativeCaptions&&!0!==i.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.autoRemoteTextTracks_=new Si.text.ListClass,n.initTrackListeners(),i.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}f(i,e);var t=i.prototype;return t.triggerSourceset=function(t){var e=this;this.isReady_||this.one("ready",function(){return e.setTimeout(function(){return e.triggerSourceset(t)},1)}),this.trigger({src:t,type:"sourceset"})},t.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},t.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},t.trackProgress=function(t){this.stopTrackingProgress(),this.progressInterval=this.setInterval(kt(this,function(){var t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),1===(this.bufferedPercent_=t)&&this.stopTrackingProgress()}),500)},t.onDurationChange=function(t){this.duration_=this.duration()},t.buffered=function(){return de(0,0)},t.bufferedPercent=function(){return pe(this.buffered(),this.duration_)},t.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},t.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},t.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},t.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},t.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},t.dispose=function(){this.clearTracks(bi.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),e.prototype.dispose.call(this)},t.clearTracks=function(t){var r=this;(t=[].concat(t)).forEach(function(t){for(var e=r[t+"Tracks"]()||[],i=e.length;i--;){var n=e[i];"text"===t&&r.removeRemoteTextTrack(n),e.removeTrack(n)}})},t.cleanupAutoTextTracks=function(){for(var t=this.autoRemoteTextTracks_||[],e=t.length;e--;){var i=t[e];this.removeRemoteTextTrack(i)}},t.reset=function(){},t.error=function(t){return void 0!==t&&(this.error_=new be(t),this.trigger("error")),this.error_},t.played=function(){return this.hasStarted_?de(0,0):de()},t.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},t.initTrackListeners=function(){var r=this;bi.names.forEach(function(t){var e=bi[t],i=function(){r.trigger(t+"trackchange")},n=r[e.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),r.on("dispose",function(){n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)})})},t.addWebVttScript_=function(){var t=this;if(!v.WebVTT)if(d.body.contains(this.el())){if(!this.options_["vtt.js"]&&c(Ki)&&0<Object.keys(Ki).length)return void this.trigger("vttjsloaded");var e=d.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=function(){t.trigger("vttjsloaded")},e.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){e.onload=null,e.onerror=null}),v.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)},t.emulateTextTracks=function(){var t=this,i=this.textTracks(),e=this.remoteTextTracks(),n=function(t){return i.addTrack(t.track)},r=function(t){return i.removeTrack(t.track)};e.on("addtrack",n),e.on("removetrack",r),this.addWebVttScript_();var a=function(){return t.trigger("texttrackchange")},s=function(){a();for(var t=0;t<i.length;t++){var e=i[t];e.removeEventListener("cuechange",a),"showing"===e.mode&&e.addEventListener("cuechange",a)}};s(),i.addEventListener("change",s),i.addEventListener("addtrack",s),i.addEventListener("removetrack",s),this.on("dispose",function(){e.off("addtrack",n),e.off("removetrack",r),i.removeEventListener("change",s),i.removeEventListener("addtrack",s),i.removeEventListener("removetrack",s);for(var t=0;t<i.length;t++){i[t].removeEventListener("cuechange",a)}})},t.addTextTrack=function(t,e,i){if(!t)throw new Error("TextTrack kind is required but was not provided");return function(t,e,i,n,r){void 0===r&&(r={});var a=t.textTracks();r.kind=e,i&&(r.label=i),n&&(r.language=n),r.tech=t;var s=new Si.text.TrackClass(r);return a.addTrack(s),s}(this,t,e,i)},t.createRemoteTextTrack=function(t){var e=Nt(t,{tech:this});return new Ti.remoteTextEl.TrackClass(e)},t.addRemoteTextTrack=function(t,e){var i=this;void 0===t&&(t={});var n=this.createRemoteTextTrack(t);return!0!==e&&!1!==e&&(g.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),e=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==e&&this.ready(function(){return i.autoRemoteTextTracks_.addTrack(n.track)}),n},t.removeRemoteTextTrack=function(t){var e=this.remoteTextTrackEls().getTrackElementByTrack_(t);this.remoteTextTrackEls().removeTrackElement_(e),this.remoteTextTracks().removeTrack(t),this.autoRemoteTextTracks_.removeTrack(t)},t.getVideoPlaybackQuality=function(){return{}},t.setPoster=function(){},t.playsinline=function(){},t.setPlaysinline=function(){},t.overrideNativeAudioTracks=function(){},t.overrideNativeVideoTracks=function(){},t.canPlayType=function(){return""},i.canPlayType=function(){return""},i.canPlaySource=function(t,e){return i.canPlayType(t.type)},i.isTech=function(t){return t.prototype instanceof i||t instanceof i||t===i},i.registerTech=function(t,e){if(i.techs_||(i.techs_={}),!i.isTech(e))throw new Error("Tech "+t+" must be a Tech");if(!i.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!i.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=Bt(t),i.techs_[t]=e,"Tech"!==t&&i.defaultTechOrder_.push(t),e},i.getTech=function(t){if(t)return t=Bt(t),i.techs_&&i.techs_[t]?i.techs_[t]:v&&v.videojs&&v.videojs[t]?(g.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),v.videojs[t]):void 0},i}(jt);Si.names.forEach(function(t){var e=Si[t];Qi.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}}),Qi.prototype.featuresVolumeControl=!0,Qi.prototype.featuresMuteControl=!0,Qi.prototype.featuresFullscreenResize=!1,Qi.prototype.featuresPlaybackRate=!1,Qi.prototype.featuresProgressEvents=!1,Qi.prototype.featuresSourceset=!1,Qi.prototype.featuresTimeupdateEvents=!1,Qi.prototype.featuresNativeTextTracks=!1,Qi.withSourceHandlers=function(r){r.registerSourceHandler=function(t,e){var i=r.sourceHandlers;i||(i=r.sourceHandlers=[]),void 0===e&&(e=i.length),i.splice(e,0,t)},r.canPlayType=function(t){for(var e,i=r.sourceHandlers||[],n=0;n<i.length;n++)if(e=i[n].canPlayType(t))return e;return""},r.selectSourceHandler=function(t,e){for(var i=r.sourceHandlers||[],n=0;n<i.length;n++)if(i[n].canHandleSource(t,e))return i[n];return null},r.canPlaySource=function(t,e){var i=r.selectSourceHandler(t,e);return i?i.canHandleSource(t,e):""};["seekable","seeking","duration"].forEach(function(t){var e=this[t];"function"==typeof e&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):e.apply(this,arguments)})},r.prototype),r.prototype.setSource=function(t){var e=r.selectSourceHandler(t,this.options_);e||(r.nativeSourceHandler?e=r.nativeSourceHandler:g.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),e!==r.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=e.handleSource(t,this,this.options_),this.on("dispose",this.disposeSourceHandler)},r.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},jt.registerComponent("Tech",Qi),Qi.registerTech("Tech",Qi),Qi.defaultTechOrder_=[];var Ji={},Zi={},tn={};function en(t,e,i){t.setTimeout(function(){return function i(n,t,r,a,s,o){void 0===n&&(n={});void 0===t&&(t=[]);void 0===s&&(s=[]);void 0===o&&(o=!1);var e=t,u=e[0],l=e.slice(1);if("string"==typeof u)i(n,Ji[u],r,a,s,o);else if(u){var c=un(a,u);if(!c.setSource)return s.push(c),i(n,l,r,a,s,o);c.setSource(b({},n),function(t,e){if(t)return i(n,l,r,a,s,o);s.push(c),i(e,n.type===e.type?l:Ji[e.type],r,a,s,o)})}else l.length?i(n,l,r,a,s,o):o?r(n,s):i(n,Ji["*"],r,a,s,!0)}(e,Ji[e.type],i,t)},1)}function nn(t,e,i,n){void 0===n&&(n=null);var r="call"+Bt(i),a=t.reduce(on(r),n),s=a===tn,o=s?null:e[i](a);return function(t,e,i,n){for(var r=t.length-1;0<=r;r--){var a=t[r];a[e]&&a[e](n,i)}}(t,i,o,s),o}var rn={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1},an={setCurrentTime:1},sn={play:1,pause:1};function on(i){return function(t,e){return t===tn?tn:e[i]?e[i](t):t}}function un(t,e){var i=Zi[t.id()],n=null;if(null==i)return n=e(t),Zi[t.id()]=[[e,n]],n;for(var r=0;r<i.length;r++){var a=i[r],s=a[0],o=a[1];s===e&&(n=o)}return null===n&&(n=e(t),i.push([e,n])),n}var ln={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",mp3:"audio/mpeg",aac:"audio/aac",oga:"audio/ogg",m3u8:"application/x-mpegURL"},cn=function(t){void 0===t&&(t="");var e=Ge(t);return ln[e.toLowerCase()]||""};function hn(t){var e=cn(t.src);return!t.type&&e&&(t.type=e),t}var dn=function(l){function t(t,e,i){var n,r=Nt({createEl:!1},e);if(n=l.call(this,t,r,i)||this,e.playerOptions.sources&&0!==e.playerOptions.sources.length)t.src(e.playerOptions.sources);else for(var a=0,s=e.playerOptions.techOrder;a<s.length;a++){var o=Bt(s[a]),u=Qi.getTech(o);if(o||(u=jt.getComponent(o)),u&&u.isSupported()){t.loadTech_(o);break}}return n}return f(t,l),t}(jt);jt.registerComponent("MediaLoader",dn);var pn=function(r){function t(t,e){var i;return(i=r.call(this,t,e)||this).emitTapEvents(),i.enable(),i}f(t,r);var e=t.prototype;return e.createEl=function(t,e,i){void 0===t&&(t="div"),void 0===e&&(e={}),void 0===i&&(i={}),e=b({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},e),"button"===t&&g.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),i=b({role:"button"},i),this.tabIndex_=e.tabIndex;var n=r.prototype.createEl.call(this,t,e,i);return this.createControlTextEl(n),n},e.dispose=function(){this.controlTextEl_=null,r.prototype.dispose.call(this)},e.createControlTextEl=function(t){return this.controlTextEl_=A("span",{className:"vjs-control-text"},{"aria-live":"polite"}),t&&t.appendChild(this.controlTextEl_),this.controlText(this.controlText_,t),this.controlTextEl_},e.controlText=function(t,e){if(void 0===e&&(e=this.el()),void 0===t)return this.controlText_||"Need Text";var i=this.localize(t);this.controlText_=t,L(this.controlTextEl_,i),this.nonIconControl||e.setAttribute("title",i)},e.buildCSSClass=function(){return"vjs-control vjs-button "+r.prototype.buildCSSClass.call(this)},e.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur))},e.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur)},e.handleClick=function(t){},e.handleFocus=function(t){ht(d,"keydown",kt(this,this.handleKeyPress))},e.handleKeyPress=function(t){32===t.which||13===t.which?(t.preventDefault(),this.trigger("click")):r.prototype.handleKeyPress&&r.prototype.handleKeyPress.call(this,t)},e.handleBlur=function(t){dt(d,"keydown",kt(this,this.handleKeyPress))},t}(jt);jt.registerComponent("ClickableComponent",pn);var fn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).update(),t.on("posterchange",kt(m(m(i)),i.update)),i}f(t,n);var e=t.prototype;return e.dispose=function(){this.player().off("posterchange",this.update),n.prototype.dispose.call(this)},e.createEl=function(){return A("div",{className:"vjs-poster",tabIndex:-1})},e.update=function(t){var e=this.player().poster();this.setSrc(e),e?this.show():this.hide()},e.setSrc=function(t){var e="";t&&(e='url("'+t+'")'),this.el_.style.backgroundImage=e},e.handleClick=function(t){this.player_.controls()&&(this.player_.paused()?we(this.player_.play()):this.player_.pause())},t}(pn);jt.registerComponent("PosterImage",fn);var mn="#222",gn={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function yn(t,e){var i;if(4===t.length)i=t[1]+t[1]+t[2]+t[2]+t[3]+t[3];else{if(7!==t.length)throw new Error("Invalid color code provided, "+t+"; must be formatted as e.g. #f0e or #f604e2.");i=t.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+e+")"}function vn(t,e,i){try{t.style[e]=i}catch(t){return}}var _n=function(a){function t(i,t,e){var n;n=a.call(this,i,t,e)||this;var r=kt(m(m(n)),n.updateDisplay);return i.on("loadstart",kt(m(m(n)),n.toggleDisplay)),i.on("texttrackchange",r),i.on("loadstart",kt(m(m(n)),n.preselectTrack)),i.ready(kt(m(m(n)),function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",r),i.on("playerresize",r),v.addEventListener("orientationchange",r),i.on("dispose",function(){return v.removeEventListener("orientationchange",r)});for(var t=this.options_.playerOptions.tracks||[],e=0;e<t.length;e++)this.player_.addRemoteTextTrack(t[e],!0);this.preselectTrack()}})),n}f(t,a);var e=t.prototype;return e.preselectTrack=function(){for(var t,e,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language===o.language?o.kind===a.kind?i=o:i||(i=o):a&&!a.enabled?e=t=i=null:o.default&&("descriptions"!==o.kind||t?o.kind in n&&!e&&(e=o):t=o)}i?i.mode="showing":e?e.mode="showing":t&&(t.mode="showing")},e.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},e.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},e.clearDisplay=function(){"function"==typeof v.WebVTT&&v.WebVTT.processCues(v,[],this.el_)},e.updateDisplay=function(){var t=this.player_.textTracks();this.clearDisplay();for(var e=null,i=null,n=t.length;n--;){var r=t[n];"showing"===r.mode&&("descriptions"===r.kind?e=r:i=r)}i?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(i)):e&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(e))},e.updateForTrack=function(t){if("function"==typeof v.WebVTT&&t.activeCues){for(var e=[],i=0;i<t.activeCues.length;i++)e.push(t.activeCues[i]);if(v.WebVTT.processCues(v,e,this.el_),this.player_.textTrackSettings)for(var n=this.player_.textTrackSettings.getValues(),r=e.length;r--;){var a=e[r];if(a){var s=a.displayState;if(n.color&&(s.firstChild.style.color=n.color),n.textOpacity&&vn(s.firstChild,"color",yn(n.color||"#fff",n.textOpacity)),n.backgroundColor&&(s.firstChild.style.backgroundColor=n.backgroundColor),n.backgroundOpacity&&vn(s.firstChild,"backgroundColor",yn(n.backgroundColor||"#000",n.backgroundOpacity)),n.windowColor&&(n.windowOpacity?vn(s,"backgroundColor",yn(n.windowColor,n.windowOpacity)):s.style.backgroundColor=n.windowColor),n.edgeStyle&&("dropshadow"===n.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+mn:"raised"===n.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+mn:"depressed"===n.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+mn:"uniform"===n.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+mn)),n.fontPercent&&1!==n.fontPercent){var o=v.parseFloat(s.style.fontSize);s.style.fontSize=o*n.fontPercent+"px",s.style.height="auto",s.style.top="auto",s.style.bottom="2px"}n.fontFamily&&"default"!==n.fontFamily&&("small-caps"===n.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=gn[n.fontFamily])}}}},t}(jt);jt.registerComponent("TextTrackDisplay",_n);var bn=function(r){function t(){return r.apply(this,arguments)||this}return f(t,r),t.prototype.createEl=function(){var t=this.player_.isAudio(),e=this.localize(t?"Audio Player":"Video Player"),i=A("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[e])}),n=r.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(i),n},t}(jt);jt.registerComponent("LoadingSpinner",bn);var Tn=function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var i=t.prototype;return i.createEl=function(t,e,i){void 0===e&&(e={}),void 0===i&&(i={}),e=b({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},e),i=b({type:"button"},i);var n=jt.prototype.createEl.call(this,"button",e,i);return this.createControlTextEl(n),n},i.addChild=function(t,e){void 0===e&&(e={});var i=this.constructor.name;return g.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),jt.prototype.addChild.call(this,t,e)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyPress=function(t){32!==t.which&&13!==t.which&&e.prototype.handleKeyPress.call(this,t)},t}(pn);jt.registerComponent("Button",Tn);var Sn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).mouseused_=!1,i.on("mousedown",i.handleMouseDown),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-big-play-button"},e.handleClick=function(t){var e=this.player_.play();if(this.mouseused_&&t.clientX&&t.clientY)we(e);else{var i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");if(n){var r=function(){return n.focus()};ke(e)?e.then(r,function(){}):this.setTimeout(r,1)}else this.player_.focus()}},e.handleKeyPress=function(t){this.mouseused_=!1,n.prototype.handleKeyPress.call(this,t)},e.handleMouseDown=function(t){this.mouseused_=!0},t}(Tn);Sn.prototype.controlText_="Play Video",jt.registerComponent("BigPlayButton",Sn);var kn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).controlText(e&&e.controlText||i.localize("Close")),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-close-button "+n.prototype.buildCSSClass.call(this)},e.handleClick=function(t){this.trigger({type:"close",bubbles:!1})},t}(Tn);jt.registerComponent("CloseButton",kn);var wn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on(t,"play",i.handlePlay),i.on(t,"pause",i.handlePause),i.on(t,"ended",i.handleEnded),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-play-control "+n.prototype.buildCSSClass.call(this)},e.handleClick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.handleSeeked=function(t){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(t):this.handlePlay(t)},e.handlePlay=function(t){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},e.handlePause=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},e.handleEnded=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(Tn);wn.prototype.controlText_="Play",jt.registerComponent("PlayToggle",wn);var Cn=function(t,e){t=t<0?0:t;var i=Math.floor(t%60),n=Math.floor(t/60%60),r=Math.floor(t/3600),a=Math.floor(e/60%60),s=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(r=n=i="-"),(r=0<r||0<s?r+":":"")+(n=((r||10<=a)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},En=Cn;function An(t,e){return void 0===e&&(e=t),En(t,e)}var Ln=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).throttledUpdateContent=wt(kt(m(m(i)),i.updateContent),25),i.on(t,"timeupdate",i.throttledUpdateContent),i}f(t,n);var e=t.prototype;return e.createEl=function(t){var e=this.buildCSSClass(),i=n.prototype.createEl.call(this,"div",{className:e+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=A("span",{className:e+"-display"},{"aria-live":"off"}),this.updateTextNode_(),i.appendChild(this.contentEl_),i},e.dispose=function(){this.contentEl_=null,this.textNode_=null,n.prototype.dispose.call(this)},e.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=d.createTextNode(this.formattedTime_||this.formatTime_(0)),this.contentEl_.appendChild(this.textNode_)}},e.formatTime_=function(t){return An(t)},e.updateFormattedTime_=function(t){var e=this.formatTime_(t);e!==this.formattedTime_&&(this.formattedTime_=e,this.requestAnimationFrame(this.updateTextNode_))},e.updateContent=function(t){},t}(jt);Ln.prototype.labelText_="Time",Ln.prototype.controlText_="Time",jt.registerComponent("TimeDisplay",Ln);var On=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on(t,"ended",i.handleEnded),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-current-time"},e.updateContent=function(t){var e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(e)},e.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},t}(Ln);On.prototype.labelText_="Current Time",On.prototype.controlText_="Current Time",jt.registerComponent("CurrentTimeDisplay",On);var Pn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on(t,"durationchange",i.updateContent),i.on(t,"loadedmetadata",i.throttledUpdateContent),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-duration"},e.updateContent=function(t){var e=this.player_.duration();e&&this.duration_!==e&&(this.duration_=e,this.updateFormattedTime_(e))},t}(Ln);Pn.prototype.labelText_="Duration",Pn.prototype.controlText_="Duration",jt.registerComponent("DurationDisplay",Pn);var Un=function(t){function e(){return t.apply(this,arguments)||this}return f(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"})},e}(jt);jt.registerComponent("TimeDivider",Un);var xn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on(t,"durationchange",i.throttledUpdateContent),i.on(t,"ended",i.handleEnded),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-remaining-time"},e.formatTime_=function(t){return"-"+n.prototype.formatTime_.call(this,t)},e.updateContent=function(t){this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},e.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(0)},t}(Ln);xn.prototype.labelText_="Remaining Time",xn.prototype.controlText_="Remaining Time",jt.registerComponent("RemainingTimeDisplay",xn);var In=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).updateShowing(),i.on(i.player(),"durationchange",i.updateShowing),i}f(t,n);var e=t.prototype;return e.createEl=function(){var t=n.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=A("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" </span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},e.dispose=function(){this.contentEl_=null,n.prototype.dispose.call(this)},e.updateShowing=function(t){this.player().duration()===1/0?this.show():this.hide()},t}(jt);jt.registerComponent("LiveDisplay",In);var Dn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.enable(),i}f(t,n);var e=t.prototype;return e.enabled=function(){return this.enabled_},e.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},e.disable=function(){if(this.enabled()){var t=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},e.createEl=function(t,e,i){return void 0===e&&(e={}),void 0===i&&(i={}),e.className=e.className+" vjs-slider",e=b({tabIndex:0},e),i=b({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},i),n.prototype.createEl.call(this,t,e,i)},e.handleMouseDown=function(t){var e=this.bar.el_.ownerDocument;"mousedown"===t.type&&t.preventDefault(),"touchstart"!==t.type||ne||t.preventDefault(),j(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(e,"mousemove",this.handleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchmove",this.handleMouseMove),this.on(e,"touchend",this.handleMouseUp),this.handleMouseMove(t)},e.handleMouseMove=function(t){},e.handleMouseUp=function(){var t=this.bar.el_.ownerDocument;F(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.update()},e.update=function(){if(this.el_){var t=this.getPercent(),e=this.bar;if(e){("number"!=typeof t||t!=t||t<0||t===1/0)&&(t=0);var i=(100*t).toFixed(2)+"%",n=e.el().style;return this.vertical()?n.height=i:n.width=i,t}}},e.calculateDistance=function(t){var e=q(this.el_,t);return this.vertical()?e.y:e.x},e.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepBack()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepForward())},e.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},e.handleClick=function(t){t.stopImmediatePropagation(),t.preventDefault()},e.vertical=function(t){if(void 0===t)return this.vertical_||!1;this.vertical_=!!t,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(jt);jt.registerComponent("Slider",Dn);var Rn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).partEls_=[],i.on(t,"progress",i.update),i}f(t,n);var e=t.prototype;return e.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+"</span>: 0%</span>"})},e.dispose=function(){this.partEls_=null,n.prototype.dispose.call(this)},e.update=function(t){var e=this.player_.buffered(),i=this.player_.duration(),n=this.player_.bufferedEnd(),r=this.partEls_,a=function(t,e){var i=t/e||0;return 100*(1<=i?1:i)+"%"};this.el_.style.width=a(n,i);for(var s=0;s<e.length;s++){var o=e.start(s),u=e.end(s),l=r[s];l||(l=this.el_.appendChild(A()),r[s]=l),l.style.left=a(o,n),l.style.width=a(u-o,n)}for(var c=r.length;c>e.length;c--)this.el_.removeChild(r[c-1]);r.length=e.length},t}(jt);jt.registerComponent("LoadProgressBar",Rn);var Mn=function(t){function e(){return t.apply(this,arguments)||this}f(e,t);var i=e.prototype;return i.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"})},i.update=function(t,e,i){var n=V(this.el_),r=V(this.player_.el()),a=t.width*e;if(r&&n){var s=t.left-r.left+a,o=t.width-a+(r.right-t.right),u=n.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),this.el_.style.right="-"+u+"px",L(this.el_,i)}},e}(jt);jt.registerComponent("TimeTooltip",Mn);var Bn=function(t){function e(){return t.apply(this,arguments)||this}f(e,t);var i=e.prototype;return i.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 0%</span>"})},i.update=function(i,n){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var t=An(r.player_.scrubbing()?r.player_.getCache().currentTime:r.player_.currentTime(),r.player_.duration()),e=r.getChild("timeTooltip");e&&e.update(i,n,t)})},e}(jt);Bn.prototype.options_={children:[]},Kt||Jt||Bn.prototype.options_.children.push("timeTooltip"),jt.registerComponent("PlayProgressBar",Bn);var Nn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).update=wt(kt(m(m(i)),i.update),25),i}f(t,n);var e=t.prototype;return e.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},e.update=function(i,n){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var t=r.player_.duration(),e=An(n*t,t);r.el_.style.left=i.width*n+"px",r.getChild("timeTooltip").update(i,n,e)})},t}(jt);Nn.prototype.options_={children:["timeTooltip"]},jt.registerComponent("MouseTimeDisplay",Nn);var jn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).setEventHandlers_(),i}f(t,n);var e=t.prototype;return e.setEventHandlers_=function(){var t=this;this.update=wt(kt(this,this.update),30),this.on(this.player_,"timeupdate",this.update),this.on(this.player_,"ended",this.handleEnded),this.updateInterval=null,this.on(this.player_,["playing"],function(){t.clearInterval(t.updateInterval),t.updateInterval=t.setInterval(function(){t.requestAnimationFrame(function(){t.update()})},30)}),this.on(this.player_,["ended","pause","waiting"],function(){t.clearInterval(t.updateInterval)}),this.on(this.player_,["timeupdate","ended"],this.update)},e.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.update_=function(t,e){var i=this.player_.duration();this.el_.setAttribute("aria-valuenow",(100*e).toFixed(2)),this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[An(t,i),An(i,i)],"{1} of {2}")),this.bar.update(V(this.el_),e)},e.update=function(t){var e=n.prototype.update.call(this);return this.update_(this.getCurrentTime_(),e),e},e.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},e.handleEnded=function(t){this.update_(this.player_.duration(),1)},e.getPercent=function(){var t=this.getCurrentTime_()/this.player_.duration();return 1<=t?1:t||0},e.handleMouseDown=function(t){$(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),n.prototype.handleMouseDown.call(this,t))},e.handleMouseMove=function(t){if($(t)){var e=this.calculateDistance(t)*this.player_.duration();e===this.player_.duration()&&(e-=.1),this.player_.currentTime(e)}},e.enable=function(){n.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},e.disable=function(){n.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},e.handleMouseUp=function(t){n.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying&&we(this.player_.play())},e.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},e.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},e.handleAction=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.handleKeyPress=function(t){32===t.which||13===t.which?(t.preventDefault(),this.handleAction(t)):n.prototype.handleKeyPress&&n.prototype.handleKeyPress.call(this,t)},t}(Dn);jn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Kt||Jt||jn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),jn.prototype.playerEvent="timeupdate",jt.registerComponent("SeekBar",jn);var Fn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).handleMouseMove=wt(kt(m(m(i)),i.handleMouseMove),25),i.throttledHandleMouseSeek=wt(kt(m(m(i)),i.handleMouseSeek),25),i.enable(),i}f(t,n);var e=t.prototype;return e.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},e.handleMouseMove=function(t){var e=this.getChild("seekBar");if(e){var i=e.getChild("mouseTimeDisplay"),n=e.el(),r=V(n),a=q(n,t).x;1<a?a=1:a<0&&(a=0),i&&i.update(r,a)}},e.handleMouseSeek=function(t){var e=this.getChild("seekBar");e&&e.handleMouseMove(t)},e.enabled=function(){return this.enabled_},e.disable=function(){this.children().forEach(function(t){return t.disable&&t.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},e.enable=function(){this.children().forEach(function(t){return t.enable&&t.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},e.handleMouseDown=function(t){var e=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(t),this.on(e,"mousemove",this.throttledHandleMouseSeek),this.on(e,"touchmove",this.throttledHandleMouseSeek),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.handleMouseUp=function(t){var e=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(t),this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},t}(jt);Fn.prototype.options_={children:["seekBar"]},jt.registerComponent("ProgressControl",Fn);var Vn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on(t,"fullscreenchange",i.handleFullscreenChange),!1===d[me.fullscreenEnabled]&&i.disable(),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-fullscreen-control "+n.prototype.buildCSSClass.call(this)},e.handleFullscreenChange=function(t){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},e.handleClick=function(t){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(Tn);Vn.prototype.controlText_="Fullscreen",jt.registerComponent("FullscreenToggle",Vn);var Hn=function(t){function e(){return t.apply(this,arguments)||this}return f(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},e}(jt);jt.registerComponent("VolumeLevel",Hn);var qn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on("slideractive",i.updateLastVolume_),i.on(t,"volumechange",i.updateARIAAttributes),t.ready(function(){return i.updateARIAAttributes()}),i}f(t,n);var e=t.prototype;return e.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},e.handleMouseDown=function(t){$(t)&&n.prototype.handleMouseDown.call(this,t)},e.handleMouseMove=function(t){$(t)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(t)))},e.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},e.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},e.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},e.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},e.updateARIAAttributes=function(t){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e),this.el_.setAttribute("aria-valuetext",e+"%")},e.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},e.updateLastVolume_=function(){var t=this,e=this.player_.volume();this.one("sliderinactive",function(){0===t.player_.volume()&&t.player_.lastVolume_(e)})},t}(Dn);qn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},qn.prototype.playerEvent="volumechange",jt.registerComponent("VolumeBar",qn);var zn=function(a){function t(t,e){var i,n,r;return void 0===e&&(e={}),e.vertical=e.vertical||!1,("undefined"==typeof e.volumeBar||c(e.volumeBar))&&(e.volumeBar=e.volumeBar||{},e.volumeBar.vertical=e.vertical),i=a.call(this,t,e)||this,n=m(m(i)),(r=t).tech_&&!r.tech_.featuresVolumeControl&&n.addClass("vjs-hidden"),n.on(r,"loadstart",function(){r.tech_.featuresVolumeControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")}),i.throttledHandleMouseMove=wt(kt(m(m(i)),i.handleMouseMove),25),i.on("mousedown",i.handleMouseDown),i.on("touchstart",i.handleMouseDown),i.on(i.volumeBar,["focus","slideractive"],function(){i.volumeBar.addClass("vjs-slider-active"),i.addClass("vjs-slider-active"),i.trigger("slideractive")}),i.on(i.volumeBar,["blur","sliderinactive"],function(){i.volumeBar.removeClass("vjs-slider-active"),i.removeClass("vjs-slider-active"),i.trigger("sliderinactive")}),i}f(t,a);var e=t.prototype;return e.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),a.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},e.handleMouseDown=function(t){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove),this.on(e,"touchmove",this.throttledHandleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.handleMouseUp=function(t){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove),this.off(e,"touchmove",this.throttledHandleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e.handleMouseMove=function(t){this.volumeBar.handleMouseMove(t)},t}(jt);zn.prototype.options_={children:["volumeBar"]},jt.registerComponent("VolumeControl",zn);var Wn=function(a){function t(t,e){var i,n,r;return i=a.call(this,t,e)||this,n=m(m(i)),(r=t).tech_&&!r.tech_.featuresMuteControl&&n.addClass("vjs-hidden"),n.on(r,"loadstart",function(){r.tech_.featuresMuteControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")}),i.on(t,["loadstart","volumechange"],i.update),i}f(t,a);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-mute-control "+a.prototype.buildCSSClass.call(this)},e.handleClick=function(t){var e=this.player_.volume(),i=this.player_.lastVolume_();if(0===e){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},e.update=function(t){this.updateIcon_(),this.updateControlText_()},e.updateIcon_=function(){var t=this.player_.volume(),e=3;Kt&&this.player_.muted(this.player_.tech_.el_.muted),0===t||this.player_.muted()?e=0:t<.33?e=1:t<.67&&(e=2);for(var i=0;i<4;i++)x(this.el_,"vjs-vol-"+i);U(this.el_,"vjs-vol-"+e)},e.updateControlText_=function(){var t=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)},t}(Tn);Wn.prototype.controlText_="Mute",jt.registerComponent("MuteToggle",Wn);var Gn=function(n){function t(t,e){var i;return void 0===e&&(e={}),"undefined"!=typeof e.inline?e.inline=e.inline:e.inline=!0,("undefined"==typeof e.volumeControl||c(e.volumeControl))&&(e.volumeControl=e.volumeControl||{},e.volumeControl.vertical=!e.inline),(i=n.call(this,t,e)||this).on(t,["loadstart"],i.volumePanelState_),i.on(i.volumeControl,["slideractive"],i.sliderActive_),i.on(i.volumeControl,["sliderinactive"],i.sliderInactive_),i}f(t,n);var e=t.prototype;return e.sliderActive_=function(){this.addClass("vjs-slider-active")},e.sliderInactive_=function(){this.removeClass("vjs-slider-active")},e.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},e.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),n.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},t}(jt);Gn.prototype.options_={children:["muteToggle","volumeControl"]},jt.registerComponent("VolumePanel",Gn);var Xn=function(n){function t(t,e){var i;return i=n.call(this,t,e)||this,e&&(i.menuButton_=e.menuButton),i.focusedChild_=-1,i.on("keydown",i.handleKeyPress),i}f(t,n);var e=t.prototype;return e.addItem=function(e){this.addChild(e),e.on("click",kt(this,function(t){this.menuButton_&&(this.menuButton_.unpressButton(),"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus())}))},e.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=A(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var e=n.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return e.appendChild(this.contentEl_),ht(e,"click",function(t){t.preventDefault(),t.stopImmediatePropagation()}),e},e.dispose=function(){this.contentEl_=null,n.prototype.dispose.call(this)},e.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepForward()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepBack())},e.stepForward=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_+1),this.focus(t)},e.stepBack=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_-1),this.focus(t)},e.focus=function(t){void 0===t&&(t=0);var e=this.children().slice();e.length&&e[0].className&&/vjs-menu-title/.test(e[0].className)&&e.shift(),0<e.length&&(t<0?t=0:t>=e.length&&(t=e.length-1),e[this.focusedChild_=t].el_.focus())},t}(jt);jt.registerComponent("Menu",Xn);var Yn=function(r){function t(t,e){var i;void 0===e&&(e={}),(i=r.call(this,t,e)||this).menuButton_=new Tn(t,e),i.menuButton_.controlText(i.controlText_),i.menuButton_.el_.setAttribute("aria-haspopup","true");var n=Tn.prototype.buildCSSClass();return i.menuButton_.el_.className=i.buildCSSClass()+" "+n,i.menuButton_.removeClass("vjs-control"),i.addChild(i.menuButton_),i.update(),i.enabled_=!0,i.on(i.menuButton_,"tap",i.handleClick),i.on(i.menuButton_,"click",i.handleClick),i.on(i.menuButton_,"focus",i.handleFocus),i.on(i.menuButton_,"blur",i.handleBlur),i.on("keydown",i.handleSubmenuKeyPress),i}f(t,r);var e=t.prototype;return e.update=function(){var t=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=t,this.addChild(t),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},e.createMenu=function(){var t=new Xn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var e=A("li",{className:"vjs-menu-title",innerHTML:Bt(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,t.children_.unshift(e),O(e,t.contentEl())}if(this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)t.addItem(this.items[i]);return t},e.createItems=function(){},e.createEl=function(){return r.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},e.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+Tn.prototype.buildCSSClass()+" "+r.prototype.buildCSSClass.call(this)},e.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+r.prototype.buildCSSClass.call(this)},e.controlText=function(t,e){return void 0===e&&(e=this.menuButton_.el()),this.menuButton_.controlText(t,e)},e.handleClick=function(t){this.one(this.menu.contentEl(),"mouseleave",kt(this,function(t){this.unpressButton(),this.el_.blur()})),this.buttonPressed_?this.unpressButton():this.pressButton()},e.focus=function(){this.menuButton_.focus()},e.blur=function(){this.menuButton_.blur()},e.handleFocus=function(){ht(d,"keydown",kt(this,this.handleKeyPress))},e.handleBlur=function(){dt(d,"keydown",kt(this,this.handleKeyPress))},e.handleKeyPress=function(t){27===t.which||9===t.which?(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus())):38!==t.which&&40!==t.which||this.buttonPressed_||(this.pressButton(),t.preventDefault())},e.handleSubmenuKeyPress=function(t){27!==t.which&&9!==t.which||(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus()))},e.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Kt&&C())return;this.menu.focus()}},e.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},e.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},e.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},t}(jt);jt.registerComponent("MenuButton",Yn);var $n=function(a){function t(t,e){var i,n=e.tracks;if((i=a.call(this,t,e)||this).items.length<=1&&i.hide(),!n)return m(i);var r=kt(m(m(i)),i.update);return n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),i.player_.on("ready",r),i.player_.on("dispose",function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r)}),i}return f(t,a),t}(Yn);jt.registerComponent("TrackButton",$n);var Kn=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).selectable=e.selectable,i.isSelected_=e.selected||!1,i.multiSelectable=e.multiSelectable,i.selected(i.isSelected_),i.selectable?i.multiSelectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitemradio"):i.el_.setAttribute("role","menuitem"),i}f(t,n);var e=t.prototype;return e.createEl=function(t,e,i){return this.nonIconControl=!0,n.prototype.createEl.call(this,"li",b({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},e),i)},e.handleClick=function(t){this.selected(!0)},e.selected=function(t){this.selectable&&(this.isSelected_=t?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),!1))},t}(pn);jt.registerComponent("MenuItem",Kn);var Qn=function(u){function t(t,e){var n,i=e.track,r=t.textTracks();e.label=i.label||i.language||"Unknown",e.selected="showing"===i.mode,(n=u.call(this,t,e)||this).track=i;var a,s=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];n.handleTracksChange.apply(m(m(n)),e)},o=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];n.handleSelectedLanguageChange.apply(m(m(n)),e)};(t.on(["loadstart","texttrackchange"],s),r.addEventListener("change",s),r.addEventListener("selectedlanguagechange",o),n.on("dispose",function(){t.off(["loadstart","texttrackchange"],s),r.removeEventListener("change",s),r.removeEventListener("selectedlanguagechange",o)}),void 0===r.onchange)&&n.on(["tap","click"],function(){if("object"!=typeof v.Event)try{a=new v.Event("change")}catch(t){}a||(a=d.createEvent("Event")).initEvent("change",!0,!0),r.dispatchEvent(a)});return n.handleTracksChange(),n}f(t,u);var e=t.prototype;return e.handleClick=function(t){var e=this.track.kind,i=this.track.kinds,n=this.player_.textTracks();if(i||(i=[e]),u.prototype.handleClick.call(this,t),n)for(var r=0;r<n.length;r++){var a=n[r];a===this.track&&-1<i.indexOf(a.kind)?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled")}},e.handleTracksChange=function(t){var e="showing"===this.track.mode;e!==this.isSelected_&&this.selected(e)},e.handleSelectedLanguageChange=function(t){if("showing"===this.track.mode){var e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},e.dispose=function(){this.track=null,u.prototype.dispose.call(this)},t}(Kn);jt.registerComponent("TextTrackMenuItem",Qn);var Jn=function(i){function t(t,e){return e.track={player:t,kind:e.kind,kinds:e.kinds,default:!1,mode:"disabled"},e.kinds||(e.kinds=[e.kind]),e.label?e.track.label=e.label:e.track.label=e.kinds.join(" and ")+" off",e.selectable=!0,e.multiSelectable=!1,i.call(this,t,e)||this}f(t,i);var e=t.prototype;return e.handleTracksChange=function(t){for(var e=this.player().textTracks(),i=!0,n=0,r=e.length;n<r;n++){var a=e[n];if(-1<this.options_.kinds.indexOf(a.kind)&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},e.handleSelectedLanguageChange=function(t){for(var e=this.player().textTracks(),i=!0,n=0,r=e.length;n<r;n++){var a=e[n];if(-1<["captions","descriptions","subtitles"].indexOf(a.kind)&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(Qn);jt.registerComponent("OffTextTrackMenuItem",Jn);var Zn=function(i){function t(t,e){return void 0===e&&(e={}),e.tracks=t.textTracks(),i.call(this,t,e)||this}return f(t,i),t.prototype.createItems=function(t,e){var i;void 0===t&&(t=[]),void 0===e&&(e=Qn),this.label_&&(i=this.label_+" off"),t.push(new Jn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var a=n[r];if(-1<this.kinds_.indexOf(a.kind)){var s=new e(this.player_,{track:a,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),t.push(s)}}return t},t}($n);jt.registerComponent("TextTrackButton",Zn);var tr=function(s){function t(t,e){var i,n=e.track,r=e.cue,a=t.currentTime();return e.selectable=!0,e.multiSelectable=!1,e.label=r.text,e.selected=r.startTime<=a&&a<r.endTime,(i=s.call(this,t,e)||this).track=n,i.cue=r,n.addEventListener("cuechange",kt(m(m(i)),i.update)),i}f(t,s);var e=t.prototype;return e.handleClick=function(t){s.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},e.update=function(t){var e=this.cue,i=this.player_.currentTime();this.selected(e.startTime<=i&&i<e.endTime)},t}(Kn);jt.registerComponent("ChaptersTrackMenuItem",tr);var er=function(n){function t(t,e,i){return n.call(this,t,e,i)||this}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-chapters-button "+n.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-chapters-button "+n.prototype.buildWrapperCSSClass.call(this)},e.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),n.prototype.update.call(this)},e.setTrack=function(t){if(this.track_!==t){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=t,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},e.findChaptersTrack=function(){for(var t=this.player_.textTracks()||[],e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}},e.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Bt(this.kind_))},e.createMenu=function(){return this.options_.title=this.getMenuCaption(),n.prototype.createMenu.call(this)},e.createItems=function(){var t=[];if(!this.track_)return t;var e=this.track_.cues;if(!e)return t;for(var i=0,n=e.length;i<n;i++){var r=e[i],a=new tr(this.player_,{track:this.track_,cue:r});t.push(a)}return t},t}(Zn);er.prototype.kind_="chapters",er.prototype.controlText_="Chapters",jt.registerComponent("ChaptersButton",er);var ir=function(s){function t(t,e,i){var n;n=s.call(this,t,e,i)||this;var r=t.textTracks(),a=kt(m(m(n)),n.handleTracksChange);return r.addEventListener("change",a),n.on("dispose",function(){r.removeEventListener("change",a)}),n}f(t,s);var e=t.prototype;return e.handleTracksChange=function(t){for(var e=this.player().textTracks(),i=!1,n=0,r=e.length;n<r;n++){var a=e[n];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},e.buildCSSClass=function(){return"vjs-descriptions-button "+s.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+s.prototype.buildWrapperCSSClass.call(this)},t}(Zn);ir.prototype.kind_="descriptions",ir.prototype.controlText_="Descriptions",jt.registerComponent("DescriptionsButton",ir);var nr=function(n){function t(t,e,i){return n.call(this,t,e,i)||this}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(Zn);nr.prototype.kind_="subtitles",nr.prototype.controlText_="Subtitles",jt.registerComponent("SubtitlesButton",nr);var rr=function(n){function t(t,e){var i;return e.track={player:t,kind:e.kind,label:e.kind+" settings",selectable:!1,default:!1,mode:"disabled"},e.selectable=!1,e.name="CaptionSettingsMenuItem",(i=n.call(this,t,e)||this).addClass("vjs-texttrack-settings"),i.controlText(", opens "+e.kind+" settings dialog"),i}return f(t,n),t.prototype.handleClick=function(t){this.player().getChild("textTrackSettings").open()},t}(Qn);jt.registerComponent("CaptionSettingsMenuItem",rr);var ar=function(n){function t(t,e,i){return n.call(this,t,e,i)||this}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-captions-button "+n.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-captions-button "+n.prototype.buildWrapperCSSClass.call(this)},e.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new rr(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,t)},t}(Zn);ar.prototype.kind_="captions",ar.prototype.controlText_="Captions",jt.registerComponent("CaptionsButton",ar);var sr=function(r){function t(){return r.apply(this,arguments)||this}return f(t,r),t.prototype.createEl=function(t,e,i){var n='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(n+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),n+="</span>",r.prototype.createEl.call(this,t,b({innerHTML:n},e),i)},t}(Qn);jt.registerComponent("SubsCapsMenuItem",sr);var or=function(n){function t(t,e){var i;return void 0===e&&(e={}),(i=n.call(this,t,e)||this).label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(i.player_.language_)&&(i.label_="captions"),i.menuButton_.controlText(Bt(i.label_)),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildWrapperCSSClass.call(this)},e.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new rr(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=n.prototype.createItems.call(this,t,sr)},t}(Zn);or.prototype.kinds_=["captions","subtitles"],or.prototype.controlText_="Subtitles",jt.registerComponent("SubsCapsButton",or);var ur=function(s){function t(t,e){var n,i=e.track,r=t.audioTracks();e.label=i.label||i.language||"Unknown",e.selected=i.enabled,(n=s.call(this,t,e)||this).track=i,n.addClass("vjs-"+i.kind+"-menu-item");var a=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];n.handleTracksChange.apply(m(m(n)),e)};return r.addEventListener("change",a),n.on("dispose",function(){r.removeEventListener("change",a)}),n}f(t,s);var e=t.prototype;return e.createEl=function(t,e,i){var n='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(n+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Descriptions")+"</span>\n "),n+="</span>",s.prototype.createEl.call(this,t,b({innerHTML:n},e),i)},e.handleClick=function(t){var e=this.player_.audioTracks();s.prototype.handleClick.call(this,t);for(var i=0;i<e.length;i++){var n=e[i];n.enabled=n===this.track}},e.handleTracksChange=function(t){this.selected(this.track.enabled)},t}(Kn);jt.registerComponent("AudioTrackMenuItem",ur);var lr=function(i){function t(t,e){return void 0===e&&(e={}),e.tracks=t.audioTracks(),i.call(this,t,e)||this}f(t,i);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-audio-button "+i.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-audio-button "+i.prototype.buildWrapperCSSClass.call(this)},e.createItems=function(t){void 0===t&&(t=[]),this.hideThreshold_=1;for(var e=this.player_.audioTracks(),i=0;i<e.length;i++){var n=e[i];t.push(new ur(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return t},t}($n);lr.prototype.controlText_="Audio Track",jt.registerComponent("AudioTrackButton",lr);var cr=function(a){function t(t,e){var i,n=e.rate,r=parseFloat(n,10);return e.label=n,e.selected=1===r,e.selectable=!0,e.multiSelectable=!1,(i=a.call(this,t,e)||this).label=n,i.rate=r,i.on(t,"ratechange",i.update),i}f(t,a);var e=t.prototype;return e.handleClick=function(t){a.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},e.update=function(t){this.selected(this.player().playbackRate()===this.rate)},t}(Kn);cr.prototype.contentElType="button",jt.registerComponent("PlaybackRateMenuItem",cr);var hr=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).updateVisibility(),i.updateLabel(),i.on(t,"loadstart",i.updateVisibility),i.on(t,"ratechange",i.updateLabel),i}f(t,n);var e=t.prototype;return e.createEl=function(){var t=n.prototype.createEl.call(this);return this.labelEl_=A("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},e.dispose=function(){this.labelEl_=null,n.prototype.dispose.call(this)},e.buildCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildCSSClass.call(this)},e.buildWrapperCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildWrapperCSSClass.call(this)},e.createMenu=function(){var t=new Xn(this.player()),e=this.playbackRates();if(e)for(var i=e.length-1;0<=i;i--)t.addChild(new cr(this.player(),{rate:e[i]+"x"}));return t},e.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},e.handleClick=function(t){for(var e=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;r<i.length;r++)if(i[r]>e){n=i[r];break}this.player().playbackRate(n)},e.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},e.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length},e.updateVisibility=function(t){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},e.updateLabel=function(t){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},t}(Yn);hr.prototype.controlText_="Playback Rate",jt.registerComponent("PlaybackRateMenuButton",hr);var dr=function(t){function e(){return t.apply(this,arguments)||this}f(e,t);var i=e.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+t.prototype.buildCSSClass.call(this)},i.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},e}(jt);jt.registerComponent("Spacer",dr);var pr=function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(dr);jt.registerComponent("CustomControlSpacer",pr);var fr=function(t){function e(){return t.apply(this,arguments)||this}return f(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},e}(jt);fr.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},jt.registerComponent("ControlBar",fr);var mr=function(n){function t(t,e){var i;return(i=n.call(this,t,e)||this).on(t,"error",i.open),i}f(t,n);var e=t.prototype;return e.buildCSSClass=function(){return"vjs-error-display "+n.prototype.buildCSSClass.call(this)},e.content=function(){var t=this.player().error();return t?this.localize(t.message):""},t}(Oe);mr.prototype.options_=Nt(Oe.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),jt.registerComponent("ErrorDisplay",mr);var gr="vjs-text-track-settings",yr=["#000","Black"],vr=["#00F","Blue"],_r=["#0FF","Cyan"],br=["#0F0","Green"],Tr=["#F0F","Magenta"],Sr=["#F00","Red"],kr=["#FFF","White"],wr=["#FF0","Yellow"],Cr=["1","Opaque"],Er=["0.5","Semi-Transparent"],Ar=["0","Transparent"],Lr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[yr,kr,Sr,br,vr,wr,Tr,_r]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Cr,Er,Ar]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[kr,yr,Sr,br,vr,wr,Tr,_r]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(t){return"1.00"===t?null:Number(t)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Cr,Er]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[Ar,Er,Cr]}};function Or(t,e){if(e&&(t=e(t)),t&&"none"!==t)return t}Lr.windowColor.options=Lr.backgroundColor.options;var Pr=function(n){function t(t,e){var i;return e.temporary=!1,(i=n.call(this,t,e)||this).updateDisplay=kt(m(m(i)),i.updateDisplay),i.fill(),i.hasBeenOpened_=i.hasBeenFilled_=!0,i.endDialog=A("p",{className:"vjs-control-text",textContent:i.localize("End of dialog window.")}),i.el().appendChild(i.endDialog),i.setDefaults(),void 0===e.persistTextTrackSettings&&(i.options_.persistTextTrackSettings=i.options_.playerOptions.persistTextTrackSettings),i.on(i.$(".vjs-done-button"),"click",function(){i.saveSettings(),i.close()}),i.on(i.$(".vjs-default-button"),"click",function(){i.setDefaults(),i.updateDisplay()}),o(Lr,function(t){i.on(i.$(t.selector),"change",i.updateDisplay)}),i.options_.persistTextTrackSettings&&i.restoreSettings(),i}f(t,n);var e=t.prototype;return e.dispose=function(){this.endDialog=null,n.prototype.dispose.call(this)},e.createElSelect_=function(t,e,i){var n=this;void 0===e&&(e=""),void 0===i&&(i="label");var r=Lr[t],a=r.id.replace("%s",this.id_),s=[e,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(r.options.map(function(t){var e=a+"-"+t[1].replace(/\W+/g,"");return['<option id="'+e+'" value="'+t[0]+'" ','aria-labelledby="'+s+" "+e+'">',n.localize(t[1]),"</option>"].join("")})).concat("</select>").join("")},e.createElFgColor_=function(){var t="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",t),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",t),"</span>","</fieldset>"].join("")},e.createElBgColor_=function(){var t="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",t),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",t),"</span>","</fieldset>"].join("")},e.createElWinColor_=function(){var t="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",t),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",t),"</span>","</fieldset>"].join("")},e.createElColors_=function(){return A("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},e.createElFont_=function(){return A("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},e.createElControls_=function(){var t=this.localize("restore all settings to the default values");return A("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+t+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+t+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},e.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},e.label=function(){return this.localize("Caption Settings Dialog")},e.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},e.buildCSSClass=function(){return n.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},e.getValues=function(){var i,n,t,s=this;return n=function(t,e,i){var n,r,a=(n=s.$(e.selector),r=e.parser,Or(n.options[n.options.selectedIndex].value,r));return void 0!==a&&(t[i]=a),t},void 0===(t={})&&(t=0),r(i=Lr).reduce(function(t,e){return n(t,i[e],e)},t)},e.setValues=function(i){var n=this;o(Lr,function(t,e){!function(t,e,i){if(e)for(var n=0;n<t.options.length;n++)if(Or(t.options[n].value,i)===e){t.selectedIndex=n;break}}(n.$(t.selector),i[e],t.parser)})},e.setDefaults=function(){var i=this;o(Lr,function(t){var e=t.hasOwnProperty("default")?t.default:0;i.$(t.selector).selectedIndex=e})},e.restoreSettings=function(){var t;try{t=JSON.parse(v.localStorage.getItem(gr))}catch(t){g.warn(t)}t&&this.setValues(t)},e.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?v.localStorage.setItem(gr,JSON.stringify(t)):v.localStorage.removeItem(gr)}catch(t){g.warn(t)}}},e.updateDisplay=function(){var t=this.player_.getChild("textTrackDisplay");t&&t.updateDisplay()},e.conditionalBlur_=function(){this.previouslyActiveEl_=null,this.off(d,"keydown",this.handleKeyDown);var t=this.player_.controlBar,e=t&&t.subsCapsButton,i=t&&t.captionsButton;e?e.focus():i&&i.focus()},t}(Oe);jt.registerComponent("TextTrackSettings",Pr);var Ur=function(a){function t(t,e){var i,n=e.ResizeObserver||v.ResizeObserver;null===e.ResizeObserver&&(n=!1);var r=Nt({createEl:!n,reportTouchActivity:!1},e);return(i=a.call(this,t,r)||this).ResizeObserver=e.ResizeObserver||v.ResizeObserver,i.loadListener_=null,i.resizeObserver_=null,i.debouncedHandler_=function(n,r,a,s){var o;void 0===s&&(s=v);var t=function(){var t=this,e=arguments,i=function(){i=o=null,a||n.apply(t,e)};!o&&a&&n.apply(t,e),s.clearTimeout(o),o=s.setTimeout(i,r)};return t.cancel=function(){s.clearTimeout(o),o=null},t}(function(){i.resizeHandler()},100,!1,m(m(i))),n?(i.resizeObserver_=new i.ResizeObserver(i.debouncedHandler_),i.resizeObserver_.observe(t.el())):(i.loadListener_=function(){i.el_&&i.el_.contentWindow&&ht(i.el_.contentWindow,"resize",i.debouncedHandler_)},i.one("load",i.loadListener_)),i}f(t,a);var e=t.prototype;return e.createEl=function(){return a.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager"})},e.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},e.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.el_&&this.el_.contentWindow&&dt(this.el_.contentWindow,"resize",this.debouncedHandler_),this.loadListener_&&this.off("load",this.loadListener_),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null},t}(jt);jt.registerComponent("ResizeManager",Ur);var xr=function(t){var e=t.el();if(e.hasAttribute("src"))return t.triggerSourceset(e.src),!0;var i=t.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a<i.length;a++){var s=i[a].src;s&&-1===n.indexOf(s)&&n.push(s)}return!!n.length&&(1===n.length&&(r=n[0]),t.triggerSourceset(r),!0)},Ir=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(t){var e=d.createElement(this.nodeName.toLowerCase());e.innerHTML=t;for(var i=d.createDocumentFragment();e.childNodes.length;)i.appendChild(e.childNodes[0]);return this.innerText="",v.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Dr=function(t,e){for(var i={},n=0;n<t.length&&!((i=Object.getOwnPropertyDescriptor(t[n],e))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},Rr=function(a){var s=a.el();if(!s.resetSourceWatch_){var e={},t=Dr([a.el(),v.HTMLMediaElement.prototype,v.Element.prototype,Ir],"innerHTML"),i=function(r){return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=r.apply(s,e);return xr(a),n}};["append","appendChild","insertAdjacentHTML"].forEach(function(t){s[t]&&(e[t]=s[t],s[t]=i(e[t]))}),Object.defineProperty(s,"innerHTML",Nt(t,{set:i(t.set)})),s.resetSourceWatch_=function(){s.resetSourceWatch_=null,Object.keys(e).forEach(function(t){s[t]=e[t]}),Object.defineProperty(s,"innerHTML",t)},a.one("sourceset",s.resetSourceWatch_)}},Mr=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?We(v.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return v.Element.prototype.setAttribute.call(this,"src",t),t}}),Br=function(n){if(n.featuresSourceset){var r=n.el();if(!r.resetSourceset_){var i=Dr([n.el(),v.HTMLMediaElement.prototype,Mr],"src"),a=r.setAttribute,e=r.load;Object.defineProperty(r,"src",Nt(i,{set:function(t){var e=i.set.call(r,t);return n.triggerSourceset(r.src),e}})),r.setAttribute=function(t,e){var i=a.call(r,t,e);return/src/i.test(t)&&n.triggerSourceset(r.src),i},r.load=function(){var t=e.call(r);return xr(n)||(n.triggerSourceset(""),Rr(n)),t},r.currentSrc?n.triggerSourceset(r.currentSrc):xr(n)||Rr(n),r.resetSourceset_=function(){r.resetSourceset_=null,r.load=e,r.setAttribute=a,Object.defineProperty(r,"src",i),r.resetSourceWatch_&&r.resetSourceWatch_()}}}};function Nr(){var t=e(["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."]);return Nr=function(){return t},t}var jr=function(c){function o(t,e){var i;i=c.call(this,t,e)||this;var n=t.source,r=!1;if(n&&(i.el_.currentSrc!==n.src||t.tag&&3===t.tag.initNetworkState_)?i.setSource(n):i.handleLateInit_(i.el_),t.enableSourceset&&i.setupSourcesetHandling_(),i.el_.hasChildNodes()){for(var a=i.el_.childNodes,s=a.length,o=[];s--;){var u=a[s];"track"===u.nodeName.toLowerCase()&&(i.featuresNativeTextTracks?(i.remoteTextTrackEls().addTrackElement_(u),i.remoteTextTracks().addTrack(u.track),i.textTracks().addTrack(u.track),r||i.el_.hasAttribute("crossorigin")||!Xe(u.src)||(r=!0)):o.push(u))}for(var l=0;l<o.length;l++)i.el_.removeChild(o[l])}return i.proxyNativeTracks_(),i.featuresNativeTextTracks&&r&&g.warn(_(Nr())),i.restoreMetadataTracksInIOSNativePlayer_(),(ue||Yt||te)&&!0===t.nativeControlsForTouch&&i.setControls(!0),i.proxyWebkitFullscreen_(),i.triggerReady(),i}f(o,c);var t=o.prototype;return t.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),o.disposeMediaElement(this.el_),this.options_=null,c.prototype.dispose.call(this)},t.setupSourcesetHandling_=function(){Br(this)},t.restoreMetadataTracksInIOSNativePlayer_=function(){var n,r=this.textTracks(),t=function(){n=[];for(var t=0;t<r.length;t++){var e=r[t];"metadata"===e.kind&&n.push({track:e,storedMode:e.mode})}};t(),r.addEventListener("change",t),this.on("dispose",function(){return r.removeEventListener("change",t)});var e=function t(){for(var e=0;e<n.length;e++){var i=n[e];"disabled"===i.track.mode&&i.track.mode!==i.storedMode&&(i.track.mode=i.storedMode)}r.removeEventListener("change",t)};this.on("webkitbeginfullscreen",function(){r.removeEventListener("change",t),r.removeEventListener("change",e),r.addEventListener("change",e)}),this.on("webkitendfullscreen",function(){r.removeEventListener("change",t),r.addEventListener("change",t),r.removeEventListener("change",e)})},t.overrideNative_=function(t,e){var i=this;if(e===this["featuresNative"+t+"Tracks"]){var n=t.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach(function(t){i.el()[n+"Tracks"].removeEventListener(t,i[n+"TracksListeners_"][t])}),this["featuresNative"+t+"Tracks"]=!e,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},t.overrideNativeAudioTracks=function(t){this.overrideNative_("Audio",t)},t.overrideNativeVideoTracks=function(t){this.overrideNative_("Video",t)},t.proxyNativeTracksForType_=function(t){var n=this,e=bi[t],r=this.el()[e.getterName],a=this[e.getterName]();if(this["featuresNative"+e.capitalName+"Tracks"]&&r&&r.addEventListener){var s={change:function(t){a.trigger({type:"change",target:a,currentTarget:a,srcElement:a})},addtrack:function(t){a.addTrack(t.track)},removetrack:function(t){a.removeTrack(t.track)}},i=function(){for(var t=[],e=0;e<a.length;e++){for(var i=!1,n=0;n<r.length;n++)if(r[n]===a[e]){i=!0;break}i||t.push(a[e])}for(;t.length;)a.removeTrack(t.shift())};this[e.getterName+"Listeners_"]=s,Object.keys(s).forEach(function(e){var i=s[e];r.addEventListener(e,i),n.on("dispose",function(t){return r.removeEventListener(e,i)})}),this.on("loadstart",i),this.on("dispose",function(t){return n.off("loadstart",i)})}},t.proxyNativeTracks_=function(){var e=this;bi.names.forEach(function(t){e.proxyNativeTracksForType_(t)})},t.createEl=function(){var t=this.options_.tag;if(!t||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(t){var e=t.cloneNode(!0);t.parentNode&&t.parentNode.insertBefore(e,t),o.disposeMediaElement(t),t=e}else{t=d.createElement("video");var i=Nt({},this.options_.tag&&R(this.options_.tag));ue&&!0===this.options_.nativeControlsForTouch||delete i.controls,D(t,b(i,{id:this.options_.techId,class:"vjs-tech"}))}t.playerId=this.options_.playerId}"undefined"!=typeof this.options_.preload&&B(t,"preload",this.options_.preload);for(var n=["loop","muted","playsinline","autoplay"],r=0;r<n.length;r++){var a=n[r],s=this.options_[a];"undefined"!=typeof s&&(s?B(t,a,a):N(t,a),t[a]=s)}return t},t.handleLateInit_=function(t){if(0!==t.networkState&&3!==t.networkState){if(0===t.readyState){var e=!1,i=function(){e=!0};this.on("loadstart",i);var n=function(){e||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready(function(){this.off("loadstart",i),this.off("loadedmetadata",n),e||this.trigger("loadstart")})}var r=["loadstart"];r.push("loadedmetadata"),2<=t.readyState&&r.push("loadeddata"),3<=t.readyState&&r.push("canplay"),4<=t.readyState&&r.push("canplaythrough"),this.ready(function(){r.forEach(function(t){this.trigger(t)},this)})}},t.setCurrentTime=function(t){try{this.el_.currentTime=t}catch(t){g(t,"Video is not ready. (Video.js)")}},t.duration=function(){var e=this;if(this.el_.duration===1/0&&Jt&&ne&&0===this.el_.currentTime){return this.on("timeupdate",function t(){0<e.el_.currentTime&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))}),NaN}return this.el_.duration||NaN},t.width=function(){return this.el_.offsetWidth},t.height=function(){return this.el_.offsetHeight},t.proxyWebkitFullscreen_=function(){var t=this;if("webkitDisplayingFullscreen"in this.el_){var e=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",function(){t.off("webkitbeginfullscreen",i),t.off("webkitendfullscreen",e)})}},t.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var t=v.navigator&&v.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},t.enterFullScreen=function(){var t=this.el_;t.paused&&t.networkState<=t.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){t.pause(),t.webkitEnterFullScreen()},0)):t.webkitEnterFullScreen()},t.exitFullScreen=function(){this.el_.webkitExitFullScreen()},t.src=function(t){if(void 0===t)return this.el_.src;this.setSrc(t)},t.reset=function(){o.resetMediaElement(this.el_)},t.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},t.setControls=function(t){this.el_.controls=!!t},t.addTextTrack=function(t,e,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,e,i):c.prototype.addTextTrack.call(this,t,e,i)},t.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return c.prototype.createRemoteTextTrack.call(this,t);var e=d.createElement("track");return t.kind&&(e.kind=t.kind),t.label&&(e.label=t.label),(t.language||t.srclang)&&(e.srclang=t.language||t.srclang),t.default&&(e.default=t.default),t.id&&(e.id=t.id),t.src&&(e.src=t.src),e},t.addRemoteTextTrack=function(t,e){var i=c.prototype.addRemoteTextTrack.call(this,t,e);return this.featuresNativeTextTracks&&this.el().appendChild(i),i},t.removeRemoteTextTrack=function(t){if(c.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var e=this.$$("track"),i=e.length;i--;)t!==e[i]&&t!==e[i].track||this.el().removeChild(e[i])},t.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),v.performance&&"function"==typeof v.performance.now?t.creationTime=v.performance.now():v.performance&&v.performance.timing&&"number"==typeof v.performance.timing.navigationStart&&(t.creationTime=v.Date.now()-v.performance.timing.navigationStart),t},o}(Qi);if(k()){jr.TEST_VID=d.createElement("video");var Fr=d.createElement("track");Fr.kind="captions",Fr.srclang="en",Fr.label="English",jr.TEST_VID.appendChild(Fr)}jr.isSupported=function(){try{jr.TEST_VID.volume=.5}catch(t){return!1}return!(!jr.TEST_VID||!jr.TEST_VID.canPlayType)},jr.canPlayType=function(t){return jr.TEST_VID.canPlayType(t)},jr.canPlaySource=function(t,e){return jr.canPlayType(t.type)},jr.canControlVolume=function(){try{var t=jr.TEST_VID.volume;return jr.TEST_VID.volume=t/2+.1,t!==jr.TEST_VID.volume}catch(t){return!1}},jr.canMuteVolume=function(){try{var t=jr.TEST_VID.muted;return jr.TEST_VID.muted=!t,jr.TEST_VID.muted?B(jr.TEST_VID,"muted","muted"):N(jr.TEST_VID,"muted"),t!==jr.TEST_VID.muted}catch(t){return!1}},jr.canControlPlaybackRate=function(){if(Jt&&ne&&re<58)return!1;try{var t=jr.TEST_VID.playbackRate;return jr.TEST_VID.playbackRate=t/2+.1,t!==jr.TEST_VID.playbackRate}catch(t){return!1}},jr.canOverrideAttributes=function(){try{var t=function(){};Object.defineProperty(d.createElement("video"),"src",{get:t,set:t}),Object.defineProperty(d.createElement("audio"),"src",{get:t,set:t}),Object.defineProperty(d.createElement("video"),"innerHTML",{get:t,set:t}),Object.defineProperty(d.createElement("audio"),"innerHTML",{get:t,set:t})}catch(t){return!1}return!0},jr.supportsNativeTextTracks=function(){return oe||Kt&&ne},jr.supportsNativeVideoTracks=function(){return!(!jr.TEST_VID||!jr.TEST_VID.videoTracks)},jr.supportsNativeAudioTracks=function(){return!(!jr.TEST_VID||!jr.TEST_VID.audioTracks)},jr.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],jr.prototype.featuresVolumeControl=jr.canControlVolume(),jr.prototype.featuresMuteControl=jr.canMuteVolume(),jr.prototype.featuresPlaybackRate=jr.canControlPlaybackRate(),jr.prototype.featuresSourceset=jr.canOverrideAttributes(),jr.prototype.movingMediaElementInDOM=!Kt,jr.prototype.featuresFullscreenResize=!0,jr.prototype.featuresProgressEvents=!0,jr.prototype.featuresTimeupdateEvents=!0,jr.prototype.featuresNativeTextTracks=jr.supportsNativeTextTracks(),jr.prototype.featuresNativeVideoTracks=jr.supportsNativeVideoTracks(),jr.prototype.featuresNativeAudioTracks=jr.supportsNativeAudioTracks();var Vr=jr.TEST_VID&&jr.TEST_VID.constructor.prototype.canPlayType,Hr=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;function qr(){var t=e(["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "]);return qr=function(){return t},t}jr.patchCanPlayType=function(){4<=Zt&&!ee&&!ne&&(jr.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&Hr.test(t)?"maybe":Vr.call(this,t)})},jr.unpatchCanPlayType=function(){var t=jr.TEST_VID.constructor.prototype.canPlayType;return jr.TEST_VID.constructor.prototype.canPlayType=Vr,t},jr.patchCanPlayType(),jr.disposeMediaElement=function(t){if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(t){}}()}},jr.resetMediaElement=function(t){if(t){for(var e=t.querySelectorAll("source"),i=e.length;i--;)t.removeChild(e[i]);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(t){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(t){jr.prototype[t]=function(){return this.el_[t]||this.el_.hasAttribute(t)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){jr.prototype["set"+Bt(e)]=function(t){(this.el_[e]=t)?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(t){jr.prototype[t]=function(){return this.el_[t]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(e){jr.prototype["set"+Bt(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(t){jr.prototype[t]=function(){return this.el_[t]()}}),Qi.withSourceHandlers(jr),jr.nativeSourceHandler={},jr.nativeSourceHandler.canPlayType=function(t){try{return jr.TEST_VID.canPlayType(t)}catch(t){return""}},jr.nativeSourceHandler.canHandleSource=function(t,e){if(t.type)return jr.nativeSourceHandler.canPlayType(t.type);if(t.src){var i=Ge(t.src);return jr.nativeSourceHandler.canPlayType("video/"+i)}return""},jr.nativeSourceHandler.handleSource=function(t,e,i){e.setSrc(t.src)},jr.nativeSourceHandler.dispose=function(){},jr.registerSourceHandler(jr.nativeSourceHandler),Qi.registerTech("Html5",jr);var zr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Wr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Gr=["tiny","xsmall","small","medium","large","xlarge","huge"],Xr={};Gr.forEach(function(t){var e="x"===t.charAt(0)?"x-"+t.substring(1):t;Xr[t]="vjs-layout-"+e});var Yr={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},$r=function(c){function h(t,e,i){var n;if(t.id=t.id||e.id||"vjs_video_"+tt(),(e=b(h.getTagSettings(t),e)).initChildren=!1,e.createEl=!1,e.evented=!1,e.reportTouchActivity=!1,!e.language)if("function"==typeof t.closest){var r=t.closest("[lang]");r&&r.getAttribute&&(e.language=r.getAttribute("lang"))}else for(var a=t;a&&1===a.nodeType;){if(R(a).hasOwnProperty("lang")){e.language=a.getAttribute("lang");break}a=a.parentNode}if((n=c.call(this,null,e,i)||this).log=y(n.id_),n.isPosterFromTech_=!1,n.queuedCallbacks_=[],n.isReady_=!1,n.hasStarted_=!1,n.userActive_=!1,!n.options_||!n.options_.techOrder||!n.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(n.tag=t,n.tagAttributes=t&&R(t),n.language(n.options_.language),e.languages){var s={};Object.getOwnPropertyNames(e.languages).forEach(function(t){s[t.toLowerCase()]=e.languages[t]}),n.languages_=s}else n.languages_=h.prototype.options_.languages;n.cache_={},n.poster_=e.poster||"",n.controls_=!!e.controls,n.cache_.lastVolume=1,t.controls=!1,t.removeAttribute("controls"),t.hasAttribute("autoplay")?n.options_.autoplay=!0:n.autoplay(n.options_.autoplay),n.scrubbing_=!1,n.el_=n.createEl(),n.cache_.lastPlaybackRate=n.defaultPlaybackRate(),Dt(m(m(n)),{eventBusKey:"el_"});var o=Nt(n.options_);if(e.plugins){var u=e.plugins;Object.keys(u).forEach(function(t){if("function"!=typeof this[t])throw new Error('plugin "'+t+'" does not exist');this[t](u[t])},m(m(n)))}n.options_.playerOptions=o,n.middleware_=[],n.initChildren(),n.isAudio("audio"===t.nodeName.toLowerCase()),n.controls()?n.addClass("vjs-controls-enabled"):n.addClass("vjs-controls-disabled"),n.el_.setAttribute("role","region"),n.isAudio()?n.el_.setAttribute("aria-label",n.localize("Audio Player")):n.el_.setAttribute("aria-label",n.localize("Video Player")),n.isAudio()&&n.addClass("vjs-audio"),n.flexNotSupported_()&&n.addClass("vjs-no-flex"),Kt||n.addClass("vjs-workinghover"),h.players[n.id_]=m(m(n));var l=p.split(".")[0];return n.addClass("vjs-v"+l),n.userActive(!0),n.reportUserActivity(),n.one("play",n.listenForUserActivity_),n.on("fullscreenchange",n.handleFullscreenChange_),n.on("stageclick",n.handleStageClick_),n.breakpoints(n.options_.breakpoints),n.responsive(n.options_.responsive),n.changingSrc_=!1,n.playWaitingForReady_=!1,n.playOnLoadstart_=null,n}f(h,c);var t=h.prototype;return t.dispose=function(){this.trigger("dispose"),this.off("dispose"),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),h.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Zi[this.id()]=null,c.prototype.dispose.call(this)},t.createEl=function(){var e,i=this.tag,t=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),n="video-js"===this.tag.tagName.toLowerCase();t?e=this.el_=i.parentNode:n||(e=this.el_=c.prototype.createEl.call(this,"div"));var r=R(i);if(n){for(e=this.el_=i,i=this.tag=d.createElement("video");e.children.length;)i.appendChild(e.firstChild);P(e,"video-js")||U(e,"video-js"),e.appendChild(i),t=this.playerElIngest_=e,Object.keys(e).forEach(function(t){i[t]=e[t]})}if(i.setAttribute("tabindex","-1"),r.tabindex="-1",ae&&(i.setAttribute("role","application"),r.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(t){n&&"class"===t||e.setAttribute(t,r[t]),n&&i.setAttribute(t,r[t])}),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=e.player=this,this.addClass("vjs-paused"),!0!==v.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Tt("vjs-styles-dimensions");var a=K(".vjs-styles-defaults"),s=K("head");s.insertBefore(this.styleEl_,a?a.nextSibling:s.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var o=i.getElementsByTagName("a"),u=0;u<o.length;u++){var l=o.item(u);U(l,"vjs-hidden"),l.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!t&&i.parentNode.insertBefore(e,i),O(i,e),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_=e},t.width=function(t){return this.dimension("width",t)},t.height=function(t){return this.dimension("height",t)},t.dimension=function(t,e){var i=t+"_";if(void 0===e)return this[i]||0;if(""===e)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(e);isNaN(n)?g.error('Improper value "'+e+'" supplied for for '+t):(this[i]=n,this.updateStyleEl_())},t.fluid=function(t){if(void 0===t)return!!this.fluid_;this.fluid_=!!t,t?(this.addClass("vjs-fluid"),this.fill(!1)):this.removeClass("vjs-fluid"),this.updateStyleEl_()},t.fill=function(t){if(void 0===t)return!!this.fill_;this.fill_=!!t,t?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},t.aspectRatio=function(t){if(void 0===t)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(t))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=t,this.fluid(!0),this.updateStyleEl_()},t.updateStyleEl_=function(){if(!0!==v.VIDEOJS_NO_DYNAMIC_STYLE){var t,e,i,n=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,e=void 0!==this.height_?this.height_:t*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),St(this.styleEl_,"\n ."+i+" {\n width: "+t+"px;\n height: "+e+"px;\n }\n\n ."+i+".vjs-fluid {\n padding-top: "+100*r+"%;\n }\n ")}else{var a="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(0<=a&&(o.width=a),0<=s&&(o.height=s))}},t.loadTech_=function(t,e){var i=this;this.tech_&&this.unloadTech_();var n=Bt(t),r=t.charAt(0).toLowerCase()+t.slice(1);"Html5"!==n&&this.tag&&(Qi.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a={source:e,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Si.names.forEach(function(t){var e=Si[t];a[e.getterName]=i[e.privateName]}),b(a,this.options_[n]),b(a,this.options_[r]),b(a,this.options_[t.toLowerCase()]),this.tag&&(a.tag=this.tag),e&&e.src===this.cache_.src&&0<this.cache_.currentTime&&(a.startTime=this.cache_.currentTime);var s=Qi.getTech(t);if(!s)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new s(a),this.tech_.ready(kt(this,this.handleTechReady_),!0),Ae(this.textTracksJson_||[],this.tech_),zr.forEach(function(t){i.on(i.tech_,t,i["handleTech"+Bt(t)+"_"])}),Object.keys(Wr).forEach(function(e){i.on(i.tech_,e,function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Wr[e]+"_"].bind(i),event:t}):i["handleTech"+Wr[e]+"_"](t)})}),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"sourceset",this.handleTechSourceset_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"ratechange",this.handleTechRateChange_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||O(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},t.unloadTech_=function(){var i=this;Si.names.forEach(function(t){var e=Si[t];i[e.privateName]=i[e.getterName]()}),this.textTracksJson_=Ee(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},t.tech=function(t){return void 0===t&&g.warn(_(qr())),this.tech_},t.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mousedown",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},t.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mousedown",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},t.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},t.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay())},t.manualAutoplay_=function(e){var i=this;if(this.tech_&&"string"==typeof e){var t,n=function(){var e=i.muted();i.muted(!0);var t=i.play();if(t&&t.then&&t.catch)return t.catch(function(t){i.muted(e)})};if("any"===e?(t=this.play())&&t.then&&t.catch&&t.catch(function(){return n()}):t="muted"===e?n():this.play(),t&&t.then&&t.catch)return t.then(function(){i.trigger({type:"autoplay-success",autoplay:e})}).catch(function(t){i.trigger({type:"autoplay-failure",autoplay:e})})}},t.updateSourceCaches_=function(t){void 0===t&&(t="");var e=t,i="";"string"!=typeof e&&(e=t.src,i=t.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],e&&!i&&(i=function(t,e){if(!e)return"";if(t.cache_.source.src===e&&t.cache_.source.type)return t.cache_.source.type;var i=t.cache_.sources.filter(function(t){return t.src===e});if(i.length)return i[0].type;for(var n=t.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===e)return a.type}return cn(e)}(this,e)),this.cache_.source=Nt({},t,{src:e,type:i});for(var n=this.cache_.sources.filter(function(t){return t.src&&t.src===e}),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=R(a[o]);r.push(u),u.src&&u.src===e&&s.push(u.src)}s.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=e},t.handleTechSourceset_=function(t){var n=this;if(!this.changingSrc_){var e=function(t){return n.updateSourceCaches_(t)},i=this.currentSource().src,r=t.src;if(i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(e=function(){}),e(r),!t.src){this.tech_.one(["sourceset","loadstart"],function t(e){if("sourceset"!==e.type){var i=n.techGet("currentSrc");n.lastSource_.tech=i,n.updateSourceCaches_(i)}n.tech_.off(["sourceset","loadstart"],t)})}}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})},t.hasStarted=function(t){if(void 0===t)return this.hasStarted_;t!==this.hasStarted_&&(this.hasStarted_=t,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},t.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},t.handleTechRateChange_=function(){0<this.tech_.playbackRate()&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(t){return t.callback(t.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},t.handleTechWaiting_=function(){var t=this;this.addClass("vjs-waiting"),this.trigger("waiting"),this.one("timeupdate",function(){return t.removeClass("vjs-waiting")})},t.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},t.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},t.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},t.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},t.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.trigger("seeked")},t.handleTechFirstPlay_=function(){this.options_.starttime&&(g.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},t.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},t.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},t.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},t.handleTechClick_=function(t){$(t)&&this.controls_&&(this.paused()?we(this.play()):this.pause())},t.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)})||(this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},t.handleTechTap_=function(){this.userActive(!this.userActive())},t.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},t.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},t.handleTechTouchEnd_=function(t){t.preventDefault()},t.handleFullscreenChange_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},t.handleStageClick_=function(){this.reportUserActivity()},t.handleTechFullscreenChange_=function(t,e){e&&this.isFullscreen(e.isFullscreen),this.trigger("fullscreenchange")},t.handleTechError_=function(){var t=this.tech_.error();this.error(t)},t.handleTechTextData_=function(){var t=null;1<arguments.length&&(t=arguments[1]),this.trigger("textdata",t)},t.getCache=function(){return this.cache_},t.techCall_=function(r,a){this.ready(function(){if(r in an)return t=this.middleware_,e=this.tech_,n=a,e[i=r](t.reduce(on(i),n));if(r in sn)return nn(this.middleware_,this.tech_,r,a);var t,e,i,n;try{this.tech_&&this.tech_[r](a)}catch(t){throw g(t),t}},!0)},t.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in rn)return t=this.middleware_,i=this.tech_,n=e,t.reduceRight(on(n),i[n]());if(e in sn)return nn(this.middleware_,this.tech_,e);var t,i,n;try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw g("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw g("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw g(t),t}}},t.play=function(){var e=this,t=this.options_.Promise||v.Promise;return t?new t(function(t){e.play_(t)}):this.play_()},t.play_=function(t){var e=this;if(void 0===t&&(t=we),this.playOnLoadstart_&&this.off("loadstart",this.playOnLoadstart_),this.isReady_){if(!this.changingSrc_&&(this.src()||this.currentSrc()))return void t(this.techGet_("play"));this.playOnLoadstart_=function(){e.playOnLoadstart_=null,t(e.play())},this.one("loadstart",this.playOnLoadstart_)}else{if(this.playWaitingForReady_)return;this.playWaitingForReady_=!0,this.ready(function(){e.playWaitingForReady_=!1,t(e.play())})}},t.pause=function(){this.techCall_("pause")},t.paused=function(){return!1!==this.techGet_("paused")},t.played=function(){return this.techGet_("played")||de(0,0)},t.scrubbing=function(t){if("undefined"==typeof t)return this.scrubbing_;this.scrubbing_=!!t,t?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},t.currentTime=function(t){return"undefined"!=typeof t?(t<0&&(t=0),void this.techCall_("setCurrentTime",t)):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},t.duration=function(t){if(void 0===t)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(t=parseFloat(t))<0&&(t=1/0),t!==this.cache_.duration&&((this.cache_.duration=t)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),this.trigger("durationchange"))},t.remainingTime=function(){return this.duration()-this.currentTime()},t.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},t.buffered=function(){var t=this.techGet_("buffered");return t&&t.length||(t=de(0,0)),t},t.bufferedPercent=function(){return pe(this.buffered(),this.duration())},t.bufferedEnd=function(){var t=this.buffered(),e=this.duration(),i=t.end(t.length-1);return e<i&&(i=e),i},t.volume=function(t){var e;return void 0!==t?(e=Math.max(0,Math.min(1,parseFloat(t))),this.cache_.volume=e,this.techCall_("setVolume",e),void(0<e&&this.lastVolume_(e))):(e=parseFloat(this.techGet_("volume")),isNaN(e)?1:e)},t.muted=function(t){if(void 0===t)return this.techGet_("muted")||!1;this.techCall_("setMuted",t)},t.defaultMuted=function(t){return void 0!==t?this.techCall_("setDefaultMuted",t):this.techGet_("defaultMuted")||!1},t.lastVolume_=function(t){if(void 0===t||0===t)return this.cache_.lastVolume;this.cache_.lastVolume=t},t.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},t.isFullscreen=function(t){if(void 0===t)return!!this.isFullscreen_;this.isFullscreen_=!!t},t.requestFullscreen=function(){var i=me;this.isFullscreen(!0),i.requestFullscreen?(ht(d,i.fullscreenchange,kt(this,function t(e){this.isFullscreen(d[i.fullscreenElement]),!1===this.isFullscreen()&&dt(d,i.fullscreenchange,t),this.trigger("fullscreenchange")})),this.el_[i.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},t.exitFullscreen=function(){var t=me;this.isFullscreen(!1),t.requestFullscreen?d[t.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},t.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=d.documentElement.style.overflow,ht(d,"keydown",kt(this,this.fullWindowOnEscKey)),d.documentElement.style.overflow="hidden",U(d.body,"vjs-full-window"),this.trigger("enterFullWindow")},t.fullWindowOnEscKey=function(t){27===t.keyCode&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},t.exitFullWindow=function(){this.isFullWindow=!1,dt(d,"keydown",this.fullWindowOnEscKey),d.documentElement.style.overflow=this.docOrigOverflow,x(d.body,"vjs-full-window"),this.trigger("exitFullWindow")},t.canPlayType=function(t){for(var e,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],a=Qi.getTech(r);if(a||(a=jt.getComponent(r)),a){if(a.isSupported()&&(e=a.canPlayType(t)))return e}else g.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},t.selectSource=function(t){var i,n=this,e=this.options_.techOrder.map(function(t){return[t,Qi.getTech(t)]}).filter(function(t){var e=t[0],i=t[1];return i?i.isSupported():(g.error('The "'+e+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),r=function(t,i,n){var r;return t.some(function(e){return i.some(function(t){if(r=n(e,t))return!0})}),r},a=function(t,e){var i=t[0];if(t[1].canPlaySource(e,n.options_[i.toLowerCase()]))return{source:e,tech:i}};return(this.options_.sourceOrder?r(t,e,(i=a,function(t,e){return i(e,t)})):r(e,t,a))||!1},t.src=function(t){var r=this;if("undefined"==typeof t)return this.cache_.src||"";var a=function e(t){if(Array.isArray(t)){var i=[];t.forEach(function(t){t=e(t),Array.isArray(t)?i=i.concat(t):l(t)&&i.push(t)}),t=i}else t="string"==typeof t&&t.trim()?[hn({src:t})]:l(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[hn(t)]:[];return t}(t);a.length?(this.changingSrc_=!0,this.cache_.sources=a,this.updateSourceCaches_(a[0]),en(this,a[0],function(t,e){var i,n;if(r.middleware_=e,r.cache_.sources=a,r.updateSourceCaches_(t),r.src_(t))return 1<a.length?r.src(a.slice(1)):(r.changingSrc_=!1,r.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void r.triggerReady());i=e,n=r.tech_,i.forEach(function(t){return t.setTech&&t.setTech(n)})})):this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0)},t.src_=function(t){var e,i,n=this,r=this.selectSource([t]);return!r||(e=r.tech,i=this.techName_,Bt(e)!==Bt(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready(function(){n.changingSrc_=!1})):this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",t):this.techCall_("src",t.src),this.changingSrc_=!1},!0),!1)},t.load=function(){this.techCall_("load")},t.reset=function(){this.tech_&&this.tech_.clearTracks("text"),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset")},t.currentSources=function(){var t=this.currentSource(),e=[];return 0!==Object.keys(t).length&&e.push(t),this.cache_.sources||e},t.currentSource=function(){return this.cache_.source||{}},t.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},t.currentType=function(){return this.currentSource()&&this.currentSource().type||""},t.preload=function(t){return void 0!==t?(this.techCall_("setPreload",t),void(this.options_.preload=t)):this.techGet_("preload")},t.autoplay=function(t){if(void 0===t)return this.options_.autoplay||!1;var e;"string"==typeof t&&/(any|play|muted)/.test(t)?(this.options_.autoplay=t,this.manualAutoplay_(t),e=!1):this.options_.autoplay=!!t,e=e||this.options_.autoplay,this.tech_&&this.techCall_("setAutoplay",e)},t.playsinline=function(t){return void 0!==t?(this.techCall_("setPlaysinline",t),this.options_.playsinline=t,this):this.techGet_("playsinline")},t.loop=function(t){return void 0!==t?(this.techCall_("setLoop",t),void(this.options_.loop=t)):this.techGet_("loop")},t.poster=function(t){if(void 0===t)return this.poster_;t||(t=""),t!==this.poster_&&(this.poster_=t,this.techCall_("setPoster",t),this.isPosterFromTech_=!1,this.trigger("posterchange"))},t.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var t=this.tech_.poster()||"";t!==this.poster_&&(this.poster_=t,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},t.controls=function(t){if(void 0===t)return!!this.controls_;t=!!t,this.controls_!==t&&(this.controls_=t,this.usingNativeControls()&&this.techCall_("setControls",t),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},t.usingNativeControls=function(t){if(void 0===t)return!!this.usingNativeControls_;t=!!t,this.usingNativeControls_!==t&&(this.usingNativeControls_=t,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},t.error=function(t){return void 0===t?this.error_||null:null===t?(this.error_=t,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close())):(this.error_=new be(t),this.addClass("vjs-error"),g.error("(CODE:"+this.error_.code+" "+be.errorTypes[this.error_.code]+")",this.error_.message,this.error_),void this.trigger("error"))},t.reportUserActivity=function(t){this.userActivity_=!0},t.userActive=function(t){if(void 0===t)return this.userActive_;if((t=!!t)!==this.userActive_){if(this.userActive_=t,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},t.listenForUserActivity_=function(){var e,i,n,r,a=kt(this,this.reportUserActivity);this.on("mousedown",function(){a(),this.clearInterval(e),e=this.setInterval(a,250)}),this.on("mousemove",function(t){t.screenX===i&&t.screenY===n||(i=t.screenX,n=t.screenY,a())}),this.on("mouseup",function(t){a(),this.clearInterval(e)}),this.on("keydown",a),this.on("keyup",a),this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(r);var t=this.options_.inactivityTimeout;t<=0||(r=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},t))}},250)},t.playbackRate=function(t){if(void 0===t)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",t)},t.defaultPlaybackRate=function(t){return void 0!==t?this.techCall_("setDefaultPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},t.isAudio=function(t){if(void 0===t)return!!this.isAudio_;this.isAudio_=!!t},t.addTextTrack=function(t,e,i){if(this.tech_)return this.tech_.addTextTrack(t,e,i)},t.addRemoteTextTrack=function(t,e){if(this.tech_)return this.tech_.addRemoteTextTrack(t,e)},t.removeRemoteTextTrack=function(t){void 0===t&&(t={});var e=t.track;if(e||(e=t),this.tech_)return this.tech_.removeRemoteTextTrack(e)},t.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},t.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},t.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},t.language=function(t){if(void 0===t)return this.language_;this.language_=String(t).toLowerCase()},t.languages=function(){return Nt(h.prototype.options_.languages,this.languages_)},t.toJSON=function(){var t=Nt(this.options_),e=t.tracks;t.tracks=[];for(var i=0;i<e.length;i++){var n=e[i];(n=Nt(n)).player=void 0,t.tracks[i]=n}return t},t.createModal=function(t,e){var i=this;(e=e||{}).content=t||"";var n=new Oe(this,e);return this.addChild(n),n.on("dispose",function(){i.removeChild(n)}),n.open(),n},t.updateCurrentBreakpoint_=function(){if(this.responsive())for(var t=this.currentBreakpoint(),e=this.currentWidth(),i=0;i<Gr.length;i++){var n=Gr[i];if(e<=this.breakpoints_[n]){if(t===n)return;t&&this.removeClass(Xr[t]),this.addClass(Xr[n]),this.breakpoint_=n;break}}},t.removeCurrentBreakpoint_=function(){var t=this.currentBreakpointClass();this.breakpoint_="",t&&this.removeClass(t)},t.breakpoints=function(t){return void 0===t||(this.breakpoint_="",this.breakpoints_=b({},Yr,t),this.updateCurrentBreakpoint_()),b(this.breakpoints_)},t.responsive=function(t){return void 0===t?this.responsive_:(t=Boolean(t))!==this.responsive_?((this.responsive_=t)?(this.on("playerresize",this.updateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),t):void 0},t.currentBreakpoint=function(){return this.breakpoint_},t.currentBreakpointClass=function(){return Xr[this.breakpoint_]||""},h.getTagSettings=function(t){var e={sources:[],tracks:[]},i=R(t),n=i["data-setup"];if(P(t,"vjs-fill")&&(i.fill=!0),P(t,"vjs-fluid")&&(i.fluid=!0),null!==n){var r=Se(n||"{}"),a=r[0],s=r[1];a&&g.error(a),b(i,s)}if(b(e,i),t.hasChildNodes())for(var o=t.childNodes,u=0,l=o.length;u<l;u++){var c=o[u],h=c.nodeName.toLowerCase();"source"===h?e.sources.push(R(c)):"track"===h&&e.tracks.push(R(c))}return e},t.flexNotSupported_=function(){var t=d.createElement("i");return!("flexBasis"in t.style||"webkitFlexBasis"in t.style||"mozFlexBasis"in t.style||"msFlexBasis"in t.style||"msFlexOrder"in t.style)},h}(jt);Si.names.forEach(function(t){var e=Si[t];$r.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),$r.players={};var Kr=v.navigator;$r.prototype.options_={techOrder:Qi.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Kr&&(Kr.languages&&Kr.languages[0]||Kr.userLanguage||Kr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",breakpoints:{},responsive:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(t){$r.prototype[t]=function(){return this.techGet_(t)}}),zr.forEach(function(t){$r.prototype["handleTech"+Bt(t)+"_"]=function(){return this.trigger(t)}}),jt.registerComponent("Player",$r);var Qr="plugin",Jr="activePlugins_",Zr={},ta=function(t){return Zr.hasOwnProperty(t)},ea=function(t){return ta(t)?Zr[t]:void 0},ia=function(t,e){t[Jr]=t[Jr]||{},t[Jr][e]=!0},na=function(t,e,i){var n=(i?"before":"")+"pluginsetup";t.trigger(n,e),t.trigger(n+":"+e.name,e)},ra=function(r,a){return a.prototype.name=r,function(){na(this,{name:r,plugin:a,instance:null},!0);for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=s(a,[this].concat(e));return this[r]=function(){return n},na(this,n.getEventHash()),n}},aa=function(){function a(t){if(this.constructor===a)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,Dt(this),delete this.trigger,Mt(this,this.constructor.defaultState),ia(t,this.name),this.dispose=kt(this,this.dispose),t.on("dispose",this.dispose)}var t=a.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(t){return void 0===t&&(t={}),t.name=this.name,t.plugin=this.constructor,t.instance=this,t},t.trigger=function(t,e){return void 0===e&&(e={}),pt(this.eventBusEl_,t,this.getEventHash(e))},t.handleStateChanged=function(t){},t.dispose=function(){var t=this.name,e=this.player;this.trigger("dispose"),this.off(),e.off("dispose",this.dispose),e[Jr][t]=!1,this.player=this.state=null,e[t]=ra(t,Zr[t])},a.isBasic=function(t){var e="string"==typeof t?ea(t):t;return"function"==typeof e&&!a.prototype.isPrototypeOf(e.prototype)},a.registerPlugin=function(t,e){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(ta(t))g.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if($r.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof e)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof e+".");var i,n,r;return Zr[t]=e,t!==Qr&&(a.isBasic(e)?$r.prototype[t]=(i=t,n=e,r=function(){na(this,{name:i,plugin:n,instance:null},!0);var t=n.apply(this,arguments);return ia(this,i),na(this,{name:i,plugin:n,instance:t}),t},Object.keys(n).forEach(function(t){r[t]=n[t]}),r):$r.prototype[t]=ra(t,e)),e},a.deregisterPlugin=function(t){if(t===Qr)throw new Error("Cannot de-register base plugin.");ta(t)&&(delete Zr[t],delete $r.prototype[t])},a.getPlugins=function(t){var i;return void 0===t&&(t=Object.keys(Zr)),t.forEach(function(t){var e=ea(t);e&&((i=i||{})[t]=e)}),i},a.getPluginVersion=function(t){var e=ea(t);return e&&e.VERSION||""},a}();aa.getPlugin=ea,aa.BASE_PLUGIN_NAME=Qr,aa.registerPlugin(Qr,aa),$r.prototype.usingPlugin=function(t){return!!this[Jr]&&!0===this[Jr][t]},$r.prototype.hasPlugin=function(t){return!!ta(t)};var sa=function(t){return 0===t.indexOf("#")?t.slice(1):t};function oa(t,i,e){var n=oa.getPlayer(t);if(n)return i&&g.warn('Player "'+t+'" is already initialised. Options will not be applied.'),e&&n.ready(e),n;var r="string"==typeof t?K("#"+sa(t)):t;if(!w(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");d.body.contains(r)||g.warn("The element supplied is not included in the DOM"),i=i||{},oa.hooks("beforesetup").forEach(function(t){var e=t(r,Nt(i));l(e)&&!Array.isArray(e)?i=Nt(i,e):g.error("please return an object in beforesetup hooks")});var a=jt.getComponent("Player");return n=new a(r,i,e),oa.hooks("setup").forEach(function(t){return t(n)}),n}if(oa.hooks_={},oa.hooks=function(t,e){return oa.hooks_[t]=oa.hooks_[t]||[],e&&(oa.hooks_[t]=oa.hooks_[t].concat(e)),oa.hooks_[t]},oa.hook=function(t,e){oa.hooks(t,e)},oa.hookOnce=function(i,t){oa.hooks(i,[].concat(t).map(function(e){return function t(){return oa.removeHook(i,t),e.apply(void 0,arguments)}}))},oa.removeHook=function(t,e){var i=oa.hooks(t).indexOf(e);return!(i<=-1)&&(oa.hooks_[t]=oa.hooks_[t].slice(),oa.hooks_[t].splice(i,1),!0)},!0!==v.VIDEOJS_NO_DYNAMIC_STYLE&&k()){var ua=K(".vjs-styles-defaults");if(!ua){ua=Tt("vjs-styles-defaults");var la=K("head");la&&la.insertBefore(ua,la.firstChild),St(ua,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}_t(1,oa),oa.VERSION=p,oa.options=$r.prototype.options_,oa.getPlayers=function(){return $r.players},oa.getPlayer=function(t){var e,i=$r.players;if("string"==typeof t){var n=sa(t),r=i[n];if(r)return r;e=K("#"+n)}else e=t;if(w(e)){var a=e,s=a.player,o=a.playerId;if(s||i[o])return s||i[o]}},oa.getAllPlayers=function(){return Object.keys($r.players).map(function(t){return $r.players[t]}).filter(Boolean)},oa.players=$r.players,oa.getComponent=jt.getComponent,oa.registerComponent=function(t,e){Qi.isTech(e)&&g.warn("The "+t+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),jt.registerComponent.call(jt,t,e)},oa.getTech=Qi.getTech,oa.registerTech=Qi.registerTech,oa.use=function(t,e){Ji[t]=Ji[t]||[],Ji[t].push(e)},Object.defineProperty(oa,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(oa.middleware,"TERMINATOR",{value:tn,writeable:!1,enumerable:!0}),oa.browser=le,oa.TOUCH_ENABLED=ue,oa.extend=function(t,e){void 0===e&&(e={});var i=function(){t.apply(this,arguments)},n={};for(var r in"object"==typeof e?(e.constructor!==Object.prototype.constructor&&(i=e.constructor),n=e):"function"==typeof e&&(i=e),function(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&&(t.super_=e)}(i,t),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},oa.mergeOptions=Nt,oa.bind=kt,oa.registerPlugin=aa.registerPlugin,oa.deregisterPlugin=aa.deregisterPlugin,oa.plugin=function(t,e){return g.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),aa.registerPlugin(t,e)},oa.getPlugins=aa.getPlugins,oa.getPlugin=aa.getPlugin,oa.getPluginVersion=aa.getPluginVersion,oa.addLanguage=function(t,e){var i;return t=(""+t).toLowerCase(),oa.options.languages=Nt(oa.options.languages,((i={})[t]=e,i)),oa.options.languages[t]},oa.log=g,oa.createLogger=y,oa.createTimeRange=oa.createTimeRanges=de,oa.formatTime=An,oa.setFormatTime=function(t){En=t},oa.resetFormatTime=function(){En=Cn},oa.parseUrl=ze,oa.isCrossOrigin=Xe,oa.EventTarget=Ct,oa.on=ht,oa.one=ft,oa.off=dt,oa.trigger=pt,oa.xhr=hi,oa.TextTrack=gi,oa.AudioTrack=yi,oa.VideoTrack=vi,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){oa[t]=function(){return g.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),J[t].apply(null,arguments)}}),oa.computedStyle=n,oa.dom=J,oa.url=Ye;var ca=Qe(function(t,e){var i,c,n,r,h;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,c=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,h={buildAbsoluteURL:function(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;var n=h.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return n.path=h.normalizePath(n.path),h.buildURLFromParts(n)}var r=h.parseURL(e);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=h.normalizePath(r.path),h.buildURLFromParts(r)):e;var a=h.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var s=c.exec(a.path);a.netLoc=s[1],a.path=s[2]}a.netLoc&&!a.path&&(a.path="/");var o={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(o.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var u=a.path,l=u.substring(0,u.lastIndexOf("/")+1)+r.path;o.path=h.normalizePath(l)}else o.path=a.path,r.params||(o.params=a.params,r.query||(o.query=a.query));return null===o.path&&(o.path=i.alwaysNormalize?h.normalizePath(r.path):r.path),h.buildURLFromParts(o)},parseURL:function(t){var e=i.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(n,"");t.length!==(t=t.replace(r,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=h}),ha=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},da=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},pa=function(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)},fa=function(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},ma=function(){function t(){ha(this,t),this.listeners={}}return t.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},t.prototype.off=function(t,e){if(!this.listeners[t])return!1;var i=this.listeners[t].indexOf(e);return this.listeners[t].splice(i,1),-1<i},t.prototype.trigger=function(t){var e=this.listeners[t],i=void 0,n=void 0,r=void 0;if(e)if(2===arguments.length)for(n=e.length,i=0;i<n;++i)e[i].call(this,arguments[1]);else for(r=Array.prototype.slice.call(arguments,1),n=e.length,i=0;i<n;++i)e[i].apply(this,r)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},t}(),ga=function(e){function i(){ha(this,i);var t=fa(this,e.call(this));return t.buffer="",t}return pa(i,e),i.prototype.push=function(t){var e=void 0;for(this.buffer+=t,e=this.buffer.indexOf("\n");-1<e;e=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)},i}(ma),ya=function(t){for(var e=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),i={},n=e.length,r=void 0;n--;)""!==e[n]&&((r=/([^=]*)=(.*)/.exec(e[n]).slice(1))[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),i[r[0]]=r[1]);return i},va=function(e){function i(){ha(this,i);var t=fa(this,e.call(this));return t.customParsers=[],t}return pa(i,e),i.prototype.push=function(t){var e=void 0,i=void 0;if(0!==(t=t.replace(/^[\u0000\s]+|[\u0000\s]+$/g,"")).length)if("#"===t[0]){for(var n=0;n<this.customParsers.length;n++)if(this.customParsers[n].call(this,t))return;if(0===t.indexOf("#EXT"))if(t=t.replace("\r",""),e=/^#EXTM3U/.exec(t))this.trigger("data",{type:"tag",tagType:"m3u"});else{if(e=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(t))return i={type:"tag",tagType:"inf"},e[1]&&(i.duration=parseFloat(e[1])),e[2]&&(i.title=e[2]),void this.trigger("data",i);if(e=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(t))return i={type:"tag",tagType:"targetduration"},e[1]&&(i.duration=parseInt(e[1],10)),void this.trigger("data",i);if(e=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(t))return i={type:"tag",tagType:"totalduration"},e[1]&&(i.duration=parseInt(e[1],10)),void this.trigger("data",i);if(e=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(t))return i={type:"tag",tagType:"version"},e[1]&&(i.version=parseInt(e[1],10)),void this.trigger("data",i);if(e=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(t))return i={type:"tag",tagType:"media-sequence"},e[1]&&(i.number=parseInt(e[1],10)),void this.trigger("data",i);if(e=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(t))return i={type:"tag",tagType:"discontinuity-sequence"},e[1]&&(i.number=parseInt(e[1],10)),void this.trigger("data",i);if(e=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(t))return i={type:"tag",tagType:"playlist-type"},e[1]&&(i.playlistType=e[1]),void this.trigger("data",i);if(e=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(t))return i={type:"tag",tagType:"byterange"},e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),void this.trigger("data",i);if(e=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(t))return i={type:"tag",tagType:"allow-cache"},e[1]&&(i.allowed=!/NO/.test(e[1])),void this.trigger("data",i);if(e=/^#EXT-X-MAP:?(.*)$/.exec(t)){if(i={type:"tag",tagType:"map"},e[1]){var r=ya(e[1]);if(r.URI&&(i.uri=r.URI),r.BYTERANGE){var a=r.BYTERANGE.split("@"),s=a[0],o=a[1];i.byterange={},s&&(i.byterange.length=parseInt(s,10)),o&&(i.byterange.offset=parseInt(o,10))}}this.trigger("data",i)}else if(e=/^#EXT-X-STREAM-INF:?(.*)$/.exec(t)){if(i={type:"tag",tagType:"stream-inf"},e[1]){if(i.attributes=ya(e[1]),i.attributes.RESOLUTION){var u=i.attributes.RESOLUTION.split("x"),l={};u[0]&&(l.width=parseInt(u[0],10)),u[1]&&(l.height=parseInt(u[1],10)),i.attributes.RESOLUTION=l}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}this.trigger("data",i)}else{if(e=/^#EXT-X-MEDIA:?(.*)$/.exec(t))return i={type:"tag",tagType:"media"},e[1]&&(i.attributes=ya(e[1])),void this.trigger("data",i);if(e=/^#EXT-X-ENDLIST/.exec(t))this.trigger("data",{type:"tag",tagType:"endlist"});else if(e=/^#EXT-X-DISCONTINUITY/.exec(t))this.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(e=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(t))return i={type:"tag",tagType:"program-date-time"},e[1]&&(i.dateTimeString=e[1],i.dateTimeObject=new Date(e[1])),void this.trigger("data",i);if(e=/^#EXT-X-KEY:?(.*)$/.exec(t))return i={type:"tag",tagType:"key"},e[1]&&(i.attributes=ya(e[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void this.trigger("data",i);if(e=/^#EXT-X-START:?(.*)$/.exec(t))return i={type:"tag",tagType:"start"},e[1]&&(i.attributes=ya(e[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void this.trigger("data",i);if(e=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(t))return i={type:"tag",tagType:"cue-out-cont"},e[1]?i.data=e[1]:i.data="",void this.trigger("data",i);if(e=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(t))return i={type:"tag",tagType:"cue-out"},e[1]?i.data=e[1]:i.data="",void this.trigger("data",i);if(e=/^#EXT-X-CUE-IN:?(.*)?$/.exec(t))return i={type:"tag",tagType:"cue-in"},e[1]?i.data=e[1]:i.data="",void this.trigger("data",i);this.trigger("data",{type:"tag",data:t.slice(4)})}}}else this.trigger("data",{type:"comment",text:t.slice(1)})}else this.trigger("data",{type:"uri",uri:t})},i.prototype.addParser=function(t){var e=this,i=t.expression,n=t.customType,r=t.dataParser,a=t.segment;"function"!=typeof r&&(r=function(t){return t}),this.customParsers.push(function(t){if(i.exec(t))return e.trigger("data",{type:"custom",data:r(t),customType:n,segment:a}),!0})},i}(ma),_a=function(e){function i(){ha(this,i);var t=fa(this,e.call(this));t.lineStream=new ga,t.parseStream=new va,t.lineStream.pipe(t.parseStream);var r=t,a=[],s={},o=void 0,u=void 0,l={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c=0;return t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},t.parseStream.on("data",function(e){var i=void 0,n=void 0;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&((s.byterange=t).length=e.length,"offset"in e||(this.trigger("info",{message:"defaulting offset to zero"}),e.offset=0)),"offset"in e&&((s.byterange=t).offset=e.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),0<e.duration&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){e.attributes?"NONE"!==e.attributes.METHOD?e.attributes.URI?(e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),u={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},"undefined"!=typeof e.attributes.IV&&(u.iv=e.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):u=null:this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,c=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){o={},e.uri&&(o.uri=e.uri),e.byterange&&(o.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes?(s.attributes||(s.attributes={}),da(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var t=this.manifest.mediaGroups[e.attributes.TYPE];t[e.attributes["GROUP-ID"]]=t[e.attributes["GROUP-ID"]]||{},i=t[e.attributes["GROUP-ID"]],(n={default:/yes/i.test(e.attributes.DEFAULT)}).default?n.autoselect=!0:n.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(n.language=e.attributes.LANGUAGE),e.attributes.URI&&(n.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(n.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(n.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(n.forced=/yes/i.test(e.attributes.FORCED)),i[e.attributes.NAME]=n}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){"undefined"==typeof this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):this.manifest.targetDuration=e.duration},totalduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration}):this.manifest.totalDuration=e.duration},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data}}[e.tagType]||function(){}).call(r)},uri:function(){s.uri=e.uri,a.push(s),!this.manifest.targetDuration||"duration"in s||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),u&&(s.key=u),s.timeline=c,o&&(s.map=o),s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)}),t}return pa(i,e),i.prototype.push=function(t){this.lineStream.push(t)},i.prototype.end=function(){this.lineStream.push("\n")},i.prototype.addParser=function(t){this.parseStream.addParser(t)},i}(ma),ba=function(t){return!!t&&"object"==typeof t},Ta=function n(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.reduce(function(e,i){return Object.keys(i).forEach(function(t){Array.isArray(e[t])&&Array.isArray(i[t])?e[t]=e[t].concat(i[t]):ba(e[t])&&ba(i[t])?e[t]=n(e[t],i[t]):e[t]=i[t]}),e},{})},Sa=function(t){return t.reduce(function(t,e){return t.concat(e)},[])},ka=function(t){if(!t.length)return[];for(var e=[],i=0;i<t.length;i++)e.push(t[i]);return e},wa=function(t){var e;return(e=t.reduce(function(t,e){var i,n=e.attributes.id+(e.attributes.lang||"");t[n]?(e.segments[0].discontinuity=!0,(i=t[n].segments).push.apply(i,e.segments),e.attributes.contentProtection&&(t[n].attributes.contentProtection=e.attributes.contentProtection)):t[n]=e;return t},{}),Object.keys(e).map(function(t){return e[t]})).map(function(t){var e,n;return t.discontinuityStarts=(e=t.segments,n="discontinuity",e.reduce(function(t,e,i){return e[n]&&t.push(i),t},[])),t})},Ca=function(t){var e,i=t.attributes,n=t.segments,r={attributes:(e={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},e["PROGRAM-ID"]=1,e),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(r.contentProtection=i.contentProtection),r};"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Ea,Aa=(function(t,e){var i,c,n,r,h;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,c=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,h={buildAbsoluteURL:function(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;var n=h.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return n.path=h.normalizePath(n.path),h.buildURLFromParts(n)}var r=h.parseURL(e);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=h.normalizePath(r.path),h.buildURLFromParts(r)):e;var a=h.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var s=c.exec(a.path);a.netLoc=s[1],a.path=s[2]}a.netLoc&&!a.path&&(a.path="/");var o={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(o.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var u=a.path,l=u.substring(0,u.lastIndexOf("/")+1)+r.path;o.path=h.normalizePath(l)}else o.path=a.path,r.params||(o.params=a.params,r.query||(o.query=a.query));return null===o.path&&(o.path=i.alwaysNormalize?h.normalizePath(r.path):r.path),h.buildURLFromParts(o)},parseURL:function(t){var e=i.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(n,"");t.length!==(t=t.replace(r,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=h}(Ea={exports:{}},Ea.exports),Ea.exports),La=function(t,e){return/^[a-z]+:/i.test(e)?e:(/\/\//i.test(t)||(t=Aa.buildAbsoluteURL(v.location.href,t)),Aa.buildAbsoluteURL(t,e))},Oa=function(t){var e=t.baseUrl,i=void 0===e?"":e,n=t.source,r=void 0===n?"":n,a=t.range,s=void 0===a?"":a,o={uri:r,resolvedUri:La(i||"",r)};if(s){var u=s.split("-"),l=parseInt(u[0],10),c=parseInt(u[1],10);o.byterange={length:c-l,offset:l}}return o},Pa=function(t,e){for(var i,n,r,a,s,o,u,l,c,h,d,p,f=t.type,m=void 0===f?"static":f,g=t.minimumUpdatePeriod,y=void 0===g?0:g,v=t.media,_=void 0===v?"":v,b=t.sourceDuration,T=t.timescale,S=void 0===T?1:T,k=t.startNumber,w=void 0===k?1:k,C=t.periodIndex,E=[],A=-1,L=0;L<e.length;L++){var O=e[L],P=O.d,U=O.r||0,x=O.t||0;A<0&&(A=x),x&&A<x&&(A=x);var I=void 0;if(U<0){var D=L+1;I=D===e.length?"dynamic"===m&&0<y&&0<_.indexOf("$Number$")?(n=A,r=P,void 0,a=(i=t).NOW,s=i.clientOffset,o=i.availabilityStartTime,u=i.timescale,l=void 0===u?1:u,c=i.start,h=void 0===c?0:c,d=i.minimumUpdatePeriod,p=(a+s)/1e3+(void 0===d?0:d)-(o+h),Math.ceil((p*l-n)/r)):(b*S-A)/P:(e[D].t-A)/P}else I=U+1;for(var R=w+E.length+I,M=w+E.length;M<R;)E.push({number:M,duration:P/S,time:A,timeline:C}),A+=P,M++}return E},Ua={static:function(t){var e=t.duration,i=t.timescale,n=void 0===i?1:i,r=t.sourceDuration;return{start:0,end:Math.ceil(r/(e/n))}},dynamic:function(t){var e=t.NOW,i=t.clientOffset,n=t.availabilityStartTime,r=t.timescale,a=void 0===r?1:r,s=t.duration,o=t.start,u=void 0===o?0:o,l=t.minimumUpdatePeriod,c=void 0===l?0:l,h=t.timeShiftBufferDepth,d=void 0===h?1/0:h,p=(e+i)/1e3,f=n+u,m=p+c-f,g=Math.ceil(m*a/s),y=Math.floor((p-f-d)*a/s),v=Math.floor((p-f)*a/s);return{start:Math.max(0,y),end:Math.min(g,v)}}},xa=function(t){var o,e=t.type,i=void 0===e?"static":e,n=t.duration,r=t.timescale,a=void 0===r?1:r,s=t.sourceDuration,u=Ua[i](t),l=function(t,e){for(var i=[],n=t;n<e;n++)i.push(n);return i}(u.start,u.end).map((o=t,function(t,e){var i=o.duration,n=o.timescale,r=void 0===n?1:n,a=o.periodIndex,s=o.startNumber;return{number:(void 0===s?1:s)+t,duration:i/r,timeline:a,time:e*i}}));if("static"===i){var c=l.length-1;l[c].duration=s-n/a*c}return l},Ia=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Da=function(t,e){return t.replace(Ia,(a=e,function(t,e,i,n){if("$$"===t)return"$";if("undefined"==typeof a[e])return t;var r=""+a[e];return"RepresentationID"===e?r:(n=i?parseInt(n,10):1)<=r.length?r:""+new Array(n-r.length+1).join("0")+r}));var a},Ra=function(i,t){var e,n,r={RepresentationID:i.id,Bandwidth:i.bandwidth||0},a=i.initialization,s=void 0===a?{sourceURL:"",range:""}:a,o=Oa({baseUrl:i.baseUrl,source:Da(s.sourceURL,r),range:s.range});return(n=t,(e=i).duration||n?e.duration?xa(e):Pa(e,n):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]).map(function(t){r.Number=t.number,r.Time=t.time;var e=Da(i.media||"",r);return{uri:e,timeline:t.timeline,duration:t.duration,resolvedUri:La(i.baseUrl||"",e),map:o,number:t.number}})},Ma="INVALID_NUMBER_OF_PERIOD",Ba="DASH_EMPTY_MANIFEST",Na="DASH_INVALID_XML",ja="NO_BASE_URL",Fa="SEGMENT_TIME_UNSPECIFIED",Va="UNSUPPORTED_UTC_TIMING_SCHEME",Ha=function(u,t){var e=u.duration,i=u.segmentUrls,n=void 0===i?[]:i;if(!e&&!t||e&&t)throw new Error(Fa);var r,a=n.map(function(t){return i=t,n=(e=u).baseUrl,r=e.initialization,s=Oa({baseUrl:n,source:(a=void 0===r?{}:r).sourceURL,range:a.range}),(o=Oa({baseUrl:n,source:i.media,range:i.mediaRange})).map=s,o;var e,i,n,r,a,s,o});return e&&(r=xa(u)),t&&(r=Pa(u,t)),r.map(function(t,e){if(a[e]){var i=a[e];return i.timeline=t.timeline,i.duration=t.duration,i.number=t.number,i}}).filter(function(t){return t})},qa=function(t){var e=t.baseUrl,i=t.initialization,n=void 0===i?{}:i,r=t.sourceDuration,a=t.timescale,s=void 0===a?1:a,o=t.indexRange,u=void 0===o?"":o,l=t.duration;if(!e)throw new Error(ja);var c=Oa({baseUrl:e,source:n.sourceURL,range:n.range}),h=Oa({baseUrl:e,source:e,range:u});if(h.map=c,l){var d=xa(t);d.length&&(h.duration=d[0].duration,h.timeline=d[0].timeline)}else r&&(h.duration=r/s,h.timeline=0);return h.number=0,[h]},za=function(t){var e,i,n=t.attributes,r=t.segmentInfo;if(r.template?(i=Ra,e=Ta(n,r.template)):r.base?(i=qa,e=Ta(n,r.base)):r.list&&(i=Ha,e=Ta(n,r.list)),!i)return{attributes:n};var a=i(e,r.timeline);if(e.duration){var s=e,o=s.duration,u=s.timescale,l=void 0===u?1:u;e.duration=o/l}else a.length?e.duration=a.reduce(function(t,e){return Math.max(t,Math.ceil(e.duration))},0):e.duration=0;return{attributes:e,segments:a}},Wa=function(t,e){return ka(t.childNodes).filter(function(t){return t.tagName===e})},Ga=function(t){return t.textContent.trim()},Xa=function(t){var e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!e)return 0;var i=e.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},Ya={mediaPresentationDuration:function(t){return Xa(t)},availabilityStartTime:function(t){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=t)&&(e+="Z"),Date.parse(e)/1e3;var e},minimumUpdatePeriod:function(t){return Xa(t)},timeShiftBufferDepth:function(t){return Xa(t)},start:function(t){return Xa(t)},width:function(t){return parseInt(t,10)},height:function(t){return parseInt(t,10)},bandwidth:function(t){return parseInt(t,10)},startNumber:function(t){return parseInt(t,10)},timescale:function(t){return parseInt(t,10)},duration:function(t){var e=parseInt(t,10);return isNaN(e)?Xa(t):e},d:function(t){return parseInt(t,10)},t:function(t){return parseInt(t,10)},r:function(t){return parseInt(t,10)},DEFAULT:function(t){return t}},$a=function(t){return t&&t.attributes?ka(t.attributes).reduce(function(t,e){var i=Ya[e.name]||Ya.DEFAULT;return t[e.name]=i(e.value),t},{}):{}};var Ka,Qa,Ja,Za,ts,es={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},is=function(t,i){return i.length?Sa(t.map(function(e){return i.map(function(t){return La(e,Ga(t))})})):t},ns=function(t){var e=Wa(t,"SegmentTemplate")[0],i=Wa(t,"SegmentList")[0],n=i&&Wa(i,"SegmentURL").map(function(t){return Ta({tag:"SegmentURL"},$a(t))}),r=Wa(t,"SegmentBase")[0],a=i||e,s=a&&Wa(a,"SegmentTimeline")[0],o=i||r||e,u=o&&Wa(o,"Initialization")[0],l=e&&$a(e);l&&u?l.initialization=u&&$a(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,timeline:s&&Wa(s,"S").map(function(t){return $a(t)}),list:i&&Ta($a(i),{segmentUrls:n,initialization:$a(u)}),base:r&&Ta($a(r),{initialization:$a(u)})};return Object.keys(c).forEach(function(t){c[t]||delete c[t]}),c},rs=function(t){return t.reduce(function(t,e){var i=$a(e),n=es[i.schemeIdUri];if(n){t[n]={attributes:i};var r=Wa(e,"cenc:pssh")[0];if(r){var a=Ga(r),s=a&&function(t){for(var e=v.atob(t),i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i}(a);t[n].pssh=s}}return t},{})},as=function(p,f,m){return function(t){var e=$a(t),i=is(f,Wa(t,"BaseURL")),n=Wa(t,"Role")[0],r={role:$a(n)},a=Ta(p,e,r),s=rs(Wa(t,"ContentProtection"));Object.keys(s).length&&(a=Ta(a,{contentProtection:s}));var o,u,l,c=ns(t),h=Wa(t,"Representation"),d=Ta(m,c);return Sa(h.map((o=a,u=i,l=d,function(t){var e=Wa(t,"BaseURL"),i=is(u,e),n=Ta(o,$a(t)),r=ns(t);return i.map(function(t){return{segmentInfo:Ta(l,r),attributes:Ta(n,{baseUrl:t})}})})))}},ss=function(t,e){void 0===e&&(e={});var i=e,n=i.manifestUri,r=void 0===n?"":n,a=i.NOW,s=void 0===a?Date.now():a,o=i.clientOffset,u=void 0===o?0:o,l=Wa(t,"Period");if(!l.length)throw new Error(Ma);var c,h,d=$a(t),p=is([r],Wa(t,"BaseURL"));return d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=s,d.clientOffset=u,Sa(l.map((c=d,h=p,function(t,e){var i=is(h,Wa(t,"BaseURL")),n=$a(t),r=parseInt(n.id,10),a=v.isNaN(r)?e:r,s=Ta(c,{periodIndex:a}),o=Wa(t,"AdaptationSet"),u=ns(t);return Sa(o.map(as(s,i,u)))})))},os=function(t){if(""===t)throw new Error(Ba);var e=(new v.DOMParser).parseFromString(t,"application/xml"),i=e&&"MPD"===e.documentElement.tagName?e.documentElement:null;if(!i||i&&0<i.getElementsByTagName("parsererror").length)throw new Error(Na);return i},us=function(t,e){return function(t){var e;if(!t.length)return{};var i=t[0].attributes,n=i.sourceDuration,r=i.minimumUpdatePeriod,a=void 0===r?0:r,s=wa(t.filter(function(t){var e=t.attributes;return"video/mp4"===e.mimeType||"video"===e.contentType})).map(Ca),o=wa(t.filter(function(t){var e=t.attributes;return"audio/mp4"===e.mimeType||"audio"===e.contentType})),u=t.filter(function(t){var e=t.attributes;return"text/vtt"===e.mimeType||"text"===e.contentType}),l={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(e={AUDIO:{},VIDEO:{}},e["CLOSED-CAPTIONS"]={},e.SUBTITLES={},e),uri:"",duration:n,playlists:s,minimumUpdatePeriod:1e3*a};return o.length&&(l.mediaGroups.AUDIO.audio=o.reduce(function(t,e){var i,n,r,a,s,o=e.attributes.role&&e.attributes.role.value||"main",u=e.attributes.lang||"",l="main";return u&&(l=e.attributes.lang+" ("+o+")"),t[l]&&t[l].playlists[0].attributes.BANDWIDTH>e.attributes.bandwidth||(t[l]={language:u,autoselect:!0,default:"main"===o,playlists:[(i=e,r=i.attributes,a=i.segments,s={attributes:(n={NAME:r.id,BANDWIDTH:r.bandwidth,CODECS:r.codecs},n["PROGRAM-ID"]=1,n),uri:"",endList:"static"===(r.type||"static"),timeline:r.periodIndex,resolvedUri:"",targetDuration:r.duration,segments:a,mediaSequence:a.length?a[0].number:1},r.contentProtection&&(s.contentProtection=r.contentProtection),s)],uri:""}),t},{})),u.length&&(l.mediaGroups.SUBTITLES.subs=u.reduce(function(t,e){var i,n,r,a,s=e.attributes.lang||"text";return t[s]||(t[s]={language:s,default:!1,autoselect:!1,playlists:[(i=e,r=i.attributes,a=i.segments,"undefined"==typeof a&&(a=[{uri:r.baseUrl,timeline:r.periodIndex,resolvedUri:r.baseUrl||"",duration:r.sourceDuration,number:0}],r.duration=r.sourceDuration),{attributes:(n={NAME:r.id,BANDWIDTH:r.bandwidth},n["PROGRAM-ID"]=1,n),uri:"",endList:"static"===(r.type||"static"),timeline:r.periodIndex,resolvedUri:r.baseUrl||"",targetDuration:r.duration,segments:a,mediaSequence:a.length?a[0].number:1})],uri:""}),t},{})),l}(ss(os(t),e).map(za))},ls=function(t){return function(t){var e=Wa(t,"UTCTiming")[0];if(!e)return null;var i=$a(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Va)}return i}(os(t))},cs=function(t){return t>>>0};Ja=function(t){return Ka(t,["moov","trak"]).reduce(function(t,e){var i,n,r,a,s;return(i=Ka(e,["tkhd"])[0])?(n=i[0],a=cs(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(s=Ka(e,["mdia","mdhd"])[0])?(r=0===(n=s[0])?12:20,t[a]=cs(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),t):null):null},{})},Za=function(r,t){var e,i,n;return e=Ka(t,["moof","traf"]),i=[].concat.apply([],e.map(function(n){return Ka(n,["tfhd"]).map(function(t){var e,i;return e=cs(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),i=r[e]||9e4,(Ka(n,["tfdt"]).map(function(t){var e,i;return e=t[0],i=cs(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),1===e&&(i*=Math.pow(2,32),i+=cs(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),i})[0]||1/0)/i})})),n=Math.min.apply(null,i),isFinite(n)?n:0},ts=function(t){var e=Ka(t,["moov","trak"]),o=[];return e.forEach(function(t){var e=Ka(t,["mdia","hdlr"]),s=Ka(t,["tkhd"]);e.forEach(function(t,e){var i,n,r=Qa(t.subarray(8,12)),a=s[e];"vide"===r&&(n=0===(i=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0)?i.getUint32(12):i.getUint32(20),o.push(n))})}),o};var hs,ds,ps,fs,ms,gs,ys,vs,_s,bs,Ts,Ss,ks,ws,Cs,Es,As,Ls,Os,Ps,Us,xs,Is,Ds,Rs,Ms,Bs,Ns,js,Fs,Vs,Hs,qs,zs,Ws,Gs,Xs,Ys,$s,Ks,Qs={findBox:Ka=function(t,e){var i,n,r,a,s,o=[];if(!e.length)return null;for(i=0;i<t.byteLength;)n=cs(t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3]),r=Qa(t.subarray(i+4,i+8)),a=1<n?i+n:t.byteLength,r===e[0]&&(1===e.length?o.push(t.subarray(i+8,a)):(s=Ka(t.subarray(i+8,a),e.slice(1))).length&&(o=o.concat(s))),i=a;return o},parseType:Qa=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},timescale:Ja,startTime:Za,videoTrackIds:ts},Js=Math.pow(2,32)-1;!function(){var t;if(xs={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(t in xs)xs.hasOwnProperty(t)&&(xs[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);Is=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),Rs=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),Ds=new Uint8Array([0,0,0,1]),Ms=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Bs=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),Ns={video:Ms,audio:Bs},Vs=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Fs=new Uint8Array([0,0,0,0,0,0,0,0]),Hs=new Uint8Array([0,0,0,0,0,0,0,0]),qs=Hs,zs=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ws=Hs,js=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),hs=function(t){var e,i,n=[],r=0;for(e=1;e<arguments.length;e++)n.push(arguments[e]);for(e=n.length;e--;)r+=n[e].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(t,4),e=0,r=8;e<n.length;e++)i.set(n[e],r),r+=n[e].byteLength;return i},ds=function(){return hs(xs.dinf,hs(xs.dref,Vs))},ps=function(t){return hs(xs.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,t.audioobjecttype<<3|t.samplingfrequencyindex>>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},Cs=function(t){return hs(xs.hdlr,Ns[t])},ws=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),hs(xs.mdhd,e)},ks=function(t){return hs(xs.mdia,ws(t),Cs(t.type),gs(t))},ms=function(t){return hs(xs.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},gs=function(t){return hs(xs.minf,"video"===t.type?hs(xs.vmhd,js):hs(xs.smhd,Fs),ds(),As(t))},ys=function(t,e){for(var i=[],n=e.length;n--;)i[n]=Os(e[n]);return hs.apply(null,[xs.moof,ms(t)].concat(i))},vs=function(t){for(var e=t.length,i=[];e--;)i[e]=Ts(t[e]);return hs.apply(null,[xs.moov,bs(4294967295)].concat(i).concat(_s(t)))},_s=function(t){for(var e=t.length,i=[];e--;)i[e]=Ps(t[e]);return hs.apply(null,[xs.mvex].concat(i))},bs=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,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 hs(xs.mvhd,e)},Es=function(t){var e,i,n=t.samples||[],r=new Uint8Array(4+n.length);for(i=0;i<n.length;i++)e=n[i].flags,r[i+4]=e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy;return hs(xs.sdtp,r)},As=function(t){return hs(xs.stbl,Ls(t),hs(xs.stts,Ws),hs(xs.stsc,qs),hs(xs.stsz,zs),hs(xs.stco,Hs))},Ls=function(t){return hs(xs.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===t.type?Gs(t):Xs(t))},Gs=function(t){var e,i=t.sps||[],n=t.pps||[],r=[],a=[];for(e=0;e<i.length;e++)r.push((65280&i[e].byteLength)>>>8),r.push(255&i[e].byteLength),r=r.concat(Array.prototype.slice.call(i[e]));for(e=0;e<n.length;e++)a.push((65280&n[e].byteLength)>>>8),a.push(255&n[e].byteLength),a=a.concat(Array.prototype.slice.call(n[e]));return hs(xs.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,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),hs(xs.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([i.length]).concat(r).concat([n.length]).concat(a))),hs(xs.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},Xs=function(t){return hs(xs.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),ps(t))},Ss=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return hs(xs.tkhd,e)},Os=function(t){var e,i,n,r,a,s;return e=hs(xs.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(t.baseMediaDecodeTime/(Js+1)),s=Math.floor(t.baseMediaDecodeTime%(Js+1)),i=hs(xs.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===t.type?(n=Us(t,92),hs(xs.traf,e,i,n)):(r=Es(t),n=Us(t,r.length+92),hs(xs.traf,e,i,n,r))},Ts=function(t){return t.duration=t.duration||4294967295,hs(xs.trak,Ss(t),ks(t))},Ps=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),hs(xs.trex,e)},Ks=function(t,e){var i=0,n=0,r=0,a=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(r=4),void 0!==t[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},$s=function(t,e){var i,n,r,a;for(e+=20+16*(n=t.samples||[]).length,i=Ks(n,e),a=0;a<n.length;a++)r=n[a],i=i.concat([(4278190080&r.duration)>>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size,r.flags.isLeading<<2|r.flags.dependsOn,r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,61440&r.flags.degradationPriority,15&r.flags.degradationPriority,(4278190080&r.compositionTimeOffset)>>>24,(16711680&r.compositionTimeOffset)>>>16,(65280&r.compositionTimeOffset)>>>8,255&r.compositionTimeOffset]);return hs(xs.trun,new Uint8Array(i))},Ys=function(t,e){var i,n,r,a;for(e+=20+8*(n=t.samples||[]).length,i=Ks(n,e),a=0;a<n.length;a++)r=n[a],i=i.concat([(4278190080&r.duration)>>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size]);return hs(xs.trun,new Uint8Array(i))},Us=function(t,e){return"audio"===t.type?Ys(t,e):$s(t,e)};var Zs={ftyp:fs=function(){return hs(xs.ftyp,Is,Ds,Is,Rs)},mdat:function(t){return hs(xs.mdat,t)},moof:ys,moov:vs,initSegment:function(t){var e,i=fs(),n=vs(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},to=function(){this.init=function(){var a={};this.on=function(t,e){a[t]||(a[t]=[]),a[t]=a[t].concat(e)},this.off=function(t,e){var i;return!!a[t]&&(i=a[t].indexOf(e),a[t]=a[t].slice(),a[t].splice(i,1),-1<i)},this.trigger=function(t){var e,i,n,r;if(e=a[t])if(2===arguments.length)for(n=e.length,i=0;i<n;++i)e[i].call(this,arguments[1]);else{for(r=[],i=arguments.length,i=1;i<arguments.length;++i)r.push(arguments[i]);for(n=e.length,i=0;i<n;++i)e[i].apply(this,r)}},this.dispose=function(){a={}}}};to.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},to.prototype.push=function(t){this.trigger("data",t)},to.prototype.flush=function(t){this.trigger("done",t)};var eo=to,io=function(t){var e,i,n=[],r=[];for(e=n.byteLength=0;e<t.length;e++)"access_unit_delimiter_rbsp"===(i=t[e]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.push(n),r},no=function(t){var e,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=t[0].pts,n.dts=t[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=t[0].pts,r.dts=t[0].dts,e=0;e<t.length;e++)(i=t[e]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},ro=function(t){var e;return!t[0][0].keyFrame&&1<t.length&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},ao=function(t,e){var i,n,r,a,s,o,u,l=e||0,c=[];for(i=0;i<t.length;i++)for(a=t[i],n=0;n<a.length;n++)s=a[n],o=s,u=void 0,(u={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}).dataOffset=l,u.compositionTimeOffset=o.pts-o.dts,u.duration=o.duration,u.size=4*o.length,u.size+=o.byteLength,o.keyFrame&&(u.flags.dependsOn=2,u.flags.isNonSyncSample=0),l+=(r=u).size,c.push(r);return c},so=function(t){var e,i,n,r,a,s,o=0,u=t.byteLength,l=t.nalCount,c=new Uint8Array(u+4*l),h=new DataView(c.buffer);for(e=0;e<t.length;e++)for(r=t[e],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],h.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},oo=function(t){delete t.minSegmentDts,delete t.maxSegmentDts,delete t.minSegmentPts,delete t.maxSegmentPts},uo=function(t,e){var i,n=t.minSegmentDts;return e||(n-=t.timelineStartInfo.dts),i=t.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===t.type&&(i*=t.samplerate/9e4,i=Math.floor(i)),i},lo=function(t,e){"number"==typeof e.pts&&(void 0===t.timelineStartInfo.pts&&(t.timelineStartInfo.pts=e.pts),void 0===t.minSegmentPts?t.minSegmentPts=e.pts:t.minSegmentPts=Math.min(t.minSegmentPts,e.pts),void 0===t.maxSegmentPts?t.maxSegmentPts=e.pts:t.maxSegmentPts=Math.max(t.maxSegmentPts,e.pts)),"number"==typeof e.dts&&(void 0===t.timelineStartInfo.dts&&(t.timelineStartInfo.dts=e.dts),void 0===t.minSegmentDts?t.minSegmentDts=e.dts:t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),void 0===t.maxSegmentDts?t.maxSegmentDts=e.dts:t.maxSegmentDts=Math.max(t.maxSegmentDts,e.dts))},co=function(t){for(var e=0,i={payloadType:-1,payloadSize:0},n=0,r=0;e<t.byteLength&&128!==t[e];){for(;255===t[e];)n+=255,e++;for(n+=t[e++];255===t[e];)r+=255,e++;if(r+=t[e++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=t.subarray(e,e+r);break}e+=r,r=n=0}return i},ho=function(t){return 181!==t.payload[0]?null:49!=(t.payload[1]<<8|t.payload[2])?null:"GA94"!==String.fromCharCode(t.payload[3],t.payload[4],t.payload[5],t.payload[6])?null:3!==t.payload[7]?null:t.payload.subarray(8,t.payload.length-1)},po=function(t,e){var i,n,r,a,s=[];if(!(64&e[0]))return s;for(n=31&e[0],i=0;i<n;i++)a={type:3&e[2+(r=3*i)],pts:t},4&e[r+2]&&(a.ccData=e[r+3]<<8|e[r+4],s.push(a));return s},fo=function(t){for(var e,i,n=t.byteLength,r=[],a=1;a<n-2;)0===t[a]&&0===t[a+1]&&3===t[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return t;e=n-r.length,i=new Uint8Array(e);var s=0;for(a=0;a<e;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=t[s];return i},mo=4,go=function t(){t.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new To(0,0),new To(0,1),new To(1,0),new To(1,1)],this.reset(),this.ccStreams_.forEach(function(t){t.on("data",this.trigger.bind(this,"data")),t.on("done",this.trigger.bind(this,"done"))},this)};(go.prototype=new eo).push=function(t){var e,i,n;if("sei_rbsp"===t.nalUnitType&&(e=co(t.escapedRBSP)).payloadType===mo&&(i=ho(e)))if(t.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(t.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=po(t.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==t.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=t.dts}},go.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(t,e){t.presortIndex=e}),this.captionPackets_.sort(function(t,e){return t.pts===e.pts?t.presortIndex-e.presortIndex:t.pts-e.pts}),this.captionPackets_.forEach(function(t){t.type<2&&this.dispatchCea608Packet(t)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(t){t.flush()},this)):this.ccStreams_.forEach(function(t){t.flush()},this)},go.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(t){t.reset()})},go.prototype.dispatchCea608Packet=function(t){this.setsChannel1Active(t)?this.activeCea608Channel_[t.type]=0:this.setsChannel2Active(t)&&(this.activeCea608Channel_[t.type]=1),null!==this.activeCea608Channel_[t.type]&&this.ccStreams_[(t.type<<1)+this.activeCea608Channel_[t.type]].push(t)},go.prototype.setsChannel1Active=function(t){return 4096==(30720&t.ccData)},go.prototype.setsChannel2Active=function(t){return 6144==(30720&t.ccData)};var yo={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},vo=function(t){return null===t?"":(t=yo[t]||t,String.fromCharCode(t))},_o=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],bo=function(){for(var t=[],e=15;e--;)t.push("");return t},To=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,r,a;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,r=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=bo();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=bo();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=bo()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,r))a=vo((n=(3&n)<<8)|r),this[this.mode_](t.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=vo((n=(3&n)<<8)|r),this[this.mode_](t.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&r)&&this.addFormatting(t.pts,["i"]),1==(1&r)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=_o.indexOf(7968&e);"rollUp"===this.mode_&&this.setRollUp(t.pts,s),s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=vo(n),a+=vo(r),this[this.mode_](t.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};To.prototype=new eo,To.prototype.flushDisplayed=function(t){var e=this.displayed_.map(function(t){return t.trim()}).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},To.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=bo(),this.nonDisplayed_=bo(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},To.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},To.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&48<=e&&e<=63},To.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&32<=e&&e<=63},To.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&32<=e&&e<=47},To.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&33<=e&&e<=35},To.prototype.isPAC=function(t,e){return t>=this.BASE_&&t<this.BASE_+8&&64<=e&&e<=127},To.prototype.isColorPAC=function(t){return 64<=t&&t<=79||96<=t&&t<=127},To.prototype.isNormalChar=function(t){return 32<=t&&t<=127},To.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=bo(),this.displayed_=bo()),void 0!==e&&e!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[e-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===e&&(e=this.row_),this.topRow_=e-this.rollUpRows_+1},To.prototype.addFormatting=function(t,e){this.formatting_=this.formatting_.concat(e);var i=e.reduce(function(t,e){return t+"<"+e+">"},"");this[this.mode_](t,i)},To.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce(function(t,e){return t+"</"+e+">"},"");this.formatting_=[],this[this.mode_](t,e)}},To.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},To.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},To.prototype.shiftRowsUp_=function(){var t;for(t=0;t<this.topRow_;t++)this.displayed_[t]="";for(t=this.row_+1;t<15;t++)this.displayed_[t]="";for(t=this.topRow_;t<this.row_;t++)this.displayed_[t]=this.displayed_[t+1];this.displayed_[this.row_]=""},To.prototype.paintOn=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i};var So={CaptionStream:go,Cea608Stream:To},ko={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},wo=function(t,e){var i=1;for(e<t&&(i=-1);4294967296<Math.abs(e-t);)t+=8589934592*i;return t},Co=function t(e){var i,n;t.prototype.init.call(this),this.type_=e,this.push=function(t){t.type===this.type_&&(void 0===n&&(n=t.dts),t.dts=wo(t.dts,n),t.pts=wo(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.discontinuity=function(){i=n=void 0}};Co.prototype=new eo;var Eo,Ao=Co,Lo=wo,Oo=function(t,e,i){var n,r="";for(n=e;n<i;n++)r+="%"+("00"+t[n].toString(16)).slice(-2);return r},Po=function(t,e,i){return decodeURIComponent(Oo(t,e,i))},Uo=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},xo={TXXX:function(t){var e;if(3===t.data[0]){for(e=1;e<t.data.length;e++)if(0===t.data[e]){t.description=Po(t.data,1,e),t.value=Po(t.data,e+1,t.data.length).replace(/\0*$/,"");break}t.data=t.value}},WXXX:function(t){var e;if(3===t.data[0])for(e=1;e<t.data.length;e++)if(0===t.data[e]){t.description=Po(t.data,1,e),t.url=Po(t.data,e+1,t.data.length);break}},PRIV:function(t){var e,i;for(e=0;e<t.data.length;e++)if(0===t.data[e]){t.owner=(i=t.data,unescape(Oo(i,0,e)));break}t.privateData=t.data.subarray(e+1),t.data=t.privateData}};(Eo=function(t){var e,u={debug:!(!t||!t.debug),descriptor:t&&t.descriptor},l=0,c=[],h=0;if(Eo.prototype.init.call(this),this.dispatchType=ko.METADATA_STREAM_TYPE.toString(16),u.descriptor)for(e=0;e<u.descriptor.length;e++)this.dispatchType+=("00"+u.descriptor[e].toString(16)).slice(-2);this.push=function(t){var e,i,n,r,a;if("timed-metadata"===t.type)if(t.dataAlignmentIndicator&&(h=0,c.length=0),0===c.length&&(t.data.length<10||t.data[0]!=="I".charCodeAt(0)||t.data[1]!=="D".charCodeAt(0)||t.data[2]!=="3".charCodeAt(0)))u.debug;else if(c.push(t),h+=t.data.byteLength,1===c.length&&(l=Uo(t.data.subarray(6,10)),l+=10),!(h<l)){for(e={data:new Uint8Array(l),frames:[],pts:c[0].pts,dts:c[0].dts},a=0;a<l;)e.data.set(c[0].data.subarray(0,l-a),a),a+=c[0].data.byteLength,h-=c[0].data.byteLength,c.shift();i=10,64&e.data[5]&&(i+=4,i+=Uo(e.data.subarray(10,14)),l-=Uo(e.data.subarray(16,20)));do{if((n=Uo(e.data.subarray(i+4,i+8)))<1)return;if((r={id:String.fromCharCode(e.data[i],e.data[i+1],e.data[i+2],e.data[i+3]),data:e.data.subarray(i+10,i+n+10)}).key=r.id,xo[r.id]&&(xo[r.id](r),"com.apple.streaming.transportStreamTimestamp"===r.owner)){var s=r.data,o=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2;o*=4,o+=3&s[7],r.timeStamp=o,void 0===e.pts&&void 0===e.dts&&(e.pts=r.timeStamp,e.dts=r.timeStamp),this.trigger("timestamp",r)}e.frames.push(r),i+=10,i+=n}while(i<l);this.trigger("data",e)}}}).prototype=new eo;var Io,Do,Ro,Mo=Eo,Bo=Ao;(Io=function(){var r=new Uint8Array(188),a=0;Io.prototype.init.call(this),this.push=function(t){var e,i=0,n=188;for(a?((e=new Uint8Array(t.byteLength+a)).set(r.subarray(0,a)),e.set(t,a),a=0):e=t;n<e.byteLength;)71!==e[i]||71!==e[n]?(i++,n++):(this.trigger("data",e.subarray(i,n)),i+=188,n+=188);i<e.byteLength&&(r.set(e.subarray(i),0),a=e.byteLength-i)},this.flush=function(){188===a&&71===r[0]&&(this.trigger("data",r),a=0),this.trigger("done")}}).prototype=new eo,(Do=function(){var n,r,a,s;Do.prototype.init.call(this),(s=this).packetsWaitingForPmt=[],this.programMapTable=void 0,n=function(t,e){var i=0;e.payloadUnitStartIndicator&&(i+=t[i]+1),"pat"===e.type?r(t.subarray(i),e):a(t.subarray(i),e)},r=function(t,e){e.section_number=t[7],e.last_section_number=t[8],s.pmtPid=(31&t[10])<<8|t[11],e.pmtPid=s.pmtPid},a=function(t,e){var i,n;if(1&t[5]){for(s.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&t[1])<<8|t[2])-4,n=12+((15&t[10])<<8|t[11]);n<i;){var r=t[n],a=(31&t[n+1])<<8|t[n+2];r===ko.H264_STREAM_TYPE&&null===s.programMapTable.video?s.programMapTable.video=a:r===ko.ADTS_STREAM_TYPE&&null===s.programMapTable.audio?s.programMapTable.audio=a:r===ko.METADATA_STREAM_TYPE&&(s.programMapTable["timed-metadata"][a]=r),n+=5+((15&t[n+3])<<8|t[n+4])}e.programMapTable=s.programMapTable}},this.push=function(t){var e={},i=4;if(e.payloadUnitStartIndicator=!!(64&t[1]),e.pid=31&t[1],e.pid<<=8,e.pid|=t[2],1<(48&t[3])>>>4&&(i+=t[i]+1),0===e.pid)e.type="pat",n(t.subarray(i),e),this.trigger("data",e);else if(e.pid===this.pmtPid)for(e.type="pmt",n(t.subarray(i),e),this.trigger("data",e);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,i,e]):this.processPes_(t,i,e)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=ko.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=ko.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new eo,Do.STREAM_TYPES={h264:27,adts:15},(Ro=function(){var d=this,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(t,e,i){var n,r,a=new Uint8Array(t.size),s={type:e},o=0,u=0;if(t.data.length&&!(t.size<9)){for(s.trackId=t.data[0].pid,o=0;o<t.data.length;o++)r=t.data[o],a.set(r.data,u),u+=r.data.byteLength;var l,c,h;l=a,(c=s).packetLength=6+(l[4]<<8|l[5]),c.dataAlignmentIndicator=0!=(4&l[6]),192&(h=l[7])&&(c.pts=(14&l[9])<<27|(255&l[10])<<20|(254&l[11])<<12|(255&l[12])<<5|(254&l[13])>>>3,c.pts*=4,c.pts+=(6&l[13])>>>1,c.dts=c.pts,64&h&&(c.dts=(14&l[14])<<27|(255&l[15])<<20|(254&l[16])<<12|(255&l[17])<<5|(254&l[18])>>>3,c.dts*=4,c.dts+=(6&l[18])>>>1)),c.data=l.subarray(9+l[8]),n="video"===e||s.packetLength<=t.size,(i||n)&&(t.size=0,t.data.length=0),n&&d.trigger("data",s)}};Ro.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var t,e;switch(i.streamType){case ko.H264_STREAM_TYPE:case ko.H264_STREAM_TYPE:t=n,e="video";break;case ko.ADTS_STREAM_TYPE:t=r,e="audio";break;case ko.METADATA_STREAM_TYPE:t=a,e="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(i),t.size+=i.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},e=i.programMapTable;null!==e.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),d.trigger("data",t)}})[i.type]()},this.flush=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata"),this.trigger("done")}}).prototype=new eo;var No={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Io,TransportParseStream:Do,ElementaryStream:Ro,TimestampRolloverStream:Bo,CaptionStream:So.CaptionStream,Cea608Stream:So.Cea608Stream,MetadataStream:Mo};for(var jo in ko)ko.hasOwnProperty(jo)&&(No[jo]=ko[jo]);var Fo,Vo=No,Ho=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Fo=function(){var l;Fo.prototype.init.call(this),this.push=function(t){var e,i,n,r,a,s,o=0,u=0;if("audio"===t.type)for(l?(r=l,(l=new Uint8Array(r.byteLength+t.data.byteLength)).set(r),l.set(t.data,r.byteLength)):l=t.data;o+5<l.length;)if(255===l[o]&&240==(246&l[o+1])){if(i=2*(1&~l[o+1]),e=(3&l[o+3])<<11|l[o+4]<<3|(224&l[o+5])>>5,s=9e4*(a=1024*(1+(3&l[o+6])))/Ho[(60&l[o+2])>>>2],n=o+e,l.byteLength<n)return;if(this.trigger("data",{pts:t.pts+u*s,dts:t.dts+u*s,sampleCount:a,audioobjecttype:1+(l[o+2]>>>6&3),channelcount:(1&l[o+2])<<2|(192&l[o+3])>>>6,samplerate:Ho[(60&l[o+2])>>>2],samplingfrequencyindex:(60&l[o+2])>>>2,samplesize:16,data:l.subarray(o+7+i,n)}),l.byteLength===n)return void(l=void 0);u++,l=l.subarray(n)}else o++},this.flush=function(){this.trigger("done")}}).prototype=new eo;var qo,zo,Wo,Go=Fo,Xo=function(n){var r=n.byteLength,a=0,s=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+s},this.loadWord=function(){var t=n.byteLength-r,e=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");e.set(n.subarray(t,t+i)),a=new DataView(e.buffer).getUint32(0),s=8*i,r-=i},this.skipBits=function(t){var e;t<s||(t-=s,t-=8*(e=Math.floor(t/8)),r-=e,this.loadWord()),a<<=t,s-=t},this.readBits=function(t){var e=Math.min(s,t),i=a>>>32-e;return 0<(s-=e)?a<<=e:0<r&&this.loadWord(),0<(e=t-e)?i<<e|this.readBits(e):i},this.skipLeadingZeros=function(){var t;for(t=0;t<s;++t)if(0!=(a&2147483648>>>t))return a<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(zo=function(){var i,n,r=0;zo.prototype.init.call(this),this.push=function(t){var e;for(n=n?((e=new Uint8Array(n.byteLength+t.data.byteLength)).set(n),e.set(t.data,n.byteLength),e):t.data;r<n.byteLength-3;r++)if(1===n[r+2]){i=r+5;break}for(;i<n.byteLength;)switch(n[i]){case 0:if(0!==n[i-1]){i+=2;break}if(0!==n[i-2]){i++;break}for(r+3!==i-2&&this.trigger("data",n.subarray(r+3,i-2));1!==n[++i]&&i<n.length;);r=i-2,i+=3;break;case 1:if(0!==n[i-1]||0!==n[i-2]){i+=3;break}this.trigger("data",n.subarray(r+3,i-2)),r=i-2,i+=3;break;default:i+=3}n=n.subarray(r),i-=r,r=0},this.flush=function(){n&&3<n.byteLength&&this.trigger("data",n.subarray(r+3)),n=null,r=0,this.trigger("done")}}).prototype=new eo,Wo={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(qo=function(){var i,n,r,a,s,o,_,e=new zo;qo.prototype.init.call(this),(i=this).push=function(t){"video"===t.type&&(n=t.trackId,r=t.pts,a=t.dts,e.push(t))},e.on("data",function(t){var e={trackId:n,pts:r,dts:a,data:t};switch(31&t[0]){case 5:e.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:e.nalUnitType="sei_rbsp",e.escapedRBSP=s(t.subarray(1));break;case 7:e.nalUnitType="seq_parameter_set_rbsp",e.escapedRBSP=s(t.subarray(1)),e.config=o(e.escapedRBSP);break;case 8:e.nalUnitType="pic_parameter_set_rbsp";break;case 9:e.nalUnitType="access_unit_delimiter_rbsp"}i.trigger("data",e)}),e.on("done",function(){i.trigger("done")}),this.flush=function(){e.flush()},_=function(t,e){var i,n=8,r=8;for(i=0;i<t;i++)0!==r&&(r=(n+e.readExpGolomb()+256)%256),n=0===r?n:r},s=function(t){for(var e,i,n=t.byteLength,r=[],a=1;a<n-2;)0===t[a]&&0===t[a+1]&&3===t[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return t;e=n-r.length,i=new Uint8Array(e);var s=0;for(a=0;a<e;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=t[s];return i},o=function(t){var e,i,n,r,a,s,o,u,l,c,h,d,p,f=0,m=0,g=0,y=0,v=1;if(i=(e=new Xo(t)).readUnsignedByte(),r=e.readUnsignedByte(),n=e.readUnsignedByte(),e.skipUnsignedExpGolomb(),Wo[i]&&(3===(a=e.readUnsignedExpGolomb())&&e.skipBits(1),e.skipUnsignedExpGolomb(),e.skipUnsignedExpGolomb(),e.skipBits(1),e.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)e.readBoolean()&&_(p<6?16:64,e);if(e.skipUnsignedExpGolomb(),0===(s=e.readUnsignedExpGolomb()))e.readUnsignedExpGolomb();else if(1===s)for(e.skipBits(1),e.skipExpGolomb(),e.skipExpGolomb(),o=e.readUnsignedExpGolomb(),p=0;p<o;p++)e.skipExpGolomb();if(e.skipUnsignedExpGolomb(),e.skipBits(1),u=e.readUnsignedExpGolomb(),l=e.readUnsignedExpGolomb(),0===(c=e.readBits(1))&&e.skipBits(1),e.skipBits(1),e.readBoolean()&&(f=e.readUnsignedExpGolomb(),m=e.readUnsignedExpGolomb(),g=e.readUnsignedExpGolomb(),y=e.readUnsignedExpGolomb()),e.readBoolean()&&e.readBoolean()){switch(e.readUnsignedByte()){case 1:d=[1,1];break;case 2:d=[12,11];break;case 3:d=[10,11];break;case 4:d=[16,11];break;case 5:d=[40,33];break;case 6:d=[24,11];break;case 7:d=[20,11];break;case 8:d=[32,11];break;case 9:d=[80,33];break;case 10:d=[18,11];break;case 11:d=[15,11];break;case 12:d=[64,33];break;case 13:d=[160,99];break;case 14:d=[4,3];break;case 15:d=[3,2];break;case 16:d=[2,1];break;case 255:d=[e.readUnsignedByte()<<8|e.readUnsignedByte(),e.readUnsignedByte()<<8|e.readUnsignedByte()]}d&&(v=d[0]/d[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(u+1)-2*f-2*m)*v),height:(2-c)*(l+1)*16-2*g-2*y}}}).prototype=new eo;var Yo,$o={H264Stream:qo,NalByteStream:zo};(Yo=function(){var o=new Uint8Array,u=0;Yo.prototype.init.call(this),this.setTimestamp=function(t){u=t},this.parseId3TagSize=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&t[e+5])>>4?i+20:i+10},this.parseAdtsSize=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},this.push=function(t){var e,i,n,r,a=0,s=0;for(o.length?(r=o.length,(o=new Uint8Array(t.byteLength+r)).set(o.subarray(0,r)),o.set(t,r)):o=t;3<=o.length-s;)if(o[s]!=="I".charCodeAt(0)||o[s+1]!=="D".charCodeAt(0)||o[s+2]!=="3".charCodeAt(0))if(!0&o[s]&&240==(240&o[s+1])){if(o.length-s<7)break;if((a=this.parseAdtsSize(o,s))>o.length)break;n={type:"audio",data:o.subarray(s,s+a),pts:u,dts:u},this.trigger("data",n),s+=a}else s++;else{if(o.length-s<10)break;if((a=this.parseId3TagSize(o,s))>o.length)break;i={type:"timed-metadata",data:o.subarray(s,s+a)},this.trigger("data",i),s+=a}e=o.length-s,o=0<e?o.subarray(s):new Uint8Array}}).prototype=new eo;var Ko,Qo,Jo,Zo,tu,eu,iu,nu=Yo,ru=[33,16,5,32,164,27],au=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],su=function(t){for(var e=[];t--;)e.push(0);return e},ou={96e3:[ru,[227,64],su(154),[56]],88200:[ru,[231],su(170),[56]],64e3:[ru,[248,192],su(240),[56]],48e3:[ru,[255,192],su(268),[55,148,128],su(54),[112]],44100:[ru,[255,192],su(268),[55,163,128],su(84),[112]],32e3:[ru,[255,192],su(268),[55,234],su(226),[112]],24e3:[ru,[255,192],su(268),[55,255,128],su(268),[111,112],su(126),[224]],16e3:[ru,[255,192],su(268),[55,255,128],su(268),[111,255],su(269),[223,108],su(195),[1,192]],12e3:[au,su(268),[3,127,248],su(268),[6,255,240],su(268),[13,255,224],su(268),[27,253,128],su(259),[56]],11025:[au,su(268),[3,127,248],su(268),[6,255,240],su(268),[13,255,224],su(268),[27,255,192],su(268),[55,175,128],su(108),[112]],8e3:[au,su(268),[3,121,16],su(47),[7]]},uu=(Ko=ou,Object.keys(Ko).reduce(function(t,e){return t[e]=new Uint8Array(Ko[e].reduce(function(t,e){return t.concat(e)},[])),t},{}));eu=function(t,e){return Qo(tu(t,e))},iu=function(t,e){return Jo(Zo(t),e)};Qo=function(t){return 9e4*t},Jo=function(t,e){return t*e},Zo=function(t){return t/9e4},tu=function(t,e){return t/e};var lu,cu,hu,du,pu,fu,mu,gu=eu,yu=iu,vu=$o.H264Stream,_u=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],bu=["width","height","profileIdc","levelIdc","profileCompatibility"];pu=function(t){return t[0]==="I".charCodeAt(0)&&t[1]==="D".charCodeAt(0)&&t[2]==="3".charCodeAt(0)},fu=function(t,e){var i;if(t.length!==e.length)return!1;for(i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0},mu=function(t){var e,i=0;for(e=0;e<t.length;e++)i+=t[e].data.byteLength;return i},(cu=function(r,a){var s=[],o=0,e=0,l=0,c=1/0;a=a||{},cu.prototype.init.call(this),this.push=function(e){lo(r,e),r&&_u.forEach(function(t){r[t]=e[t]}),s.push(e)},this.setEarliestDts=function(t){e=t-r.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(t){c=t},this.setAudioAppendStart=function(t){l=t},this.flush=function(){var t,e,i,n;0!==s.length&&(t=this.trimAdtsFramesByEarliestDts_(s),r.baseMediaDecodeTime=uo(r,a.keepOriginalTimestamps),this.prefixWithSilence_(r,t),r.samples=this.generateSampleTable_(t),i=Zs.mdat(this.concatenateFrameData_(t)),s=[],e=Zs.moof(o,[r]),n=new Uint8Array(e.byteLength+i.byteLength),o++,n.set(e),n.set(i,e.byteLength),oo(r),this.trigger("data",{track:r,boxes:n})),this.trigger("done","AudioSegmentStream")},this.prefixWithSilence_=function(t,e){var i,n,r,a,s=0,o=0,u=0;if(e.length&&(i=gu(t.baseMediaDecodeTime,t.samplerate),n=Math.ceil(9e4/(t.samplerate/1024)),l&&c&&(s=i-Math.max(l,c),u=(o=Math.floor(s/n))*n),!(o<1||45e3<u))){for((r=uu[t.samplerate])||(r=e[0].data),a=0;a<o;a++)e.splice(a,0,{data:r});t.baseMediaDecodeTime-=Math.floor(yu(u,t.samplerate))}},this.trimAdtsFramesByEarliestDts_=function(t){return r.minSegmentDts>=e?t:(r.minSegmentDts=1/0,t.filter(function(t){return t.dts>=e&&(r.minSegmentDts=Math.min(r.minSegmentDts,t.dts),r.minSegmentPts=r.minSegmentDts,!0)}))},this.generateSampleTable_=function(t){var e,i,n=[];for(e=0;e<t.length;e++)i=t[e],n.push({size:i.data.byteLength,duration:1024});return n},this.concatenateFrameData_=function(t){var e,i,n=0,r=new Uint8Array(mu(t));for(e=0;e<t.length;e++)i=t[e],r.set(i.data,n),n+=i.data.byteLength;return r}}).prototype=new eo,(lu=function(o,u){var e,i,l=0,c=[],h=[];u=u||{},lu.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(t){lo(o,t),"seq_parameter_set_rbsp"!==t.nalUnitType||e||(e=t.config,o.sps=[t.data],bu.forEach(function(t){o[t]=e[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.data,o.pps=[t.data]),c.push(t)},this.flush=function(){for(var t,e,i,n,r,a;c.length&&"access_unit_delimiter_rbsp"!==c[0].nalUnitType;)c.shift();if(0===c.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(t=io(c),(i=no(t))[0][0].keyFrame||((e=this.getGopForFusion_(c[0],o))?(i.unshift(e),i.byteLength+=e.byteLength,i.nalCount+=e.nalCount,i.pts=e.pts,i.dts=e.dts,i.duration+=e.duration):i=ro(i)),h.length){var s;if(!(s=u.alignGopsAtEnd?this.alignGopsAtEnd_(i):this.alignGopsAtStart_(i)))return this.gopCache_.unshift({gop:i.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),c=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");oo(o),i=s}lo(o,i),o.samples=ao(i),r=Zs.mdat(so(i)),o.baseMediaDecodeTime=uo(o,u.keepOriginalTimestamps),this.trigger("processedGopsInfo",i.map(function(t){return{pts:t.pts,dts:t.dts,byteLength:t.byteLength}})),this.gopCache_.unshift({gop:i.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),c=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),n=Zs.moof(l,[o]),a=new Uint8Array(n.byteLength+r.byteLength),l++,a.set(n),a.set(r,n.byteLength),this.trigger("data",{track:o,boxes:a}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){oo(o),i=e=void 0},this.getGopForFusion_=function(t){var e,i,n,r,a,s=1/0;for(a=0;a<this.gopCache_.length;a++)n=(r=this.gopCache_[a]).gop,o.pps&&fu(o.pps[0],r.pps[0])&&o.sps&&fu(o.sps[0],r.sps[0])&&(n.dts<o.timelineStartInfo.dts||-1e4<=(e=t.dts-n.dts-n.duration)&&e<=45e3&&(!i||e<s)&&(i=r,s=e));return i?i.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,r,a,s,o,u;for(a=t.byteLength,s=t.nalCount,o=t.duration,e=i=0;e<h.length&&i<t.length&&(n=h[e],r=t[i],n.pts!==r.pts);)r.pts>n.pts?e++:(i++,a-=r.byteLength,s-=r.nalCount,o-=r.duration);return 0===i?t:i===t.length?null:((u=t.slice(i)).byteLength=a,u.duration=o,u.nalCount=s,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(t){var e,i,n,r,a,s,o;for(e=h.length-1,i=t.length-1,a=null,s=!1;0<=e&&0<=i;){if(n=h[e],r=t[i],n.pts===r.pts){s=!0;break}n.pts>r.pts?e--:(e===h.length-1&&(a=i),i--)}if(!s&&null===a)return null;if(0===(o=s?i:a))return t;var u=t.slice(o),l=u.reduce(function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t},{byteLength:0,duration:0,nalCount:0});return u.byteLength=l.byteLength,u.duration=l.duration,u.nalCount=l.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(t){h=t}}).prototype=new eo,(du=function(t,e){this.numberOfTracks=0,this.metadataStream=e,"undefined"!=typeof t.remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,du.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBoxes.push(t.boxes),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track),void("audio"===t.track.type&&(this.audioTrack=t.track)))}}).prototype=new eo,du.prototype.flush=function(t){var e,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==t&&"AudioSegmentStream"!==t)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,bu.forEach(function(t){s.info[t]=this.videoTrack[t]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,_u.forEach(function(t){s.info[t]=this.audioTrack[t]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=Zs.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(e=this.pendingCaptions[r]).startTime=e.startPts-o,e.startTime/=9e4,e.endTime=e.endPts-o,e.endTime/=9e4,s.captionStreams[e.stream]=!0,s.captions.push(e);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=i.pts-o,i.cueTime/=9e4,s.metadata.push(i);s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(hu=function(n){var r,a,s=this,i=!0;hu.prototype.init.call(this),n=n||{},this.baseMediaDecodeTime=n.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var e={};(this.transmuxPipeline_=e).type="aac",e.metadataStream=new Vo.MetadataStream,e.aacStream=new nu,e.audioTimestampRolloverStream=new Vo.TimestampRolloverStream("audio"),e.timedMetadataTimestampRolloverStream=new Vo.TimestampRolloverStream("timed-metadata"),e.adtsStream=new Go,e.coalesceStream=new du(n,e.metadataStream),e.headOfPipeline=e.aacStream,e.aacStream.pipe(e.audioTimestampRolloverStream).pipe(e.adtsStream),e.aacStream.pipe(e.timedMetadataTimestampRolloverStream).pipe(e.metadataStream).pipe(e.coalesceStream),e.metadataStream.on("timestamp",function(t){e.aacStream.setTimestamp(t.timeStamp)}),e.aacStream.on("data",function(t){"timed-metadata"!==t.type||e.audioSegmentStream||(a=a||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},e.coalesceStream.numberOfTracks++,e.audioSegmentStream=new cu(a,n),e.adtsStream.pipe(e.audioSegmentStream).pipe(e.coalesceStream))}),e.coalesceStream.on("data",this.trigger.bind(this,"data")),e.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new Vo.MetadataStream,i.packetStream=new Vo.TransportPacketStream,i.parseStream=new Vo.TransportParseStream,i.elementaryStream=new Vo.ElementaryStream,i.videoTimestampRolloverStream=new Vo.TimestampRolloverStream("video"),i.audioTimestampRolloverStream=new Vo.TimestampRolloverStream("audio"),i.timedMetadataTimestampRolloverStream=new Vo.TimestampRolloverStream("timed-metadata"),i.adtsStream=new Go,i.h264Stream=new vu,i.captionStream=new Vo.CaptionStream,i.coalesceStream=new du(n,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream),i.elementaryStream.pipe(i.videoTimestampRolloverStream).pipe(i.h264Stream),i.elementaryStream.pipe(i.audioTimestampRolloverStream).pipe(i.adtsStream),i.elementaryStream.pipe(i.timedMetadataTimestampRolloverStream).pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(t){var e;if("metadata"===t.type){for(e=t.tracks.length;e--;)r||"video"!==t.tracks[e].type?a||"audio"!==t.tracks[e].type||((a=t.tracks[e]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(r=t.tracks[e]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new lu(r,n),i.videoSegmentStream.on("timelineStartInfo",function(t){a&&(a.timelineStartInfo=t,i.audioSegmentStream.setEarliestDts(t.dts))}),i.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(t){a&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(t)}),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),a&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new cu(a,n),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream))}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(t){var e=this.transmuxPipeline_;this.baseMediaDecodeTime=t,a&&(a.timelineStartInfo.dts=void 0,a.timelineStartInfo.pts=void 0,oo(a),a.timelineStartInfo.baseMediaDecodeTime=t,e.audioTimestampRolloverStream&&e.audioTimestampRolloverStream.discontinuity()),r&&(e.videoSegmentStream&&(e.videoSegmentStream.gopCache_=[],e.videoTimestampRolloverStream.discontinuity()),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,oo(r),e.captionStream.reset(),r.timelineStartInfo.baseMediaDecodeTime=t),e.timedMetadataTimestampRolloverStream&&e.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){a&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.alignGopsWith=function(t){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(i){var e=pu(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new eo;var Tu,Su,ku={Transmuxer:hu,VideoSegmentStream:lu,AudioSegmentStream:cu,AUDIO_PROPERTIES:_u,VIDEO_PROPERTIES:bu},wu=Qs.parseType,Cu=function(t){return new Date(1e3*t-20828448e5)},Eu=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},Au={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:Tu(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,r,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,r=0;r<o;r++)i=a.getUint16(n),n+=2,s.sps.push(new Uint8Array(t.subarray(n,n+i))),n+=i;for(e=t[n],n++,r=0;r<e;r++)i=a.getUint16(n),n+=2,s.pps.push(new Uint8Array(t.subarray(n,n+i))),n+=i;return s},btrt:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{bufferSizeDB:e.getUint32(0),maxBitrate:e.getUint32(4),avgBitrate:e.getUint32(8)}},esds:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),esId:t[6]<<8|t[7],streamPriority:31&t[8],decoderConfig:{objectProfileIndication:t[11],streamType:t[12]>>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:wu(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n<t.byteLength;)i.compatibleBrands.push(wu(t.subarray(n,n+4))),n+=4;return i},dinf:function(t){return{boxes:Tu(t)}},dref:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),dataReferences:Tu(t.subarray(8))}},hdlr:function(t){var e={version:new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0),flags:new Uint8Array(t.subarray(1,4)),handlerType:wu(t.subarray(8,12)),name:""},i=8;for(i=24;i<t.byteLength;i++){if(0===t[i]){i++;break}e.name+=String.fromCharCode(t[i])}return e.name=decodeURIComponent(escape(e.name)),e},mdat:function(t){return{byteLength:t.byteLength,nals:function(t){var e,i,n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=[];for(e=0;e+4<t.length;e+=i)if(i=n.getUint32(e),e+=4,i<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&t[e]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+t[e]&31)}return r}(t)}},mdhd:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=4,r={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),language:""};return 1===r.version?(n+=4,r.creationTime=Cu(i.getUint32(n)),n+=8,r.modificationTime=Cu(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8):(r.creationTime=Cu(i.getUint32(n)),n+=4,r.modificationTime=Cu(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=4),r.duration=i.getUint32(n),n+=4,e=i.getUint16(n),r.language+=String.fromCharCode(96+(e>>10)),r.language+=String.fromCharCode(96+((992&e)>>5)),r.language+=String.fromCharCode(96+(31&e)),r},mdia:function(t){return{boxes:Tu(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:Tu(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return 28<t.byteLength&&(i.streamDescriptor=Tu(t.subarray(28))[0]),i},moof:function(t){return{boxes:Tu(t)}},moov:function(t){return{boxes:Tu(t)}},mvex:function(t){return{boxes:Tu(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=Cu(e.getUint32(i)),i+=8,n.modificationTime=Cu(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8):(n.creationTime=Cu(e.getUint32(i)),i+=4,n.modificationTime=Cu(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4),n.duration=e.getUint32(i),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e<t.byteLength;e++)i.samples.push({dependsOn:(48&t[e])>>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(e=24;r;e+=12,r--)n.references.push({referenceType:(128&t[e])>>>7,referencedSize:2147483647&i.getUint32(e),subsegmentDuration:i.getUint32(e+4),startsWithSap:!!(128&t[e+8]),sapType:(112&t[e+8])>>>4,sapDeltaTime:268435455&i.getUint32(e+8)});return n},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:Tu(t)}},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(e=8;r;e+=4,r--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)r.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return r},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:Tu(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e<t.byteLength;e+=4)n.entries.push(i.getUint32(e));return n},stts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),timeToSamples:[]},r=i.getUint32(4);for(e=8;r;e+=8,r--)n.timeToSamples.push({sampleCount:i.getUint32(e),sampleDelta:i.getUint32(e+4)});return n},styp:function(t){return Au.ftyp(t)},tfdt:function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),baseMediaDecodeTime:t[4]<<24|t[5]<<16|t[6]<<8|t[7]};return 1===e.version&&(e.baseMediaDecodeTime*=Math.pow(2,32),e.baseMediaDecodeTime+=t[8]<<24|t[9]<<16|t[10]<<8|t[11]),e},tfhd:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return e=8,r&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),a&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),u&&(n.defaultSampleFlags=i.getUint32(e)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},tkhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=Cu(e.getUint32(i)),i+=8,n.modificationTime=Cu(e.getUint32(i)),i+=4,n.trackId=e.getUint32(i),i+=4,i+=8):(n.creationTime=Cu(e.getUint32(i)),i+=4,n.modificationTime=Cu(e.getUint32(i)),i+=4,n.trackId=e.getUint32(i),i+=4,i+=4),n.duration=e.getUint32(i),i+=4,i+=8,n.layer=e.getUint16(i),i+=2,n.alternateGroup=e.getUint16(i),i+=2,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,n.width=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.height=e.getUint16(i)+e.getUint16(i+2)/16,n},traf:function(t){return{boxes:Tu(t)}},trak:function(t){return{boxes:Tu(t)}},trex:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:e.getUint32(4),defaultSampleDescriptionIndex:e.getUint32(8),defaultSampleDuration:e.getUint32(12),defaultSampleSize:e.getUint32(16),sampleDependsOn:3&t[20],sampleIsDependedOn:(192&t[21])>>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),a&&c&&(e={flags:Eu(t.subarray(h,h+4))},h+=4,s&&(e.duration=n.getUint32(h),h+=4),o&&(e.size=n.getUint32(h),h+=4),l&&(e.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(e),c--);c--;)e={},s&&(e.duration=n.getUint32(h),h+=4),o&&(e.size=n.getUint32(h),h+=4),u&&(e.flags=Eu(t.subarray(h,h+4)),h+=4),l&&(e.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(e);return i},"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}},Lu={inspect:Tu=function(t){for(var e,i,n,r,a,s=0,o=[],u=new ArrayBuffer(t.length),l=new Uint8Array(u),c=0;c<t.length;++c)l[c]=t[c];for(e=new DataView(u);s<t.byteLength;)i=e.getUint32(s),n=wu(t.subarray(s+4,s+8)),r=1<i?s+i:t.byteLength,(a=(Au[n]||function(t){return{data:t}})(t.subarray(s+8,r))).size=i,a.type=n,o.push(a),s=r;return o},textify:Su=function(t,e){var a;return e=e||0,a=new Array(2*e+1).join(" "),t.map(function(r,t){return a+r.type+"\n"+Object.keys(r).filter(function(t){return"type"!==t&&"boxes"!==t}).map(function(t){var e=a+" "+t+": ",i=r[t];if(i instanceof Uint8Array||i instanceof Uint32Array){var n=Array.prototype.slice.call(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)).map(function(t){return" "+("00"+t.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return n?1===n.length?e+"<"+n.join("").slice(1)+">":e+"<\n"+n.map(function(t){return a+" "+t}).join("\n")+"\n"+a+" >":e+"<>"}return e+JSON.stringify(i,null,2).split("\n").map(function(t,e){return 0===e?t:a+" "+t}).join("\n")}).join("\n")+(r.boxes?"\n"+Su(r.boxes,e+1):"")}).join("\n")},parseTfdt:Au.tfdt,parseHdlr:Au.hdlr,parseTfhd:Au.tfhd,parseTrun:Au.trun},Ou=fo,Pu=So.CaptionStream,Uu=function(t,e){for(var i=t,n=0;n<e.length;n++){var r=e[n];if(i<r.size)return r;i-=r.size}return null},xu=function(t,y){var n=Qs.findBox(t,["moof","traf"]),e=Qs.findBox(t,["mdat"]),v={},r=[];return e.forEach(function(t,e){var i=n[e];r.push({mdat:t,traf:i})}),r.forEach(function(t){var e,i,n,r,a,s,o,u,l=t.mdat,c=t.traf,h=Qs.findBox(c,["tfhd"]),d=Lu.parseTfhd(h[0]),p=d.trackId,f=Qs.findBox(c,["tfdt"]),m=0<f.length?Lu.parseTfdt(f[0]).baseMediaDecodeTime:0,g=Qs.findBox(c,["trun"]);y===p&&0<g.length&&(i=g,r=m,a=(n=d).defaultSampleDuration||0,s=n.defaultSampleSize||0,o=n.trackId,u=[],i.forEach(function(t){var e=Lu.parseTrun(t).samples;e.forEach(function(t){void 0===t.duration&&(t.duration=a),void 0===t.size&&(t.size=s),t.trackId=o,t.dts=r,void 0===t.compositionTimeOffset&&(t.compositionTimeOffset=0),t.pts=r+t.compositionTimeOffset,r+=t.duration}),u=u.concat(e)}),e=function(t,e,i){var n,r,a,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),u=[];for(r=0;r+4<t.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&t[r]){case 6:var l=t.subarray(r+1,r+1+a),c=Uu(r,e);n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Ou(l),trackId:i},c?(n.pts=c.pts,n.dts=c.dts,s=c):(n.pts=s.pts,n.dts=s.dts),u.push(n)}return u}(l,u,p),v[p]||(v[p]=[]),v[p]=v[p].concat(e))}),v},Iu={generator:Zs,probe:Qs,Transmuxer:ku.Transmuxer,AudioSegmentStream:ku.AudioSegmentStream,VideoSegmentStream:ku.VideoSegmentStream,CaptionParser:function(){var e,u,l,c,h,t=!1;this.isInitialized=function(){return t},this.init=function(){e=new Pu,t=!0,e.on("data",function(t){t.startTime=t.startPts/c,t.endTime=t.endPts/c,h.captions.push(t),h.captionStreams[t.stream]=!0})},this.isNewInit=function(t,e){return!(t&&0===t.length||e&&"object"==typeof e&&0===Object.keys(e).length||l===t[0]&&c===e[l])},this.parse=function(t,e,i){var n,r,a,s;if(!this.isInitialized())return null;if(!e||!i)return null;if(this.isNewInit(e,i))l=e[0],c=i[l];else if(!l||!c)return u.push(t),null;for(;0<u.length;){var o=u.shift();this.parse(o,e,i)}return r=t,s=c,null!==(n=(a=l)?{seiNals:xu(r,a)[a],timescale:s}:null)&&n.seiNals?(this.pushNals(n.seiNals),this.flushStream(),h):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;e.flush()},this.clearParsedCaptions=function(){h.captions=[],h.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){u=[],c=l=null,h?this.clearParsedCaptions():h={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}}.CaptionParser,Du=function(t){var e=31&t[1];return e<<=8,e|=t[2]},Ru=function(t){return!!(64&t[1])},Mu=function(t){var e=0;return 1<(48&t[3])>>>4&&(e+=t[4]+1),e},Bu=function(t){switch(t){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Nu={parseType:function(t,e){var i=Du(t);return 0===i?"pat":i===e?"pmt":e?"pes":null},parsePat:function(t){var e=Ru(t),i=4+Mu(t);return e&&(i+=t[i]+1),(31&t[i+10])<<8|t[i+11]},parsePmt:function(t){var e={},i=Ru(t),n=4+Mu(t);if(i&&(n+=t[n]+1),1&t[n+5]){var r;r=3+((15&t[n+1])<<8|t[n+2])-4;for(var a=12+((15&t[n+10])<<8|t[n+11]);a<r;){var s=n+a;e[(31&t[s+1])<<8|t[s+2]]=t[s],a+=5+((15&t[s+3])<<8|t[s+4])}return e}},parsePayloadUnitStartIndicator:Ru,parsePesType:function(t,e){switch(e[Du(t)]){case ko.H264_STREAM_TYPE:return"video";case ko.ADTS_STREAM_TYPE:return"audio";case ko.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(t){if(!Ru(t))return null;var e=4+Mu(t);if(e>=t.byteLength)return null;var i,n=null;return 192&(i=t[e+7])&&((n={}).pts=(14&t[e+9])<<27|(255&t[e+10])<<20|(254&t[e+11])<<12|(255&t[e+12])<<5|(254&t[e+13])>>>3,n.pts*=4,n.pts+=(6&t[e+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&t[e+14])<<27|(255&t[e+15])<<20|(254&t[e+16])<<12|(255&t[e+17])<<5|(254&t[e+18])>>>3,n.dts*=4,n.dts+=(6&t[e+18])>>>1)),n},videoPacketContainsKeyFrame:function(t){for(var e=4+Mu(t),i=t.subarray(e),n=0,r=0,a=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}for(r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===Bu(31&i[r+3])&&(a=!0);1!==i[++n]&&n<i.length;);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===Bu(31&i[r+3])&&(a=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===Bu(31&i[r+3])&&(a=!0),a}},ju=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Fu=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},Vu={parseId3TagSize:function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&t[e+5])>>4?i+20:i+10},parseAdtsSize:function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},parseType:function(t,e){return t[e]==="I".charCodeAt(0)&&t[e+1]==="D".charCodeAt(0)&&t[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[e]&&240==(240&t[e+1])?"audio":null},parseSampleRate:function(t){for(var e=0;e+5<t.length;){if(255===t[e]&&240==(246&t[e+1]))return ju[(60&t[e+2])>>>2];e++}return null},parseAacTimestamp:function(t){var e,i,n;e=10,64&t[5]&&(e+=4,e+=Fu(t.subarray(10,14)));do{if((i=Fu(t.subarray(e+4,e+8)))<1)return null;if("PRIV"===String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])){n=t.subarray(e+10,e+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"!==unescape(function(t,e,i){var n,r="";for(n=e;n<i;n++)r+="%"+("00"+t[n].toString(16)).slice(-2);return r}(n,0,r)))break;var a=n.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}}e+=10,e+=i}while(e<t.byteLength);return null}},Hu=Lo,qu={};qu.ts=Nu,qu.aac=Vu;var zu=188,Wu=function(t,e,i){for(var n,r,a,s,o=0,u=zu,l=!1;u<t.byteLength;)if(71!==t[o]||71!==t[u])o++,u++;else{switch(n=t.subarray(o,u),qu.ts.parseType(n,e.pid)){case"pes":r=qu.ts.parsePesType(n,e.table),a=qu.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=qu.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o+=zu,u+=zu}for(o=(u=t.byteLength)-zu,l=!1;0<=o;)if(71!==t[o]||71!==t[u])o--,u--;else{switch(n=t.subarray(o,u),qu.ts.parseType(n,e.pid)){case"pes":r=qu.ts.parsePesType(n,e.table),a=qu.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=qu.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o-=zu,u-=zu}},Gu=function(t,e,i){for(var n,r,a,s,o,u,l,c=0,h=zu,d=!1,p={data:[],size:0};h<t.byteLength;)if(71!==t[c]||71!==t[h])c++,h++;else{switch(n=t.subarray(c,h),qu.ts.parseType(n,e.pid)){case"pes":if(r=qu.ts.parsePesType(n,e.table),a=qu.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!d&&(s=qu.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),d=!0),!i.firstKeyFrame)){if(a&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;qu.ts.videoPacketContainsKeyFrame(o)&&(i.firstKeyFrame=qu.ts.parsePesTime(o),i.firstKeyFrame.type="video"),p.size=0}p.data.push(n),p.size+=n.byteLength}}if(d&&i.firstKeyFrame)break;c+=zu,h+=zu}for(c=(h=t.byteLength)-zu,d=!1;0<=c;)if(71!==t[c]||71!==t[h])c--,h--;else{switch(n=t.subarray(c,h),qu.ts.parseType(n,e.pid)){case"pes":r=qu.ts.parsePesType(n,e.table),a=qu.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=qu.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),d=!0)}if(d)break;c-=zu,h-=zu}},Xu=function(t){var e={pid:null,table:null},i={};for(var n in function(t,e){for(var i,n=0,r=zu;r<t.byteLength;)if(71!==t[n]||71!==t[r])n++,r++;else{switch(i=t.subarray(n,r),qu.ts.parseType(i,e.pid)){case"pat":e.pid||(e.pid=qu.ts.parsePat(i));break;case"pmt":e.table||(e.table=qu.ts.parsePmt(i))}if(e.pid&&e.table)return;n+=zu,r+=zu}}(t,e),e.table){if(e.table.hasOwnProperty(n))switch(e.table[n]){case ko.H264_STREAM_TYPE:i.video=[],Gu(t,e,i),0===i.video.length&&delete i.video;break;case ko.ADTS_STREAM_TYPE:i.audio=[],Wu(t,e,i),0===i.audio.length&&delete i.audio}}return i},Yu=function(t,e){var i,n;return(n=(i=t)[0]==="I".charCodeAt(0)&&i[1]==="D".charCodeAt(0)&&i[2]==="3".charCodeAt(0)?function(t){for(var e,i=!1,n=0,r=null,a=null,s=0,o=0;3<=t.length-o;){switch(qu.aac.parseType(t,o)){case"timed-metadata":if(t.length-o<10){i=!0;break}if((s=qu.aac.parseId3TagSize(t,o))>t.length){i=!0;break}null===a&&(e=t.subarray(o,o+s),a=qu.aac.parseAacTimestamp(e)),o+=s;break;case"audio":if(t.length-o<7){i=!0;break}if((s=qu.aac.parseAdtsSize(t,o))>t.length){i=!0;break}null===r&&(e=t.subarray(o,o+s),r=qu.aac.parseSampleRate(e)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=9e4/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(t):Xu(t))&&(n.audio||n.video)?(function(t,e){if(t.audio&&t.audio.length){var i=e;"undefined"==typeof i&&(i=t.audio[0].dts),t.audio.forEach(function(t){t.dts=Hu(t.dts,i),t.pts=Hu(t.pts,i),t.dtsTime=t.dts/9e4,t.ptsTime=t.pts/9e4})}if(t.video&&t.video.length){var n=e;if("undefined"==typeof n&&(n=t.video[0].dts),t.video.forEach(function(t){t.dts=Hu(t.dts,n),t.pts=Hu(t.pts,n),t.dtsTime=t.dts/9e4,t.ptsTime=t.pts/9e4}),t.firstKeyFrame){var r=t.firstKeyFrame;r.dts=Hu(r.dts,n),r.pts=Hu(r.pts,n),r.dtsTime=r.dts/9e4,r.ptsTime=r.dts/9e4}}}(n,e),n):null};var $u=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ku=function(){function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}(),Qu=null,Ju=function(){function c(t){$u(this,c),Qu||(Qu=function(){var t=[[[],[],[],[],[]],[[],[],[],[],[]]],e=t[0],i=t[1],n=e[4],r=i[4],a=void 0,s=void 0,o=void 0,u=[],l=[],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0;for(a=0;a<256;a++)l[(u[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!n[s];s^=c||1,o=l[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,f=16843009*u[h=u[c=u[r[n[s]=d]=s]]]^65537*h^257*c^16843008*s,p=257*u[d]^16843008*d,a=0;a<4;a++)e[a][s]=p=p<<24^p>>>8,i[a][d]=f=f<<24^f>>>8;for(a=0;a<5;a++)e[a]=e[a].slice(0),i[a]=i[a].slice(0);return t}()),this._tables=[[Qu[0][0].slice(),Qu[0][1].slice(),Qu[0][2].slice(),Qu[0][3].slice(),Qu[0][4].slice()],[Qu[1][0].slice(),Qu[1][1].slice(),Qu[1][2].slice(),Qu[1][3].slice(),Qu[1][4].slice()]];var e=void 0,i=void 0,n=void 0,r=void 0,a=void 0,s=this._tables[0][4],o=this._tables[1],u=t.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");for(r=t.slice(0),a=[],this._key=[r,a],e=u;e<4*u+28;e++)n=r[e-1],(e%u==0||8===u&&e%u==4)&&(n=s[n>>>24]<<24^s[n>>16&255]<<16^s[n>>8&255]<<8^s[255&n],e%u==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),r[e]=r[e-u]^n;for(i=0;e;i++,e--)n=r[3&i?e:e-4],a[i]=e<=4||i<4?n:o[0][s[n>>>24]]^o[1][s[n>>16&255]]^o[2][s[n>>8&255]]^o[3][s[255&n]]}return c.prototype.decrypt=function(t,e,i,n,r,a){var s=this._key[1],o=t^s[0],u=n^s[1],l=i^s[2],c=e^s[3],h=void 0,d=void 0,p=void 0,f=s.length/4-2,m=void 0,g=4,y=this._tables[1],v=y[0],_=y[1],b=y[2],T=y[3],S=y[4];for(m=0;m<f;m++)h=v[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^s[g],d=v[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^s[g+1],p=v[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^s[g+2],c=v[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^s[g+3],g+=4,o=h,u=d,l=p;for(m=0;m<4;m++)r[(3&-m)+a]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^s[g++],h=o,o=u,u=l,l=c,c=h},c}(),Zu=function(){function t(){$u(this,t),this.listeners={}}return t.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},t.prototype.off=function(t,e){if(!this.listeners[t])return!1;var i=this.listeners[t].indexOf(e);return this.listeners[t].splice(i,1),-1<i},t.prototype.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var i=e.length,n=0;n<i;++n)e[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=e.length,s=0;s<a;++s)e[s].apply(this,r)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},t}(),tl=function(e){function i(){$u(this,i);var t=function(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}(this,e.call(this,Zu));return t.jobs=[],t.delay=1,t.timeout_=null,t}return function(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)}(i,e),i.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.prototype.push=function(t){this.jobs.push(t),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},i}(Zu),el=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},il=function(t,e,i){var n=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),r=new Ju(Array.prototype.slice.call(e)),a=new Uint8Array(t.byteLength),s=new Int32Array(a.buffer),o=void 0,u=void 0,l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=void 0;for(o=i[0],u=i[1],l=i[2],c=i[3],m=0;m<n.length;m+=4)h=el(n[m]),d=el(n[m+1]),p=el(n[m+2]),f=el(n[m+3]),r.decrypt(h,d,p,f,s,m),s[m]=el(s[m]^o),s[m+1]=el(s[m+1]^u),s[m+2]=el(s[m+2]^l),s[m+3]=el(s[m+3]^c),o=h,u=d,l=p,c=f;return a},nl=function(){function u(t,e,i,n){$u(this,u);var r=u.STEP,a=new Int32Array(t.buffer),s=new Uint8Array(t.byteLength),o=0;for(this.asyncStream_=new tl,this.asyncStream_.push(this.decryptChunk_(a.subarray(o,o+r),e,i,s)),o=r;o<a.length;o+=r)i=new Uint32Array([el(a[o-4]),el(a[o-3]),el(a[o-2]),el(a[o-1])]),this.asyncStream_.push(this.decryptChunk_(a.subarray(o,o+r),e,i,s));this.asyncStream_.push(function(){var t;n(null,(t=s).subarray(0,t.byteLength-t[t.byteLength-1]))})}return u.prototype.decryptChunk_=function(e,i,n,r){return function(){var t=il(e,i,n);r.set(t,e.byteOffset)}},Ku(u,null,[{key:"STEP",get:function(){return 32e3}}]),u}(),rl=function(t,e){return/^[a-z]+:/i.test(e)?e:(/\/\//i.test(t)||(t=ca.buildAbsoluteURL(v.location.href,t)),ca.buildAbsoluteURL(t,e))},al=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},sl=function(){function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}(),ol=function(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)},ul=function(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},ll=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],n=!0,r=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{!n&&o.return&&o.return()}finally{if(r)throw a}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},cl=oa.mergeOptions,hl=oa.EventTarget,dl=oa.log,pl=function(r,a){["AUDIO","SUBTITLES"].forEach(function(t){for(var e in r.mediaGroups[t])for(var i in r.mediaGroups[t][e]){var n=r.mediaGroups[t][e][i];a(n,t,e,i)}})},fl=function(t,e){var i=cl(t,{}),n=i.playlists[e.uri];if(!n)return null;if(n.segments&&e.segments&&n.segments.length===e.segments.length&&n.mediaSequence===e.mediaSequence)return null;var r=cl(n,e);n.segments&&(r.segments=function(t,e,i){var n=e.slice();i=i||0;for(var r=Math.min(t.length,e.length+i),a=i;a<r;a++)n[a-i]=cl(t[a],n[a-i]);return n}(n.segments,e.segments,e.mediaSequence-n.mediaSequence)),r.segments.forEach(function(t){var e,i;e=t,i=r.resolvedUri,e.resolvedUri||(e.resolvedUri=rl(i,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=rl(i,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=rl(i,e.map.uri))});for(var a=0;a<i.playlists.length;a++)i.playlists[a].uri===e.uri&&(i.playlists[a]=r);return i.playlists[e.uri]=r,i},ml=function(t){for(var e=t.playlists.length;e--;){var i=t.playlists[e];(t.playlists[i.uri]=i).resolvedUri=rl(t.uri,i.uri),i.id=e,i.attributes||(i.attributes={},dl.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}},gl=function(e){pl(e,function(t){t.uri&&(t.resolvedUri=rl(e.uri,t.uri))})},yl=function(t,e){var i=t.segments[t.segments.length-1];return e&&i&&i.duration?1e3*i.duration:500*(t.targetDuration||10)},vl=function(t){function r(t,e,i){al(this,r);var n=ul(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(n.srcUrl=t,n.hls_=e,n.withCredentials=i,!n.srcUrl)throw new Error("A non-empty playlist URL is required");return n.state="HAVE_NOTHING",n.on("mediaupdatetimeout",function(){"HAVE_METADATA"===n.state&&(n.state="HAVE_CURRENT_METADATA",n.request=n.hls_.xhr({uri:rl(n.master.uri,n.media().uri),withCredentials:n.withCredentials},function(t,e){if(n.request)return t?n.playlistRequestError(n.request,n.media().uri,"HAVE_METADATA"):void n.haveMetadata(n.request,n.media().uri)}))}),n}return ol(r,hl),sl(r,[{key:"playlistRequestError",value:function(t,e,i){this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[e],status:t.status,message:"HLS playlist request error at URL: "+e,responseText:t.responseText,code:500<=t.status?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,e){var i=this;this.request=null,this.state="HAVE_METADATA";var n=new _a;n.push(t.responseText),n.end(),n.manifest.uri=e,n.manifest.attributes=n.manifest.attributes||{};var r=fl(this.master,n.manifest);this.targetDuration=n.manifest.targetDuration,r?(this.master=r,this.media_=this.master.playlists[n.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(v.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=v.setTimeout(function(){i.trigger("mediaupdatetimeout")},yl(this.media(),!!r))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),v.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var t=this.request;this.request=null,t.onreadystatechange=null,t.abort()}}},{key:"media",value:function(i){var n=this;if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var r=this.state;if("string"==typeof i){if(!this.master.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.master.playlists[i]}var t=!this.media_||i.uri!==this.media_.uri;if(this.master.playlists[i.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,void(t&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(t){if(this.state="SWITCHING_MEDIA",this.request){if(rl(this.master.uri,i.uri)===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:rl(this.master.uri,i.uri),withCredentials:this.withCredentials},function(t,e){if(n.request){if(t)return n.playlistRequestError(n.request,i.uri,r);n.haveMetadata(e,i.uri),"HAVE_MASTER"===r?n.trigger("loadedmetadata"):n.trigger("mediachange")}})}}},{key:"pause",value:function(){this.stopRequest(),v.clearTimeout(this.mediaUpdateTimeout),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(t){var e=this;v.clearTimeout(this.mediaUpdateTimeout);var i=this.media();if(t){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=v.setTimeout(function(){return e.load()},n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var n=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(t,e){if(n.request){if(n.request=null,t)return n.error={status:e.status,message:"HLS playlist request error at URL: "+n.srcUrl,responseText:e.responseText,code:2},"HAVE_NOTHING"===n.state&&(n.started=!1),n.trigger("error");var i=new _a;return i.push(e.responseText),i.end(),n.state="HAVE_MASTER",i.manifest.uri=n.srcUrl,i.manifest.playlists?(n.master=i.manifest,ml(n.master),gl(n.master),n.trigger("loadedplaylist"),void(n.request||n.media(i.manifest.playlists[0]))):(n.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:v.location.href,playlists:[{uri:n.srcUrl,id:0}]},n.master.playlists[n.srcUrl]=n.master.playlists[0],n.master.playlists[0].resolvedUri=n.srcUrl,n.master.playlists[0].attributes=n.master.playlists[0].attributes||{},n.haveMetadata(e,n.srcUrl),n.trigger("loadedmetadata"))}})}}]),r}(),_l=oa.createTimeRange,bl=function(t,e,i){var n,r;return"undefined"==typeof e&&(e=t.mediaSequence+t.segments.length),e<t.mediaSequence?0:(n=function(t,e){var i=0,n=e-t.mediaSequence,r=t.segments[n];if(r){if("undefined"!=typeof r.start)return{result:r.start,precise:!0};if("undefined"!=typeof r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if("undefined"!=typeof(r=t.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=r.duration,"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(t,e)).precise?n.result:(r=function(t,e){for(var i=0,n=void 0,r=e-t.mediaSequence;r<t.segments.length;r++){if("undefined"!=typeof(n=t.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=n.duration,"undefined"!=typeof n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(t,e)).precise?r.result:n.result+i},Tl=function(t,e,i){if(!t)return 0;if("number"!=typeof i&&(i=0),"undefined"==typeof e){if(t.totalDuration)return t.totalDuration;if(!t.endList)return v.Infinity}return bl(t,e,i)},Sl=function(t,e,i){var n=0;if(i<e){var r=[i,e];e=r[0],i=r[1]}if(e<0){for(var a=e;a<Math.min(0,i);a++)n+=t.targetDuration;e=0}for(var s=e;s<i;s++)n+=t.segments[s].duration;return n},kl=function(t){if(!t.segments.length)return 0;for(var e=t.segments.length-1,i=t.segments[e].duration||t.targetDuration,n=i+2*t.targetDuration;e--&&!(n<=(i+=t.segments[e].duration)););return Math.max(0,e)},wl=function(t,e,i){if(!t||!t.segments)return null;if(t.endList)return Tl(t);if(null===e)return null;e=e||0;var n=i?kl(t):t.segments.length;return bl(t,t.mediaSequence+n,e)},Cl=function(t){return t-Math.floor(t)==0},El=function(t,e){if(Cl(e))return e+.1*t;for(var i=e.toString().split(".")[1].length,n=1;n<=i;n++){var r=Math.pow(10,n),a=e*r;if(Cl(a)||n===i)return(a+t)/r}},Al=El.bind(null,1),Ll=El.bind(null,-1),Ol=function(t){return t.excludeUntil&&t.excludeUntil>Date.now()},Pl=function(t){return t.excludeUntil&&t.excludeUntil===1/0},Ul=function(t){var e=Ol(t);return!t.disabled&&!e},xl=function(t,e){return e.attributes&&e.attributes[t]},Il=function(t,e){if(1===t.playlists.length)return!0;var i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===t.playlists.filter(function(t){return!!Ul(t)&&(t.attributes.BANDWIDTH||0)<i}).length},Dl={duration:Tl,seekable:function(t,e){var i=e||0,n=wl(t,e,!0);return null===n?_l():_l(i,n)},safeLiveIndex:kl,getMediaInfoForTime:function(t,e,i,n){var r=void 0,a=void 0,s=t.segments.length,o=e-n;if(o<0){if(0<i)for(r=i-1;0<=r;r--)if(a=t.segments[r],0<(o+=Ll(a.duration)))return{mediaIndex:r,startTime:n-Sl(t,i,r)};return{mediaIndex:0,startTime:e}}if(i<0){for(r=i;r<0;r++)if((o-=t.targetDuration)<0)return{mediaIndex:0,startTime:e};i=0}for(r=i;r<s;r++)if(a=t.segments[r],(o-=Al(a.duration))<0)return{mediaIndex:r,startTime:n+Sl(t,i,r)};return{mediaIndex:s-1,startTime:e}},isEnabled:Ul,isDisabled:function(t){return t.disabled},isBlacklisted:Ol,isIncompatible:Pl,playlistEnd:wl,isAes:function(t){for(var e=0;e<t.segments.length;e++)if(t.segments[e].key)return!0;return!1},isFmp4:function(t){for(var e=0;e<t.segments.length;e++)if(t.segments[e].map)return!0;return!1},hasAttribute:xl,estimateSegmentRequestTime:function(t,e,i){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;return xl("BANDWIDTH",i)?(t*i.attributes.BANDWIDTH-8*n)/e:NaN},isLowestEnabledRendition:Il},Rl=oa.xhr,Ml=oa.mergeOptions,Bl=function(){return function t(e,n){e=Ml({timeout:45e3},e);var i=t.beforeRequest||oa.Hls.xhr.beforeRequest;if(i&&"function"==typeof i){var r=i(e);r&&(e=r)}var a=Rl(e,function(t,e){var i=a.response;!t&&i&&(a.responseTime=Date.now(),a.roundTripTime=a.responseTime-a.requestTime,a.bytesReceived=i.byteLength||i.length,a.bandwidth||(a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3))),e.headers&&(a.responseHeaders=e.headers),t&&"ETIMEDOUT"===t.code&&(a.timedout=!0),t||a.aborted||200===e.statusCode||206===e.statusCode||0===e.statusCode||(t=new Error("XHR Failed with a response of: "+(a&&(i||a.responseText)))),n(t,a)}),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=e.uri,a.requestTime=Date.now(),a}},Nl=function(t,e){var i=t.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},jl=function(t){return 32<=t&&t<126?String.fromCharCode(t):"."},Fl=function(i){var n={};return Object.keys(i).forEach(function(t){var e=i[t];ArrayBuffer.isView(e)?n[t]={bytes:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}:n[t]=e}),n},Vl=function(t){var e=t.byterange||{length:1/0,offset:0};return[e.length,e.offset,t.resolvedUri].join(",")},Hl=function(t){for(var e=Array.prototype.slice.call(t),i="",n=0;n<e.length/16;n++)i+=e.slice(16*n,16*n+16).map(Nl).join("")+" "+e.slice(16*n,16*n+16).map(jl).join("")+"\n";return i},ql=Object.freeze({createTransferableMessage:Fl,initSegmentId:Vl,hexDump:Hl,tagDump:function(t){var e=t.bytes;return Hl(e)},textRanges:function(t){var e,i,n="",r=void 0;for(r=0;r<t.length;r++)n+=(i=r,(e=t).start(i)+"-"+e.end(i)+" ");return n}}),zl=1/30,Wl=function(t,e){var i=[],n=void 0;if(t&&t.length)for(n=0;n<t.length;n++)e(t.start(n),t.end(n))&&i.push([t.start(n),t.end(n)]);return oa.createTimeRanges(i)},Gl=function(t,i){return Wl(t,function(t,e){return t-zl<=i&&i<=e+zl})},Xl=function(t,e){return Wl(t,function(t){return e<=t-zl})},Yl=function(t){var e=[];if(!t||!t.length)return"";for(var i=0;i<t.length;i++)e.push(t.start(i)+" => "+t.end(i));return e.join(", ")},$l=function(t){for(var e=[],i=0;i<t.length;i++)e.push({start:t.start(i),end:t.end(i)});return e},Kl=function(t,e,i){var n=void 0,r=void 0;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime<=e&&r.endTime>=t&&i.removeCue(r)},Ql=function(t){return isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t},Jl=function(t,e,i){var r=v.WebKitDataCue||v.VTTCue;if(e&&e.forEach(function(t){var e=t.stream;this.inbandTextTracks_[e].addCue(new r(t.startTime+this.timestampOffset,t.endTime+this.timestampOffset,t.text))},t),i){var a=Ql(t.mediaSource_.duration);if(i.forEach(function(t){var n=t.cueTime+this.timestampOffset;t.frames.forEach(function(t){var e,i=new r(n,n,t.value||t.url||t.data||"");i.frame=t,i.value=t,e=i,Object.defineProperties(e.frame,{id:{get:function(){return oa.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return oa.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return oa.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}}),this.metadataTrack_.addCue(i)},this)},t),t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var n=t.metadataTrack_.cues,s=[],o=0;o<n.length;o++)n[o]&&s.push(n[o]);var u=s.reduce(function(t,e){var i=t[e.startTime]||[];return i.push(e),t[e.startTime]=i,t},{}),l=Object.keys(u).sort(function(t,e){return Number(t)-Number(e)});l.forEach(function(t,e){var i=u[t],n=Number(l[e+1])||a;i.forEach(function(t){t.endTime=n})})}}},Zl="undefined"!=typeof window?window:{},tc="undefined"==typeof Symbol?"__target":Symbol(),ec="application/javascript",ic=Zl.BlobBuilder||Zl.WebKitBlobBuilder||Zl.MozBlobBuilder||Zl.MSBlobBuilder,nc=Zl.URL||Zl.webkitURL||nc&&nc.msURL,rc=Zl.Worker;function ac(r,a){return function(t){var e=this;if(!a)return new rc(r);if(rc&&!t){var i=lc(a.toString().replace(/^function.+?{/,"").slice(0,-1));return this[tc]=new rc(i),function(t,e){if(!t||!e)return;var i=t.terminate;t.objURL=e,t.terminate=function(){t.objURL&&nc.revokeObjectURL(t.objURL),i.call(t)}}(this[tc],i),this[tc]}var n={postMessage:function(t){e.onmessage&&setTimeout(function(){e.onmessage({data:t,target:n})})}};a.call(n),this.postMessage=function(t){setTimeout(function(){n.onmessage({data:t,target:e})})},this.isThisThread=!0}}if(rc){var sc,oc=lc("self.onmessage = function () {}"),uc=new Uint8Array(1);try{(sc=new rc(oc)).postMessage(uc,[uc.buffer])}catch(t){rc=null}finally{nc.revokeObjectURL(oc),sc&&sc.terminate()}}function lc(e){try{return nc.createObjectURL(new Blob([e],{type:ec}))}catch(t){var i=new ic;return i.append(e),nc.createObjectURL(i.getBlob(type))}}var cc=new ac("./transmuxer-worker.worker.js",function(t,e){var Oe=this;!function(){var o,e,i,r,a,n,t,s,u,l,c,h,d,p,f,m,g,y,v,_,b,T,S,k,w,C,E,A,L,O,P,U,x,I,D,R,M,B,N,j,F=Math.pow(2,32)-1;!function(){var t;if(T={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(t in T)T.hasOwnProperty(t)&&(T[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);S=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),k=new Uint8Array([0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),E=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:C,audio:E},P=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),O=new Uint8Array([0,0,0,0,0,0,0,0]),U=new Uint8Array([0,0,0,0,0,0,0,0]),x=U,I=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D=U,L=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),o=function(t){var e,i,n=[],r=0;for(e=1;e<arguments.length;e++)n.push(arguments[e]);for(e=n.length;e--;)r+=n[e].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(t,4),e=0,r=8;e<n.length;e++)i.set(n[e],r),r+=n[e].byteLength;return i},e=function(){return o(T.dinf,o(T.dref,P))},i=function(t){return o(T.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,t.audioobjecttype<<3|t.samplingfrequencyindex>>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},f=function(t){return o(T.hdlr,A[t])},p=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),o(T.mdhd,e)},d=function(t){return o(T.mdia,p(t),f(t.type),n(t))},a=function(t){return o(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},n=function(t){return o(T.minf,"video"===t.type?o(T.vmhd,L):o(T.smhd,O),e(),g(t))},t=function(t,e){for(var i=[],n=e.length;n--;)i[n]=v(e[n]);return o.apply(null,[T.moof,a(t)].concat(i))},s=function(t){for(var e=t.length,i=[];e--;)i[e]=c(t[e]);return o.apply(null,[T.moov,l(4294967295)].concat(i).concat(u(t)))},u=function(t){for(var e=t.length,i=[];e--;)i[e]=_(t[e]);return o.apply(null,[T.mvex].concat(i))},l=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,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 o(T.mvhd,e)},m=function(t){var e,i,n=t.samples||[],r=new Uint8Array(4+n.length);for(i=0;i<n.length;i++)e=n[i].flags,r[i+4]=e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy;return o(T.sdtp,r)},g=function(t){return o(T.stbl,y(t),o(T.stts,D),o(T.stsc,x),o(T.stsz,I),o(T.stco,U))},y=function(t){return o(T.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===t.type?R(t):M(t))},R=function(t){var e,i=t.sps||[],n=t.pps||[],r=[],a=[];for(e=0;e<i.length;e++)r.push((65280&i[e].byteLength)>>>8),r.push(255&i[e].byteLength),r=r.concat(Array.prototype.slice.call(i[e]));for(e=0;e<n.length;e++)a.push((65280&n[e].byteLength)>>>8),a.push(255&n[e].byteLength),a=a.concat(Array.prototype.slice.call(n[e]));return o(T.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,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(T.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([i.length]).concat(r).concat([n.length]).concat(a))),o(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},M=function(t){return o(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),i(t))},h=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return o(T.tkhd,e)},v=function(t){var e,i,n,r,a,s;return e=o(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(t.baseMediaDecodeTime/(F+1)),s=Math.floor(t.baseMediaDecodeTime%(F+1)),i=o(T.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===t.type?(n=b(t,92),o(T.traf,e,i,n)):(r=m(t),n=b(t,r.length+92),o(T.traf,e,i,n,r))},c=function(t){return t.duration=t.duration||4294967295,o(T.trak,h(t),d(t))},_=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),o(T.trex,e)},j=function(t,e){var i=0,n=0,r=0,a=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(r=4),void 0!==t[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},N=function(t,e){var i,n,r,a;for(e+=20+16*(n=t.samples||[]).length,i=j(n,e),a=0;a<n.length;a++)r=n[a],i=i.concat([(4278190080&r.duration)>>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size,r.flags.isLeading<<2|r.flags.dependsOn,r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,61440&r.flags.degradationPriority,15&r.flags.degradationPriority,(4278190080&r.compositionTimeOffset)>>>24,(16711680&r.compositionTimeOffset)>>>16,(65280&r.compositionTimeOffset)>>>8,255&r.compositionTimeOffset]);return o(T.trun,new Uint8Array(i))},B=function(t,e){var i,n,r,a;for(e+=20+8*(n=t.samples||[]).length,i=j(n,e),a=0;a<n.length;a++)r=n[a],i=i.concat([(4278190080&r.duration)>>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size]);return o(T.trun,new Uint8Array(i))},b=function(t,e){return"audio"===t.type?B(t,e):N(t,e)};var V,H,q,z,W,G={ftyp:r=function(){return o(T.ftyp,S,k,S,w)},mdat:function(t){return o(T.mdat,t)},moof:t,moov:s,initSegment:function(t){var e,i=r(),n=s(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},X=function(t){return t>>>0};q=function(t){return V(t,["moov","trak"]).reduce(function(t,e){var i,n,r,a,s;return(i=V(e,["tkhd"])[0])?(n=i[0],a=X(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(s=V(e,["mdia","mdhd"])[0])?(r=0===(n=s[0])?12:20,t[a]=X(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),t):null):null},{})},z=function(r,t){var e,i,n;return e=V(t,["moof","traf"]),i=[].concat.apply([],e.map(function(n){return V(n,["tfhd"]).map(function(t){var e,i;return e=X(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),i=r[e]||9e4,(V(n,["tfdt"]).map(function(t){var e,i;return e=t[0],i=X(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),1===e&&(i*=Math.pow(2,32),i+=X(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),i})[0]||1/0)/i})})),n=Math.min.apply(null,i),isFinite(n)?n:0},W=function(t){var e=V(t,["moov","trak"]),o=[];return e.forEach(function(t){var e=V(t,["mdia","hdlr"]),s=V(t,["tkhd"]);e.forEach(function(t,e){var i,n,r=H(t.subarray(8,12)),a=s[e];"vide"===r&&(n=0===(i=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0)?i.getUint32(12):i.getUint32(20),o.push(n))})}),o};var Y={findBox:V=function(t,e){var i,n,r,a,s,o=[];if(!e.length)return null;for(i=0;i<t.byteLength;)n=X(t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3]),r=H(t.subarray(i+4,i+8)),a=1<n?i+n:t.byteLength,r===e[0]&&(1===e.length?o.push(t.subarray(i+8,a)):(s=V(t.subarray(i+8,a),e.slice(1))).length&&(o=o.concat(s))),i=a;return o},parseType:H=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},timescale:q,startTime:z,videoTrackIds:W},$=function(){this.init=function(){var a={};this.on=function(t,e){a[t]||(a[t]=[]),a[t]=a[t].concat(e)},this.off=function(t,e){var i;return!!a[t]&&(i=a[t].indexOf(e),a[t]=a[t].slice(),a[t].splice(i,1),-1<i)},this.trigger=function(t){var e,i,n,r;if(e=a[t])if(2===arguments.length)for(n=e.length,i=0;i<n;++i)e[i].call(this,arguments[1]);else{for(r=[],i=arguments.length,i=1;i<arguments.length;++i)r.push(arguments[i]);for(n=e.length,i=0;i<n;++i)e[i].apply(this,r)}},this.dispose=function(){a={}}}};$.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},$.prototype.push=function(t){this.trigger("data",t)},$.prototype.flush=function(t){this.trigger("done",t)};var K=$,Q=function(t){var e,i,n=[],r=[];for(e=n.byteLength=0;e<t.length;e++)"access_unit_delimiter_rbsp"===(i=t[e]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.push(n),r},J=function(t){var e,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=t[0].pts,n.dts=t[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=t[0].pts,r.dts=t[0].dts,e=0;e<t.length;e++)(i=t[e]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},Z=function(t){var e;return!t[0][0].keyFrame&&1<t.length&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},tt=function(t,e){var i,n,r,a,s,o,u,l=e||0,c=[];for(i=0;i<t.length;i++)for(a=t[i],n=0;n<a.length;n++)s=a[n],o=s,u=void 0,(u={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}).dataOffset=l,u.compositionTimeOffset=o.pts-o.dts,u.duration=o.duration,u.size=4*o.length,u.size+=o.byteLength,o.keyFrame&&(u.flags.dependsOn=2,u.flags.isNonSyncSample=0),l+=(r=u).size,c.push(r);return c},et=function(t){var e,i,n,r,a,s,o=0,u=t.byteLength,l=t.nalCount,c=new Uint8Array(u+4*l),h=new DataView(c.buffer);for(e=0;e<t.length;e++)for(r=t[e],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],h.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},it=function(t){delete t.minSegmentDts,delete t.maxSegmentDts,delete t.minSegmentPts,delete t.maxSegmentPts},nt=function(t,e){var i,n=t.minSegmentDts;return e||(n-=t.timelineStartInfo.dts),i=t.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===t.type&&(i*=t.samplerate/9e4,i=Math.floor(i)),i},rt=function(t,e){"number"==typeof e.pts&&(void 0===t.timelineStartInfo.pts&&(t.timelineStartInfo.pts=e.pts),void 0===t.minSegmentPts?t.minSegmentPts=e.pts:t.minSegmentPts=Math.min(t.minSegmentPts,e.pts),void 0===t.maxSegmentPts?t.maxSegmentPts=e.pts:t.maxSegmentPts=Math.max(t.maxSegmentPts,e.pts)),"number"==typeof e.dts&&(void 0===t.timelineStartInfo.dts&&(t.timelineStartInfo.dts=e.dts),void 0===t.minSegmentDts?t.minSegmentDts=e.dts:t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),void 0===t.maxSegmentDts?t.maxSegmentDts=e.dts:t.maxSegmentDts=Math.max(t.maxSegmentDts,e.dts))},at=function(t){for(var e=0,i={payloadType:-1,payloadSize:0},n=0,r=0;e<t.byteLength&&128!==t[e];){for(;255===t[e];)n+=255,e++;for(n+=t[e++];255===t[e];)r+=255,e++;if(r+=t[e++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=t.subarray(e,e+r);break}e+=r,r=n=0}return i},st=function(t){return 181!==t.payload[0]?null:49!=(t.payload[1]<<8|t.payload[2])?null:"GA94"!==String.fromCharCode(t.payload[3],t.payload[4],t.payload[5],t.payload[6])?null:3!==t.payload[7]?null:t.payload.subarray(8,t.payload.length-1)},ot=function(t,e){var i,n,r,a,s=[];if(!(64&e[0]))return s;for(n=31&e[0],i=0;i<n;i++)a={type:3&e[2+(r=3*i)],pts:t},4&e[r+2]&&(a.ccData=e[r+3]<<8|e[r+4],s.push(a));return s},ut=function(t){for(var e,i,n=t.byteLength,r=[],a=1;a<n-2;)0===t[a]&&0===t[a+1]&&3===t[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return t;e=n-r.length,i=new Uint8Array(e);var s=0;for(a=0;a<e;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=t[s];return i},lt=4,ct=function t(){t.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new mt(0,0),new mt(0,1),new mt(1,0),new mt(1,1)],this.reset(),this.ccStreams_.forEach(function(t){t.on("data",this.trigger.bind(this,"data")),t.on("done",this.trigger.bind(this,"done"))},this)};(ct.prototype=new K).push=function(t){var e,i,n;if("sei_rbsp"===t.nalUnitType&&(e=at(t.escapedRBSP)).payloadType===lt&&(i=st(e)))if(t.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(t.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=ot(t.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==t.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=t.dts}},ct.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(t,e){t.presortIndex=e}),this.captionPackets_.sort(function(t,e){return t.pts===e.pts?t.presortIndex-e.presortIndex:t.pts-e.pts}),this.captionPackets_.forEach(function(t){t.type<2&&this.dispatchCea608Packet(t)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(t){t.flush()},this)):this.ccStreams_.forEach(function(t){t.flush()},this)},ct.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(t){t.reset()})},ct.prototype.dispatchCea608Packet=function(t){this.setsChannel1Active(t)?this.activeCea608Channel_[t.type]=0:this.setsChannel2Active(t)&&(this.activeCea608Channel_[t.type]=1),null!==this.activeCea608Channel_[t.type]&&this.ccStreams_[(t.type<<1)+this.activeCea608Channel_[t.type]].push(t)},ct.prototype.setsChannel1Active=function(t){return 4096==(30720&t.ccData)},ct.prototype.setsChannel2Active=function(t){return 6144==(30720&t.ccData)};var ht={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},dt=function(t){return null===t?"":(t=ht[t]||t,String.fromCharCode(t))},pt=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ft=function(){for(var t=[],e=15;e--;)t.push("");return t},mt=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,r,a;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,r=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=ft();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ft();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=ft()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,r))a=dt((n=(3&n)<<8)|r),this[this.mode_](t.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=dt((n=(3&n)<<8)|r),this[this.mode_](t.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&r)&&this.addFormatting(t.pts,["i"]),1==(1&r)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=pt.indexOf(7968&e);"rollUp"===this.mode_&&this.setRollUp(t.pts,s),s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=dt(n),a+=dt(r),this[this.mode_](t.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};mt.prototype=new K,mt.prototype.flushDisplayed=function(t){var e=this.displayed_.map(function(t){return t.trim()}).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},mt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ft(),this.nonDisplayed_=ft(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},mt.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},mt.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&48<=e&&e<=63},mt.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&32<=e&&e<=63},mt.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&32<=e&&e<=47},mt.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&33<=e&&e<=35},mt.prototype.isPAC=function(t,e){return t>=this.BASE_&&t<this.BASE_+8&&64<=e&&e<=127},mt.prototype.isColorPAC=function(t){return 64<=t&&t<=79||96<=t&&t<=127},mt.prototype.isNormalChar=function(t){return 32<=t&&t<=127},mt.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=ft(),this.displayed_=ft()),void 0!==e&&e!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[e-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===e&&(e=this.row_),this.topRow_=e-this.rollUpRows_+1},mt.prototype.addFormatting=function(t,e){this.formatting_=this.formatting_.concat(e);var i=e.reduce(function(t,e){return t+"<"+e+">"},"");this[this.mode_](t,i)},mt.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce(function(t,e){return t+"</"+e+">"},"");this.formatting_=[],this[this.mode_](t,e)}},mt.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},mt.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},mt.prototype.shiftRowsUp_=function(){var t;for(t=0;t<this.topRow_;t++)this.displayed_[t]="";for(t=this.row_+1;t<15;t++)this.displayed_[t]="";for(t=this.topRow_;t<this.row_;t++)this.displayed_[t]=this.displayed_[t+1];this.displayed_[this.row_]=""},mt.prototype.paintOn=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i};var gt={CaptionStream:ct,Cea608Stream:mt},yt={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},vt=function(t,e){var i=1;for(e<t&&(i=-1);4294967296<Math.abs(e-t);)t+=8589934592*i;return t},_t=function t(e){var i,n;t.prototype.init.call(this),this.type_=e,this.push=function(t){t.type===this.type_&&(void 0===n&&(n=t.dts),t.dts=vt(t.dts,n),t.pts=vt(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.discontinuity=function(){i=n=void 0}};_t.prototype=new K;var bt,Tt=_t,St=function(t,e,i){var n,r="";for(n=e;n<i;n++)r+="%"+("00"+t[n].toString(16)).slice(-2);return r},kt=function(t,e,i){return decodeURIComponent(St(t,e,i))},wt=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},Ct={TXXX:function(t){var e;if(3===t.data[0]){for(e=1;e<t.data.length;e++)if(0===t.data[e]){t.description=kt(t.data,1,e),t.value=kt(t.data,e+1,t.data.length).replace(/\0*$/,"");break}t.data=t.value}},WXXX:function(t){var e;if(3===t.data[0])for(e=1;e<t.data.length;e++)if(0===t.data[e]){t.description=kt(t.data,1,e),t.url=kt(t.data,e+1,t.data.length);break}},PRIV:function(t){var e,i;for(e=0;e<t.data.length;e++)if(0===t.data[e]){t.owner=(i=t.data,unescape(St(i,0,e)));break}t.privateData=t.data.subarray(e+1),t.data=t.privateData}};(bt=function(t){var e,u={debug:!(!t||!t.debug),descriptor:t&&t.descriptor},l=0,c=[],h=0;if(bt.prototype.init.call(this),this.dispatchType=yt.METADATA_STREAM_TYPE.toString(16),u.descriptor)for(e=0;e<u.descriptor.length;e++)this.dispatchType+=("00"+u.descriptor[e].toString(16)).slice(-2);this.push=function(t){var e,i,n,r,a;if("timed-metadata"===t.type)if(t.dataAlignmentIndicator&&(h=0,c.length=0),0===c.length&&(t.data.length<10||t.data[0]!=="I".charCodeAt(0)||t.data[1]!=="D".charCodeAt(0)||t.data[2]!=="3".charCodeAt(0)))u.debug;else if(c.push(t),h+=t.data.byteLength,1===c.length&&(l=wt(t.data.subarray(6,10)),l+=10),!(h<l)){for(e={data:new Uint8Array(l),frames:[],pts:c[0].pts,dts:c[0].dts},a=0;a<l;)e.data.set(c[0].data.subarray(0,l-a),a),a+=c[0].data.byteLength,h-=c[0].data.byteLength,c.shift();i=10,64&e.data[5]&&(i+=4,i+=wt(e.data.subarray(10,14)),l-=wt(e.data.subarray(16,20)));do{if((n=wt(e.data.subarray(i+4,i+8)))<1)return;if((r={id:String.fromCharCode(e.data[i],e.data[i+1],e.data[i+2],e.data[i+3]),data:e.data.subarray(i+10,i+n+10)}).key=r.id,Ct[r.id]&&(Ct[r.id](r),"com.apple.streaming.transportStreamTimestamp"===r.owner)){var s=r.data,o=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2;o*=4,o+=3&s[7],r.timeStamp=o,void 0===e.pts&&void 0===e.dts&&(e.pts=r.timeStamp,e.dts=r.timeStamp),this.trigger("timestamp",r)}e.frames.push(r),i+=10,i+=n}while(i<l);this.trigger("data",e)}}}).prototype=new K;var Et,At,Lt,Ot=bt,Pt=Tt;(Et=function(){var r=new Uint8Array(188),a=0;Et.prototype.init.call(this),this.push=function(t){var e,i=0,n=188;for(a?((e=new Uint8Array(t.byteLength+a)).set(r.subarray(0,a)),e.set(t,a),a=0):e=t;n<e.byteLength;)71!==e[i]||71!==e[n]?(i++,n++):(this.trigger("data",e.subarray(i,n)),i+=188,n+=188);i<e.byteLength&&(r.set(e.subarray(i),0),a=e.byteLength-i)},this.flush=function(){188===a&&71===r[0]&&(this.trigger("data",r),a=0),this.trigger("done")}}).prototype=new K,(At=function(){var n,r,a,s;At.prototype.init.call(this),(s=this).packetsWaitingForPmt=[],this.programMapTable=void 0,n=function(t,e){var i=0;e.payloadUnitStartIndicator&&(i+=t[i]+1),"pat"===e.type?r(t.subarray(i),e):a(t.subarray(i),e)},r=function(t,e){e.section_number=t[7],e.last_section_number=t[8],s.pmtPid=(31&t[10])<<8|t[11],e.pmtPid=s.pmtPid},a=function(t,e){var i,n;if(1&t[5]){for(s.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&t[1])<<8|t[2])-4,n=12+((15&t[10])<<8|t[11]);n<i;){var r=t[n],a=(31&t[n+1])<<8|t[n+2];r===yt.H264_STREAM_TYPE&&null===s.programMapTable.video?s.programMapTable.video=a:r===yt.ADTS_STREAM_TYPE&&null===s.programMapTable.audio?s.programMapTable.audio=a:r===yt.METADATA_STREAM_TYPE&&(s.programMapTable["timed-metadata"][a]=r),n+=5+((15&t[n+3])<<8|t[n+4])}e.programMapTable=s.programMapTable}},this.push=function(t){var e={},i=4;if(e.payloadUnitStartIndicator=!!(64&t[1]),e.pid=31&t[1],e.pid<<=8,e.pid|=t[2],1<(48&t[3])>>>4&&(i+=t[i]+1),0===e.pid)e.type="pat",n(t.subarray(i),e),this.trigger("data",e);else if(e.pid===this.pmtPid)for(e.type="pmt",n(t.subarray(i),e),this.trigger("data",e);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,i,e]):this.processPes_(t,i,e)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=yt.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=yt.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new K,At.STREAM_TYPES={h264:27,adts:15},(Lt=function(){var d=this,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(t,e,i){var n,r,a=new Uint8Array(t.size),s={type:e},o=0,u=0;if(t.data.length&&!(t.size<9)){for(s.trackId=t.data[0].pid,o=0;o<t.data.length;o++)r=t.data[o],a.set(r.data,u),u+=r.data.byteLength;var l,c,h;l=a,(c=s).packetLength=6+(l[4]<<8|l[5]),c.dataAlignmentIndicator=0!=(4&l[6]),192&(h=l[7])&&(c.pts=(14&l[9])<<27|(255&l[10])<<20|(254&l[11])<<12|(255&l[12])<<5|(254&l[13])>>>3,c.pts*=4,c.pts+=(6&l[13])>>>1,c.dts=c.pts,64&h&&(c.dts=(14&l[14])<<27|(255&l[15])<<20|(254&l[16])<<12|(255&l[17])<<5|(254&l[18])>>>3,c.dts*=4,c.dts+=(6&l[18])>>>1)),c.data=l.subarray(9+l[8]),n="video"===e||s.packetLength<=t.size,(i||n)&&(t.size=0,t.data.length=0),n&&d.trigger("data",s)}};Lt.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var t,e;switch(i.streamType){case yt.H264_STREAM_TYPE:case yt.H264_STREAM_TYPE:t=n,e="video";break;case yt.ADTS_STREAM_TYPE:t=r,e="audio";break;case yt.METADATA_STREAM_TYPE:t=a,e="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(i),t.size+=i.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},e=i.programMapTable;null!==e.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),d.trigger("data",t)}})[i.type]()},this.flush=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata"),this.trigger("done")}}).prototype=new K;var Ut={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Et,TransportParseStream:At,ElementaryStream:Lt,TimestampRolloverStream:Pt,CaptionStream:gt.CaptionStream,Cea608Stream:gt.Cea608Stream,MetadataStream:Ot};for(var xt in yt)yt.hasOwnProperty(xt)&&(Ut[xt]=yt[xt]);var It,Dt=Ut,Rt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(It=function(){var l;It.prototype.init.call(this),this.push=function(t){var e,i,n,r,a,s,o=0,u=0;if("audio"===t.type)for(l?(r=l,(l=new Uint8Array(r.byteLength+t.data.byteLength)).set(r),l.set(t.data,r.byteLength)):l=t.data;o+5<l.length;)if(255===l[o]&&240==(246&l[o+1])){if(i=2*(1&~l[o+1]),e=(3&l[o+3])<<11|l[o+4]<<3|(224&l[o+5])>>5,s=9e4*(a=1024*(1+(3&l[o+6])))/Rt[(60&l[o+2])>>>2],n=o+e,l.byteLength<n)return;if(this.trigger("data",{pts:t.pts+u*s,dts:t.dts+u*s,sampleCount:a,audioobjecttype:1+(l[o+2]>>>6&3),channelcount:(1&l[o+2])<<2|(192&l[o+3])>>>6,samplerate:Rt[(60&l[o+2])>>>2],samplingfrequencyindex:(60&l[o+2])>>>2,samplesize:16,data:l.subarray(o+7+i,n)}),l.byteLength===n)return void(l=void 0);u++,l=l.subarray(n)}else o++},this.flush=function(){this.trigger("done")}}).prototype=new K;var Mt,Bt,Nt,jt=It,Ft=function(n){var r=n.byteLength,a=0,s=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+s},this.loadWord=function(){var t=n.byteLength-r,e=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");e.set(n.subarray(t,t+i)),a=new DataView(e.buffer).getUint32(0),s=8*i,r-=i},this.skipBits=function(t){var e;t<s||(t-=s,t-=8*(e=Math.floor(t/8)),r-=e,this.loadWord()),a<<=t,s-=t},this.readBits=function(t){var e=Math.min(s,t),i=a>>>32-e;return 0<(s-=e)?a<<=e:0<r&&this.loadWord(),0<(e=t-e)?i<<e|this.readBits(e):i},this.skipLeadingZeros=function(){var t;for(t=0;t<s;++t)if(0!=(a&2147483648>>>t))return a<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Bt=function(){var i,n,r=0;Bt.prototype.init.call(this),this.push=function(t){var e;for(n=n?((e=new Uint8Array(n.byteLength+t.data.byteLength)).set(n),e.set(t.data,n.byteLength),e):t.data;r<n.byteLength-3;r++)if(1===n[r+2]){i=r+5;break}for(;i<n.byteLength;)switch(n[i]){case 0:if(0!==n[i-1]){i+=2;break}if(0!==n[i-2]){i++;break}for(r+3!==i-2&&this.trigger("data",n.subarray(r+3,i-2));1!==n[++i]&&i<n.length;);r=i-2,i+=3;break;case 1:if(0!==n[i-1]||0!==n[i-2]){i+=3;break}this.trigger("data",n.subarray(r+3,i-2)),r=i-2,i+=3;break;default:i+=3}n=n.subarray(r),i-=r,r=0},this.flush=function(){n&&3<n.byteLength&&this.trigger("data",n.subarray(r+3)),n=null,r=0,this.trigger("done")}}).prototype=new K,Nt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Mt=function(){var i,n,r,a,s,o,_,e=new Bt;Mt.prototype.init.call(this),(i=this).push=function(t){"video"===t.type&&(n=t.trackId,r=t.pts,a=t.dts,e.push(t))},e.on("data",function(t){var e={trackId:n,pts:r,dts:a,data:t};switch(31&t[0]){case 5:e.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:e.nalUnitType="sei_rbsp",e.escapedRBSP=s(t.subarray(1));break;case 7:e.nalUnitType="seq_parameter_set_rbsp",e.escapedRBSP=s(t.subarray(1)),e.config=o(e.escapedRBSP);break;case 8:e.nalUnitType="pic_parameter_set_rbsp";break;case 9:e.nalUnitType="access_unit_delimiter_rbsp"}i.trigger("data",e)}),e.on("done",function(){i.trigger("done")}),this.flush=function(){e.flush()},_=function(t,e){var i,n=8,r=8;for(i=0;i<t;i++)0!==r&&(r=(n+e.readExpGolomb()+256)%256),n=0===r?n:r},s=function(t){for(var e,i,n=t.byteLength,r=[],a=1;a<n-2;)0===t[a]&&0===t[a+1]&&3===t[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return t;e=n-r.length,i=new Uint8Array(e);var s=0;for(a=0;a<e;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=t[s];return i},o=function(t){var e,i,n,r,a,s,o,u,l,c,h,d,p,f=0,m=0,g=0,y=0,v=1;if(i=(e=new Ft(t)).readUnsignedByte(),r=e.readUnsignedByte(),n=e.readUnsignedByte(),e.skipUnsignedExpGolomb(),Nt[i]&&(3===(a=e.readUnsignedExpGolomb())&&e.skipBits(1),e.skipUnsignedExpGolomb(),e.skipUnsignedExpGolomb(),e.skipBits(1),e.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)e.readBoolean()&&_(p<6?16:64,e);if(e.skipUnsignedExpGolomb(),0===(s=e.readUnsignedExpGolomb()))e.readUnsignedExpGolomb();else if(1===s)for(e.skipBits(1),e.skipExpGolomb(),e.skipExpGolomb(),o=e.readUnsignedExpGolomb(),p=0;p<o;p++)e.skipExpGolomb();if(e.skipUnsignedExpGolomb(),e.skipBits(1),u=e.readUnsignedExpGolomb(),l=e.readUnsignedExpGolomb(),0===(c=e.readBits(1))&&e.skipBits(1),e.skipBits(1),e.readBoolean()&&(f=e.readUnsignedExpGolomb(),m=e.readUnsignedExpGolomb(),g=e.readUnsignedExpGolomb(),y=e.readUnsignedExpGolomb()),e.readBoolean()&&e.readBoolean()){switch(e.readUnsignedByte()){case 1:d=[1,1];break;case 2:d=[12,11];break;case 3:d=[10,11];break;case 4:d=[16,11];break;case 5:d=[40,33];break;case 6:d=[24,11];break;case 7:d=[20,11];break;case 8:d=[32,11];break;case 9:d=[80,33];break;case 10:d=[18,11];break;case 11:d=[15,11];break;case 12:d=[64,33];break;case 13:d=[160,99];break;case 14:d=[4,3];break;case 15:d=[3,2];break;case 16:d=[2,1];break;case 255:d=[e.readUnsignedByte()<<8|e.readUnsignedByte(),e.readUnsignedByte()<<8|e.readUnsignedByte()]}d&&(v=d[0]/d[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(u+1)-2*f-2*m)*v),height:(2-c)*(l+1)*16-2*g-2*y}}}).prototype=new K;var Vt,Ht={H264Stream:Mt,NalByteStream:Bt};(Vt=function(){var o=new Uint8Array,u=0;Vt.prototype.init.call(this),this.setTimestamp=function(t){u=t},this.parseId3TagSize=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&t[e+5])>>4?i+20:i+10},this.parseAdtsSize=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},this.push=function(t){var e,i,n,r,a=0,s=0;for(o.length?(r=o.length,(o=new Uint8Array(t.byteLength+r)).set(o.subarray(0,r)),o.set(t,r)):o=t;3<=o.length-s;)if(o[s]!=="I".charCodeAt(0)||o[s+1]!=="D".charCodeAt(0)||o[s+2]!=="3".charCodeAt(0))if(!0&o[s]&&240==(240&o[s+1])){if(o.length-s<7)break;if((a=this.parseAdtsSize(o,s))>o.length)break;n={type:"audio",data:o.subarray(s,s+a),pts:u,dts:u},this.trigger("data",n),s+=a}else s++;else{if(o.length-s<10)break;if((a=this.parseId3TagSize(o,s))>o.length)break;i={type:"timed-metadata",data:o.subarray(s,s+a)},this.trigger("data",i),s+=a}e=o.length-s,o=0<e?o.subarray(s):new Uint8Array}}).prototype=new K;var qt,zt,Wt,Gt,Xt,Yt,$t,Kt=Vt,Qt=[33,16,5,32,164,27],Jt=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Zt=function(t){for(var e=[];t--;)e.push(0);return e},te={96e3:[Qt,[227,64],Zt(154),[56]],88200:[Qt,[231],Zt(170),[56]],64e3:[Qt,[248,192],Zt(240),[56]],48e3:[Qt,[255,192],Zt(268),[55,148,128],Zt(54),[112]],44100:[Qt,[255,192],Zt(268),[55,163,128],Zt(84),[112]],32e3:[Qt,[255,192],Zt(268),[55,234],Zt(226),[112]],24e3:[Qt,[255,192],Zt(268),[55,255,128],Zt(268),[111,112],Zt(126),[224]],16e3:[Qt,[255,192],Zt(268),[55,255,128],Zt(268),[111,255],Zt(269),[223,108],Zt(195),[1,192]],12e3:[Jt,Zt(268),[3,127,248],Zt(268),[6,255,240],Zt(268),[13,255,224],Zt(268),[27,253,128],Zt(259),[56]],11025:[Jt,Zt(268),[3,127,248],Zt(268),[6,255,240],Zt(268),[13,255,224],Zt(268),[27,255,192],Zt(268),[55,175,128],Zt(108),[112]],8e3:[Jt,Zt(268),[3,121,16],Zt(47),[7]]},ee=(qt=te,Object.keys(qt).reduce(function(t,e){return t[e]=new Uint8Array(qt[e].reduce(function(t,e){return t.concat(e)},[])),t},{}));Yt=function(t,e){return zt(Xt(t,e))},$t=function(t,e){return Wt(Gt(t),e)};zt=function(t){return 9e4*t},Wt=function(t,e){return t*e},Gt=function(t){return t/9e4},Xt=function(t,e){return t/e};var ie,ne,re,ae,se,oe,ue,le=Yt,ce=$t,he=Ht.H264Stream,de=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],pe=["width","height","profileIdc","levelIdc","profileCompatibility"];se=function(t){return t[0]==="I".charCodeAt(0)&&t[1]==="D".charCodeAt(0)&&t[2]==="3".charCodeAt(0)},oe=function(t,e){var i;if(t.length!==e.length)return!1;for(i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0},ue=function(t){var e,i=0;for(e=0;e<t.length;e++)i+=t[e].data.byteLength;return i},(ne=function(r,a){var s=[],o=0,e=0,l=0,c=1/0;a=a||{},ne.prototype.init.call(this),this.push=function(e){rt(r,e),r&&de.forEach(function(t){r[t]=e[t]}),s.push(e)},this.setEarliestDts=function(t){e=t-r.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(t){c=t},this.setAudioAppendStart=function(t){l=t},this.flush=function(){var t,e,i,n;0!==s.length&&(t=this.trimAdtsFramesByEarliestDts_(s),r.baseMediaDecodeTime=nt(r,a.keepOriginalTimestamps),this.prefixWithSilence_(r,t),r.samples=this.generateSampleTable_(t),i=G.mdat(this.concatenateFrameData_(t)),s=[],e=G.moof(o,[r]),n=new Uint8Array(e.byteLength+i.byteLength),o++,n.set(e),n.set(i,e.byteLength),it(r),this.trigger("data",{track:r,boxes:n})),this.trigger("done","AudioSegmentStream")},this.prefixWithSilence_=function(t,e){var i,n,r,a,s=0,o=0,u=0;if(e.length&&(i=le(t.baseMediaDecodeTime,t.samplerate),n=Math.ceil(9e4/(t.samplerate/1024)),l&&c&&(s=i-Math.max(l,c),u=(o=Math.floor(s/n))*n),!(o<1||45e3<u))){for((r=ee[t.samplerate])||(r=e[0].data),a=0;a<o;a++)e.splice(a,0,{data:r});t.baseMediaDecodeTime-=Math.floor(ce(u,t.samplerate))}},this.trimAdtsFramesByEarliestDts_=function(t){return r.minSegmentDts>=e?t:(r.minSegmentDts=1/0,t.filter(function(t){return t.dts>=e&&(r.minSegmentDts=Math.min(r.minSegmentDts,t.dts),r.minSegmentPts=r.minSegmentDts,!0)}))},this.generateSampleTable_=function(t){var e,i,n=[];for(e=0;e<t.length;e++)i=t[e],n.push({size:i.data.byteLength,duration:1024});return n},this.concatenateFrameData_=function(t){var e,i,n=0,r=new Uint8Array(ue(t));for(e=0;e<t.length;e++)i=t[e],r.set(i.data,n),n+=i.data.byteLength;return r}}).prototype=new K,(ie=function(o,u){var e,i,l=0,c=[],h=[];u=u||{},ie.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(t){rt(o,t),"seq_parameter_set_rbsp"!==t.nalUnitType||e||(e=t.config,o.sps=[t.data],pe.forEach(function(t){o[t]=e[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.data,o.pps=[t.data]),c.push(t)},this.flush=function(){for(var t,e,i,n,r,a;c.length&&"access_unit_delimiter_rbsp"!==c[0].nalUnitType;)c.shift();if(0===c.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(t=Q(c),(i=J(t))[0][0].keyFrame||((e=this.getGopForFusion_(c[0],o))?(i.unshift(e),i.byteLength+=e.byteLength,i.nalCount+=e.nalCount,i.pts=e.pts,i.dts=e.dts,i.duration+=e.duration):i=Z(i)),h.length){var s;if(!(s=u.alignGopsAtEnd?this.alignGopsAtEnd_(i):this.alignGopsAtStart_(i)))return this.gopCache_.unshift({gop:i.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),c=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");it(o),i=s}rt(o,i),o.samples=tt(i),r=G.mdat(et(i)),o.baseMediaDecodeTime=nt(o,u.keepOriginalTimestamps),this.trigger("processedGopsInfo",i.map(function(t){return{pts:t.pts,dts:t.dts,byteLength:t.byteLength}})),this.gopCache_.unshift({gop:i.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),c=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),n=G.moof(l,[o]),a=new Uint8Array(n.byteLength+r.byteLength),l++,a.set(n),a.set(r,n.byteLength),this.trigger("data",{track:o,boxes:a}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){it(o),i=e=void 0},this.getGopForFusion_=function(t){var e,i,n,r,a,s=1/0;for(a=0;a<this.gopCache_.length;a++)n=(r=this.gopCache_[a]).gop,o.pps&&oe(o.pps[0],r.pps[0])&&o.sps&&oe(o.sps[0],r.sps[0])&&(n.dts<o.timelineStartInfo.dts||-1e4<=(e=t.dts-n.dts-n.duration)&&e<=45e3&&(!i||e<s)&&(i=r,s=e));return i?i.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,r,a,s,o,u;for(a=t.byteLength,s=t.nalCount,o=t.duration,e=i=0;e<h.length&&i<t.length&&(n=h[e],r=t[i],n.pts!==r.pts);)r.pts>n.pts?e++:(i++,a-=r.byteLength,s-=r.nalCount,o-=r.duration);return 0===i?t:i===t.length?null:((u=t.slice(i)).byteLength=a,u.duration=o,u.nalCount=s,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(t){var e,i,n,r,a,s,o;for(e=h.length-1,i=t.length-1,a=null,s=!1;0<=e&&0<=i;){if(n=h[e],r=t[i],n.pts===r.pts){s=!0;break}n.pts>r.pts?e--:(e===h.length-1&&(a=i),i--)}if(!s&&null===a)return null;if(0===(o=s?i:a))return t;var u=t.slice(o),l=u.reduce(function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t},{byteLength:0,duration:0,nalCount:0});return u.byteLength=l.byteLength,u.duration=l.duration,u.nalCount=l.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(t){h=t}}).prototype=new K,(ae=function(t,e){this.numberOfTracks=0,this.metadataStream=e,"undefined"!=typeof t.remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ae.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBoxes.push(t.boxes),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track),void("audio"===t.track.type&&(this.audioTrack=t.track)))}}).prototype=new K,ae.prototype.flush=function(t){var e,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==t&&"AudioSegmentStream"!==t)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,pe.forEach(function(t){s.info[t]=this.videoTrack[t]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,de.forEach(function(t){s.info[t]=this.audioTrack[t]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=G.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(e=this.pendingCaptions[r]).startTime=e.startPts-o,e.startTime/=9e4,e.endTime=e.endPts-o,e.endTime/=9e4,s.captionStreams[e.stream]=!0,s.captions.push(e);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=i.pts-o,i.cueTime/=9e4,s.metadata.push(i);s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(re=function(n){var r,a,s=this,i=!0;re.prototype.init.call(this),n=n||{},this.baseMediaDecodeTime=n.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var e={};(this.transmuxPipeline_=e).type="aac",e.metadataStream=new Dt.MetadataStream,e.aacStream=new Kt,e.audioTimestampRolloverStream=new Dt.TimestampRolloverStream("audio"),e.timedMetadataTimestampRolloverStream=new Dt.TimestampRolloverStream("timed-metadata"),e.adtsStream=new jt,e.coalesceStream=new ae(n,e.metadataStream),e.headOfPipeline=e.aacStream,e.aacStream.pipe(e.audioTimestampRolloverStream).pipe(e.adtsStream),e.aacStream.pipe(e.timedMetadataTimestampRolloverStream).pipe(e.metadataStream).pipe(e.coalesceStream),e.metadataStream.on("timestamp",function(t){e.aacStream.setTimestamp(t.timeStamp)}),e.aacStream.on("data",function(t){"timed-metadata"!==t.type||e.audioSegmentStream||(a=a||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},e.coalesceStream.numberOfTracks++,e.audioSegmentStream=new ne(a,n),e.adtsStream.pipe(e.audioSegmentStream).pipe(e.coalesceStream))}),e.coalesceStream.on("data",this.trigger.bind(this,"data")),e.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new Dt.MetadataStream,i.packetStream=new Dt.TransportPacketStream,i.parseStream=new Dt.TransportParseStream,i.elementaryStream=new Dt.ElementaryStream,i.videoTimestampRolloverStream=new Dt.TimestampRolloverStream("video"),i.audioTimestampRolloverStream=new Dt.TimestampRolloverStream("audio"),i.timedMetadataTimestampRolloverStream=new Dt.TimestampRolloverStream("timed-metadata"),i.adtsStream=new jt,i.h264Stream=new he,i.captionStream=new Dt.CaptionStream,i.coalesceStream=new ae(n,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream),i.elementaryStream.pipe(i.videoTimestampRolloverStream).pipe(i.h264Stream),i.elementaryStream.pipe(i.audioTimestampRolloverStream).pipe(i.adtsStream),i.elementaryStream.pipe(i.timedMetadataTimestampRolloverStream).pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(t){var e;if("metadata"===t.type){for(e=t.tracks.length;e--;)r||"video"!==t.tracks[e].type?a||"audio"!==t.tracks[e].type||((a=t.tracks[e]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(r=t.tracks[e]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new ie(r,n),i.videoSegmentStream.on("timelineStartInfo",function(t){a&&(a.timelineStartInfo=t,i.audioSegmentStream.setEarliestDts(t.dts))}),i.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(t){a&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(t)}),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),a&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new ne(a,n),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream))}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(t){var e=this.transmuxPipeline_;this.baseMediaDecodeTime=t,a&&(a.timelineStartInfo.dts=void 0,a.timelineStartInfo.pts=void 0,it(a),a.timelineStartInfo.baseMediaDecodeTime=t,e.audioTimestampRolloverStream&&e.audioTimestampRolloverStream.discontinuity()),r&&(e.videoSegmentStream&&(e.videoSegmentStream.gopCache_=[],e.videoTimestampRolloverStream.discontinuity()),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,it(r),e.captionStream.reset(),r.timelineStartInfo.baseMediaDecodeTime=t),e.timedMetadataTimestampRolloverStream&&e.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){a&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.alignGopsWith=function(t){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(i){var e=se(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new K;var fe,me,ge={Transmuxer:re,VideoSegmentStream:ie,AudioSegmentStream:ne,AUDIO_PROPERTIES:de,VIDEO_PROPERTIES:pe},ye=Y.parseType,ve=function(t){return new Date(1e3*t-20828448e5)},_e=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},be={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:fe(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,r,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,r=0;r<o;r++)i=a.getUint16(n),n+=2,s.sps.push(new Uint8Array(t.subarray(n,n+i))),n+=i;for(e=t[n],n++,r=0;r<e;r++)i=a.getUint16(n),n+=2,s.pps.push(new Uint8Array(t.subarray(n,n+i))),n+=i;return s},btrt:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{bufferSizeDB:e.getUint32(0),maxBitrate:e.getUint32(4),avgBitrate:e.getUint32(8)}},esds:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),esId:t[6]<<8|t[7],streamPriority:31&t[8],decoderConfig:{objectProfileIndication:t[11],streamType:t[12]>>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:ye(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n<t.byteLength;)i.compatibleBrands.push(ye(t.subarray(n,n+4))),n+=4;return i},dinf:function(t){return{boxes:fe(t)}},dref:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),dataReferences:fe(t.subarray(8))}},hdlr:function(t){var e={version:new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0),flags:new Uint8Array(t.subarray(1,4)),handlerType:ye(t.subarray(8,12)),name:""},i=8;for(i=24;i<t.byteLength;i++){if(0===t[i]){i++;break}e.name+=String.fromCharCode(t[i])}return e.name=decodeURIComponent(escape(e.name)),e},mdat:function(t){return{byteLength:t.byteLength,nals:function(t){var e,i,n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=[];for(e=0;e+4<t.length;e+=i)if(i=n.getUint32(e),e+=4,i<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&t[e]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+t[e]&31)}return r}(t)}},mdhd:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=4,r={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),language:""};return 1===r.version?(n+=4,r.creationTime=ve(i.getUint32(n)),n+=8,r.modificationTime=ve(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8):(r.creationTime=ve(i.getUint32(n)),n+=4,r.modificationTime=ve(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=4),r.duration=i.getUint32(n),n+=4,e=i.getUint16(n),r.language+=String.fromCharCode(96+(e>>10)),r.language+=String.fromCharCode(96+((992&e)>>5)),r.language+=String.fromCharCode(96+(31&e)),r},mdia:function(t){return{boxes:fe(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:fe(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return 28<t.byteLength&&(i.streamDescriptor=fe(t.subarray(28))[0]),i},moof:function(t){return{boxes:fe(t)}},moov:function(t){return{boxes:fe(t)}},mvex:function(t){return{boxes:fe(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=ve(e.getUint32(i)),i+=8,n.modificationTime=ve(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8):(n.creationTime=ve(e.getUint32(i)),i+=4,n.modificationTime=ve(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4),n.duration=e.getUint32(i),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e<t.byteLength;e++)i.samples.push({dependsOn:(48&t[e])>>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(e=24;r;e+=12,r--)n.references.push({referenceType:(128&t[e])>>>7,referencedSize:2147483647&i.getUint32(e),subsegmentDuration:i.getUint32(e+4),startsWithSap:!!(128&t[e+8]),sapType:(112&t[e+8])>>>4,sapDeltaTime:268435455&i.getUint32(e+8)});return n},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:fe(t)}},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(e=8;r;e+=4,r--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)r.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return r},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:fe(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e<t.byteLength;e+=4)n.entries.push(i.getUint32(e));return n},stts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),timeToSamples:[]},r=i.getUint32(4);for(e=8;r;e+=8,r--)n.timeToSamples.push({sampleCount:i.getUint32(e),sampleDelta:i.getUint32(e+4)});return n},styp:function(t){return be.ftyp(t)},tfdt:function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),baseMediaDecodeTime:t[4]<<24|t[5]<<16|t[6]<<8|t[7]};return 1===e.version&&(e.baseMediaDecodeTime*=Math.pow(2,32),e.baseMediaDecodeTime+=t[8]<<24|t[9]<<16|t[10]<<8|t[11]),e},tfhd:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return e=8,r&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),a&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),u&&(n.defaultSampleFlags=i.getUint32(e)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},tkhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=ve(e.getUint32(i)),i+=8,n.modificationTime=ve(e.getUint32(i)),i+=4,n.trackId=e.getUint32(i),i+=4,i+=8):(n.creationTime=ve(e.getUint32(i)),i+=4,n.modificationTime=ve(e.getUint32(i)),i+=4,n.trackId=e.getUint32(i),i+=4,i+=4),n.duration=e.getUint32(i),i+=4,i+=8,n.layer=e.getUint16(i),i+=2,n.alternateGroup=e.getUint16(i),i+=2,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,n.width=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.height=e.getUint16(i)+e.getUint16(i+2)/16,n},traf:function(t){return{boxes:fe(t)}},trak:function(t){return{boxes:fe(t)}},trex:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:e.getUint32(4),defaultSampleDescriptionIndex:e.getUint32(8),defaultSampleDuration:e.getUint32(12),defaultSampleSize:e.getUint32(16),sampleDependsOn:3&t[20],sampleIsDependedOn:(192&t[21])>>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),a&&c&&(e={flags:_e(t.subarray(h,h+4))},h+=4,s&&(e.duration=n.getUint32(h),h+=4),o&&(e.size=n.getUint32(h),h+=4),l&&(e.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(e),c--);c--;)e={},s&&(e.duration=n.getUint32(h),h+=4),o&&(e.size=n.getUint32(h),h+=4),u&&(e.flags=_e(t.subarray(h,h+4)),h+=4),l&&(e.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(e);return i},"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}},Te={inspect:fe=function(t){for(var e,i,n,r,a,s=0,o=[],u=new ArrayBuffer(t.length),l=new Uint8Array(u),c=0;c<t.length;++c)l[c]=t[c];for(e=new DataView(u);s<t.byteLength;)i=e.getUint32(s),n=ye(t.subarray(s+4,s+8)),r=1<i?s+i:t.byteLength,(a=(be[n]||function(t){return{data:t}})(t.subarray(s+8,r))).size=i,a.type=n,o.push(a),s=r;return o},textify:me=function(t,e){var a;return e=e||0,a=new Array(2*e+1).join(" "),t.map(function(r,t){return a+r.type+"\n"+Object.keys(r).filter(function(t){return"type"!==t&&"boxes"!==t}).map(function(t){var e=a+" "+t+": ",i=r[t];if(i instanceof Uint8Array||i instanceof Uint32Array){var n=Array.prototype.slice.call(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)).map(function(t){return" "+("00"+t.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return n?1===n.length?e+"<"+n.join("").slice(1)+">":e+"<\n"+n.map(function(t){return a+" "+t}).join("\n")+"\n"+a+" >":e+"<>"}return e+JSON.stringify(i,null,2).split("\n").map(function(t,e){return 0===e?t:a+" "+t}).join("\n")}).join("\n")+(r.boxes?"\n"+me(r.boxes,e+1):"")}).join("\n")},parseTfdt:be.tfdt,parseHdlr:be.hdlr,parseTfhd:be.tfhd,parseTrun:be.trun},Se=ut,ke=gt.CaptionStream,we=function(t,e){for(var i=t,n=0;n<e.length;n++){var r=e[n];if(i<r.size)return r;i-=r.size}return null},Ce=function(t,y){var n=Y.findBox(t,["moof","traf"]),e=Y.findBox(t,["mdat"]),v={},r=[];return e.forEach(function(t,e){var i=n[e];r.push({mdat:t,traf:i})}),r.forEach(function(t){var e,i,n,r,a,s,o,u,l=t.mdat,c=t.traf,h=Y.findBox(c,["tfhd"]),d=Te.parseTfhd(h[0]),p=d.trackId,f=Y.findBox(c,["tfdt"]),m=0<f.length?Te.parseTfdt(f[0]).baseMediaDecodeTime:0,g=Y.findBox(c,["trun"]);y===p&&0<g.length&&(i=g,r=m,a=(n=d).defaultSampleDuration||0,s=n.defaultSampleSize||0,o=n.trackId,u=[],i.forEach(function(t){var e=Te.parseTrun(t).samples;e.forEach(function(t){void 0===t.duration&&(t.duration=a),void 0===t.size&&(t.size=s),t.trackId=o,t.dts=r,void 0===t.compositionTimeOffset&&(t.compositionTimeOffset=0),t.pts=r+t.compositionTimeOffset,r+=t.duration}),u=u.concat(e)}),e=function(t,e,i){var n,r,a,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),u=[];for(r=0;r+4<t.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&t[r]){case 6:var l=t.subarray(r+1,r+1+a),c=we(r,e);n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Se(l),trackId:i},c?(n.pts=c.pts,n.dts=c.dts,s=c):(n.pts=s.pts,n.dts=s.dts),u.push(n)}return u}(l,u,p),v[p]||(v[p]=[]),v[p]=v[p].concat(e))}),v},Ee={generator:G,probe:Y,Transmuxer:ge.Transmuxer,AudioSegmentStream:ge.AudioSegmentStream,VideoSegmentStream:ge.VideoSegmentStream,CaptionParser:function(){var e,u,l,c,h,t=!1;this.isInitialized=function(){return t},this.init=function(){e=new ke,t=!0,e.on("data",function(t){t.startTime=t.startPts/c,t.endTime=t.endPts/c,h.captions.push(t),h.captionStreams[t.stream]=!0})},this.isNewInit=function(t,e){return!(t&&0===t.length||e&&"object"==typeof e&&0===Object.keys(e).length||l===t[0]&&c===e[l])},this.parse=function(t,e,i){var n,r,a,s;if(!this.isInitialized())return null;if(!e||!i)return null;if(this.isNewInit(e,i))l=e[0],c=i[l];else if(!l||!c)return u.push(t),null;for(;0<u.length;){var o=u.shift();this.parse(o,e,i)}return r=t,s=c,null!==(n=(a=l)?{seiNals:Ce(r,a)[a],timescale:s}:null)&&n.seiNals?(this.pushNals(n.seiNals),this.flushStream(),h):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;e.flush()},this.clearParsedCaptions=function(){h.captions=[],h.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){u=[],c=l=null,h?this.clearParsedCaptions():h={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}},Ae=function(){function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}(),Le=function(){function i(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),this.options=e||{},this.self=t,this.init()}return Ae(i,[{key:"init",value:function(){var n,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Ee.Transmuxer(this.options),n=this.self,(t=this.transmuxer).on("data",function(t){var e=t.initSegment;t.initSegment={data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength};var i=t.data;t.data=i.buffer,n.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])}),t.captionStream&&t.captionStream.on("data",function(t){n.postMessage({action:"caption",data:t})}),t.on("done",function(t){n.postMessage({action:"done"})}),t.on("gopInfo",function(t){n.postMessage({action:"gopInfo",gopInfo:t})})}},{key:"push",value:function(t){var e=new Uint8Array(t.data,t.byteOffset,t.byteLength);this.transmuxer.push(e)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(t){var e=t.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*e))}},{key:"setAudioAppendStart",value:function(t){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*t.appendStart))}},{key:"flush",value:function(t){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(t){this.transmuxer.alignGopsWith(t.gopsToAlignWith.slice())}}]),i}();new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new Le(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new Le(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(Oe)}()}),hc={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},dc=function(t){return t.map(function(t){return t.replace(/avc1\.(\d+)\.(\d+)/i,function(t,e,i){return"avc1."+("00"+Number(e).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})})},pc=function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",i={codecCount:0};return i.codecCount=e.split(",").length,i.codecCount=i.codecCount||2,(t=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(e))&&(i.videoCodec=t[2],i.videoObjectTypeIndicator=t[3]),i.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(e),i.audioProfile=i.audioProfile&&i.audioProfile[2],i},fc=function(t,e,i){return t+"/"+e+'; codecs="'+i.filter(function(t){return!!t}).join(", ")+'"'},mc=function(t,e){var i,n,r=(i=e).segments&&i.segments.length&&i.segments[0].map?"mp4":"mp2t",a=(n=e.attributes||{}).CODECS?pc(n.CODECS):hc,s=e.attributes||{},o=!0,u=!1;if(!e)return[];if(t.mediaGroups.AUDIO&&s.AUDIO){var l=t.mediaGroups.AUDIO[s.AUDIO];if(l)for(var c in o=!(u=!0),l)if(!l[c].uri&&!l[c].playlists){o=!0;break}}u&&!a.audioProfile&&(o||(a.audioProfile=function(t,e){if(!t.mediaGroups.AUDIO||!e)return null;var i=t.mediaGroups.AUDIO[e];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return pc(r.playlists[0].attributes.CODECS).audioProfile}return null}(t,s.AUDIO)),a.audioProfile||(oa.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),a.audioProfile=hc.audioProfile));var h={};a.videoCodec&&(h.video=""+a.videoCodec+a.videoObjectTypeIndicator),a.audioProfile&&(h.audio="mp4a.40."+a.audioProfile);var d=fc("audio",r,[h.audio]),p=fc("video",r,[h.video]),f=fc("video",r,[h.video,h.audio]);return u?!o&&h.video?[p,d]:o||h.video?[f,d]:[d,d]:h.video?[f]:[d]},gc=function(t){return/mp4a\.\d+.\d+/i.test(t)},yc=function(t){return/avc1\.[\da-f]+/i.test(t)},vc=function(t){function r(t,e){al(this,r);var i=ul(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,oa.EventTarget));i.timestampOffset_=0,i.pendingBuffers_=[],i.bufferUpdating_=!1,i.mediaSource_=t,i.codecs_=e,i.audioCodec_=null,i.videoCodec_=null,i.audioDisabled_=!1,i.appendAudioInitSegment_=!0,i.gopBuffer_=[],i.timeMapping_=0,i.safeAppend_=11<=oa.browser.IE_VERSION;var n={remux:!1,alignGopsAtEnd:i.safeAppend_};return i.codecs_.forEach(function(t){gc(t)?i.audioCodec_=t:yc(t)&&(i.videoCodec_=t)}),i.transmuxer_=new cc,i.transmuxer_.postMessage({action:"init",options:n}),i.transmuxer_.onmessage=function(t){return"data"===t.data.action?i.data_(t):"done"===t.data.action?i.done_(t):"gopInfo"===t.data.action?i.appendGopInfo_(t):void 0},Object.defineProperty(i,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(t){"number"==typeof t&&0<=t&&(this.timestampOffset_=t,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:t}))}}),Object.defineProperty(i,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(t){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=t),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=t)}}),Object.defineProperty(i,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(i,"buffered",{get:function(){return function(t,e,i){var n=null,r=null,a=0,s=[],o=[];if(!t&&!e)return oa.createTimeRange();if(!t)return e.buffered;if(!e)return t.buffered;if(i)return t.buffered;if(0===t.buffered.length&&0===e.buffered.length)return oa.createTimeRange();for(var u=t.buffered,l=e.buffered,c=u.length;c--;)s.push({time:u.start(c),type:"start"}),s.push({time:u.end(c),type:"end"});for(c=l.length;c--;)s.push({time:l.start(c),type:"start"}),s.push({time:l.end(c),type:"end"});for(s.sort(function(t,e){return t.time-e.time}),c=0;c<s.length;c++)"start"===s[c].type?2==++a&&(n=s[c].time):"end"===s[c].type&&1==--a&&(r=s[c].time),null!==n&&null!==r&&(o.push([n,r]),r=n=null);return oa.createTimeRanges(o)}(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),i}return ol(r,oa.EventTarget),sl(r,[{key:"data_",value:function(t){var e=t.data.segment;e.data=new Uint8Array(e.data,t.data.byteOffset,t.data.byteLength),e.initSegment=new Uint8Array(e.initSegment.data,e.initSegment.byteOffset,e.initSegment.byteLength),function(t,e,i){var n=e.player_;if(i.captions&&i.captions.length)for(var r in t.inbandTextTracks_||(t.inbandTextTracks_={}),i.captionStreams)if(!t.inbandTextTracks_[r]){n.tech_.trigger({type:"usage",name:"hls-608"});var a=n.textTracks().getTrackById(r);t.inbandTextTracks_[r]=a||n.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}i.metadata&&i.metadata.length&&!t.metadataTrack_&&(t.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,t.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)}(this,this.mediaSource_,e),this.pendingBuffers_.push(e)}},{key:"done_",value:function(t){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"createRealSourceBuffers_",value:function(){var n=this,r=["audio","video"];r.forEach(function(e){if(n[e+"Codec_"]&&!n[e+"Buffer_"]){var i=null;if(n.mediaSource_[e+"Buffer_"])(i=n.mediaSource_[e+"Buffer_"]).updating=!1;else{var t=e+'/mp4;codecs="'+n[e+"Codec_"]+'"';i=function(t,e){var i=t.addSourceBuffer(e),n=Object.create(null);n.updating=!1,n.realBuffer_=i;var r=function(e){"function"==typeof i[e]?n[e]=function(){return i[e].apply(i,arguments)}:"undefined"==typeof n[e]&&Object.defineProperty(n,e,{get:function(){return i[e]},set:function(t){return i[e]=t}})};for(var a in i)r(a);return n}(n.mediaSource_.nativeMediaSource_,t),n.mediaSource_[e+"Buffer_"]=i}n[e+"Buffer_"]=i,["update","updatestart","updateend"].forEach(function(t){i.addEventListener(t,function(){if("audio"!==e||!n.audioDisabled_)return"updateend"===t&&(n[e+"Buffer_"].updating=!1),r.every(function(t){return!("audio"!==t||!n.audioDisabled_)||(e===t||!n[t+"Buffer_"]||!n[t+"Buffer_"].updating)})?n.trigger(t):void 0})})}})}},{key:"appendBuffer",value:function(t){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var e=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:e.end(e.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:function(t,e,i){if("undefined"==typeof e||null===e||!t.length)return[];var n=Math.ceil(9e4*(e-i+3)),r=void 0;for(r=0;r<t.length&&!(t[r].pts>n);r++);return t.slice(r)}(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)}),this.transmuxer_.postMessage({action:"push",data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},[t.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(t){this.gopBuffer_=function(t,e,i){if(!e.length)return t;if(i)return e.slice();for(var n=e[0].pts,r=0;r<t.length&&!(t[r].pts>=n);r++);return t.slice(0,r).concat(e)}(this.gopBuffer_,t.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(t,e){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(t,e),this.gopBuffer_=function(t,e,i,n){for(var r=Math.ceil(9e4*(e-n)),a=Math.ceil(9e4*(i-n)),s=t.slice(),o=t.length;o--&&!(t[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(t[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,t,e,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(t,e)),Kl(t,e,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)Kl(t,e,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var t={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};t=this.pendingBuffers_.reduce(function(t,e){var i=e.type,n=e.data,r=e.initSegment;return t[i].segments.push(n),t[i].bytes+=n.byteLength,t[i].initSegment=r,e.captions&&(t.captions=t.captions.concat(e.captions)),e.info&&(t[i].info=e.info),e.metadata&&(t.metadata=t.metadata.concat(e.metadata)),t},t),this.videoBuffer_||this.audioBuffer_||(0===t.video.bytes&&(this.videoCodec_=null),0===t.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),t.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:t.audio.info}),t.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:t.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(t.audio.segments.unshift(t.audio.initSegment),t.audio.bytes+=t.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);var e=!1;this.videoBuffer_&&t.video.bytes?(t.video.segments.unshift(t.video.initSegment),t.video.bytes+=t.video.initSegment.byteLength,this.concatAndAppendSegments_(t.video,this.videoBuffer_),Jl(this,t.captions,t.metadata)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(e=!0),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(t.audio,this.audioBuffer_),this.pendingBuffers_.length=0,e&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(t,e){var i=0,n=void 0;if(t.bytes){n=new Uint8Array(t.bytes),t.segments.forEach(function(t){n.set(t,i),i+=t.byteLength});try{e.updating=!0,e.appendBuffer(n)}catch(t){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:t.message,originalError:t})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),r}(),_c=function(t){function e(){al(this,e);var a=ul(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),t=void 0;for(t in a.nativeMediaSource_=new v.MediaSource,a.nativeMediaSource_)t in e.prototype||"function"!=typeof a.nativeMediaSource_[t]||(a[t]=a.nativeMediaSource_[t].bind(a.nativeMediaSource_));return a.duration_=NaN,Object.defineProperty(a,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(t){(this.duration_=t)===1/0||(this.nativeMediaSource_.duration=t)}}),Object.defineProperty(a,"seekable",{get:function(){return this.duration_===1/0?oa.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(a,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(a,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),a.sourceBuffers=[],a.activeSourceBuffers_=[],a.updateActiveSourceBuffers_=function(){if(a.activeSourceBuffers_.length=0,1===a.sourceBuffers.length){var t=a.sourceBuffers[0];return t.appendAudioInitSegment_=!0,t.audioDisabled_=!t.audioCodec_,void a.activeSourceBuffers_.push(t)}for(var i=!1,n=!0,e=0;e<a.player_.audioTracks().length;e++){var r=a.player_.audioTracks()[e];if(r.enabled&&"main"!==r.kind){n=!(i=!0);break}}a.sourceBuffers.forEach(function(t,e){if(t.appendAudioInitSegment_=!0,t.videoCodec_&&t.audioCodec_)t.audioDisabled_=i;else if(t.videoCodec_&&!t.audioCodec_)t.audioDisabled_=!0,n=!1;else if(!t.videoCodec_&&t.audioCodec_&&(t.audioDisabled_=e?n:!n,t.audioDisabled_))return;a.activeSourceBuffers_.push(t)})},a.onPlayerMediachange_=function(){a.sourceBuffers.forEach(function(t){t.appendAudioInitSegment_=!0})},a.onHlsReset_=function(){a.sourceBuffers.forEach(function(t){t.transmuxer_&&t.transmuxer_.postMessage({action:"resetCaptions"})})},a.onHlsSegmentTimeMapping_=function(e){a.sourceBuffers.forEach(function(t){return t.timeMapping_=e.mapping})},["sourceopen","sourceclose","sourceended"].forEach(function(t){this.nativeMediaSource_.addEventListener(t,this.trigger.bind(this))},a),a.on("sourceopen",function(t){var e=d.querySelector('[src="'+a.url_+'"]');e&&(a.player_=oa(e.parentNode),a.player_.tech_.on("hls-reset",a.onHlsReset_),a.player_.tech_.on("hls-segment-time-mapping",a.onHlsSegmentTimeMapping_),a.player_.audioTracks&&a.player_.audioTracks()&&(a.player_.audioTracks().on("change",a.updateActiveSourceBuffers_),a.player_.audioTracks().on("addtrack",a.updateActiveSourceBuffers_),a.player_.audioTracks().on("removetrack",a.updateActiveSourceBuffers_)),a.player_.on("mediachange",a.onPlayerMediachange_))}),a.on("sourceended",function(t){for(var e=Ql(a.duration),i=0;i<a.sourceBuffers.length;i++){var n=a.sourceBuffers[i],r=n.metadataTrack_&&n.metadataTrack_.cues;r&&r.length&&(r[r.length-1].endTime=e)}}),a.on("sourceclose",function(t){this.sourceBuffers.forEach(function(t){t.transmuxer_&&t.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_&&(this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&(this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))}),a}return ol(e,oa.EventTarget),sl(e,[{key:"addSeekableRange_",value:function(t,e){var i=void 0;if(this.duration!==1/0)throw(i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",i.code=11,i;(e>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=e)}},{key:"addSourceBuffer",value:function(t){var r,e,i=void 0,n=(r={type:"",parameters:{}},e=t.trim().split(";"),r.type=e.shift().trim(),e.forEach(function(t){var e=t.trim().split("=");if(1<e.length){var i=e[0].replace(/"/g,"").trim(),n=e[1].replace(/"/g,"").trim();r.parameters[i]=n}}),r);if(/^(video|audio)\/mp2t$/i.test(n.type)){var a=[];n.parameters&&n.parameters.codecs&&(a=n.parameters.codecs.split(","),a=(a=dc(a)).filter(function(t){return gc(t)||yc(t)})),0===a.length&&(a=["avc1.4d400d","mp4a.40.2"]),i=new vc(this,a),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),i.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else i=this.nativeMediaSource_.addSourceBuffer(t);return this.sourceBuffers.push(i),i}}]),e}(),bc=0;oa.mediaSources={};var Tc=function(t,e){var i=oa.mediaSources[t];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:e})},Sc=function(){return!!v.MediaSource&&!!v.MediaSource.isTypeSupported&&v.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},kc=function(){if(this.MediaSource={open:Tc,supportsNativeMediaSources:Sc},Sc())return new _c;throw new Error("Cannot use create a virtual MediaSource for this video")};kc.open=Tc,kc.supportsNativeMediaSources=Sc;var wc={createObjectURL:function(t){var e=void 0;return t instanceof _c?(e=v.URL.createObjectURL(t.nativeMediaSource_),t.url_=e):t instanceof _c?(e="blob:vjs-media-source/"+bc,bc++,oa.mediaSources[e]=t,e):(e=v.URL.createObjectURL(t),t.url_=e)}};oa.MediaSource=kc,oa.URL=wc;var Cc=oa.EventTarget,Ec=oa.mergeOptions,Ac=function(t,e){for(var s=Ec(t,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod}),i=0;i<e.playlists.length;i++){var n=fl(s,e.playlists[i]);n&&(s=n)}return pl(e,function(t,e,i,n){if(t.playlists&&t.playlists.length){var r=t.playlists[0].uri,a=fl(s,t.playlists[0]);a&&((s=a).mediaGroups[e][i][n].playlists[0]=s.playlists[r])}}),s},Lc=function(t){function a(t,e,i,n){al(this,a);var r=ul(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));if(r.hls_=e,r.withCredentials=i,!t)throw new Error("A non-empty playlist URL or playlist is required");return r.on("minimumUpdatePeriod",function(){r.refreshXml_()}),r.on("mediaupdatetimeout",function(){r.refreshMedia_()}),"string"==typeof t?(r.srcUrl=t,r.state="HAVE_NOTHING",ul(r)):(r.masterPlaylistLoader_=n,r.state="HAVE_METADATA",r.started=!0,r.media(t),v.setTimeout(function(){r.trigger("loadedmetadata")},0),r)}return ol(a,Cc),sl(a,[{key:"dispose",value:function(){this.stopRequest(),v.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var t=this.request;this.request=null,t.onreadystatechange=null,t.abort()}}},{key:"media",value:function(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var e=this.state;if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var i=!this.media_||t.uri!==this.media_.uri;this.state="HAVE_METADATA",i&&(this.media_&&this.trigger("mediachanging"),this.media_=t,this.refreshMedia_(),"HAVE_MASTER"!==e&&this.trigger("mediachange"))}},{key:"pause",value:function(){this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(){this.started?this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var a=us(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_});a.uri=this.srcUrl;for(var t=0;t<a.playlists.length;t++){var e="placeholder-uri-"+t;a.playlists[t].uri=e,a.playlists[e]=a.playlists[t]}return pl(a,function(t,e,i,n){if(t.playlists&&t.playlists.length){var r="placeholder-uri-"+e+"-"+i+"-"+n;t.playlists[0].uri=r,a.playlists[r]=t.playlists[0]}}),ml(a),gl(a),a}},{key:"start",value:function(){var i=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(t,e){if(i.request){if(i.request=null,t)return i.error={status:e.status,message:"DASH playlist request error at URL: "+i.srcUrl,responseText:e.responseText,code:2},"HAVE_NOTHING"===i.state&&(i.started=!1),i.trigger("error");i.masterXml_=e.responseText,e.responseHeaders&&e.responseHeaders.date?i.masterLoaded_=Date.parse(e.responseHeaders.date):i.masterLoaded_=Date.now(),i.syncClientServerClock_(i.onClientServerClockSync_.bind(i))}})}},{key:"syncClientServerClock_",value:function(n){var r=this,a=ls(this.masterXml_);return null===a?(this.clientOffset_=this.masterLoaded_-Date.now(),n()):"DIRECT"===a.method?(this.clientOffset_=a.value-Date.now(),n()):void(this.request=this.hls_.xhr({uri:rl(this.srcUrl,a.value),method:a.method,withCredentials:this.withCredentials},function(t,e){if(r.request){if(t)return r.clientOffset_=r.masterLoaded_-Date.now(),n();var i=void 0;i="HEAD"===a.method?e.responseHeaders&&e.responseHeaders.date?Date.parse(e.responseHeaders.date):r.masterLoaded_:Date.parse(e.responseText),r.clientOffset_=i-Date.now(),n()}}))}},{key:"onClientServerClockSync_",value:function(){var t=this;this.master=this.parseMasterXml(),this.state="HAVE_MASTER",this.trigger("loadedplaylist"),this.media_||this.media(this.master.playlists[0]),v.setTimeout(function(){t.trigger("loadedmetadata")},0),this.master.minimumUpdatePeriod&&v.setTimeout(function(){t.trigger("minimumUpdatePeriod")},this.master.minimumUpdatePeriod)}},{key:"refreshXml_",value:function(){var n=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(t,e){if(n.request){if(n.request=null,t)return n.error={status:e.status,message:"DASH playlist request error at URL: "+n.srcUrl,responseText:e.responseText,code:2},"HAVE_NOTHING"===n.state&&(n.started=!1),n.trigger("error");n.masterXml_=e.responseText;var i=n.parseMasterXml();n.master=Ac(n.master,i),v.setTimeout(function(){n.trigger("minimumUpdatePeriod")},n.master.minimumUpdatePeriod)}})}},{key:"refreshMedia_",value:function(){var t=this,e=void 0,i=void 0;i=this.masterPlaylistLoader_?(e=this.masterPlaylistLoader_.master,this.masterPlaylistLoader_.parseMasterXml()):(e=this.master,this.parseMasterXml());var n=Ac(e,i);n?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=n:this.master=n,this.media_=n.playlists[this.media_.uri]):this.trigger("playlistunchanged"),this.media().endList||(this.mediaUpdateTimeout=v.setTimeout(function(){t.trigger("mediaupdatetimeout")},yl(this.media(),!!n))),this.trigger("loadedplaylist")}}]),a}(),Oc=function(t){return oa.log.debug?oa.log.debug.bind(oa,"VHS:",t+" >"):function(){}};function Pc(){}var Uc=function(){function r(t,e,i,n){al(this,r),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,this.type_=i,this.mimeType_=e,this.logger_=Oc("SourceUpdater["+i+"]["+e+"]"),"closed"===t.readyState?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,e,n)):this.createSourceBuffer_(e,n)}return sl(r,[{key:"createSourceBuffer_",value:function(t,e){var i=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(t),this.logger_("created SourceBuffer"),e&&(e.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?e.on("sourcebufferadded",function(){i.start_()}):this.start_()}},{key:"start_",value:function(){var e=this;this.started_=!0,this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null,e.logger_("buffered ["+Yl(e.buffered())+"]"),t&&t(),e.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(t){var e=this;this.processedAppend_&&this.queueCallback_(function(){e.sourceBuffer_.abort()},t)}},{key:"appendBuffer",value:function(t,e){var i=this;this.processedAppend_=!0,this.queueCallback_(function(){i.sourceBuffer_.appendBuffer(t)},e)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:oa.createTimeRanges()}},{key:"remove",value:function(t,e){var i=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Pc;this.processedAppend_&&this.queueCallback_(function(){i.logger_("remove ["+t+" => "+e+"]"),i.sourceBuffer_.remove(t,e)},n)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||this.pendingCallback_}},{key:"timestampOffset",value:function(t){var e=this;return"undefined"!=typeof t&&(this.queueCallback_(function(){e.sourceBuffer_.timestampOffset=t}),this.timestampOffset_=t),this.timestampOffset_}},{key:"queueCallback_",value:function(t,e){this.callbacks_.push([t.bind(this),e]),this.runCallback_()}},{key:"runCallback_",value:function(){var t=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(t=this.callbacks_.shift(),this.pendingCallback_=t[1],t[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_&&"open"===this.mediaSource.readyState&&this.sourceBuffer_.abort()}}]),r}(),xc={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},Ic=2,Dc=-101,Rc=-102,Mc=function(t){var e,i,n={};return t.byterange&&(n.Range=(e=t.byterange,i=e.offset+e.length-1,"bytes="+e.offset+"-"+i)),n},Bc=function(t){t.forEach(function(t){t.abort()})},Nc=function(t,e){return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Dc,xhr:e}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Rc,xhr:e}:t?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Ic,xhr:e}:null},jc=function(s,o,u){var l=[],c=0;return function(t,e){if(t&&(Bc(s),l.push(t)),(c+=1)===s.length){if(e.endOfAllRequests=Date.now(),0<l.length){var i=l.reduce(function(t,e){return e.code>t.code?e:t});return u(i,e)}return e.encryptedBytes?(r=e,a=u,(n=o).addEventListener("message",function t(e){if(e.data.source===r.requestId){n.removeEventListener("message",t);var i=e.data.decrypted;return r.bytes=new Uint8Array(i.bytes,i.byteOffset,i.byteLength),a(null,r)}}),void n.postMessage(Fl({source:r.requestId,encrypted:r.encryptedBytes,key:r.key.bytes,iv:r.key.iv}),[r.encryptedBytes.buffer,r.key.bytes.buffer])):u(null,e)}var n,r,a}},Fc=function(r,a){return function(t){var e,i,n;return r.stats=oa.mergeOptions(r.stats,(i=(e=t).target,(n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-i.requestTime||0}).bytesReceived=e.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n)),!r.stats.firstBytesReceivedAt&&r.stats.bytesReceived&&(r.stats.firstBytesReceivedAt=Date.now()),a(t,r)}},Vc=function(t,e,i,n,r,a,s){var o,u,l,c,h,d=[],p=jc(d,i,s);if(r.key){var f=t(oa.mergeOptions(e,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),(o=r,u=p,function(t,e){var i=e.response,n=Nc(t,e);if(n)return u(n,o);if(16!==i.byteLength)return u({status:e.status,message:"Invalid HLS key at URL: "+e.uri,code:Ic,xhr:e},o);var r=new DataView(i);return o.key.bytes=new Uint32Array([r.getUint32(0),r.getUint32(4),r.getUint32(8),r.getUint32(12)]),u(null,o)}));d.push(f)}if(r.map&&!r.map.bytes){var m=t(oa.mergeOptions(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Mc(r.map)}),(l=r,c=n,h=p,function(t,e){var i=e.response,n=Nc(t,e);return n?h(n,l):0===i.byteLength?h({status:e.status,message:"Empty HLS segment content at URL: "+e.uri,code:Ic,xhr:e},l):(l.map.bytes=new Uint8Array(e.response),c.isInitialized()||c.init(),l.map.timescales=Qs.timescale(l.map.bytes),l.map.videoTrackIds=Qs.videoTrackIds(l.map.bytes),h(null,l))}));d.push(m)}var g,y,v,_=t(oa.mergeOptions(e,{uri:r.resolvedUri,responseType:"arraybuffer",headers:Mc(r)}),(g=r,y=n,v=p,function(t,e){var i,n=e.response,r=Nc(t,e),a=void 0;return r?v(r,g):0===n.byteLength?v({status:e.status,message:"Empty HLS segment content at URL: "+e.uri,code:Ic,xhr:e},g):(g.stats={bandwidth:(i=e).bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0},g.key?g.encryptedBytes=new Uint8Array(e.response):g.bytes=new Uint8Array(e.response),g.map&&g.map.bytes&&(y.isInitialized()||y.init(),(a=y.parse(g.bytes,g.map.videoTrackIds,g.map.timescales))&&a.captions&&(g.captionStreams=a.captionStreams,g.fmp4Captions=a.captions)),v(null,g))}));return _.addEventListener("progress",Fc(r,a)),d.push(_),function(){return Bc(d)}},Hc=function(t,e){var i;return t&&(i=v.getComputedStyle(t))?i[e]:""},qc=function(t,n){var r=t.slice();t.sort(function(t,e){var i=n(t,e);return 0===i?r.indexOf(t)-r.indexOf(e):i})},zc=function(t,e){var i=void 0,n=void 0;return t.attributes.BANDWIDTH&&(i=t.attributes.BANDWIDTH),i=i||v.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),i-(n=n||v.Number.MAX_VALUE)},Wc=function(t,e,i){if(!t||!e)return!1;var n=i===t.segments.length;return t.endList&&"open"===e.readyState&&n},Gc=function(t){return"number"==typeof t&&isFinite(t)},Xc=function(t){function i(t){al(this,i);var e=ul(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));if(!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return e.bandwidth=t.bandwidth,e.throughput={rate:0,count:0},e.roundTrip=NaN,e.resetStats_(),e.mediaIndex=null,e.hasPlayed_=t.hasPlayed,e.currentTime_=t.currentTime,e.seekable_=t.seekable,e.seeking_=t.seeking,e.duration_=t.duration,e.mediaSource_=t.mediaSource,e.hls_=t.hls,e.loaderType_=t.loaderType,e.startingMedia_=void 0,e.segmentMetadataTrack_=t.segmentMetadataTrack,e.goalBufferLength_=t.goalBufferLength,e.sourceType_=t.sourceType,e.inbandTextTracks_=t.inbandTextTracks,e.state_="INIT",e.checkBufferTimeout_=null,e.error_=void 0,e.currentTimeline_=-1,e.pendingSegment_=null,e.mimeType_=null,e.sourceUpdater_=null,e.xhrOptions_=null,e.activeInitSegmentId_=null,e.initSegments_={},e.captionParser_=new Iu,e.decrypter_=t.decrypter,e.syncController_=t.syncController,e.syncPoint_={segmentIndex:0,time:0},e.syncController_.on("syncinfoupdate",function(){return e.trigger("syncinfoupdate")}),e.mediaSource_.addEventListener("sourceopen",function(){return e.ended_=!1}),e.fetchAtBuffer_=!1,e.logger_=Oc("SegmentLoader["+e.loaderType_+"]"),Object.defineProperty(e,"state",{get:function(){return this.state_},set:function(t){t!==this.state_&&(this.logger_(this.state_+" -> "+t),this.state_=t)}}),e}return ol(i,oa.EventTarget),sl(i,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_.reset()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(t){return"undefined"!=typeof t&&(this.error_=t),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():oa.createTimeRanges()}},{key:"initSegment",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!t)return null;var i=Vl(t),n=this.initSegments_[i];return e&&!n&&t.bytes&&(this.initSegments_[i]=n={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:t.bytes,timescales:t.timescales,videoTrackIds:t.videoTrackIds}),n||t}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new Uc(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(t){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=e,this.hasPlayed_()||(t.syncInfo={mediaSequence:t.mediaSequence,time:0});var r=i?i.id:null;if(this.logger_("playlist update ["+r+" => "+t.id+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(i&&i.uri===t.uri){var a=t.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex&&(this.mediaIndex-=a),n&&(n.mediaIndex-=a,0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,t)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(v.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(t,e){this.mimeType_||(this.mimeType_=t,this.sourceBufferEmitter_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(t){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),t),this.captionParser_.clearAllCaptions(),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(t,e,i){if(this.sourceUpdater_&&this.sourceUpdater_.remove(t,e,i),Kl(t,e,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var n in this.inbandTextTracks_)Kl(t,e,this.inbandTextTracks_[n])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&v.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=v.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&v.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=v.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t)Wc(this.playlist_,this.mediaSource_,t.mediaIndex)?this.endOfStream():(t.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&((t.timeline!==this.currentTimeline_||null!==t.startOfSegment&&t.startOfSegment<this.sourceUpdater_.timestampOffset())&&(this.syncController_.reset(),t.timestampOffset=t.startOfSegment,this.captionParser_.clearAllCaptions()),this.loadSegment_(t))}}},{key:"checkBuffer_",value:function(t,e,i,n,r,a){var s=0,o=void 0;t.length&&(s=t.end(t.length-1));var u=Math.max(0,s-r);if(!e.segments.length)return null;if(u>=this.goalBufferLength_())return null;if(!n&&1<=u)return null;if(null===a)return i=this.getSyncSegmentCandidate_(e),this.generateSegmentInfo_(e,i,null,!0);if(null!==i){var l=e.segments[i];return o=l&&l.end?l.end:s,this.generateSegmentInfo_(e,i+1,o,!1)}if(this.fetchAtBuffer_){var c=Dl.getMediaInfoForTime(e,s,a.segmentIndex,a.time);i=c.mediaIndex,o=c.startTime}else{var h=Dl.getMediaInfoForTime(e,r,a.segmentIndex,a.time);i=h.mediaIndex,o=h.startTime}return this.generateSegmentInfo_(e,i,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(t){var e=this;if(-1===this.currentTimeline_)return 0;var i=t.segments.map(function(t,e){return{timeline:t.timeline,segmentIndex:e}}).filter(function(t){return t.timeline===e.currentTimeline_});return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(t.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(t,e,i,n){if(e<0||e>=t.segments.length)return null;var r=t.segments[e];return{requestId:"segment-loader-"+Math.random(),uri:r.resolvedUri,mediaIndex:e,isSyncRequest:n,startOfSegment:i,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:r.timeline,duration:r.duration,segment:r}}},{key:"abortRequestEarly_",value:function(t){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(t.firstBytesReceivedAt||Date.now())<1e3)return!1;var e=this.currentTime_(),i=t.bandwidth,n=this.pendingSegment_.duration,r=Dl.estimateSegmentRequestTime(n,i,this.playlist_,t.bytesReceived),a=function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return((t.length?t.end(t.length-1):0)-e)/i}(this.buffered_(),e,this.hls_.tech_.playbackRate())-1;if(r<=a)return!1;var s=function(t){var e=t.master,i=t.currentTime,n=t.bandwidth,r=t.duration,a=t.segmentDuration,s=t.timeUntilRebuffer,o=t.currentTimeline,u=t.syncController,l=e.playlists.filter(function(t){return!Dl.isIncompatible(t)}),c=l.filter(Dl.isEnabled);c.length||(c=l.filter(function(t){return!Dl.isDisabled(t)}));var h=c.filter(Dl.hasAttribute.bind(null,"BANDWIDTH")).map(function(t){var e=u.getSyncPoint(t,r,o,i)?1:2;return{playlist:t,rebufferingImpact:Dl.estimateSegmentRequestTime(a,n,t)*e-s}}),d=h.filter(function(t){return t.rebufferingImpact<=0});return qc(d,function(t,e){return zc(e.playlist,t.playlist)}),d.length?d[0]:(qc(h,function(t,e){return t.rebufferingImpact-e.rebufferingImpact}),h[0]||null)}({master:this.hls_.playlists.master,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;return a<=zl&&(u=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<u?!1:(this.bandwidth=s.playlist.attributes.BANDWIDTH*xc.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(t,e){this.pendingSegment_&&e.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(e.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),t.abortRequests=Vc(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(t),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(t){var e,i,n,r,a=(e=this.seekable_(),i=this.currentTime_(),n=this.playlist_.targetDuration||10,r=void 0,r=e.length&&0<e.start(0)&&e.start(0)<i?e.start(0):i-30,Math.min(r,i-n));0<a&&this.remove(0,a)}},{key:"createSimplifiedSegmentObj_",value:function(t){var e=t.segment,i={resolvedUri:e.resolvedUri,byterange:e.byterange,requestId:t.requestId};if(e.key){var n=e.key.iv||new Uint32Array([0,0,0,t.mediaIndex+t.playlist.mediaSequence]);i.key={resolvedUri:e.key.resolvedUri,iv:n}}return e.map&&(i.map=this.initSegment(e.map)),i}},{key:"segmentRequestFinished_",value:function(t,e){if(this.mediaRequests+=1,e.stats&&(this.mediaBytesTransferred+=e.stats.bytesReceived,this.mediaTransferDuration+=e.stats.roundTripTime),this.pendingSegment_){if(e.requestId===this.pendingSegment_.requestId){if(t)return this.pendingSegment_=null,this.state="READY",t.code===Rc?void(this.mediaRequestsAborted+=1):(this.pause(),t.code===Dc?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(t),void this.trigger("error")));this.bandwidth=e.stats.bandwidth,this.roundTrip=e.stats.roundTripTime,e.map&&(e.map=this.initSegment(e.map,!0)),this.processSegmentResponse_(e)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(t){var e=this.pendingSegment_;e.bytes=t.bytes,t.map&&(e.segment.map.bytes=t.map.bytes),e.endOfAllRequests=t.endOfAllRequests,t.fmp4Captions&&(!function(t,e,i){for(var n in i)if(!t[n]){e.trigger({type:"usage",name:"hls-608"});var r=e.textTracks().getTrackById(n);t[n]=r||e.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,t.captionStreams),function(t){var r=t.inbandTextTracks,e=t.captionArray,a=t.timestampOffset;if(e){var s=window.WebKitDataCue||window.VTTCue;e.forEach(function(t){var e=t.stream,i=t.startTime,n=t.endTime;r[e]&&(i+=a,n+=a,r[e].addCue(new s(i,n,t.text)))})}}({inbandTextTracks:this.inbandTextTracks_,captionArray:t.fmp4Captions,timestampOffset:0}),this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_){var e=this.pendingSegment_,i=e.segment,n=this.syncController_.probeSegmentInfo(e);"undefined"==typeof this.startingMedia_&&n&&(n.containsAudio||n.containsVideo)&&(this.startingMedia_={containsAudio:n.containsAudio,containsVideo:n.containsVideo});var r,a,s,o=(r=this.loaderType_,a=this.startingMedia_,s=n,"main"===r&&a&&s?s.containsAudio||s.containsVideo?a.containsVideo&&!s.containsVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!a.containsVideo&&s.containsVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null);if(o)return this.error({message:o,blacklistDuration:1/0}),void this.trigger("error");if(e.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==e.timestampOffset&&e.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(e.timestampOffset),this.trigger("timestampoffset"));var u,l,c,h,d,p,f,m,g,y,v,_=this.syncController_.mappingForTimeline(e.timeline);if(null!==_&&this.trigger({type:"segmenttimemapping",mapping:_}),this.state="APPENDING",i.map){var b=Vl(i.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==b){var T=this.initSegment(i.map);this.sourceUpdater_.appendBuffer(T.bytes,function(){t.activeInitSegmentId_=b})}}e.byteLength=e.bytes.byteLength,"number"==typeof i.start&&"number"==typeof i.end?this.mediaSecondsLoaded+=i.end-i.start:this.mediaSecondsLoaded+=i.duration,this.logger_((l=(u=e).segment,c=l.start,h=l.end,d=u.playlist,p=d.mediaSequence,f=d.id,m=d.segments,g=void 0===m?[]:m,y=u.mediaIndex,v=u.timeline,["appending ["+y+"] of ["+p+", "+(p+g.length)+"] from playlist ["+f+"]","["+c+" => "+h+"] in timeline ["+v+"]"].join(" "))),this.sourceUpdater_.appendBuffer(e.bytes,this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var t=this.pendingSegment_,e=t.segment,i=null!==this.mediaIndex;(this.pendingSegment_=null,this.recordThroughput_(t),this.addSegmentMetadataCue_(t),this.state="READY",this.mediaIndex=t.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=t.timeline,this.trigger("syncinfoupdate"),e.end&&this.currentTime_()-e.end>3*t.playlist.targetDuration)?this.resetEverything():(i&&this.trigger("bandwidthupdate"),this.trigger("progress"),Wc(t.playlist,this.mediaSource_,t.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(t){var e=this.throughput.rate,i=Date.now()-t.endOfAllRequests+1,n=Math.floor(t.byteLength/i*8*1e3);this.throughput.rate+=(n-e)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var e=t.segment,i=e.start,n=e.end;if(Gc(i)&&Gc(n)){Kl(i,n,this.segmentMetadataTrack_);var r=v.WebKitDataCue||v.VTTCue,a={bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:i,end:n},s=new r(i,n,JSON.stringify(a));s.value=a,this.segmentMetadataTrack_.addCue(s)}}}}]),i}(),Yc=function(t){return decodeURIComponent(escape(String.fromCharCode.apply(null,t)))},$c=new Uint8Array("\n\n".split("").map(function(t){return t.charCodeAt(0)})),Kc=function(t){function n(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};al(this,n);var i=ul(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.mediaSource_=null,i.subtitlesTrack_=null,i}return ol(n,Xc),sl(n,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return oa.createTimeRanges();var t=this.subtitlesTrack_.cues,e=t[0].startTime,i=t[t.length-1].startTime;return oa.createTimeRanges([[e,i]])}},{key:"initSegment",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!t)return null;var i=Vl(t),n=this.initSegments_[i];if(e&&!n&&t.bytes){var r=$c.byteLength+t.bytes.byteLength,a=new Uint8Array(r);a.set(t.bytes),a.set($c,t.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:a}}return n||t}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(t){return"undefined"==typeof t||(this.subtitlesTrack_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(t,e){Kl(t,e,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var t=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(e=this.skipEmptySegments_(e)){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){return this.syncController_.one("timestampoffset",function(){t.state="READY",t.paused()||t.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(e)}}},{key:"skipEmptySegments_",value:function(t){for(;t&&t.segment.empty;)t=this.generateSegmentInfo_(t.playlist,t.mediaIndex+1,t.startOfSegment+t.duration,t.isSyncRequest);return t}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_&&this.subtitlesTrack_){this.state="APPENDING";var t=this.pendingSegment_,i=t.segment;if("function"!=typeof v.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var n=function(){e.handleSegment_()};return this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",n),void this.subtitlesTrack_.tech_.one("vttjserror",function(){e.subtitlesTrack_.tech_.off("vttjsloaded",n),e.error({message:"Error loading vtt.js"}),e.state="READY",e.pause(),e.trigger("error")})}i.requested=!0;try{this.parseVTTCues_(t)}catch(t){return this.error({message:t.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(t,this.syncController_.timelines[t.timeline],this.playlist_),t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");t.byteLength=t.bytes.byteLength,this.mediaSecondsLoaded+=i.duration,t.cues.length&&this.remove(t.cues[0].endTime,t.cues[t.cues.length-1].endTime),t.cues.forEach(function(t){e.subtitlesTrack_.addCue(t)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(e){var t=void 0,i=!1;"function"==typeof v.TextDecoder?t=new v.TextDecoder("utf8"):(t=v.WebVTT.StringDecoder(),i=!0);var n=new v.WebVTT.Parser(v,v.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){return e.timestampmap=t},n.onparsingerror=function(t){oa.log.warn("Error encountered when parsing cues: "+t.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=Yc(r)),n.parse(r)}var a=e.bytes;i&&(a=Yc(a)),n.parse(a),n.flush()}},{key:"updateTimeMapping_",value:function(t,e,i){var n=t.segment;if(e)if(t.cues.length){var r=t.timestampmap,a=r.MPEGTS/9e4-r.LOCAL+e.mapping;if(t.cues.forEach(function(t){t.startTime+=a,t.endTime+=a}),!i.syncInfo){var s=t.cues[0].startTime,o=t.cues[t.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+t.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0}}]),n}(),Qc=function(t,e){for(var i=t.cues,n=0;n<i.length;n++){var r=i[n];if(e>=r.adStartTime&&e<=r.adEndTime)return r}return null},Jc=Yu,Zc=[{name:"VOD",run:function(t,e,i,n,r){if(i===1/0)return null;return{time:0,segmentIndex:0}}},{name:"ProgramDateTime",run:function(t,e,i,n,r){if(!t.datetimeToDisplayTime)return null;var a=e.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var l=a[u];if(l.dateTimeObject){var c=l.dateTimeObject.getTime()/1e3+t.datetimeToDisplayTime,h=Math.abs(r-c);if(null!==o&&o<h)break;o=h,s={time:c,segmentIndex:u}}}return s}},{name:"Segment",run:function(t,e,i,n,r){var a=e.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var l=a[u];if(l.timeline===n&&"undefined"!=typeof l.start){var c=Math.abs(r-l.start);if(null!==o&&o<c)break;(!s||null===o||c<=o)&&(o=c,s={time:l.start,segmentIndex:u})}}return s}},{name:"Discontinuity",run:function(t,e,i,n,r){var a=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length)for(var s=null,o=0;o<e.discontinuityStarts.length;o++){var u=e.discontinuityStarts[o],l=e.discontinuitySequence+o+1,c=t.discontinuities[l];if(c){var h=Math.abs(r-c.time);if(null!==s&&s<h)break;(!a||null===s||h<=s)&&(s=h,a={time:c.time,segmentIndex:u})}}return a}},{name:"Playlist",run:function(t,e,i,n,r){return e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence}:null}}],th=function(t){function e(){al(this,e);var t=ul(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.inspectCache_=void 0,t.timelines=[],t.discontinuities=[],t.datetimeToDisplayTime=null,t.logger_=Oc("SyncController"),t}return ol(e,oa.EventTarget),sl(e,[{key:"getSyncPoint",value:function(t,e,i,n){var r=this.runStrategies_(t,e,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null}},{key:"getExpiredTime",value:function(t,e){if(!t||!t.segments)return null;var i=this.runStrategies_(t,e,t.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return 0<n.segmentIndex&&(n.time*=-1),Math.abs(n.time+Sl(t,n.segmentIndex,0))}},{key:"runStrategies_",value:function(t,e,i,n){for(var r=[],a=0;a<Zc.length;a++){var s=Zc[a],o=s.run(this,t,e,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r}},{key:"selectSyncPoint_",value:function(t,e){for(var i=t[0].syncPoint,n=Math.abs(t[0].syncPoint[e.key]-e.value),r=t[0].strategy,a=1;a<t.length;a++){var s=Math.abs(t[a].syncPoint[e.key]-e.value);s<n&&(n=s,i=t[a].syncPoint,r=t[a].strategy)}return this.logger_("syncPoint for ["+e.key+": "+e.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+"]"),i}},{key:"saveExpiredSegmentInfo",value:function(t,e){for(var i=e.mediaSequence-t.mediaSequence-1;0<=i;i--){var n=t.segments[i];if(n&&"undefined"!=typeof n.start){e.syncInfo={mediaSequence:t.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+e.syncInfo.time+", mediaSequence: "+e.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(t){if(!this.datetimeToDisplayTime&&t.segments&&t.segments.length&&t.segments[0].dateTimeObject){var e=t.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-e}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(t){var e=t.segment,i=t.playlist,n=void 0;return(n=e.map?this.probeMp4Segment_(t):this.probeTsSegment_(t))&&this.calculateSegmentTimeMapping_(t,n)&&(this.saveDiscontinuitySyncInfo_(t),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+t.mediaIndex,time:e.start})),n}},{key:"probeMp4Segment_",value:function(t){var e=t.segment,i=Qs.timescale(e.map.bytes),n=Qs.startTime(i,t.bytes);return null!==t.timestampOffset&&(t.timestampOffset-=n),{start:n,end:n+e.duration}}},{key:"probeTsSegment_",value:function(t){var e=Jc(t.bytes,this.inspectCache_),i=void 0,n=void 0;return e?(e.video&&2===e.video.length?(this.inspectCache_=e.video[1].dts,i=e.video[0].dtsTime,n=e.video[1].dtsTime):e.audio&&2===e.audio.length&&(this.inspectCache_=e.audio[1].dts,i=e.audio[0].dtsTime,n=e.audio[1].dtsTime),{start:i,end:n,containsVideo:e.video&&2===e.video.length,containsAudio:e.audio&&2===e.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(t){return"undefined"==typeof this.timelines[t]?null:this.timelines[t].time}},{key:"mappingForTimeline",value:function(t){return"undefined"==typeof this.timelines[t]?null:this.timelines[t].mapping}},{key:"calculateSegmentTimeMapping_",value:function(t,e){var i=t.segment,n=this.timelines[t.timeline];if(null!==t.timestampOffset)n={time:t.startOfSegment,mapping:t.startOfSegment-e.start},this.timelines[t.timeline]=n,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+t.timeline+": [time: "+n.time+"] [mapping: "+n.mapping+"]"),i.start=t.startOfSegment,i.end=e.end+n.mapping;else{if(!n)return!1;i.start=e.start+n.mapping,i.end=e.end+n.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(t){var e=t.playlist,i=t.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(e.discontinuityStarts&&e.discontinuityStarts.length)for(var n=0;n<e.discontinuityStarts.length;n++){var r=e.discontinuityStarts[n],a=e.discontinuitySequence+n+1,s=r-t.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0;u=s<0?i.start-Sl(e,t.mediaIndex,r):i.end+Sl(e,t.mediaIndex+1,r),this.discontinuities[a]={time:u,accuracy:o}}}}}]),e}(),eh=new ac("./decrypter-worker.worker.js",function(t,e){var h,i,d,g,n,l,y,s,r=this;h=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=function(){function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}(),d=null,g=function(){function c(t){h(this,c),d||(d=function(){var t=[[[],[],[],[],[]],[[],[],[],[],[]]],e=t[0],i=t[1],n=e[4],r=i[4],a=void 0,s=void 0,o=void 0,u=[],l=[],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0;for(a=0;a<256;a++)l[(u[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!n[s];s^=c||1,o=l[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,f=16843009*u[h=u[c=u[r[n[s]=d]=s]]]^65537*h^257*c^16843008*s,p=257*u[d]^16843008*d,a=0;a<4;a++)e[a][s]=p=p<<24^p>>>8,i[a][d]=f=f<<24^f>>>8;for(a=0;a<5;a++)e[a]=e[a].slice(0),i[a]=i[a].slice(0);return t}()),this._tables=[[d[0][0].slice(),d[0][1].slice(),d[0][2].slice(),d[0][3].slice(),d[0][4].slice()],[d[1][0].slice(),d[1][1].slice(),d[1][2].slice(),d[1][3].slice(),d[1][4].slice()]];var e=void 0,i=void 0,n=void 0,r=void 0,a=void 0,s=this._tables[0][4],o=this._tables[1],u=t.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");for(r=t.slice(0),a=[],this._key=[r,a],e=u;e<4*u+28;e++)n=r[e-1],(e%u==0||8===u&&e%u==4)&&(n=s[n>>>24]<<24^s[n>>16&255]<<16^s[n>>8&255]<<8^s[255&n],e%u==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),r[e]=r[e-u]^n;for(i=0;e;i++,e--)n=r[3&i?e:e-4],a[i]=e<=4||i<4?n:o[0][s[n>>>24]]^o[1][s[n>>16&255]]^o[2][s[n>>8&255]]^o[3][s[255&n]]}return c.prototype.decrypt=function(t,e,i,n,r,a){var s=this._key[1],o=t^s[0],u=n^s[1],l=i^s[2],c=e^s[3],h=void 0,d=void 0,p=void 0,f=s.length/4-2,m=void 0,g=4,y=this._tables[1],v=y[0],_=y[1],b=y[2],T=y[3],S=y[4];for(m=0;m<f;m++)h=v[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^s[g],d=v[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^s[g+1],p=v[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^s[g+2],c=v[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^s[g+3],g+=4,o=h,u=d,l=p;for(m=0;m<4;m++)r[(3&-m)+a]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^s[g++],h=o,o=u,u=l,l=c,c=h},c}(),n=function(){function t(){h(this,t),this.listeners={}}return t.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},t.prototype.off=function(t,e){if(!this.listeners[t])return!1;var i=this.listeners[t].indexOf(e);return this.listeners[t].splice(i,1),-1<i},t.prototype.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var i=e.length,n=0;n<i;++n)e[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=e.length,s=0;s<a;++s)e[s].apply(this,r)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},t}(),l=function(e){function i(){h(this,i);var t=function(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}(this,e.call(this,n));return t.jobs=[],t.delay=1,t.timeout_=null,t}return function(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)}(i,e),i.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.prototype.push=function(t){this.jobs.push(t),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},i}(n),y=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},s=function(){function u(t,e,i,n){h(this,u);var r=u.STEP,a=new Int32Array(t.buffer),s=new Uint8Array(t.byteLength),o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(a.subarray(o,o+r),e,i,s)),o=r;o<a.length;o+=r)i=new Uint32Array([y(a[o-4]),y(a[o-3]),y(a[o-2]),y(a[o-1])]),this.asyncStream_.push(this.decryptChunk_(a.subarray(o,o+r),e,i,s));this.asyncStream_.push(function(){var t;n(null,(t=s).subarray(0,t.byteLength-t[t.byteLength-1]))})}return u.prototype.decryptChunk_=function(e,i,n,r){return function(){var t=function(t,e,i){var n=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),r=new g(Array.prototype.slice.call(e)),a=new Uint8Array(t.byteLength),s=new Int32Array(a.buffer),o=void 0,u=void 0,l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=void 0;for(o=i[0],u=i[1],l=i[2],c=i[3],m=0;m<n.length;m+=4)h=y(n[m]),d=y(n[m+1]),p=y(n[m+2]),f=y(n[m+3]),r.decrypt(h,d,p,f,s,m),s[m]=y(s[m]^o),s[m+1]=y(s[m+1]^u),s[m+2]=y(s[m+2]^l),s[m+3]=y(s[m+3]^c),o=h,u=d,l=p,c=f;return a}(e,i,n);r.set(t,e.byteOffset)}},i(u,null,[{key:"STEP",get:function(){return 32e3}}]),u}(),new function(a){a.onmessage=function(t){var r=t.data,e=new Uint8Array(r.encrypted.bytes,r.encrypted.byteOffset,r.encrypted.byteLength),i=new Uint32Array(r.key.bytes,r.key.byteOffset,r.key.byteLength/4),n=new Uint32Array(r.iv.bytes,r.iv.byteOffset,r.iv.byteLength/4);new s(e,i,n,function(t,e){var i,n;a.postMessage((i={source:r.source,decrypted:e},n={},Object.keys(i).forEach(function(t){var e=i[t];ArrayBuffer.isView(e)?n[t]={bytes:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}:n[t]=e}),n),[e.buffer])})}}(r)}),ih=function(t,e){t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},nh=function(t,e){(e.activePlaylistLoader=t).load()},rh={AUDIO:function(u,l){return function(){var t=l.segmentLoaders[u],e=l.mediaTypes[u],i=l.blacklistCurrentPlaylist;ih(t,e);var n=e.activeTrack(),r=e.activeGroup(),a=(r.filter(function(t){return t.default})[0]||r[0]).id,s=e.tracks[a];if(n!==s){for(var o in oa.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),e.tracks)e.tracks[o].enabled=e.tracks[o]===s;e.onTrackChanged()}else i({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(n,r){return function(){var t=r.segmentLoaders[n],e=r.mediaTypes[n];oa.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),ih(t,e);var i=e.activeTrack();i&&(i.mode="disabled"),e.onTrackChanged()}}},ah={AUDIO:function(t,e,i){if(e){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[t];e.on("loadedmetadata",function(){var t=e.media();a.playlist(t,r),(!n.paused()||t.endList&&"none"!==n.preload())&&a.load()}),e.on("loadedplaylist",function(){a.playlist(e.media(),r),n.paused()||a.load()}),e.on("error",rh[t](t,i))}},SUBTITLES:function(t,e,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[t],s=i.mediaTypes[t];e.on("loadedmetadata",function(){var t=e.media();a.playlist(t,r),a.track(s.activeTrack()),(!n.paused()||t.endList&&"none"!==n.preload())&&a.load()}),e.on("loadedplaylist",function(){a.playlist(e.media(),r),n.paused()||a.load()}),e.on("error",rh[t](t,i))}},sh=function(e,i){return function(t){return t.attributes[e]===i}},oh=function(e){return function(t){return t.resolvedUri===e}},uh={AUDIO:function(t,e){var i,n,r=e.hls,a=e.sourceType,s=e.segmentLoaders[t],o=e.requestOptions.withCredentials,u=e.master,l=u.mediaGroups,c=u.playlists,h=e.mediaTypes[t],d=h.groups,p=h.tracks,f=e.masterPlaylistLoader;for(var m in l[t]&&0!==Object.keys(l[t]).length||(l[t]={main:{default:{default:!0}}}),l[t]){d[m]||(d[m]=[]);var g=c.filter(sh(t,m));for(var y in l[t][m]){var v=l[t][m][y];g.filter(oh(v.resolvedUri)).length&&delete v.resolvedUri;var _=void 0;if(_=v.resolvedUri?new vl(v.resolvedUri,r,o):v.playlists&&"dash"===a?new Lc(v.playlists[0],r,o,f):null,v=oa.mergeOptions({id:y,playlistLoader:_},v),ah[t](t,v.playlistLoader,e),d[m].push(v),"undefined"==typeof p[y]){var b=new oa.AudioTrack({id:y,kind:(i=v,n=void 0,n=i.default?"main":"alternative",i.characteristics&&0<=i.characteristics.indexOf("public.accessibility.describes-video")&&(n="main-desc"),n),enabled:!1,language:v.language,default:v.default,label:y});p[y]=b}}}s.on("error",rh[t](t,e))},SUBTITLES:function(t,e){var i=e.tech,n=e.hls,r=e.sourceType,a=e.segmentLoaders[t],s=e.requestOptions.withCredentials,o=e.master.mediaGroups,u=e.mediaTypes[t],l=u.groups,c=u.tracks,h=e.masterPlaylistLoader;for(var d in o[t])for(var p in l[d]||(l[d]=[]),o[t][d])if(!o[t][d][p].forced){var f=o[t][d][p],m=void 0;if("hls"===r?m=new vl(f.resolvedUri,n,s):"dash"===r&&(m=new Lc(f.playlists[0],n,s,h)),f=oa.mergeOptions({id:p,playlistLoader:m},f),ah[t](t,f.playlistLoader,e),l[d].push(f),"undefined"==typeof c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",rh[t](t,e))},"CLOSED-CAPTIONS":function(t,e){var i=e.tech,n=e.master.mediaGroups,r=e.mediaTypes[t],a=r.groups,s=r.tracks;for(var o in n[t])for(var u in a[o]||(a[o]=[]),n[t][o]){var l=n[t][o][u];if(l.instreamId.match(/CC\d/)&&(a[o].push(oa.mergeOptions({id:u},l)),"undefined"==typeof s[u])){var c=i.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default&&l.autoselect,language:l.language,label:u},!1).track;s[u]=c}}}},lh={AUDIO:function(i,n){return function(){var t=n.mediaTypes[i].tracks;for(var e in t)if(t[e].enabled)return t[e];return null}},SUBTITLES:function(i,n){return function(){var t=n.mediaTypes[i].tracks;for(var e in t)if("showing"===t[e].mode)return t[e];return null}}},ch=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){uh[t](t,e)});var i=e.mediaTypes,t=e.masterPlaylistLoader,n=e.tech,r=e.hls;["AUDIO","SUBTITLES"].forEach(function(t){var a,s,o,u,l,c;i[t].activeGroup=(a=t,s=e,function(e){var t=s.masterPlaylistLoader,i=s.mediaTypes[a].groups,n=t.media();if(!n)return null;var r=null;return n.attributes[a]&&(r=i[n.attributes[a]]),r=r||i.main,"undefined"==typeof e?r:null===e?null:r.filter(function(t){return t.id===e.id})[0]||null}),i[t].activeTrack=lh[t](t,e),i[t].onGroupChanged=(o=t,u=e,function(){var t=u.segmentLoaders,e=t[o],i=t.main,n=u.mediaTypes[o],r=n.activeTrack(),a=n.activeGroup(r),s=n.activePlaylistLoader;ih(e,n),a&&(a.playlistLoader?(e.resyncLoader(),nh(a.playlistLoader,n)):s&&i.resetEverything())}),i[t].onTrackChanged=(l=t,c=e,function(){var t=c.segmentLoaders,e=t[l],i=t.main,n=c.mediaTypes[l],r=n.activeTrack(),a=n.activeGroup(r),s=n.activePlaylistLoader;ih(e,n),a&&(a.playlistLoader?(s!==a.playlistLoader&&(e.track&&e.track(r),e.resetEverything()),nh(a.playlistLoader,n)):i.resetEverything())})});var a=i.AUDIO.activeGroup(),s=(a.filter(function(t){return t.default})[0]||a[0]).id;i.AUDIO.tracks[s].enabled=!0,i.AUDIO.onTrackChanged(),t.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(t){return i[t].onGroupChanged()})});var o=function(){i.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"hls-audio-change"})};for(var u in n.audioTracks().addEventListener("change",o),n.remoteTextTracks().addEventListener("change",i.SUBTITLES.onTrackChanged),r.on("dispose",function(){n.audioTracks().removeEventListener("change",o),n.remoteTextTracks().removeEventListener("change",i.SUBTITLES.onTrackChanged)}),n.clearTracks("audio"),i.AUDIO.tracks)n.audioTracks().addTrack(i.AUDIO.tracks[u])},hh=void 0,dh=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],ph=function(t){function f(t){al(this,f);var e,i=ul(this,(f.__proto__||Object.getPrototypeOf(f)).call(this)),n=t.url,r=t.withCredentials,a=t.tech,s=t.bandwidth,o=t.externHls,u=t.useCueTags,l=t.blacklistDuration,c=t.enableLowInitialPlaylist,h=t.sourceType,d=t.seekTo;if(!n)throw new Error("A non-empty playlist URL is required");hh=o,i.withCredentials=r,i.tech_=a,i.hls_=a.hls,i.seekTo_=d,i.sourceType_=h,i.useCueTags_=u,i.blacklistDuration=l,i.enableLowInitialPlaylist=c,i.useCueTags_&&(i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues"),i.cueTagsTrack_.inBandMetadataTrackDispatchType=""),i.requestOptions_={withCredentials:i.withCredentials,timeout:null},i.mediaTypes_=(e={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Pc,activeTrack:Pc,onGroupChanged:Pc,onTrackChanged:Pc}}),e),i.mediaSource=new oa.MediaSource,i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_.bind(i)),i.seekable_=oa.createTimeRanges(),i.hasPlayed_=function(){return!1},i.syncController_=new th(t),i.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,i.decrypter_=new eh,i.inbandTextTracks_={};var p={hls:i.hls_,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.mediaSource.duration},hasPlayed:function(){return i.hasPlayed_()},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:s,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_};return i.masterPlaylistLoader_="dash"===i.sourceType_?new Lc(n,i.hls_,i.withCredentials):new vl(n,i.hls_,i.withCredentials),i.setupMasterPlaylistLoaderListeners_(),i.mainSegmentLoader_=new Xc(oa.mergeOptions(p,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t),i.audioSegmentLoader_=new Xc(oa.mergeOptions(p,{loaderType:"audio"}),t),i.subtitleSegmentLoader_=new Kc(oa.mergeOptions(p,{loaderType:"vtt"}),t),i.setupSegmentLoaderListeners_(),dh.forEach(function(t){i[t+"_"]=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]}.bind(i,t)}),i.logger_=Oc("MPC"),i.masterPlaylistLoader_.load(),i}return ol(f,oa.EventTarget),sl(f,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var n=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=n.masterPlaylistLoader_.media(),e=1.5*n.masterPlaylistLoader_.targetDuration*1e3;Il(n.masterPlaylistLoader_.master,n.masterPlaylistLoader_.media())?n.requestOptions_.timeout=0:n.requestOptions_.timeout=e,t.endList&&"none"!==n.tech_.preload()&&(n.mainSegmentLoader_.playlist(t,n.requestOptions_),n.mainSegmentLoader_.load()),ch({sourceType:n.sourceType_,segmentLoaders:{AUDIO:n.audioSegmentLoader_,SUBTITLES:n.subtitleSegmentLoader_,main:n.mainSegmentLoader_},tech:n.tech_,requestOptions:n.requestOptions_,masterPlaylistLoader:n.masterPlaylistLoader_,hls:n.hls_,master:n.master(),mediaTypes:n.mediaTypes_,blacklistCurrentPlaylist:n.blacklistCurrentPlaylist.bind(n)}),n.triggerPresenceUsage_(n.master(),t);try{n.setupSourceBuffers_()}catch(t){return oa.log.warn("Failed to create SourceBuffers",t),n.mediaSource.endOfStream("decode")}n.setupFirstPlay(),n.trigger("selectedinitialmedia")}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var t=n.masterPlaylistLoader_.media();if(!t){n.excludeUnsupportedVariants_();var e=void 0;return n.enableLowInitialPlaylist&&(e=n.selectInitialPlaylist()),e||(e=n.selectPlaylist()),n.initialMedia_=e,void n.masterPlaylistLoader_.media(n.initialMedia_)}if(n.useCueTags_&&n.updateAdCues_(t),n.mainSegmentLoader_.playlist(t,n.requestOptions_),n.updateDuration(),n.tech_.paused()||(n.mainSegmentLoader_.load(),n.audioSegmentLoader_&&n.audioSegmentLoader_.load()),!t.endList){var i=function(){var t=n.seekable();0!==t.length&&n.mediaSource.addSeekableRange_(t.start(0),t.end(0))};if(n.duration()!==1/0){n.tech_.one("durationchange",function t(){n.duration()===1/0?i():n.tech_.one("durationchange",t)})}else i()}}),this.masterPlaylistLoader_.on("error",function(){n.blacklistCurrentPlaylist(n.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){n.mainSegmentLoader_.abort(),n.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var t=n.masterPlaylistLoader_.media(),e=1.5*n.masterPlaylistLoader_.targetDuration*1e3;Il(n.masterPlaylistLoader_.master,n.masterPlaylistLoader_.media())?n.requestOptions_.timeout=0:n.requestOptions_.timeout=e,n.mainSegmentLoader_.playlist(t,n.requestOptions_),n.mainSegmentLoader_.load(),n.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var t=n.masterPlaylistLoader_.media();n.stuckAtPlaylistEnd_(t)&&(n.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),n.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){n.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){n.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(t,e){var i=t.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a]){i.AUDIO[a][s].uri||(n=!1)}n&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),hh.Playlist.isAes(e)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),hh.Playlist.isFmp4(e)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),r.length&&1<Object.keys(i.AUDIO[r[0]]).length&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var a=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var t=a.selectPlaylist(),e=a.masterPlaylistLoader_.media(),i=a.tech_.buffered(),n=i.length?i.end(i.length-1)-a.tech_.currentTime():0,r=a.bufferLowWaterLine();(!e.endList||a.duration()<xc.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<e.attributes.BANDWIDTH||r<=n)&&a.masterPlaylistLoader_.media(t),a.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){a.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){a.blacklistCurrentPlaylist(a.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){a.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){a.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){a.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){a.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(){a.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}),this.mainSegmentLoader_.on("reseteverything",function(){a.tech_.trigger("hls-reset")}),this.mainSegmentLoader_.on("segmenttimemapping",function(t){a.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})}),this.audioSegmentLoader_.on("ended",function(){a.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var t=this,e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetEverything(function(){oa.browser.IE_VERSION||oa.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0),this.hasPlayed_()&&this.load();var t=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<t.start(0)?this.seekTo_(t.end(t.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var t=this,e=this.masterPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_())return!1;if(!e.endList){var i=this.seekable();if(!i.length)return!1;if(oa.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",function(){t.trigger("firstplay"),t.seekTo_(i.end(0)),t.hasPlayed_=function(){return!0}}),!1;this.trigger("firstplay"),this.seekTo_(i.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(t){return oa.log.warn("Failed to create Source Buffers",t),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var t=this.tech_.play();"undefined"!=typeof t&&"function"==typeof t.then&&t.then(null,function(t){})}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var t=this.mainSegmentLoader_.ended_;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?t&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),t&&this.mediaSource.endOfStream()}},{key:"stuckAtPlaylistEnd_",value:function(t){if(!this.seekable().length)return!1;var e=this.syncController_.getExpiredTime(t,this.mediaSource.duration);if(null===e)return!1;var i=hh.Playlist.playlistEnd(t,e),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=.1;var a=r.end(r.length-1);return a-n<=.1&&i-a<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1],n=void 0;if(n=e.playlist||this.masterPlaylistLoader_.media(),i=i||e.blacklistDuration||this.blacklistDuration,!n){this.error=e;try{return this.mediaSource.endOfStream("network")}catch(t){return this.trigger("error")}}var r=1===this.masterPlaylistLoader_.master.playlists.filter(Ul).length;return r?(oa.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the final playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(r)):(n.excludeUntil=Date.now()+1e3*i,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),t=this.selectPlaylist(),oa.log.warn("Problem encountered with the current HLS playlist."+(e.message?" "+e.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(t))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(t){var e=Gl(this.tech_.buffered(),t);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?e&&e.length?t:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:hh.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var t=void 0,e=void 0;if(this.masterPlaylistLoader_){var i=this.masterPlaylistLoader_.media();if(i){var n=this.syncController_.getExpiredTime(i,this.mediaSource.duration);if(null!==n&&0!==(t=hh.Playlist.seekable(i,n)).length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(i=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(n=this.syncController_.getExpiredTime(i,this.mediaSource.duration)))return;if(0===(e=hh.Playlist.seekable(i,n)).length)return}e?e.start(0)>t.end(0)||t.start(0)>e.end(0)?this.seekable_=t:this.seekable_=oa.createTimeRanges([[e.start(0)>t.start(0)?e.start(0):t.start(0),e.end(0)<t.end(0)?e.end(0):t.end(0)]]):this.seekable_=t,this.logger_("seekable updated ["+Yl(this.seekable_)+"]"),this.tech_.trigger("seekablechanged")}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=hh.Playlist.duration(this.masterPlaylistLoader_.media()),n=this.tech_.buffered(),r=function t(){e.mediaSource.duration=i,e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};0<n.length&&(i=Math.max(i,n.end(n.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",r):r())}},{key:"dispose",value:function(){var n=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach(function(t){var e=n.mediaTypes_[t].groups;for(var i in e)e[i].forEach(function(t){t.playlistLoader&&t.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var t,e=this.masterPlaylistLoader_.media();if(e&&"open"===this.mediaSource.readyState){if((t=mc(this.masterPlaylistLoader_.master,e)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+e.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(t),this.excludeIncompatibleVariants_(e)}}},{key:"configureLoaderMimeTypes_",value:function(t){var e=1<t.length&&-1===t[0].indexOf(",")&&t[0]!==t[1]?new oa.EventTarget:null;this.mainSegmentLoader_.mimeType(t[0],e),t[1]&&this.audioSegmentLoader_.mimeType(t[1],e)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(t){t.attributes.CODECS&&v.MediaSource&&v.MediaSource.isTypeSupported&&!v.MediaSource.isTypeSupported('video/mp4; codecs="'+t.attributes.CODECS.replace(/avc1\.(\d+)\.(\d+)/i,function(t){return dc([t])[0]})+'"')&&(t.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(t){var i=2,n=null,e=void 0;t.attributes.CODECS&&(e=pc(t.attributes.CODECS),n=e.videoCodec,i=e.codecCount),this.master().playlists.forEach(function(t){var e={codecCount:2,videoCodec:null};t.attributes.CODECS&&(e=pc(t.attributes.CODECS)),e.codecCount!==i&&(t.excludeUntil=1/0),e.videoCodec!==n&&(t.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(t){var e=0,i=this.seekable();i.length&&(e=i.start(0)),function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(t.segments)for(var n=i,r=void 0,a=0;a<t.segments.length;a++){var s=t.segments[a];if(r||(r=Qc(e,n+s.duration/2)),r){if("cueIn"in s){r.endTime=n,r.adEndTime=n,n+=s.duration,r=null;continue}if(n<r.endTime){n+=s.duration;continue}r.endTime+=s.duration}else if("cueOut"in s&&((r=new v.VTTCue(n,n+s.duration,s.cueOut)).adStartTime=n,r.adEndTime=n+parseFloat(s.cueOut),e.addCue(r)),"cueOutCont"in s){var o,u,l=s.cueOutCont.split("/").map(parseFloat),c=ll(l,2);o=c[0],u=c[1],(r=new v.VTTCue(n,n+s.duration,"")).adStartTime=n-o,r.adEndTime=r.adStartTime+u,e.addCue(r)}n+=s.duration}}(t,this.cueTagsTrack_,e)}},{key:"goalBufferLength",value:function(){var t=this.tech_.currentTime(),e=xc.GOAL_BUFFER_LENGTH,i=xc.GOAL_BUFFER_LENGTH_RATE,n=Math.max(e,xc.MAX_GOAL_BUFFER_LENGTH);return Math.min(e+t*i,n)}},{key:"bufferLowWaterLine",value:function(){var t=this.tech_.currentTime(),e=xc.BUFFER_LOW_WATER_LINE,i=xc.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(e,xc.MAX_BUFFER_LOW_WATER_LINE);return Math.min(e+t*i,n)}}]),f}(),fh=function t(e,i,n){al(this,t);var r,a,s,o=e.masterPlaylistController_,u=o[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION;this.width=l.width,this.height=l.height}this.bandwidth=i.attributes.BANDWIDTH,this.id=n,this.enabled=(r=e.playlists,a=i.uri,s=u,function(t){var e=r.master.playlists[a],i=Pl(e),n=Ul(e);return"undefined"==typeof t?n:(t?delete e.disabled:e.disabled=!0,t===n||i||(s(),t?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),t)})},mh=["seeking","seeked","pause","playing","error"],gh=function(){function s(t){var e=this;al(this,s),this.tech_=t.tech,this.seekable=t.seekable,this.seekTo=t.seekTo,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=Oc("PlaybackWatcher"),this.logger_("initialize");var i=function(){return e.monitorCurrentTime_()},n=function(){return e.techWaiting_()},r=function(){return e.cancelTimer_()},a=function(){return e.fixesBadSeeks_()};this.tech_.on("seekablechanged",a),this.tech_.on("waiting",n),this.tech_.on(mh,r),this.tech_.on("canplay",i),this.dispose=function(){e.logger_("dispose"),e.tech_.off("seekablechanged",a),e.tech_.off("waiting",n),e.tech_.off(mh,r),e.tech_.off("canplay",i),e.checkCurrentTimeTimeout_&&v.clearTimeout(e.checkCurrentTimeTimeout_),e.cancelTimer_()}}return sl(s,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&v.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=v.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var t=this.tech_.currentTime(),e=this.tech_.buffered();if(this.lastRecordedTime===t&&(!e.length||t+.1>=e.end(e.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&t===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):t===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=t)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var t=this.tech_.seeking(),e=this.seekable(),i=this.tech_.currentTime(),n=void 0;t&&this.afterSeekableWindow_(e,i)&&(n=e.end(e.length-1));t&&this.beforeSeekableWindow_(e,i)&&(n=e.start(0)+.1);return"undefined"!=typeof n&&(this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+Yl(e)+". Seeking to "+n+"."),this.seekTo(n),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var t=this.tech_.currentTime(),e=this.tech_.buffered(),i=Gl(e,t);return i.length&&t+3<=i.end(0)?(this.cancelTimer_(),this.seekTo(t),this.logger_("Stopped at "+t+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var t=this.seekable(),e=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(t,e)){var i=t.end(t.length-1);return this.logger_("Fell out of live window at time "+e+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.seekTo(i),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.buffered(),r=Xl(n,e);if(this.videoUnderflow_(r,n,e))return this.cancelTimer_(),this.seekTo(e),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(0<r.length){var a=r.start(0)-e;return this.logger_("Stopped at "+e+", setting timer for "+a+", seeking to "+r.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*a,e),!0}return!1}},{key:"afterSeekableWindow_",value:function(t,e){return!!t.length&&e>t.end(t.length-1)+.1}},{key:"beforeSeekableWindow_",value:function(t,e){return!!(t.length&&0<t.start(0)&&e<t.start(0)-.1)}},{key:"videoUnderflow_",value:function(t,e,i){if(0===t.length){var n=this.gapFromVideoUnderflow_(e,i);if(n)return this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(t){var e=this.tech_.buffered(),i=this.tech_.currentTime(),n=Xl(e,i);this.cancelTimer_(),0!==n.length&&i===t&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",t,"nextRange start:",n.start(0)),this.seekTo(n.start(0)+zl),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(t,e){for(var i=function(t){if(t.length<2)return oa.createTimeRanges();for(var e=[],i=1;i<t.length;i++){var n=t.end(i-1),r=t.start(i);e.push([n,r])}return oa.createTimeRanges(e)}(t),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(e-r<4&&2<e-r)return{start:r,end:a}}return null}}]),s}(),yh={errorInterval:30,getSource:function(t){return t(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},vh=function(t){!function e(i,t){var n=0,r=0,a=oa.mergeOptions(yh,t);i.ready(function(){i.trigger({type:"usage",name:"hls-error-reload-initialized"})});var s=function(){r&&i.currentTime(r)},o=function(t){null!=t&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",s),i.src(t),i.trigger({type:"usage",name:"hls-error-reload"}),i.play())},u=function(){if(Date.now()-n<1e3*a.errorInterval)i.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(a.getSource&&"function"==typeof a.getSource)return n=Date.now(),a.getSource.call(i,o);oa.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function t(){i.off("loadedmetadata",s),i.off("error",u),i.off("dispose",t)};i.on("error",u),i.on("dispose",l),i.reloadSourceOnError=function(t){l(),e(i,t)}}(this,t)};oa.use("*",function(e){return{setSource:function(t,e){e(null,t)},setCurrentTime:function(t){return e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(t),t},play:function(){e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(e.currentTime())}}});var _h={PlaylistLoader:vl,Playlist:Dl,Decrypter:nl,AsyncStream:tl,decrypt:il,utils:ql,STANDARD_PLAYLIST_SELECTOR:function(){return function(t,e,i,n,r){var a=t.playlists.map(function(t){var e,i;return e=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,i=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||v.Number.MAX_VALUE,width:e,height:i,playlist:t}});qc(a,function(t,e){return t.bandwidth-e.bandwidth});var s=(a=a.filter(function(t){return!Dl.isIncompatible(t.playlist)})).filter(function(t){return Dl.isEnabled(t.playlist)});s.length||(s=a.filter(function(t){return!Dl.isDisabled(t.playlist)}));var o=s.filter(function(t){return t.bandwidth*xc.BANDWIDTH_VARIANCE<e}),u=o[o.length-1],l=o.filter(function(t){return t.bandwidth===u.bandwidth})[0];if(!1===r){var c=l||s[0]||a[0];return c?c.playlist:null}var h=o.filter(function(t){return t.width&&t.height});qc(h,function(t,e){return t.width-e.width});var d=h.filter(function(t){return t.width===i&&t.height===n});u=d[d.length-1];var p=d.filter(function(t){return t.bandwidth===u.bandwidth})[0],f=void 0,m=void 0,g=void 0;p||(m=(f=h.filter(function(t){return t.width>i||t.height>n})).filter(function(t){return t.width===f[0].width&&t.height===f[0].height}),u=m[m.length-1],g=m.filter(function(t){return t.bandwidth===u.bandwidth})[0]);var y=g||p||l||s[0]||a[0];return y?y.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(Hc(this.tech_.el(),"width"),10),parseInt(Hc(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var t=this.playlists.master.playlists.filter(Dl.isEnabled);return qc(t,function(t,e){return zc(t,e)}),t.filter(function(t){return pc(t.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:zc,comparePlaylistResolution:function(t,e){var i=void 0,n=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(i=t.attributes.RESOLUTION.width),i=i||v.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),i===(n=n||v.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?t.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-n},xhr:Bl()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach(function(e){Object.defineProperty(_h,e,{get:function(){return oa.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),xc[e]},set:function(t){oa.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?oa.log.warn("value of Hls."+e+" must be greater than or equal to 0"):xc[e]=t}})});var bh=function(t){if(/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(t))return"hls";return/^application\/dash\+xml/i.test(t)?"dash":null},Th=function(t,e){for(var i=e.media(),n=-1,r=0;r<t.length;r++)if(t[r].id===i.uri){n=r;break}t.selectedIndex_=n,t.trigger({selectedIndex:n,type:"change"})};_h.canPlaySource=function(){return oa.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Sh=function(t){if("dash"===t.options_.sourceType){var e=oa.players[t.tech_.options_.playerId];if(e.eme){var i=function(t,e,i){if(!t)return t;var n={};for(var r in t)n[r]={audioContentType:'audio/mp4; codecs="'+i.attributes.CODECS+'"',videoContentType:'video/mp4; codecs="'+e.attributes.CODECS+'"'},e.contentProtection&&e.contentProtection[r]&&e.contentProtection[r].pssh&&(n[r].pssh=e.contentProtection[r].pssh),"string"==typeof t[r]&&(n[r].url=t[r]);return oa.mergeOptions(t,n)}(t.source_.keySystems,t.playlists.media(),t.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader.media());i&&(e.currentSource().keySystems=i,e.eme.initializeMediaKeys&&e.eme.initializeMediaKeys())}}};_h.supportsNativeHls=function(){var e=d.createElement("video");if(!oa.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),_h.supportsNativeDash=!!oa.getTech("Html5").isSupported()&&/maybe|probably/i.test(d.createElement("video").canPlayType("application/dash+xml")),_h.supportsTypeNatively=function(t){return"hls"===t?_h.supportsNativeHls:"dash"===t&&_h.supportsNativeDash},_h.isSupported=function(){return oa.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var kh=oa.getComponent("Component"),wh=function(t){function a(t,e,i){al(this,a);var n=ul(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e,i.hls));if(e.options_&&e.options_.playerId){var r=oa(e.options_.playerId);r.hasOwnProperty("hls")||Object.defineProperty(r,"hls",{get:function(){return oa.log.warn("player.hls is deprecated. Use player.tech().hls instead."),e.trigger({type:"usage",name:"hls-player-access"}),n}}),r.vhs=n,r.dash=n}if(n.tech_=e,n.source_=t,n.stats={},n.setOptions_(),n.options_.overrideNative&&e.overrideNativeAudioTracks&&e.overrideNativeVideoTracks)e.overrideNativeAudioTracks(!0),e.overrideNativeVideoTracks(!0);else if(n.options_.overrideNative&&(e.featuresNativeVideoTracks||e.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return n.on(d,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(t){var e=d.fullscreenElement||d.webkitFullscreenElement||d.mozFullScreenElement||d.msFullscreenElement;e&&e.contains(n.tech_.el())&&n.masterPlaylistController_.smoothQualityChange_()}),n.on(n.tech_,"seeking",function(){this.tech_.seeking()&&0===this.tech_.currentTime()&&this.tech_.player_.loop()&&this.setCurrentTime(0)}),n.on(n.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),n.on(n.tech_,"play",n.play),n}return ol(a,kh),sl(a,[{key:"setOptions_",value:function(){var e=this;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=xc.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===xc.INITIAL_BANDWIDTH,["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange"].forEach(function(t){"undefined"!=typeof e.source_[t]&&(e.options_[t]=e.source_[t])}),this.bandwidth=this.options_.bandwidth,this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(t,e){var n=this;t&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=_h,this.options_.sourceType=bh(e),this.options_.seekTo=function(t){n.tech_.setCurrentTime(t),n.setCurrentTime(t)},this.masterPlaylistController_=new ph(this.options_),this.playbackWatcher_=new gh(oa.mergeOptions(this.options_,{seekable:function(){return n.seekable()}})),this.masterPlaylistController_.on("error",function(){oa.players[n.tech_.options_.playerId].error(n.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):_h.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=_h.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(t){this.masterPlaylistController_.selectPlaylist=t.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(t){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=t,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(t){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=t,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var t=1/(this.bandwidth||1),e=void 0;return e=0<this.throughput?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){oa.log.error('The "systemBandwidth" property is read-only')}}}),Object.defineProperties(this.stats,{bandwidth:{get:function(){return n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return $l(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},master:{get:function(){return n.playlists.master},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return $l(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.masterPlaylistController_.on("selectedinitialmedia",function(){var i,t;t=(i=n).playlists,i.representations=function(){return t.master.playlists.filter(function(t){return!Pl(t)}).map(function(t,e){return new fh(i,t,t.uri)})},Sh(n)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return n.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(oa.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var i=this,t=oa.players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var e,t;e=i.qualityLevels_,(t=i).representations().forEach(function(t){e.addQualityLevel(t)}),Th(e,t.playlists)}),this.playlists.on("mediachange",function(){Th(i.qualityLevels_,i.playlists)}))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(t){this.masterPlaylistController_.setCurrentTime(t)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"dispose",this).call(this)}}]),a}(),Ch={name:"videojs-http-streaming",VERSION:"1.4.1",canHandleSource:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=oa.mergeOptions(oa.options,e);return Ch.canPlayType(t.type,i)},handleSource:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=oa.mergeOptions(oa.options,i);return e.hls=new wh(t,e,n),e.hls.xhr=Bl(),e.hls.src(t.src,t.type),e.hls},canPlayType:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=oa.mergeOptions(oa.options,e).hls.overrideNative,n=bh(t);return n&&(!_h.supportsTypeNatively(n)||i)?"maybe":""}};return"undefined"!=typeof oa.MediaSource&&"undefined"!=typeof oa.URL||(oa.MediaSource=kc,oa.URL=wc),kc.supportsNativeMediaSources()&&oa.getTech("Html5").registerSourceHandler(Ch,0),oa.HlsHandler=wh,oa.HlsSourceHandler=Ch,oa.Hls=_h,oa.use||oa.registerComponent("Hls",_h),oa.options.hls=oa.options.hls||{},oa.registerPlugin?oa.registerPlugin("reloadSourceOnError",vh):oa.plugin("reloadSourceOnError",vh),oa}); +!function(){!function(a){var b=a&&a.videojs;b&&(b.CDN_VERSION="7.3.0")}(window)}(); \ No newline at end of file diff --git a/embed/players/videojs-contrib-hls.js b/embed/players/videojs-contrib-hls.js deleted file mode 100644 index 336e67a9..00000000 --- a/embed/players/videojs-contrib-hls.js +++ /dev/null @@ -1,19848 +0,0 @@ -/** - * videojs-contrib-hls - * @version 5.8.0 - * @copyright 2017 Brightcove, Inc - * @license Apache-2.0 - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojsContribHls = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ -/** - * @file ad-cue-tags.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -/** - * Searches for an ad cue that overlaps with the given mediaTime - */ -var findAdCue = function findAdCue(track, mediaTime) { - var cues = track.cues; - - for (var i = 0; i < cues.length; i++) { - var cue = cues[i]; - - if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) { - return cue; - } - } - return null; -}; - -var updateAdCues = function updateAdCues(media, track) { - var offset = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; - - if (!media.segments) { - return; - } - - var mediaTime = offset; - var cue = undefined; - - for (var i = 0; i < media.segments.length; i++) { - var segment = media.segments[i]; - - if (!cue) { - // Since the cues will span for at least the segment duration, adding a fudge - // factor of half segment duration will prevent duplicate cues from being - // created when timing info is not exact (e.g. cue start time initialized - // at 10.006677, but next call mediaTime is 10.003332 ) - cue = findAdCue(track, mediaTime + segment.duration / 2); - } - - if (cue) { - if ('cueIn' in segment) { - // Found a CUE-IN so end the cue - cue.endTime = mediaTime; - cue.adEndTime = mediaTime; - mediaTime += segment.duration; - cue = null; - continue; - } - - if (mediaTime < cue.endTime) { - // Already processed this mediaTime for this cue - mediaTime += segment.duration; - continue; - } - - // otherwise extend cue until a CUE-IN is found - cue.endTime += segment.duration; - } else { - if ('cueOut' in segment) { - cue = new _globalWindow2['default'].VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut); - cue.adStartTime = mediaTime; - // Assumes tag format to be - // #EXT-X-CUE-OUT:30 - cue.adEndTime = mediaTime + parseFloat(segment.cueOut); - track.addCue(cue); - } - - if ('cueOutCont' in segment) { - // Entered into the middle of an ad cue - var adOffset = undefined; - var adTotal = undefined; - - // Assumes tag formate to be - // #EXT-X-CUE-OUT-CONT:10/30 - - var _segment$cueOutCont$split$map = segment.cueOutCont.split('/').map(parseFloat); - - var _segment$cueOutCont$split$map2 = _slicedToArray(_segment$cueOutCont$split$map, 2); - - adOffset = _segment$cueOutCont$split$map2[0]; - adTotal = _segment$cueOutCont$split$map2[1]; - - cue = new _globalWindow2['default'].VTTCue(mediaTime, mediaTime + segment.duration, ''); - cue.adStartTime = mediaTime - adOffset; - cue.adEndTime = cue.adStartTime + adTotal; - track.addCue(cue); - } - } - mediaTime += segment.duration; - } -}; - -exports['default'] = { - updateAdCues: updateAdCues, - findAdCue: findAdCue -}; -module.exports = exports['default']; -},{"global/window":30}],2:[function(require,module,exports){ -/** - * @file bin-utils.js - */ - -/** - * convert a TimeRange to text - * - * @param {TimeRange} range the timerange to use for conversion - * @param {Number} i the iterator on the range to convert - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -var textRange = function textRange(range, i) { - return range.start(i) + '-' + range.end(i); -}; - -/** - * format a number as hex string - * - * @param {Number} e The number - * @param {Number} i the iterator - */ -var formatHexString = function formatHexString(e, i) { - var value = e.toString(16); - - return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); -}; -var formatAsciiString = function formatAsciiString(e) { - if (e >= 0x20 && e < 0x7e) { - return String.fromCharCode(e); - } - return '.'; -}; - -/** - * Creates an object for sending to a web worker modifying properties that are TypedArrays - * into a new object with seperated properties for the buffer, byteOffset, and byteLength. - * - * @param {Object} message - * Object of properties and values to send to the web worker - * @return {Object} - * Modified message with TypedArray values expanded - * @function createTransferableMessage - */ -var createTransferableMessage = function createTransferableMessage(message) { - var transferable = {}; - - Object.keys(message).forEach(function (key) { - var value = message[key]; - - if (ArrayBuffer.isView(value)) { - transferable[key] = { - bytes: value.buffer, - byteOffset: value.byteOffset, - byteLength: value.byteLength - }; - } else { - transferable[key] = value; - } - }); - - return transferable; -}; - -/** - * Returns a unique string identifier for a media initialization - * segment. - */ -var initSegmentId = function initSegmentId(initSegment) { - var byterange = initSegment.byterange || { - length: Infinity, - offset: 0 - }; - - return [byterange.length, byterange.offset, initSegment.resolvedUri].join(','); -}; - -/** - * utils to help dump binary data to the console - */ -var utils = { - hexDump: function hexDump(data) { - var bytes = Array.prototype.slice.call(data); - var step = 16; - var result = ''; - var hex = undefined; - var ascii = undefined; - - for (var j = 0; j < bytes.length / step; j++) { - hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); - ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); - result += hex + ' ' + ascii + '\n'; - } - return result; - }, - tagDump: function tagDump(tag) { - return utils.hexDump(tag.bytes); - }, - textRanges: function textRanges(ranges) { - var result = ''; - var i = undefined; - - for (i = 0; i < ranges.length; i++) { - result += textRange(ranges, i) + ' '; - } - return result; - }, - createTransferableMessage: createTransferableMessage, - initSegmentId: initSegmentId -}; - -exports['default'] = utils; -module.exports = exports['default']; -},{}],3:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = { - GOAL_BUFFER_LENGTH: 30, - MAX_GOAL_BUFFER_LENGTH: 60, - GOAL_BUFFER_LENGTH_RATE: 1, - // A fudge factor to apply to advertised playlist bitrates to account for - // temporary flucations in client bandwidth - BANDWIDTH_VARIANCE: 1.2, - // How much of the buffer must be filled before we consider upswitching - BUFFER_LOW_WATER_LINE: 0, - MAX_BUFFER_LOW_WATER_LINE: 30, - BUFFER_LOW_WATER_LINE_RATE: 1 -}; -module.exports = exports["default"]; -},{}],4:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _aesDecrypter = require('aes-decrypter'); - -var _binUtils = require('./bin-utils'); - -/** - * Our web worker interface so that things can talk to aes-decrypter - * that will be running in a web worker. the scope is passed to this by - * webworkify. - * - * @param {Object} self - * the scope for the web worker - */ -var DecrypterWorker = function DecrypterWorker(self) { - self.onmessage = function (event) { - var data = event.data; - var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength); - var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4); - var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4); - - /* eslint-disable no-new, handle-callback-err */ - new _aesDecrypter.Decrypter(encrypted, key, iv, function (err, bytes) { - _globalWindow2['default'].postMessage((0, _binUtils.createTransferableMessage)({ - source: data.source, - decrypted: bytes - }), [bytes.buffer]); - }); - /* eslint-enable */ - }; -}; - -exports['default'] = function (self) { - return new DecrypterWorker(self); -}; - -module.exports = exports['default']; -},{"./bin-utils":2,"aes-decrypter":23,"global/window":30}],5:[function(require,module,exports){ -(function (global){ -/** - * @file master-playlist-controller.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _playlistLoader = require('./playlist-loader'); - -var _playlistLoader2 = _interopRequireDefault(_playlistLoader); - -var _segmentLoader = require('./segment-loader'); - -var _segmentLoader2 = _interopRequireDefault(_segmentLoader); - -var _vttSegmentLoader = require('./vtt-segment-loader'); - -var _vttSegmentLoader2 = _interopRequireDefault(_vttSegmentLoader); - -var _ranges = require('./ranges'); - -var _ranges2 = _interopRequireDefault(_ranges); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _adCueTags = require('./ad-cue-tags'); - -var _adCueTags2 = _interopRequireDefault(_adCueTags); - -var _syncController = require('./sync-controller'); - -var _syncController2 = _interopRequireDefault(_syncController); - -var _videojsContribMediaSourcesEs5CodecUtils = require('videojs-contrib-media-sources/es5/codec-utils'); - -var _webworkify = require('webworkify'); - -var _webworkify2 = _interopRequireDefault(_webworkify); - -var _decrypterWorker = require('./decrypter-worker'); - -var _decrypterWorker2 = _interopRequireDefault(_decrypterWorker); - -var _config = require('./config'); - -var _config2 = _interopRequireDefault(_config); - -var Hls = undefined; - -// Default codec parameters if none were provided for video and/or audio -var defaultCodecs = { - videoCodec: 'avc1', - videoObjectTypeIndicator: '.4d400d', - // AAC-LC - audioProfile: '2' -}; - -// SegmentLoader stats that need to have each loader's -// values summed to calculate the final value -var loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred']; -var sumLoaderStat = function sumLoaderStat(stat) { - return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat]; -}; - -/** - * determine if an object a is differnt from - * and object b. both only having one dimensional - * properties - * - * @param {Object} a object one - * @param {Object} b object two - * @return {Boolean} if the object has changed or not - */ -var objectChanged = function objectChanged(a, b) { - if (typeof a !== typeof b) { - return true; - } - // if we have a different number of elements - // something has changed - if (Object.keys(a).length !== Object.keys(b).length) { - return true; - } - - for (var prop in a) { - if (a[prop] !== b[prop]) { - return true; - } - } - return false; -}; - -/** - * Parses a codec string to retrieve the number of codecs specified, - * the video codec and object type indicator, and the audio profile. - * - * @private - */ -var parseCodecs = function parseCodecs(codecs) { - var result = { - codecCount: 0 - }; - var parsed = undefined; - - result.codecCount = codecs.split(',').length; - result.codecCount = result.codecCount || 2; - - // parse the video codec - parsed = /(^|\s|,)+(avc1)([^ ,]*)/i.exec(codecs); - if (parsed) { - result.videoCodec = parsed[2]; - result.videoObjectTypeIndicator = parsed[3]; - } - - // parse the last field of the audio codec - result.audioProfile = /(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(codecs); - result.audioProfile = result.audioProfile && result.audioProfile[2]; - - return result; -}; - -/** - * Replace codecs in the codec string with the old apple-style `avc1.<dd>.<dd>` to the - * standard `avc1.<hhhhhh>`. - * - * @param codecString {String} the codec string - * @return {String} the codec string with old apple-style codecs replaced - * - * @private - */ -var mapLegacyAvcCodecs_ = function mapLegacyAvcCodecs_(codecString) { - return codecString.replace(/avc1\.(\d+)\.(\d+)/i, function (match) { - return (0, _videojsContribMediaSourcesEs5CodecUtils.translateLegacyCodecs)([match])[0]; - }); -}; - -exports.mapLegacyAvcCodecs_ = mapLegacyAvcCodecs_; -/** - * Build a media mime-type string from a set of parameters - * @param {String} type either 'audio' or 'video' - * @param {String} container either 'mp2t' or 'mp4' - * @param {Array} codecs an array of codec strings to add - * @return {String} a valid media mime-type - */ -var makeMimeTypeString = function makeMimeTypeString(type, container, codecs) { - // The codecs array is filtered so that falsey values are - // dropped and don't cause Array#join to create spurious - // commas - return type + '/' + container + '; codecs="' + codecs.filter(function (c) { - return !!c; - }).join(', ') + '"'; -}; - -/** - * Returns the type container based on information in the playlist - * @param {Playlist} media the current media playlist - * @return {String} a valid media container type - */ -var getContainerType = function getContainerType(media) { - // An initialization segment means the media playlist is an iframe - // playlist or is using the mp4 container. We don't currently - // support iframe playlists, so assume this is signalling mp4 - // fragments. - if (media.segments && media.segments.length && media.segments[0].map) { - return 'mp4'; - } - return 'mp2t'; -}; - -/** - * Returns a set of codec strings parsed from the playlist or the default - * codec strings if no codecs were specified in the playlist - * @param {Playlist} media the current media playlist - * @return {Object} an object with the video and audio codecs - */ -var getCodecs = function getCodecs(media) { - // if the codecs were explicitly specified, use them instead of the - // defaults - var mediaAttributes = media.attributes || {}; - - if (mediaAttributes.CODECS) { - return parseCodecs(mediaAttributes.CODECS); - } - return defaultCodecs; -}; - -/** - * Calculates the MIME type strings for a working configuration of - * SourceBuffers to play variant streams in a master playlist. If - * there is no possible working configuration, an empty array will be - * returned. - * - * @param master {Object} the m3u8 object for the master playlist - * @param media {Object} the m3u8 object for the variant playlist - * @return {Array} the MIME type strings. If the array has more than - * one entry, the first element should be applied to the video - * SourceBuffer and the second to the audio SourceBuffer. - * - * @private - */ -var mimeTypesForPlaylist_ = function mimeTypesForPlaylist_(master, media) { - var containerType = getContainerType(media); - var codecInfo = getCodecs(media); - var mediaAttributes = media.attributes || {}; - // Default condition for a traditional HLS (no demuxed audio/video) - var isMuxed = true; - var isMaat = false; - - if (!media) { - // Not enough information - return []; - } - - if (master.mediaGroups.AUDIO && mediaAttributes.AUDIO) { - var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO]; - - // Handle the case where we are in a multiple-audio track scenario - if (audioGroup) { - isMaat = true; - // Start with the everything demuxed then... - isMuxed = false; - // ...check to see if any audio group tracks are muxed (ie. lacking a uri) - for (var groupId in audioGroup) { - if (!audioGroup[groupId].uri) { - isMuxed = true; - break; - } - } - } - } - - // HLS with multiple-audio tracks must always get an audio codec. - // Put another way, there is no way to have a video-only multiple-audio HLS! - if (isMaat && !codecInfo.audioProfile) { - _videoJs2['default'].log.warn('Multiple audio tracks present but no audio codec string is specified. ' + 'Attempting to use the default audio codec (mp4a.40.2)'); - codecInfo.audioProfile = defaultCodecs.audioProfile; - } - - // Generate the final codec strings from the codec object generated above - var codecStrings = {}; - - if (codecInfo.videoCodec) { - codecStrings.video = '' + codecInfo.videoCodec + codecInfo.videoObjectTypeIndicator; - } - - if (codecInfo.audioProfile) { - codecStrings.audio = 'mp4a.40.' + codecInfo.audioProfile; - } - - // Finally, make and return an array with proper mime-types depending on - // the configuration - var justAudio = makeMimeTypeString('audio', containerType, [codecStrings.audio]); - var justVideo = makeMimeTypeString('video', containerType, [codecStrings.video]); - var bothVideoAudio = makeMimeTypeString('video', containerType, [codecStrings.video, codecStrings.audio]); - - if (isMaat) { - if (!isMuxed && codecStrings.video) { - return [justVideo, justAudio]; - } - // There exists the possiblity that this will return a `video/container` - // mime-type for the first entry in the array even when there is only audio. - // This doesn't appear to be a problem and simplifies the code. - return [bothVideoAudio, justAudio]; - } - - // If there is ano video codec at all, always just return a single - // audio/<container> mime-type - if (!codecStrings.video) { - return [justAudio]; - } - - // When not using separate audio media groups, audio and video is - // *always* muxed - return [bothVideoAudio]; -}; - -exports.mimeTypesForPlaylist_ = mimeTypesForPlaylist_; -/** - * the master playlist controller controller all interactons - * between playlists and segmentloaders. At this time this mainly - * involves a master playlist and a series of audio playlists - * if they are available - * - * @class MasterPlaylistController - * @extends videojs.EventTarget - */ - -var MasterPlaylistController = (function (_videojs$EventTarget) { - _inherits(MasterPlaylistController, _videojs$EventTarget); - - function MasterPlaylistController(options) { - var _this = this; - - _classCallCheck(this, MasterPlaylistController); - - _get(Object.getPrototypeOf(MasterPlaylistController.prototype), 'constructor', this).call(this); - - var url = options.url; - var withCredentials = options.withCredentials; - var mode = options.mode; - var tech = options.tech; - var bandwidth = options.bandwidth; - var externHls = options.externHls; - var useCueTags = options.useCueTags; - var blacklistDuration = options.blacklistDuration; - - if (!url) { - throw new Error('A non-empty playlist URL is required'); - } - - Hls = externHls; - - this.withCredentials = withCredentials; - this.tech_ = tech; - this.hls_ = tech.hls; - this.mode_ = mode; - this.useCueTags_ = useCueTags; - this.blacklistDuration = blacklistDuration; - if (this.useCueTags_) { - this.cueTagsTrack_ = this.tech_.addTextTrack('metadata', 'ad-cues'); - this.cueTagsTrack_.inBandMetadataTrackDispatchType = ''; - } - - this.requestOptions_ = { - withCredentials: this.withCredentials, - timeout: null - }; - - this.audioGroups_ = {}; - this.subtitleGroups_ = { groups: {}, tracks: {} }; - - this.mediaSource = new _videoJs2['default'].MediaSource({ mode: mode }); - this.audioinfo_ = null; - this.mediaSource.on('audioinfo', this.handleAudioinfoUpdate_.bind(this)); - - // load the media source into the player - this.mediaSource.addEventListener('sourceopen', this.handleSourceOpen_.bind(this)); - - this.seekable_ = _videoJs2['default'].createTimeRanges(); - this.hasPlayed_ = function () { - return false; - }; - - this.syncController_ = new _syncController2['default'](options); - this.segmentMetadataTrack_ = tech.addRemoteTextTrack({ - kind: 'metadata', - label: 'segment-metadata' - }, true).track; - - this.decrypter_ = (0, _webworkify2['default'])(_decrypterWorker2['default']); - - var segmentLoaderSettings = { - hls: this.hls_, - mediaSource: this.mediaSource, - currentTime: this.tech_.currentTime.bind(this.tech_), - seekable: function seekable() { - return _this.seekable(); - }, - seeking: function seeking() { - return _this.tech_.seeking(); - }, - duration: function duration() { - return _this.mediaSource.duration; - }, - hasPlayed: function hasPlayed() { - return _this.hasPlayed_(); - }, - goalBufferLength: function goalBufferLength() { - return _this.goalBufferLength(); - }, - bandwidth: bandwidth, - syncController: this.syncController_, - decrypter: this.decrypter_ - }; - - // setup playlist loaders - this.masterPlaylistLoader_ = new _playlistLoader2['default'](url, this.hls_, this.withCredentials); - this.setupMasterPlaylistLoaderListeners_(); - this.audioPlaylistLoader_ = null; - this.subtitlePlaylistLoader_ = null; - - // setup segment loaders - // combined audio/video or just video when alternate audio track is selected - this.mainSegmentLoader_ = new _segmentLoader2['default'](_videoJs2['default'].mergeOptions(segmentLoaderSettings, { - segmentMetadataTrack: this.segmentMetadataTrack_, - loaderType: 'main' - }), options); - - // alternate audio track - this.audioSegmentLoader_ = new _segmentLoader2['default'](_videoJs2['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'audio' - }), options); - - this.subtitleSegmentLoader_ = new _vttSegmentLoader2['default'](_videoJs2['default'].mergeOptions(segmentLoaderSettings, { - loaderType: 'vtt' - }), options); - - this.setupSegmentLoaderListeners_(); - - // Create SegmentLoader stat-getters - loaderStats.forEach(function (stat) { - _this[stat + '_'] = sumLoaderStat.bind(_this, stat); - }); - - this.masterPlaylistLoader_.load(); - } - - /** - * Register event handlers on the master playlist loader. A helper - * function for construction time. - * - * @private - */ - - _createClass(MasterPlaylistController, [{ - key: 'setupMasterPlaylistLoaderListeners_', - value: function setupMasterPlaylistLoaderListeners_() { - var _this2 = this; - - this.masterPlaylistLoader_.on('loadedmetadata', function () { - var media = _this2.masterPlaylistLoader_.media(); - var requestTimeout = _this2.masterPlaylistLoader_.targetDuration * 1.5 * 1000; - - // If we don't have any more available playlists, we don't want to - // timeout the request. - if (_this2.masterPlaylistLoader_.isLowestEnabledRendition_()) { - _this2.requestOptions_.timeout = 0; - } else { - _this2.requestOptions_.timeout = requestTimeout; - } - - // if this isn't a live video and preload permits, start - // downloading segments - if (media.endList && _this2.tech_.preload() !== 'none') { - _this2.mainSegmentLoader_.playlist(media, _this2.requestOptions_); - _this2.mainSegmentLoader_.load(); - } - - _this2.fillAudioTracks_(); - _this2.setupAudio(); - - _this2.fillSubtitleTracks_(); - _this2.setupSubtitles(); - - _this2.triggerPresenceUsage_(_this2.master(), media); - - try { - _this2.setupSourceBuffers_(); - } catch (e) { - _videoJs2['default'].log.warn('Failed to create SourceBuffers', e); - return _this2.mediaSource.endOfStream('decode'); - } - _this2.setupFirstPlay(); - - _this2.trigger('audioupdate'); - _this2.trigger('selectedinitialmedia'); - }); - - this.masterPlaylistLoader_.on('loadedplaylist', function () { - var updatedPlaylist = _this2.masterPlaylistLoader_.media(); - - if (!updatedPlaylist) { - // select the initial variant - _this2.initialMedia_ = _this2.selectPlaylist(); - _this2.masterPlaylistLoader_.media(_this2.initialMedia_); - return; - } - - if (_this2.useCueTags_) { - _this2.updateAdCues_(updatedPlaylist); - } - - // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `mediachange` - _this2.mainSegmentLoader_.playlist(updatedPlaylist, _this2.requestOptions_); - _this2.updateDuration(); - - // If the player isn't paused, ensure that the segment loader is running, - // as it is possible that it was temporarily stopped while waiting for - // a playlist (e.g., in case the playlist errored and we re-requested it). - if (!_this2.tech_.paused()) { - _this2.mainSegmentLoader_.load(); - } - - if (!updatedPlaylist.endList) { - (function () { - var addSeekableRange = function addSeekableRange() { - var seekable = _this2.seekable(); - - if (seekable.length !== 0) { - _this2.mediaSource.addSeekableRange_(seekable.start(0), seekable.end(0)); - } - }; - - if (_this2.duration() !== Infinity) { - (function () { - var onDurationchange = function onDurationchange() { - if (_this2.duration() === Infinity) { - addSeekableRange(); - } else { - _this2.tech_.one('durationchange', onDurationchange); - } - }; - - _this2.tech_.one('durationchange', onDurationchange); - })(); - } else { - addSeekableRange(); - } - })(); - } - }); - - this.masterPlaylistLoader_.on('error', function () { - _this2.blacklistCurrentPlaylist(_this2.masterPlaylistLoader_.error); - }); - - this.masterPlaylistLoader_.on('mediachanging', function () { - _this2.mainSegmentLoader_.abort(); - _this2.mainSegmentLoader_.pause(); - }); - - this.masterPlaylistLoader_.on('mediachange', function () { - var media = _this2.masterPlaylistLoader_.media(); - var requestTimeout = _this2.masterPlaylistLoader_.targetDuration * 1.5 * 1000; - var activeAudioGroup = undefined; - var activeTrack = undefined; - - // If we don't have any more available playlists, we don't want to - // timeout the request. - if (_this2.masterPlaylistLoader_.isLowestEnabledRendition_()) { - _this2.requestOptions_.timeout = 0; - } else { - _this2.requestOptions_.timeout = requestTimeout; - } - - // TODO: Create a new event on the PlaylistLoader that signals - // that the segments have changed in some way and use that to - // update the SegmentLoader instead of doing it twice here and - // on `loadedplaylist` - _this2.mainSegmentLoader_.playlist(media, _this2.requestOptions_); - _this2.mainSegmentLoader_.load(); - - // if the audio group has changed, a new audio track has to be - // enabled - activeAudioGroup = _this2.activeAudioGroup(); - activeTrack = activeAudioGroup.filter(function (track) { - return track.enabled; - })[0]; - if (!activeTrack) { - _this2.mediaGroupChanged(); - _this2.trigger('audioupdate'); - } - _this2.setupSubtitles(); - - _this2.tech_.trigger({ - type: 'mediachange', - bubbles: true - }); - }); - - this.masterPlaylistLoader_.on('playlistunchanged', function () { - var updatedPlaylist = _this2.masterPlaylistLoader_.media(); - var playlistOutdated = _this2.stuckAtPlaylistEnd_(updatedPlaylist); - - if (playlistOutdated) { - // Playlist has stopped updating and we're stuck at its end. Try to - // blacklist it and switch to another playlist in the hope that that - // one is updating (and give the player a chance to re-adjust to the - // safe live point). - _this2.blacklistCurrentPlaylist({ - message: 'Playlist no longer updating.' - }); - // useful for monitoring QoS - _this2.tech_.trigger('playliststuck'); - } - }); - - this.masterPlaylistLoader_.on('renditiondisabled', function () { - _this2.tech_.trigger({ type: 'usage', name: 'hls-rendition-disabled' }); - }); - this.masterPlaylistLoader_.on('renditionenabled', function () { - _this2.tech_.trigger({ type: 'usage', name: 'hls-rendition-enabled' }); - }); - } - - /** - * A helper function for triggerring presence usage events once per source - * - * @private - */ - }, { - key: 'triggerPresenceUsage_', - value: function triggerPresenceUsage_(master, media) { - var mediaGroups = master.mediaGroups || {}; - var defaultDemuxed = true; - var audioGroupKeys = Object.keys(mediaGroups.AUDIO); - - for (var mediaGroup in mediaGroups.AUDIO) { - for (var label in mediaGroups.AUDIO[mediaGroup]) { - var properties = mediaGroups.AUDIO[mediaGroup][label]; - - if (!properties.uri) { - defaultDemuxed = false; - } - } - } - - if (defaultDemuxed) { - this.tech_.trigger({ type: 'usage', name: 'hls-demuxed' }); - } - - if (Object.keys(mediaGroups.SUBTITLES).length) { - this.tech_.trigger({ type: 'usage', name: 'hls-webvtt' }); - } - - if (Hls.Playlist.isAes(media)) { - this.tech_.trigger({ type: 'usage', name: 'hls-aes' }); - } - - if (Hls.Playlist.isFmp4(media)) { - this.tech_.trigger({ type: 'usage', name: 'hls-fmp4' }); - } - - if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) { - this.tech_.trigger({ type: 'usage', name: 'hls-alternate-audio' }); - } - - if (this.useCueTags_) { - this.tech_.trigger({ type: 'usage', name: 'hls-playlist-cue-tags' }); - } - } - - /** - * Register event handlers on the segment loaders. A helper function - * for construction time. - * - * @private - */ - }, { - key: 'setupSegmentLoaderListeners_', - value: function setupSegmentLoaderListeners_() { - var _this3 = this; - - this.mainSegmentLoader_.on('bandwidthupdate', function () { - var nextPlaylist = _this3.selectPlaylist(); - var currentPlaylist = _this3.masterPlaylistLoader_.media(); - var buffered = _this3.tech_.buffered(); - var forwardBuffer = buffered.length ? buffered.end(buffered.length - 1) - _this3.tech_.currentTime() : 0; - - var bufferLowWaterLine = _this3.bufferLowWaterLine(); - - // If the playlist is live, then we want to not take low water line into account. - // This is because in LIVE, the player plays 3 segments from the end of the - // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble - // in those segments, a viewer will never experience a rendition upswitch. - if (!currentPlaylist.endList || - // For the same reason as LIVE, we ignore the low water line when the VOD - // duration is below the max potential low water line - _this3.duration() < _config2['default'].MAX_BUFFER_LOW_WATER_LINE || - // we want to switch down to lower resolutions quickly to continue playback, but - nextPlaylist.attributes.BANDWIDTH < currentPlaylist.attributes.BANDWIDTH || - // ensure we have some buffer before we switch up to prevent us running out of - // buffer while loading a higher rendition. - forwardBuffer >= bufferLowWaterLine) { - _this3.masterPlaylistLoader_.media(nextPlaylist); - } - - _this3.tech_.trigger('bandwidthupdate'); - }); - this.mainSegmentLoader_.on('progress', function () { - _this3.trigger('progress'); - }); - - this.mainSegmentLoader_.on('error', function () { - _this3.blacklistCurrentPlaylist(_this3.mainSegmentLoader_.error()); - }); - - this.mainSegmentLoader_.on('syncinfoupdate', function () { - _this3.onSyncInfoUpdate_(); - }); - - this.mainSegmentLoader_.on('timestampoffset', function () { - _this3.tech_.trigger({ type: 'usage', name: 'hls-timestamp-offset' }); - }); - this.audioSegmentLoader_.on('syncinfoupdate', function () { - _this3.onSyncInfoUpdate_(); - }); - - this.mainSegmentLoader_.on('ended', function () { - _this3.onEndOfStream(); - }); - - this.audioSegmentLoader_.on('ended', function () { - _this3.onEndOfStream(); - }); - - this.audioSegmentLoader_.on('error', function () { - _videoJs2['default'].log.warn('Problem encountered with the current alternate audio track' + '. Switching back to default.'); - _this3.audioSegmentLoader_.abort(); - _this3.audioPlaylistLoader_ = null; - _this3.setupAudio(); - }); - - this.subtitleSegmentLoader_.on('error', this.handleSubtitleError_.bind(this)); - } - }, { - key: 'handleAudioinfoUpdate_', - value: function handleAudioinfoUpdate_(event) { - if (Hls.supportsAudioInfoChange_() || !this.audioInfo_ || !objectChanged(this.audioInfo_, event.info)) { - this.audioInfo_ = event.info; - return; - } - - var error = 'had different audio properties (channels, sample rate, etc.) ' + 'or changed in some other way. This behavior is currently ' + 'unsupported in Firefox 48 and below due to an issue: \n\n' + 'https://bugzilla.mozilla.org/show_bug.cgi?id=1247138\n\n'; - - var enabledIndex = this.activeAudioGroup().map(function (track) { - return track.enabled; - }).indexOf(true); - var enabledTrack = this.activeAudioGroup()[enabledIndex]; - var defaultTrack = this.activeAudioGroup().filter(function (track) { - return track.properties_ && track.properties_['default']; - })[0]; - - // they did not switch audiotracks - // blacklist the current playlist - if (!this.audioPlaylistLoader_) { - error = 'The rendition that we tried to switch to ' + error + 'Unfortunately that means we will have to blacklist ' + 'the current playlist and switch to another. Sorry!'; - this.blacklistCurrentPlaylist(); - } else { - error = 'The audio track \'' + enabledTrack.label + '\' that we tried to ' + ('switch to ' + error + ' Unfortunately this means we will have to ') + ('return you to the main track \'' + defaultTrack.label + '\'. Sorry!'); - defaultTrack.enabled = true; - this.activeAudioGroup().splice(enabledIndex, 1); - this.trigger('audioupdate'); - } - - _videoJs2['default'].log.warn(error); - this.setupAudio(); - } - }, { - key: 'mediaSecondsLoaded_', - value: function mediaSecondsLoaded_() { - return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded); - } - - /** - * fill our internal list of HlsAudioTracks with data from - * the master playlist or use a default - * - * @private - */ - }, { - key: 'fillAudioTracks_', - value: function fillAudioTracks_() { - var master = this.master(); - var mediaGroups = master.mediaGroups || {}; - - // force a default if we have none or we are not - // in html5 mode (the only mode to support more than one - // audio track) - if (!mediaGroups || !mediaGroups.AUDIO || Object.keys(mediaGroups.AUDIO).length === 0 || this.mode_ !== 'html5') { - // "main" audio group, track name "default" - mediaGroups.AUDIO = { main: { 'default': { 'default': true } } }; - } - - for (var mediaGroup in mediaGroups.AUDIO) { - if (!this.audioGroups_[mediaGroup]) { - this.audioGroups_[mediaGroup] = []; - } - - for (var label in mediaGroups.AUDIO[mediaGroup]) { - var properties = mediaGroups.AUDIO[mediaGroup][label]; - var track = new _videoJs2['default'].AudioTrack({ - id: label, - kind: this.audioTrackKind_(properties), - enabled: false, - language: properties.language, - label: label - }); - - track.properties_ = properties; - this.audioGroups_[mediaGroup].push(track); - } - } - - // enable the default active track - (this.activeAudioGroup().filter(function (audioTrack) { - return audioTrack.properties_['default']; - })[0] || this.activeAudioGroup()[0]).enabled = true; - } - - /** - * Convert the properties of an HLS track into an audioTrackKind. - * - * @private - */ - }, { - key: 'audioTrackKind_', - value: function audioTrackKind_(properties) { - var kind = properties['default'] ? 'main' : 'alternative'; - - if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) { - kind = 'main-desc'; - } - - return kind; - } - - /** - * fill our internal list of Subtitle Tracks with data from - * the master playlist or use a default - * - * @private - */ - }, { - key: 'fillSubtitleTracks_', - value: function fillSubtitleTracks_() { - var master = this.master(); - var mediaGroups = master.mediaGroups || {}; - - for (var mediaGroup in mediaGroups.SUBTITLES) { - if (!this.subtitleGroups_.groups[mediaGroup]) { - this.subtitleGroups_.groups[mediaGroup] = []; - } - - for (var label in mediaGroups.SUBTITLES[mediaGroup]) { - var properties = mediaGroups.SUBTITLES[mediaGroup][label]; - - if (!properties.forced) { - this.subtitleGroups_.groups[mediaGroup].push(_videoJs2['default'].mergeOptions({ id: label }, properties)); - - if (typeof this.subtitleGroups_.tracks[label] === 'undefined') { - var track = this.tech_.addRemoteTextTrack({ - id: label, - kind: 'subtitles', - enabled: false, - language: properties.language, - label: label - }, true).track; - - this.subtitleGroups_.tracks[label] = track; - } - } - } - } - - // Do not enable a default subtitle track. Wait for user interaction instead. - } - - /** - * Call load on our SegmentLoaders - */ - }, { - key: 'load', - value: function load() { - this.mainSegmentLoader_.load(); - if (this.audioPlaylistLoader_) { - this.audioSegmentLoader_.load(); - } - if (this.subtitlePlaylistLoader_) { - this.subtitleSegmentLoader_.load(); - } - } - - /** - * Returns the audio group for the currently active primary - * media playlist. - */ - }, { - key: 'activeAudioGroup', - value: function activeAudioGroup() { - var videoPlaylist = this.masterPlaylistLoader_.media(); - var result = undefined; - - if (videoPlaylist.attributes && videoPlaylist.attributes.AUDIO) { - result = this.audioGroups_[videoPlaylist.attributes.AUDIO]; - } - - return result || this.audioGroups_.main; - } - - /** - * Returns the subtitle group for the currently active primary - * media playlist. - */ - }, { - key: 'activeSubtitleGroup_', - value: function activeSubtitleGroup_() { - var videoPlaylist = this.masterPlaylistLoader_.media(); - var result = undefined; - - if (!videoPlaylist) { - return null; - } - - if (videoPlaylist.attributes && videoPlaylist.attributes.SUBTITLES) { - result = this.subtitleGroups_.groups[videoPlaylist.attributes.SUBTITLES]; - } - - return result || this.subtitleGroups_.groups.main; - } - }, { - key: 'activeSubtitleTrack_', - value: function activeSubtitleTrack_() { - for (var trackName in this.subtitleGroups_.tracks) { - if (this.subtitleGroups_.tracks[trackName].mode === 'showing') { - return this.subtitleGroups_.tracks[trackName]; - } - } - - return null; - } - }, { - key: 'handleSubtitleError_', - value: function handleSubtitleError_() { - _videoJs2['default'].log.warn('Problem encountered loading the subtitle track' + '. Switching back to default.'); - - this.subtitleSegmentLoader_.abort(); - - var track = this.activeSubtitleTrack_(); - - if (track) { - track.mode = 'disabled'; - } - - this.setupSubtitles(); - } - - /** - * Determine the correct audio renditions based on the active - * AudioTrack and initialize a PlaylistLoader and SegmentLoader if - * necessary. This method is only called when the media-group changes - * and performs non-destructive 'resync' of the SegmentLoader(s) since - * the playlist has likely changed - */ - }, { - key: 'mediaGroupChanged', - value: function mediaGroupChanged() { - var track = this.getActiveAudioTrack_(); - - this.stopAudioLoaders_(); - this.resyncAudioLoaders_(track); - } - - /** - * Determine the correct audio rendition based on the active - * AudioTrack and initialize a PlaylistLoader and SegmentLoader if - * necessary. This method is called once automatically before - * playback begins to enable the default audio track and should be - * invoked again if the track is changed. Performs destructive 'reset' - * on the SegmentLoaders(s) to ensure we start loading audio as - * close to currentTime as possible - */ - }, { - key: 'setupAudio', - value: function setupAudio() { - var track = this.getActiveAudioTrack_(); - - this.stopAudioLoaders_(); - this.resetAudioLoaders_(track); - } - - /** - * Returns the currently active track or the default track if none - * are active - */ - }, { - key: 'getActiveAudioTrack_', - value: function getActiveAudioTrack_() { - // determine whether seperate loaders are required for the audio - // rendition - var audioGroup = this.activeAudioGroup(); - var track = audioGroup.filter(function (audioTrack) { - return audioTrack.enabled; - })[0]; - - if (!track) { - track = audioGroup.filter(function (audioTrack) { - return audioTrack.properties_['default']; - })[0] || audioGroup[0]; - track.enabled = true; - } - - return track; - } - - /** - * Destroy the PlaylistLoader and pause the SegmentLoader specifically - * for audio when switching audio tracks - */ - }, { - key: 'stopAudioLoaders_', - value: function stopAudioLoaders_() { - // stop playlist and segment loading for audio - if (this.audioPlaylistLoader_) { - this.audioPlaylistLoader_.dispose(); - this.audioPlaylistLoader_ = null; - } - this.audioSegmentLoader_.pause(); - } - - /** - * Destructive reset of the mainSegmentLoader (when audio is muxed) - * or audioSegmentLoader (when audio is demuxed) to prepare them - * to start loading new data right at currentTime - */ - }, { - key: 'resetAudioLoaders_', - value: function resetAudioLoaders_(track) { - if (!track.properties_.resolvedUri) { - this.mainSegmentLoader_.resetEverything(); - return; - } - - this.audioSegmentLoader_.resetEverything(); - this.setupAudioPlaylistLoader_(track); - } - - /** - * Non-destructive resync of the audioSegmentLoader (when audio - * is demuxed) to prepare to continue appending new audio data - * at the end of the current buffered region - */ - }, { - key: 'resyncAudioLoaders_', - value: function resyncAudioLoaders_(track) { - if (!track.properties_.resolvedUri) { - return; - } - - this.audioSegmentLoader_.resyncLoader(); - this.setupAudioPlaylistLoader_(track); - } - - /** - * Setup a new audioPlaylistLoader and start the audioSegmentLoader - * to begin loading demuxed audio - */ - }, { - key: 'setupAudioPlaylistLoader_', - value: function setupAudioPlaylistLoader_(track) { - var _this4 = this; - - // startup playlist and segment loaders for the enabled audio - // track - this.audioPlaylistLoader_ = new _playlistLoader2['default'](track.properties_.resolvedUri, this.hls_, this.withCredentials); - this.audioPlaylistLoader_.load(); - - this.audioPlaylistLoader_.on('loadedmetadata', function () { - var audioPlaylist = _this4.audioPlaylistLoader_.media(); - - _this4.audioSegmentLoader_.playlist(audioPlaylist, _this4.requestOptions_); - - // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - if (!_this4.tech_.paused() || audioPlaylist.endList && _this4.tech_.preload() !== 'none') { - _this4.audioSegmentLoader_.load(); - } - - if (!audioPlaylist.endList) { - _this4.audioPlaylistLoader_.trigger('firstplay'); - } - }); - - this.audioPlaylistLoader_.on('loadedplaylist', function () { - var updatedPlaylist = undefined; - - if (_this4.audioPlaylistLoader_) { - updatedPlaylist = _this4.audioPlaylistLoader_.media(); - } - - if (!updatedPlaylist) { - // only one playlist to select - _this4.audioPlaylistLoader_.media(_this4.audioPlaylistLoader_.playlists.master.playlists[0]); - return; - } - - _this4.audioSegmentLoader_.playlist(updatedPlaylist, _this4.requestOptions_); - }); - - this.audioPlaylistLoader_.on('error', function () { - _videoJs2['default'].log.warn('Problem encountered loading the alternate audio track' + '. Switching back to default.'); - _this4.audioSegmentLoader_.abort(); - _this4.setupAudio(); - }); - } - - /** - * Determine the correct subtitle playlist based on the active - * SubtitleTrack and initialize a PlaylistLoader and SegmentLoader if - * necessary. This method is called once automatically before - * playback begins to enable the default subtitle track and should be - * invoked again if the track is changed. - */ - }, { - key: 'setupSubtitles', - value: function setupSubtitles() { - var _this5 = this; - - var subtitleGroup = this.activeSubtitleGroup_(); - var track = this.activeSubtitleTrack_(); - - this.subtitleSegmentLoader_.pause(); - - if (!track) { - // stop playlist and segment loading for subtitles - if (this.subtitlePlaylistLoader_) { - this.subtitlePlaylistLoader_.dispose(); - this.subtitlePlaylistLoader_ = null; - } - return; - } - - var properties = subtitleGroup.filter(function (subtitleProperties) { - return subtitleProperties.id === track.id; - })[0]; - - // startup playlist and segment loaders for the enabled subtitle track - if (!this.subtitlePlaylistLoader_ || - // if the media hasn't loaded yet, we don't have the URI to check, so it is - // easiest to simply recreate the playlist loader - !this.subtitlePlaylistLoader_.media() || this.subtitlePlaylistLoader_.media().resolvedUri !== properties.resolvedUri) { - - if (this.subtitlePlaylistLoader_) { - this.subtitlePlaylistLoader_.dispose(); - } - - // reset the segment loader only when the subtitle playlist is changed instead of - // every time setupSubtitles is called since switching subtitle tracks fires - // multiple `change` events on the TextTrackList - this.subtitleSegmentLoader_.resetEverything(); - - // can't reuse playlistloader because we're only using single renditions and not a - // proper master - this.subtitlePlaylistLoader_ = new _playlistLoader2['default'](properties.resolvedUri, this.hls_, this.withCredentials); - - this.subtitlePlaylistLoader_.on('loadedmetadata', function () { - var subtitlePlaylist = _this5.subtitlePlaylistLoader_.media(); - - _this5.subtitleSegmentLoader_.playlist(subtitlePlaylist, _this5.requestOptions_); - _this5.subtitleSegmentLoader_.track(_this5.activeSubtitleTrack_()); - - // if the video is already playing, or if this isn't a live video and preload - // permits, start downloading segments - if (!_this5.tech_.paused() || subtitlePlaylist.endList && _this5.tech_.preload() !== 'none') { - _this5.subtitleSegmentLoader_.load(); - } - }); - - this.subtitlePlaylistLoader_.on('loadedplaylist', function () { - var updatedPlaylist = undefined; - - if (_this5.subtitlePlaylistLoader_) { - updatedPlaylist = _this5.subtitlePlaylistLoader_.media(); - } - - if (!updatedPlaylist) { - return; - } - - _this5.subtitleSegmentLoader_.playlist(updatedPlaylist, _this5.requestOptions_); - }); - - this.subtitlePlaylistLoader_.on('error', this.handleSubtitleError_.bind(this)); - } - - if (this.subtitlePlaylistLoader_.media() && this.subtitlePlaylistLoader_.media().resolvedUri === properties.resolvedUri) { - this.subtitleSegmentLoader_.load(); - } else { - this.subtitlePlaylistLoader_.load(); - } - } - - /** - * Re-tune playback quality level for the current player - * conditions. This method may perform destructive actions, like - * removing already buffered content, to readjust the currently - * active playlist quickly. - * - * @private - */ - }, { - key: 'fastQualityChange_', - value: function fastQualityChange_() { - var media = this.selectPlaylist(); - - if (media !== this.masterPlaylistLoader_.media()) { - this.masterPlaylistLoader_.media(media); - - this.mainSegmentLoader_.resetLoader(); - // don't need to reset audio as it is reset when media changes - } - } - - /** - * Begin playback. - */ - }, { - key: 'play', - value: function play() { - if (this.setupFirstPlay()) { - return; - } - - if (this.tech_.ended()) { - this.tech_.setCurrentTime(0); - } - - if (this.hasPlayed_()) { - this.load(); - } - - var seekable = this.tech_.seekable(); - - // if the viewer has paused and we fell out of the live window, - // seek forward to the live point - if (this.tech_.duration() === Infinity) { - if (this.tech_.currentTime() < seekable.start(0)) { - return this.tech_.setCurrentTime(seekable.end(seekable.length - 1)); - } - } - } - - /** - * Seek to the latest media position if this is a live video and the - * player and video are loaded and initialized. - */ - }, { - key: 'setupFirstPlay', - value: function setupFirstPlay() { - var seekable = undefined; - var media = this.masterPlaylistLoader_.media(); - - // check that everything is ready to begin buffering in the live - // scenario - // 1) the active media playlist is available - if (media && - // 2) the player is not paused - !this.tech_.paused() && - // 3) the player has not started playing - !this.hasPlayed_()) { - - // when the video is a live stream - if (!media.endList) { - this.trigger('firstplay'); - - // seek to the latest media position for live videos - seekable = this.seekable(); - if (seekable.length) { - this.tech_.setCurrentTime(seekable.end(0)); - } - } - this.hasPlayed_ = function () { - return true; - }; - // now that we are ready, load the segment - this.load(); - return true; - } - return false; - } - - /** - * handle the sourceopen event on the MediaSource - * - * @private - */ - }, { - key: 'handleSourceOpen_', - value: function handleSourceOpen_() { - // Only attempt to create the source buffer if none already exist. - // handleSourceOpen is also called when we are "re-opening" a source buffer - // after `endOfStream` has been called (in response to a seek for instance) - try { - this.setupSourceBuffers_(); - } catch (e) { - _videoJs2['default'].log.warn('Failed to create Source Buffers', e); - return this.mediaSource.endOfStream('decode'); - } - - // if autoplay is enabled, begin playback. This is duplicative of - // code in video.js but is required because play() must be invoked - // *after* the media source has opened. - if (this.tech_.autoplay()) { - this.tech_.play(); - } - - this.trigger('sourceopen'); - } - - /** - * Calls endOfStream on the media source when all active stream types have called - * endOfStream - * - * @param {string} streamType - * Stream type of the segment loader that called endOfStream - * @private - */ - }, { - key: 'onEndOfStream', - value: function onEndOfStream() { - var isEndOfStream = this.mainSegmentLoader_.ended_; - - if (this.audioPlaylistLoader_) { - // if the audio playlist loader exists, then alternate audio is active, so we need - // to wait for both the main and audio segment loaders to call endOfStream - isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_; - } - - if (isEndOfStream) { - this.mediaSource.endOfStream(); - } - } - - /** - * Check if a playlist has stopped being updated - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist has stopped being updated or not - */ - }, { - key: 'stuckAtPlaylistEnd_', - value: function stuckAtPlaylistEnd_(playlist) { - var seekable = this.seekable(); - - if (!seekable.length) { - // playlist doesn't have enough information to determine whether we are stuck - return false; - } - - var expired = this.syncController_.getExpiredTime(playlist, this.mediaSource.duration); - - if (expired === null) { - return false; - } - - // does not use the safe live end to calculate playlist end, since we - // don't want to say we are stuck while there is still content - var absolutePlaylistEnd = Hls.Playlist.playlistEnd(playlist, expired); - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (!buffered.length) { - // return true if the playhead reached the absolute end of the playlist - return absolutePlaylistEnd - currentTime <= _ranges2['default'].TIME_FUDGE_FACTOR; - } - var bufferedEnd = buffered.end(buffered.length - 1); - - // return true if there is too little buffer left and - // buffer has reached absolute end of playlist - return bufferedEnd - currentTime <= _ranges2['default'].TIME_FUDGE_FACTOR && absolutePlaylistEnd - bufferedEnd <= _ranges2['default'].TIME_FUDGE_FACTOR; - } - - /** - * Blacklists a playlist when an error occurs for a set amount of time - * making it unavailable for selection by the rendition selection algorithm - * and then forces a new playlist (rendition) selection. - * - * @param {Object=} error an optional error that may include the playlist - * to blacklist - */ - }, { - key: 'blacklistCurrentPlaylist', - value: function blacklistCurrentPlaylist() { - var error = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - var currentPlaylist = undefined; - var nextPlaylist = undefined; - - // If the `error` was generated by the playlist loader, it will contain - // the playlist we were trying to load (but failed) and that should be - // blacklisted instead of the currently selected playlist which is likely - // out-of-date in this scenario - currentPlaylist = error.playlist || this.masterPlaylistLoader_.media(); - - // If there is no current playlist, then an error occurred while we were - // trying to load the master OR while we were disposing of the tech - if (!currentPlaylist) { - this.error = error; - - try { - return this.mediaSource.endOfStream('network'); - } catch (e) { - return this.trigger('error'); - } - } - - var isFinalRendition = this.masterPlaylistLoader_.isFinalRendition_(); - - if (isFinalRendition) { - // Never blacklisting this playlist because it's final rendition - _videoJs2['default'].log.warn('Problem encountered with the current ' + 'HLS playlist. Trying again since it is the final playlist.'); - - this.tech_.trigger('retryplaylist'); - return this.masterPlaylistLoader_.load(isFinalRendition); - } - // Blacklist this playlist - currentPlaylist.excludeUntil = Date.now() + this.blacklistDuration * 1000; - this.tech_.trigger('blacklistplaylist'); - this.tech_.trigger({ type: 'usage', name: 'hls-rendition-blacklisted' }); - - // Select a new playlist - nextPlaylist = this.selectPlaylist(); - _videoJs2['default'].log.warn('Problem encountered with the current HLS playlist.' + (error.message ? ' ' + error.message : '') + ' Switching to another playlist.'); - - return this.masterPlaylistLoader_.media(nextPlaylist); - } - - /** - * Pause all segment loaders - */ - }, { - key: 'pauseLoading', - value: function pauseLoading() { - this.mainSegmentLoader_.pause(); - if (this.audioPlaylistLoader_) { - this.audioSegmentLoader_.pause(); - } - if (this.subtitlePlaylistLoader_) { - this.subtitleSegmentLoader_.pause(); - } - } - - /** - * set the current time on all segment loaders - * - * @param {TimeRange} currentTime the current time to set - * @return {TimeRange} the current time - */ - }, { - key: 'setCurrentTime', - value: function setCurrentTime(currentTime) { - var buffered = _ranges2['default'].findRange(this.tech_.buffered(), currentTime); - - if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) { - // return immediately if the metadata is not ready yet - return 0; - } - - // it's clearly an edge-case but don't thrown an error if asked to - // seek within an empty playlist - if (!this.masterPlaylistLoader_.media().segments) { - return 0; - } - - // In flash playback, the segment loaders should be reset on every seek, even - // in buffer seeks - var isFlash = this.mode_ === 'flash' || this.mode_ === 'auto' && !_videoJs2['default'].MediaSource.supportsNativeMediaSources(); - - // if the seek location is already buffered, continue buffering as - // usual - if (buffered && buffered.length && !isFlash) { - return currentTime; - } - - // cancel outstanding requests so we begin buffering at the new - // location - this.mainSegmentLoader_.resetEverything(); - this.mainSegmentLoader_.abort(); - if (this.audioPlaylistLoader_) { - this.audioSegmentLoader_.resetEverything(); - this.audioSegmentLoader_.abort(); - } - if (this.subtitlePlaylistLoader_) { - this.subtitleSegmentLoader_.resetEverything(); - this.subtitleSegmentLoader_.abort(); - } - - if (!this.tech_.paused()) { - this.mainSegmentLoader_.load(); - if (this.audioPlaylistLoader_) { - this.audioSegmentLoader_.load(); - } - if (this.subtitlePlaylistLoader_) { - this.subtitleSegmentLoader_.load(); - } - } - } - - /** - * get the current duration - * - * @return {TimeRange} the duration - */ - }, { - key: 'duration', - value: function duration() { - if (!this.masterPlaylistLoader_) { - return 0; - } - - if (this.mediaSource) { - return this.mediaSource.duration; - } - - return Hls.Playlist.duration(this.masterPlaylistLoader_.media()); - } - - /** - * check the seekable range - * - * @return {TimeRange} the seekable range - */ - }, { - key: 'seekable', - value: function seekable() { - return this.seekable_; - } - }, { - key: 'onSyncInfoUpdate_', - value: function onSyncInfoUpdate_() { - var mainSeekable = undefined; - var audioSeekable = undefined; - - if (!this.masterPlaylistLoader_) { - return; - } - - var media = this.masterPlaylistLoader_.media(); - - if (!media) { - return; - } - - var expired = this.syncController_.getExpiredTime(media, this.mediaSource.duration); - - if (expired === null) { - // not enough information to update seekable - return; - } - - mainSeekable = Hls.Playlist.seekable(media, expired); - - if (mainSeekable.length === 0) { - return; - } - - if (this.audioPlaylistLoader_) { - media = this.audioPlaylistLoader_.media(); - expired = this.syncController_.getExpiredTime(media, this.mediaSource.duration); - - if (expired === null) { - return; - } - - audioSeekable = Hls.Playlist.seekable(media, expired); - - if (audioSeekable.length === 0) { - return; - } - } - - if (!audioSeekable) { - // seekable has been calculated based on buffering video data so it - // can be returned directly - this.seekable_ = mainSeekable; - } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) { - // seekables are pretty far off, rely on main - this.seekable_ = mainSeekable; - } else { - this.seekable_ = _videoJs2['default'].createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]); - } - - this.tech_.trigger('seekablechanged'); - } - - /** - * Update the player duration - */ - }, { - key: 'updateDuration', - value: function updateDuration() { - var _this6 = this; - - var oldDuration = this.mediaSource.duration; - var newDuration = Hls.Playlist.duration(this.masterPlaylistLoader_.media()); - var buffered = this.tech_.buffered(); - var setDuration = function setDuration() { - _this6.mediaSource.duration = newDuration; - _this6.tech_.trigger('durationchange'); - - _this6.mediaSource.removeEventListener('sourceopen', setDuration); - }; - - if (buffered.length > 0) { - newDuration = Math.max(newDuration, buffered.end(buffered.length - 1)); - } - - // if the duration has changed, invalidate the cached value - if (oldDuration !== newDuration) { - // update the duration - if (this.mediaSource.readyState !== 'open') { - this.mediaSource.addEventListener('sourceopen', setDuration); - } else { - setDuration(); - } - } - } - - /** - * dispose of the MasterPlaylistController and everything - * that it controls - */ - }, { - key: 'dispose', - value: function dispose() { - this.decrypter_.terminate(); - this.masterPlaylistLoader_.dispose(); - this.mainSegmentLoader_.dispose(); - - if (this.audioPlaylistLoader_) { - this.audioPlaylistLoader_.dispose(); - } - if (this.subtitlePlaylistLoader_) { - this.subtitlePlaylistLoader_.dispose(); - } - this.audioSegmentLoader_.dispose(); - this.subtitleSegmentLoader_.dispose(); - } - - /** - * return the master playlist object if we have one - * - * @return {Object} the master playlist object that we parsed - */ - }, { - key: 'master', - value: function master() { - return this.masterPlaylistLoader_.master; - } - - /** - * return the currently selected playlist - * - * @return {Object} the currently selected playlist object that we parsed - */ - }, { - key: 'media', - value: function media() { - // playlist loader will not return media if it has not been fully loaded - return this.masterPlaylistLoader_.media() || this.initialMedia_; - } - - /** - * setup our internal source buffers on our segment Loaders - * - * @private - */ - }, { - key: 'setupSourceBuffers_', - value: function setupSourceBuffers_() { - var media = this.masterPlaylistLoader_.media(); - var mimeTypes = undefined; - - // wait until a media playlist is available and the Media Source is - // attached - if (!media || this.mediaSource.readyState !== 'open') { - return; - } - - mimeTypes = mimeTypesForPlaylist_(this.masterPlaylistLoader_.master, media); - if (mimeTypes.length < 1) { - this.error = 'No compatible SourceBuffer configuration for the variant stream:' + media.resolvedUri; - return this.mediaSource.endOfStream('decode'); - } - this.mainSegmentLoader_.mimeType(mimeTypes[0]); - if (mimeTypes[1]) { - this.audioSegmentLoader_.mimeType(mimeTypes[1]); - } - - // exclude any incompatible variant streams from future playlist - // selection - this.excludeIncompatibleVariants_(media); - } - - /** - * Blacklist playlists that are known to be codec or - * stream-incompatible with the SourceBuffer configuration. For - * instance, Media Source Extensions would cause the video element to - * stall waiting for video data if you switched from a variant with - * video and audio to an audio-only one. - * - * @param {Object} media a media playlist compatible with the current - * set of SourceBuffers. Variants in the current master playlist that - * do not appear to have compatible codec or stream configurations - * will be excluded from the default playlist selection algorithm - * indefinitely. - * @private - */ - }, { - key: 'excludeIncompatibleVariants_', - value: function excludeIncompatibleVariants_(media) { - var master = this.masterPlaylistLoader_.master; - var codecCount = 2; - var videoCodec = null; - var codecs = undefined; - - if (media.attributes && media.attributes.CODECS) { - codecs = parseCodecs(media.attributes.CODECS); - videoCodec = codecs.videoCodec; - codecCount = codecs.codecCount; - } - master.playlists.forEach(function (variant) { - var variantCodecs = { - codecCount: 2, - videoCodec: null - }; - - if (variant.attributes && variant.attributes.CODECS) { - var codecString = variant.attributes.CODECS; - - variantCodecs = parseCodecs(codecString); - - if (window.MediaSource && window.MediaSource.isTypeSupported && !window.MediaSource.isTypeSupported('video/mp4; codecs="' + mapLegacyAvcCodecs_(codecString) + '"')) { - variant.excludeUntil = Infinity; - } - } - - // if the streams differ in the presence or absence of audio or - // video, they are incompatible - if (variantCodecs.codecCount !== codecCount) { - variant.excludeUntil = Infinity; - } - - // if h.264 is specified on the current playlist, some flavor of - // it must be specified on all compatible variants - if (variantCodecs.videoCodec !== videoCodec) { - variant.excludeUntil = Infinity; - } - }); - } - }, { - key: 'updateAdCues_', - value: function updateAdCues_(media) { - var offset = 0; - var seekable = this.seekable(); - - if (seekable.length) { - offset = seekable.start(0); - } - - _adCueTags2['default'].updateAdCues(media, this.cueTagsTrack_, offset); - } - - /** - * Calculates the desired forward buffer length based on current time - * - * @return {Number} Desired forward buffer length in seconds - */ - }, { - key: 'goalBufferLength', - value: function goalBufferLength() { - var currentTime = this.tech_.currentTime(); - var initial = _config2['default'].GOAL_BUFFER_LENGTH; - var rate = _config2['default'].GOAL_BUFFER_LENGTH_RATE; - var max = Math.max(initial, _config2['default'].MAX_GOAL_BUFFER_LENGTH); - - return Math.min(initial + currentTime * rate, max); - } - - /** - * Calculates the desired buffer low water line based on current time - * - * @return {Number} Desired buffer low water line in seconds - */ - }, { - key: 'bufferLowWaterLine', - value: function bufferLowWaterLine() { - var currentTime = this.tech_.currentTime(); - var initial = _config2['default'].BUFFER_LOW_WATER_LINE; - var rate = _config2['default'].BUFFER_LOW_WATER_LINE_RATE; - var max = Math.max(initial, _config2['default'].MAX_BUFFER_LOW_WATER_LINE); - - return Math.min(initial + currentTime * rate, max); - } - }]); - - return MasterPlaylistController; -})(_videoJs2['default'].EventTarget); - -exports.MasterPlaylistController = MasterPlaylistController; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./ad-cue-tags":1,"./config":3,"./decrypter-worker":4,"./playlist-loader":8,"./ranges":11,"./segment-loader":15,"./sync-controller":17,"./vtt-segment-loader":18,"videojs-contrib-media-sources/es5/codec-utils":64,"webworkify":75}],6:[function(require,module,exports){ -(function (global){ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _binUtils = require('./bin-utils'); - -var REQUEST_ERRORS = { - FAILURE: 2, - TIMEOUT: -101, - ABORTED: -102 -}; - -exports.REQUEST_ERRORS = REQUEST_ERRORS; -/** - * Turns segment byterange into a string suitable for use in - * HTTP Range requests - * - * @param {Object} byterange - an object with two values defining the start and end - * of a byte-range - */ -var byterangeStr = function byterangeStr(byterange) { - var byterangeStart = undefined; - var byterangeEnd = undefined; - - // `byterangeEnd` is one less than `offset + length` because the HTTP range - // header uses inclusive ranges - byterangeEnd = byterange.offset + byterange.length - 1; - byterangeStart = byterange.offset; - return 'bytes=' + byterangeStart + '-' + byterangeEnd; -}; - -/** - * Defines headers for use in the xhr request for a particular segment. - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - */ -var segmentXhrHeaders = function segmentXhrHeaders(segment) { - var headers = {}; - - if (segment.byterange) { - headers.Range = byterangeStr(segment.byterange); - } - return headers; -}; - -/** - * Abort all requests - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - */ -var abortAll = function abortAll(activeXhrs) { - activeXhrs.forEach(function (xhr) { - xhr.abort(); - }); -}; - -/** - * Gather important bandwidth stats once a request has completed - * - * @param {Object} request - the XHR request from which to gather stats - */ -var getRequestStats = function getRequestStats(request) { - return { - bandwidth: request.bandwidth, - bytesReceived: request.bytesReceived || 0, - roundTripTime: request.roundTripTime || 0 - }; -}; - -/** - * If possible gather bandwidth stats as a request is in - * progress - * - * @param {Event} progressEvent - an event object from an XHR's progress event - */ -var getProgressStats = function getProgressStats(progressEvent) { - var request = progressEvent.target; - var roundTripTime = Date.now() - request.requestTime; - var stats = { - bandwidth: Infinity, - bytesReceived: 0, - roundTripTime: roundTripTime || 0 - }; - - stats.bytesReceived = progressEvent.loaded; - // This can result in Infinity if stats.roundTripTime is 0 but that is ok - // because we should only use bandwidth stats on progress to determine when - // abort a request early due to insufficient bandwidth - stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000); - - return stats; -}; - -/** - * Handle all error conditions in one place and return an object - * with all the information - * - * @param {Error|null} error - if non-null signals an error occured with the XHR - * @param {Object} request - the XHR request that possibly generated the error - */ -var handleErrors = function handleErrors(error, request) { - if (request.timedout) { - return { - status: request.status, - message: 'HLS request timed-out at URL: ' + request.uri, - code: REQUEST_ERRORS.TIMEOUT, - xhr: request - }; - } - - if (request.aborted) { - return { - status: request.status, - message: 'HLS request aborted at URL: ' + request.uri, - code: REQUEST_ERRORS.ABORTED, - xhr: request - }; - } - - if (error) { - return { - status: request.status, - message: 'HLS request errored at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }; - } - - return null; -}; - -/** - * Handle responses for key data and convert the key data to the correct format - * for the decryption step later - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ -var handleKeyResponse = function handleKeyResponse(segment, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - if (response.byteLength !== 16) { - return finishProcessingFn({ - status: request.status, - message: 'Invalid HLS key at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - var view = new DataView(response); - - segment.key.bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); - return finishProcessingFn(null, segment); - }; -}; - -/** - * Handle init-segment responses - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ -var handleInitSegmentResponse = function handleInitSegmentResponse(segment, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - // stop processing if received empty content - if (response.byteLength === 0) { - return finishProcessingFn({ - status: request.status, - message: 'Empty HLS segment content at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - segment.map.bytes = new Uint8Array(request.response); - return finishProcessingFn(null, segment); - }; -}; - -/** - * Response handler for segment-requests being sure to set the correct - * property depending on whether the segment is encryped or not - * Also records and keeps track of stats that are used for ABR purposes - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} finishProcessingFn - a callback to execute to continue processing - * this request - */ -var handleSegmentResponse = function handleSegmentResponse(segment, finishProcessingFn) { - return function (error, request) { - var response = request.response; - var errorObj = handleErrors(error, request); - - if (errorObj) { - return finishProcessingFn(errorObj, segment); - } - - // stop processing if received empty content - if (response.byteLength === 0) { - return finishProcessingFn({ - status: request.status, - message: 'Empty HLS segment content at URL: ' + request.uri, - code: REQUEST_ERRORS.FAILURE, - xhr: request - }, segment); - } - - segment.stats = getRequestStats(request); - - if (segment.key) { - segment.encryptedBytes = new Uint8Array(request.response); - } else { - segment.bytes = new Uint8Array(request.response); - } - - return finishProcessingFn(null, segment); - }; -}; - -/** - * Decrypt the segment via the decryption web worker - * - * @param {WebWorker} decrypter - a WebWorker interface to AES-128 decryption routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} doneFn - a callback that is executed after decryption has completed - */ -var decryptSegment = function decryptSegment(decrypter, segment, doneFn) { - var decryptionHandler = function decryptionHandler(event) { - if (event.data.source === segment.requestId) { - decrypter.removeEventListener('message', decryptionHandler); - var decrypted = event.data.decrypted; - - segment.bytes = new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength); - return doneFn(null, segment); - } - }; - - decrypter.addEventListener('message', decryptionHandler); - - // this is an encrypted segment - // incrementally decrypt the segment - decrypter.postMessage((0, _binUtils.createTransferableMessage)({ - source: segment.requestId, - encrypted: segment.encryptedBytes, - key: segment.key.bytes, - iv: segment.key.iv - }), [segment.encryptedBytes.buffer, segment.key.bytes.buffer]); -}; - -/** - * The purpose of this function is to get the most pertinent error from the - * array of errors. - * For instance if a timeout and two aborts occur, then the aborts were - * likely triggered by the timeout so return that error object. - */ -var getMostImportantError = function getMostImportantError(errors) { - return errors.reduce(function (prev, err) { - return err.code > prev.code ? err : prev; - }); -}; - -/** - * This function waits for all XHRs to finish (with either success or failure) - * before continueing processing via it's callback. The function gathers errors - * from each request into a single errors array so that the error status for - * each request can be examined later. - * - * @param {Object} activeXhrs - an object that tracks all XHR requests - * @param {WebWorker} decrypter - a WebWorker interface to AES-128 decryption routines - * @param {Function} doneFn - a callback that is executed after all resources have been - * downloaded and any decryption completed - */ -var waitForCompletion = function waitForCompletion(activeXhrs, decrypter, doneFn) { - var errors = []; - var count = 0; - - return function (error, segment) { - if (error) { - // If there are errors, we have to abort any outstanding requests - abortAll(activeXhrs); - errors.push(error); - } - count += 1; - - if (count === activeXhrs.length) { - // Keep track of when *all* of the requests have completed - segment.endOfAllRequests = Date.now(); - - if (errors.length > 0) { - var worstError = getMostImportantError(errors); - - return doneFn(worstError, segment); - } - if (segment.encryptedBytes) { - return decryptSegment(decrypter, segment, doneFn); - } - // Otherwise, everything is ready just continue - return doneFn(null, segment); - } - }; -}; - -/** - * Simple progress event callback handler that gathers some stats before - * executing a provided callback with the `segment` object - * - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} progressFn - a callback that is executed each time a progress event - * is received - * @param {Event} event - the progress event object from XMLHttpRequest - */ -var handleProgress = function handleProgress(segment, progressFn) { - return function (event) { - segment.stats = _videoJs2['default'].mergeOptions(segment.stats, getProgressStats(event)); - - // record the time that we receive the first byte of data - if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) { - segment.stats.firstBytesReceivedAt = Date.now(); - } - - return progressFn(event, segment); - }; -}; - -/** - * Load all resources and does any processing necessary for a media-segment - * - * Features: - * decrypts the media-segment if it has a key uri and an iv - * aborts *all* requests if *any* one request fails - * - * The segment object, at minimum, has the following format: - * { - * resolvedUri: String, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [key]: { - * resolvedUri: String - * [byterange]: { - * offset: Number, - * length: Number - * }, - * iv: { - * bytes: Uint32Array - * } - * }, - * [map]: { - * resolvedUri: String, - * [byterange]: { - * offset: Number, - * length: Number - * }, - * [bytes]: Uint8Array - * } - * } - * ...where [name] denotes optional properties - * - * @param {Function} xhr - an instance of the xhr wrapper in xhr.js - * @param {Object} xhrOptions - the base options to provide to all xhr requests - * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 - * decryption routines - * @param {Object} segment - a simplified copy of the segmentInfo object - * from SegmentLoader - * @param {Function} progressFn - a callback that receives progress events from the main - * segment's xhr request - * @param {Function} doneFn - a callback that is executed only once all requests have - * succeeded or failed - * @returns {Function} a function that, when invoked, immediately aborts all - * outstanding requests - */ -var mediaSegmentRequest = function mediaSegmentRequest(xhr, xhrOptions, decryptionWorker, segment, progressFn, doneFn) { - var activeXhrs = []; - var finishProcessingFn = waitForCompletion(activeXhrs, decryptionWorker, doneFn); - - // optionally, request the decryption key - if (segment.key) { - var keyRequestOptions = _videoJs2['default'].mergeOptions(xhrOptions, { - uri: segment.key.resolvedUri, - responseType: 'arraybuffer' - }); - var keyRequestCallback = handleKeyResponse(segment, finishProcessingFn); - var keyXhr = xhr(keyRequestOptions, keyRequestCallback); - - activeXhrs.push(keyXhr); - } - - // optionally, request the associated media init segment - if (segment.map && !segment.map.bytes) { - var initSegmentOptions = _videoJs2['default'].mergeOptions(xhrOptions, { - uri: segment.map.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment.map) - }); - var initSegmentRequestCallback = handleInitSegmentResponse(segment, finishProcessingFn); - var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback); - - activeXhrs.push(initSegmentXhr); - } - - var segmentRequestOptions = _videoJs2['default'].mergeOptions(xhrOptions, { - uri: segment.resolvedUri, - responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment) - }); - var segmentRequestCallback = handleSegmentResponse(segment, finishProcessingFn); - var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback); - - segmentXhr.addEventListener('progress', handleProgress(segment, progressFn)); - activeXhrs.push(segmentXhr); - - return function () { - return abortAll(activeXhrs); - }; -}; -exports.mediaSegmentRequest = mediaSegmentRequest; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./bin-utils":2}],7:[function(require,module,exports){ -(function (global){ -/** - * @file playback-watcher.js - * - * Playback starts, and now my watch begins. It shall not end until my death. I shall - * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns - * and win no glory. I shall live and die at my post. I am the corrector of the underflow. - * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge - * my life and honor to the Playback Watch, for this Player and all the Players to come. - */ - -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _ranges = require('./ranges'); - -var _ranges2 = _interopRequireDefault(_ranges); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -// Set of events that reset the playback-watcher time check logic and clear the timeout -var timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error']; - -/** - * @class PlaybackWatcher - */ - -var PlaybackWatcher = (function () { - /** - * Represents an PlaybackWatcher object. - * @constructor - * @param {object} options an object that includes the tech and settings - */ - - function PlaybackWatcher(options) { - var _this = this; - - _classCallCheck(this, PlaybackWatcher); - - this.tech_ = options.tech; - this.seekable = options.seekable; - - this.consecutiveUpdates = 0; - this.lastRecordedTime = null; - this.timer_ = null; - this.checkCurrentTimeTimeout_ = null; - - if (options.debug) { - this.logger_ = _videoJs2['default'].log.bind(_videoJs2['default'], 'playback-watcher ->'); - } - this.logger_('initialize'); - - var waitingHandler = function waitingHandler() { - return _this.techWaiting_(); - }; - var cancelTimerHandler = function cancelTimerHandler() { - return _this.cancelTimer_(); - }; - var fixesBadSeeksHandler = function fixesBadSeeksHandler() { - return _this.fixesBadSeeks_(); - }; - - this.tech_.on('seekablechanged', fixesBadSeeksHandler); - this.tech_.on('waiting', waitingHandler); - this.tech_.on(timerCancelEvents, cancelTimerHandler); - this.monitorCurrentTime_(); - - // Define the dispose function to clean up our events - this.dispose = function () { - _this.logger_('dispose'); - _this.tech_.off('seekablechanged', fixesBadSeeksHandler); - _this.tech_.off('waiting', waitingHandler); - _this.tech_.off(timerCancelEvents, cancelTimerHandler); - if (_this.checkCurrentTimeTimeout_) { - _globalWindow2['default'].clearTimeout(_this.checkCurrentTimeTimeout_); - } - _this.cancelTimer_(); - }; - } - - /** - * Periodically check current time to see if playback stopped - * - * @private - */ - - _createClass(PlaybackWatcher, [{ - key: 'monitorCurrentTime_', - value: function monitorCurrentTime_() { - this.checkCurrentTime_(); - - if (this.checkCurrentTimeTimeout_) { - _globalWindow2['default'].clearTimeout(this.checkCurrentTimeTimeout_); - } - - // 42 = 24 fps // 250 is what Webkit uses // FF uses 15 - this.checkCurrentTimeTimeout_ = _globalWindow2['default'].setTimeout(this.monitorCurrentTime_.bind(this), 250); - } - - /** - * The purpose of this function is to emulate the "waiting" event on - * browsers that do not emit it when they are waiting for more - * data to continue playback - * - * @private - */ - }, { - key: 'checkCurrentTime_', - value: function checkCurrentTime_() { - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - this.consecutiveUpdates = 0; - this.lastRecordedTime = this.tech_.currentTime(); - return; - } - - if (this.tech_.paused() || this.tech_.seeking()) { - return; - } - - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - - if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + 0.1 >= buffered.end(buffered.length - 1))) { - // If current time is at the end of the final buffered region, then any playback - // stall is most likely caused by buffering in a low bandwidth environment. The tech - // should fire a `waiting` event in this scenario, but due to browser and tech - // inconsistencies (e.g. The Flash tech does not fire a `waiting` event when the end - // of the buffer is reached and has fallen off the live window). Calling - // `techWaiting_` here allows us to simulate responding to a native `waiting` event - // when the tech fails to emit one. - return this.techWaiting_(); - } - - if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - this.waiting_(); - } else if (currentTime === this.lastRecordedTime) { - this.consecutiveUpdates++; - } else { - this.consecutiveUpdates = 0; - this.lastRecordedTime = currentTime; - } - } - - /** - * Cancels any pending timers and resets the 'timeupdate' mechanism - * designed to detect that we are stalled - * - * @private - */ - }, { - key: 'cancelTimer_', - value: function cancelTimer_() { - this.consecutiveUpdates = 0; - - if (this.timer_) { - this.logger_('cancelTimer_'); - clearTimeout(this.timer_); - } - - this.timer_ = null; - } - - /** - * Fixes situations where there's a bad seek - * - * @return {Boolean} whether an action was taken to fix the seek - * @private - */ - }, { - key: 'fixesBadSeeks_', - value: function fixesBadSeeks_() { - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - - if (this.tech_.seeking() && this.outsideOfSeekableWindow_(seekable, currentTime)) { - var seekableEnd = seekable.end(seekable.length - 1); - - // sync to live point (if VOD, our seekable was updated and we're simply adjusting) - this.logger_('Trying to seek outside of seekable at time ' + currentTime + ' with ' + ('seekable range ' + _ranges2['default'].printableRange(seekable) + '. Seeking to ') + (seekableEnd + '.')); - this.tech_.setCurrentTime(seekableEnd); - return true; - } - - return false; - } - - /** - * Handler for situations when we determine the player is waiting. - * - * @private - */ - }, { - key: 'waiting_', - value: function waiting_() { - if (this.techWaiting_()) { - return; - } - - // All tech waiting checks failed. Use last resort correction - var currentTime = this.tech_.currentTime(); - var buffered = this.tech_.buffered(); - var currentRange = _ranges2['default'].findRange(buffered, currentTime); - - // Sometimes the player can stall for unknown reasons within a contiguous buffered - // region with no indication that anything is amiss (seen in Firefox). Seeking to - // currentTime is usually enough to kickstart the player. This checks that the player - // is currently within a buffered region before attempting a corrective seek. - // Chrome does not appear to continue `timeupdate` events after a `waiting` event - // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also - // make sure there is ~3 seconds of forward buffer before taking any corrective action - // to avoid triggering an `unknownwaiting` event when the network is slow. - if (currentRange.length && currentTime + 3 <= currentRange.end(0)) { - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); - - this.logger_('Stopped at ' + currentTime + ' while inside a buffered region ' + ('[' + currentRange.start(0) + ' -> ' + currentRange.end(0) + ']. Attempting to resume ') + 'playback by seeking to the current time.'); - - // unknown waiting corrections may be useful for monitoring QoS - this.tech_.trigger({ type: 'usage', name: 'hls-unknown-waiting' }); - return; - } - } - - /** - * Handler for situations when the tech fires a `waiting` event - * - * @return {Boolean} - * True if an action (or none) was needed to correct the waiting. False if no - * checks passed - * @private - */ - }, { - key: 'techWaiting_', - value: function techWaiting_() { - var seekable = this.seekable(); - var currentTime = this.tech_.currentTime(); - - if (this.tech_.seeking() && this.fixesBadSeeks_()) { - // Tech is seeking or bad seek fixed, no action needed - return true; - } - - if (this.tech_.seeking() || this.timer_ !== null) { - // Tech is seeking or already waiting on another action, no action needed - return true; - } - - if (this.fellOutOfLiveWindow_(seekable, currentTime)) { - var livePoint = seekable.end(seekable.length - 1); - - this.logger_('Fell out of live window at time ' + currentTime + '. Seeking to ' + ('live point (seekable end) ' + livePoint)); - this.cancelTimer_(); - this.tech_.setCurrentTime(livePoint); - - // live window resyncs may be useful for monitoring QoS - this.tech_.trigger({ type: 'usage', name: 'hls-live-resync' }); - return true; - } - - var buffered = this.tech_.buffered(); - var nextRange = _ranges2['default'].findNextRange(buffered, currentTime); - - if (this.videoUnderflow_(nextRange, buffered, currentTime)) { - // Even though the video underflowed and was stuck in a gap, the audio overplayed - // the gap, leading currentTime into a buffered range. Seeking to currentTime - // allows the video to catch up to the audio position without losing any audio - // (only suffering ~3 seconds of frozen video and a pause in audio playback). - this.cancelTimer_(); - this.tech_.setCurrentTime(currentTime); - - // video underflow may be useful for monitoring QoS - this.tech_.trigger({ type: 'usage', name: 'hls-video-underflow' }); - return true; - } - - // check for gap - if (nextRange.length > 0) { - var difference = nextRange.start(0) - currentTime; - - this.logger_('Stopped at ' + currentTime + ', setting timer for ' + difference + ', seeking ' + ('to ' + nextRange.start(0))); - - this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1000, currentTime); - return true; - } - - // All checks failed. Returning false to indicate failure to correct waiting - return false; - } - }, { - key: 'outsideOfSeekableWindow_', - value: function outsideOfSeekableWindow_(seekable, currentTime) { - if (!seekable.length) { - // we can't make a solid case if there's no seekable, default to false - return false; - } - - // provide a buffer of .1 seconds to handle rounding/imprecise numbers - if (currentTime < seekable.start(0) - 0.1 || currentTime > seekable.end(seekable.length - 1) + 0.1) { - return true; - } - - return false; - } - }, { - key: 'fellOutOfLiveWindow_', - value: function fellOutOfLiveWindow_(seekable, currentTime) { - if (seekable.length && - // can't fall before 0 and 0 seekable start identifies VOD stream - seekable.start(0) > 0 && currentTime < seekable.start(0)) { - return true; - } - - return false; - } - }, { - key: 'videoUnderflow_', - value: function videoUnderflow_(nextRange, buffered, currentTime) { - if (nextRange.length === 0) { - // Even if there is no available next range, there is still a possibility we are - // stuck in a gap due to video underflow. - var gap = this.gapFromVideoUnderflow_(buffered, currentTime); - - if (gap) { - this.logger_('Encountered a gap in video from ' + gap.start + ' to ' + gap.end + '. ' + ('Seeking to current time ' + currentTime)); - - return true; - } - } - - return false; - } - - /** - * Timer callback. If playback still has not proceeded, then we seek - * to the start of the next buffered region. - * - * @private - */ - }, { - key: 'skipTheGap_', - value: function skipTheGap_(scheduledCurrentTime) { - var buffered = this.tech_.buffered(); - var currentTime = this.tech_.currentTime(); - var nextRange = _ranges2['default'].findNextRange(buffered, currentTime); - - this.cancelTimer_(); - - if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) { - return; - } - - this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); - - // only seek if we still have not played - this.tech_.setCurrentTime(nextRange.start(0) + _ranges2['default'].TIME_FUDGE_FACTOR); - - this.tech_.trigger({ type: 'usage', name: 'hls-gap-skip' }); - } - }, { - key: 'gapFromVideoUnderflow_', - value: function gapFromVideoUnderflow_(buffered, currentTime) { - // At least in Chrome, if there is a gap in the video buffer, the audio will continue - // playing for ~3 seconds after the video gap starts. This is done to account for - // video buffer underflow/underrun (note that this is not done when there is audio - // buffer underflow/underrun -- in that case the video will stop as soon as it - // encounters the gap, as audio stalls are more noticeable/jarring to a user than - // video stalls). The player's time will reflect the playthrough of audio, so the - // time will appear as if we are in a buffered region, even if we are stuck in a - // "gap." - // - // Example: - // video buffer: 0 => 10.1, 10.2 => 20 - // audio buffer: 0 => 20 - // overall buffer: 0 => 10.1, 10.2 => 20 - // current time: 13 - // - // Chrome's video froze at 10 seconds, where the video buffer encountered the gap, - // however, the audio continued playing until it reached ~3 seconds past the gap - // (13 seconds), at which point it stops as well. Since current time is past the - // gap, findNextRange will return no ranges. - // - // To check for this issue, we see if there is a gap that starts somewhere within - // a 3 second range (3 seconds +/- 1 second) back from our current time. - var gaps = _ranges2['default'].findGaps(buffered); - - for (var i = 0; i < gaps.length; i++) { - var start = gaps.start(i); - var end = gaps.end(i); - - // gap is starts no more than 4 seconds back - if (currentTime - start < 4 && currentTime - start > 2) { - return { - start: start, - end: end - }; - } - } - - return null; - } - - /** - * A debugging logger noop that is set to console.log only if debugging - * is enabled globally - * - * @private - */ - }, { - key: 'logger_', - value: function logger_() {} - }]); - - return PlaybackWatcher; -})(); - -exports['default'] = PlaybackWatcher; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./ranges":11,"global/window":30}],8:[function(require,module,exports){ -(function (global){ -/** - * @file playlist-loader.js - * - * A state machine that manages the loading, caching, and updating of - * M3U8 playlists. - * - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _resolveUrl = require('./resolve-url'); - -var _resolveUrl2 = _interopRequireDefault(_resolveUrl); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _playlistJs = require('./playlist.js'); - -var _m3u8Parser = require('m3u8-parser'); - -var _m3u8Parser2 = _interopRequireDefault(_m3u8Parser); - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -/** - * Returns a new array of segments that is the result of merging - * properties from an older list of segments onto an updated - * list. No properties on the updated playlist will be overridden. - * - * @param {Array} original the outdated list of segments - * @param {Array} update the updated list of segments - * @param {Number=} offset the index of the first update - * segment in the original segment list. For non-live playlists, - * this should always be zero and does not need to be - * specified. For live playlists, it should be the difference - * between the media sequence numbers in the original and updated - * playlists. - * @return a list of merged segment objects - */ -var updateSegments = function updateSegments(original, update, offset) { - var result = update.slice(); - var length = undefined; - var i = undefined; - - offset = offset || 0; - length = Math.min(original.length, update.length + offset); - - for (i = offset; i < length; i++) { - result[i - offset] = (0, _videoJs.mergeOptions)(original[i], result[i - offset]); - } - return result; -}; - -/** - * Returns a new master playlist that is the result of merging an - * updated media playlist into the original version. If the - * updated media playlist does not match any of the playlist - * entries in the original master playlist, null is returned. - * - * @param {Object} master a parsed master M3U8 object - * @param {Object} media a parsed media M3U8 object - * @return {Object} a new object that represents the original - * master playlist with the updated media playlist merged in, or - * null if the merge produced no change. - */ -var updateMaster = function updateMaster(master, media) { - var changed = false; - var result = (0, _videoJs.mergeOptions)(master, {}); - var i = master.playlists.length; - var playlist = undefined; - var segment = undefined; - var j = undefined; - - while (i--) { - playlist = result.playlists[i]; - if (playlist.uri === media.uri) { - // consider the playlist unchanged if the number of segments - // are equal and the media sequence number is unchanged - if (playlist.segments && media.segments && playlist.segments.length === media.segments.length && playlist.mediaSequence === media.mediaSequence) { - continue; - } - - result.playlists[i] = (0, _videoJs.mergeOptions)(playlist, media); - result.playlists[media.uri] = result.playlists[i]; - - // if the update could overlap existing segment information, - // merge the two lists - if (playlist.segments) { - result.playlists[i].segments = updateSegments(playlist.segments, media.segments, media.mediaSequence - playlist.mediaSequence); - } - // resolve any missing segment and key URIs - j = 0; - if (result.playlists[i].segments) { - j = result.playlists[i].segments.length; - } - while (j--) { - segment = result.playlists[i].segments[j]; - if (!segment.resolvedUri) { - segment.resolvedUri = (0, _resolveUrl2['default'])(playlist.resolvedUri, segment.uri); - } - if (segment.key && !segment.key.resolvedUri) { - segment.key.resolvedUri = (0, _resolveUrl2['default'])(playlist.resolvedUri, segment.key.uri); - } - if (segment.map && !segment.map.resolvedUri) { - segment.map.resolvedUri = (0, _resolveUrl2['default'])(playlist.resolvedUri, segment.map.uri); - } - } - changed = true; - } - } - return changed ? result : null; -}; - -/** - * Load a playlist from a remote location - * - * @class PlaylistLoader - * @extends Stream - * @param {String} srcUrl the url to start with - * @param {Boolean} withCredentials the withCredentials xhr option - * @constructor - */ -var PlaylistLoader = function PlaylistLoader(srcUrl, hls, withCredentials) { - var _this = this; - - /* eslint-disable consistent-this */ - var loader = this; - /* eslint-enable consistent-this */ - var mediaUpdateTimeout = undefined; - var request = undefined; - var playlistRequestError = undefined; - var haveMetadata = undefined; - - PlaylistLoader.prototype.constructor.call(this); - - this.hls_ = hls; - - if (!srcUrl) { - throw new Error('A non-empty playlist URL is required'); - } - - playlistRequestError = function (xhr, url, startingState) { - loader.setBandwidth(request || xhr); - - // any in-flight request is now finished - request = null; - - if (startingState) { - loader.state = startingState; - } - - loader.error = { - playlist: loader.master.playlists[url], - status: xhr.status, - message: 'HLS playlist request error at URL: ' + url, - responseText: xhr.responseText, - code: xhr.status >= 500 ? 4 : 2 - }; - - loader.trigger('error'); - }; - - // update the playlist loader's state in response to a new or - // updated playlist. - haveMetadata = function (xhr, url) { - var parser = undefined; - var refreshDelay = undefined; - var update = undefined; - - loader.setBandwidth(request || xhr); - - // any in-flight request is now finished - request = null; - - loader.state = 'HAVE_METADATA'; - - parser = new _m3u8Parser2['default'].Parser(); - parser.push(xhr.responseText); - parser.end(); - parser.manifest.uri = url; - - // merge this playlist into the master - update = updateMaster(loader.master, parser.manifest); - refreshDelay = (parser.manifest.targetDuration || 10) * 1000; - loader.targetDuration = parser.manifest.targetDuration; - if (update) { - loader.master = update; - loader.media_ = loader.master.playlists[parser.manifest.uri]; - } else { - // if the playlist is unchanged since the last reload, - // try again after half the target duration - refreshDelay /= 2; - loader.trigger('playlistunchanged'); - } - - // refresh live playlists after a target duration passes - if (!loader.media().endList) { - _globalWindow2['default'].clearTimeout(mediaUpdateTimeout); - mediaUpdateTimeout = _globalWindow2['default'].setTimeout(function () { - loader.trigger('mediaupdatetimeout'); - }, refreshDelay); - } - - loader.trigger('loadedplaylist'); - }; - - // initialize the loader state - loader.state = 'HAVE_NOTHING'; - - /** - * Abort any outstanding work and clean up. - */ - loader.dispose = function () { - loader.stopRequest(); - _globalWindow2['default'].clearTimeout(mediaUpdateTimeout); - loader.off(); - }; - - loader.stopRequest = function () { - if (request) { - var oldRequest = request; - - request = null; - oldRequest.onreadystatechange = null; - oldRequest.abort(); - } - }; - - /** - * Returns the number of enabled playlists on the master playlist object - * - * @return {Number} number of eneabled playlists - */ - loader.enabledPlaylists_ = function () { - return loader.master.playlists.filter(_playlistJs.isEnabled).length; - }; - - /** - * Returns whether the current playlist is the lowest rendition - * - * @return {Boolean} true if on lowest rendition - */ - loader.isLowestEnabledRendition_ = function () { - if (loader.master.playlists.length === 1) { - return true; - } - - var media = loader.media(); - - var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE; - - return loader.master.playlists.filter(function (playlist) { - var enabled = (0, _playlistJs.isEnabled)(playlist); - - if (!enabled) { - return false; - } - - var bandwidth = 0; - - if (playlist && playlist.attributes) { - bandwidth = playlist.attributes.BANDWIDTH; - } - return bandwidth < currentBandwidth; - }).length === 0; - }; - - /** - * Returns whether the current playlist is the final available rendition - * - * @return {Boolean} true if on final rendition - */ - loader.isFinalRendition_ = function () { - return loader.master.playlists.filter(_playlistJs.isEnabled).length === 1; - }; - - /** - * When called without any arguments, returns the currently - * active media playlist. When called with a single argument, - * triggers the playlist loader to asynchronously switch to the - * specified media playlist. Calling this method while the - * loader is in the HAVE_NOTHING causes an error to be emitted - * but otherwise has no effect. - * - * @param {Object=} playlist the parsed media playlist - * object to switch to - * @return {Playlist} the current loaded media - */ - loader.media = function (playlist) { - var startingState = loader.state; - var mediaChange = undefined; - - // getter - if (!playlist) { - return loader.media_; - } - - // setter - if (loader.state === 'HAVE_NOTHING') { - throw new Error('Cannot switch media playlist from ' + loader.state); - } - - // find the playlist object if the target playlist has been - // specified by URI - if (typeof playlist === 'string') { - if (!loader.master.playlists[playlist]) { - throw new Error('Unknown playlist URI: ' + playlist); - } - playlist = loader.master.playlists[playlist]; - } - - mediaChange = !loader.media_ || playlist.uri !== loader.media_.uri; - - // switch to fully loaded playlists immediately - if (loader.master.playlists[playlist.uri].endList) { - // abort outstanding playlist requests - if (request) { - request.onreadystatechange = null; - request.abort(); - request = null; - } - loader.state = 'HAVE_METADATA'; - loader.media_ = playlist; - - // trigger media change if the active media has been updated - if (mediaChange) { - loader.trigger('mediachanging'); - loader.trigger('mediachange'); - } - return; - } - - // switching to the active playlist is a no-op - if (!mediaChange) { - return; - } - - loader.state = 'SWITCHING_MEDIA'; - - // there is already an outstanding playlist request - if (request) { - if ((0, _resolveUrl2['default'])(loader.master.uri, playlist.uri) === request.url) { - // requesting to switch to the same playlist multiple times - // has no effect after the first - return; - } - request.onreadystatechange = null; - request.abort(); - request = null; - } - - // request the new playlist - if (this.media_) { - this.trigger('mediachanging'); - } - request = this.hls_.xhr({ - uri: (0, _resolveUrl2['default'])(loader.master.uri, playlist.uri), - withCredentials: withCredentials - }, function (error, req) { - // disposed - if (!request) { - return; - } - - if (error) { - return playlistRequestError(request, playlist.uri, startingState); - } - - haveMetadata(req, playlist.uri); - - // fire loadedmetadata the first time a media playlist is loaded - if (startingState === 'HAVE_MASTER') { - loader.trigger('loadedmetadata'); - } else { - loader.trigger('mediachange'); - } - }); - }; - - /** - * set the bandwidth on an xhr to the bandwidth on the playlist - */ - loader.setBandwidth = function (xhr) { - loader.bandwidth = xhr.bandwidth; - }; - - // live playlist staleness timeout - loader.on('mediaupdatetimeout', function () { - if (loader.state !== 'HAVE_METADATA') { - // only refresh the media playlist if no other activity is going on - return; - } - - loader.state = 'HAVE_CURRENT_METADATA'; - request = this.hls_.xhr({ - uri: (0, _resolveUrl2['default'])(loader.master.uri, loader.media().uri), - withCredentials: withCredentials - }, function (error, req) { - // disposed - if (!request) { - return; - } - - if (error) { - return playlistRequestError(request, loader.media().uri, 'HAVE_METADATA'); - } - haveMetadata(request, loader.media().uri); - }); - }); - - // setup initial sync info - loader.on('firstplay', function () { - var playlist = loader.media(); - - if (playlist) { - playlist.syncInfo = { - mediaSequence: playlist.mediaSequence, - time: 0 - }; - } - }); - - /** - * pause loading of the playlist - */ - loader.pause = function () { - loader.stopRequest(); - _globalWindow2['default'].clearTimeout(mediaUpdateTimeout); - if (loader.state === 'HAVE_NOTHING') { - // If we pause the loader before any data has been retrieved, its as if we never - // started, so reset to an unstarted state. - loader.started = false; - } - }; - - /** - * start loading of the playlist - */ - loader.load = function (isFinalRendition) { - var media = loader.media(); - - _globalWindow2['default'].clearTimeout(mediaUpdateTimeout); - - if (isFinalRendition) { - var refreshDelay = media ? media.targetDuration / 2 * 1000 : 5 * 1000; - - mediaUpdateTimeout = _globalWindow2['default'].setTimeout(loader.load.bind(null, false), refreshDelay); - return; - } - - if (!loader.started) { - loader.start(); - return; - } - - if (media && !media.endList) { - loader.trigger('mediaupdatetimeout'); - } else { - loader.trigger('loadedplaylist'); - } - }; - - /** - * start loading of the playlist - */ - loader.start = function () { - loader.started = true; - - // request the specified URL - request = _this.hls_.xhr({ - uri: srcUrl, - withCredentials: withCredentials - }, function (error, req) { - var parser = undefined; - var playlist = undefined; - var i = undefined; - - // disposed - if (!request) { - return; - } - - // clear the loader's request reference - request = null; - - if (error) { - loader.error = { - status: req.status, - message: 'HLS playlist request error at URL: ' + srcUrl, - responseText: req.responseText, - // MEDIA_ERR_NETWORK - code: 2 - }; - if (loader.state === 'HAVE_NOTHING') { - loader.started = false; - } - return loader.trigger('error'); - } - - parser = new _m3u8Parser2['default'].Parser(); - parser.push(req.responseText); - parser.end(); - - loader.state = 'HAVE_MASTER'; - - parser.manifest.uri = srcUrl; - - // loaded a master playlist - if (parser.manifest.playlists) { - loader.master = parser.manifest; - - // setup by-URI lookups and resolve media playlist URIs - i = loader.master.playlists.length; - while (i--) { - playlist = loader.master.playlists[i]; - loader.master.playlists[playlist.uri] = playlist; - playlist.resolvedUri = (0, _resolveUrl2['default'])(loader.master.uri, playlist.uri); - } - - // resolve any media group URIs - ['AUDIO', 'SUBTITLES'].forEach(function (mediaType) { - for (var groupKey in loader.master.mediaGroups[mediaType]) { - for (var labelKey in loader.master.mediaGroups[mediaType][groupKey]) { - var mediaProperties = loader.master.mediaGroups[mediaType][groupKey][labelKey]; - - if (mediaProperties.uri) { - mediaProperties.resolvedUri = (0, _resolveUrl2['default'])(loader.master.uri, mediaProperties.uri); - } - } - } - }); - - loader.trigger('loadedplaylist'); - if (!request) { - // no media playlist was specifically selected so start - // from the first listed one - loader.media(parser.manifest.playlists[0]); - } - return; - } - - // loaded a media playlist - // infer a master playlist if none was previously requested - loader.master = { - mediaGroups: { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }, - uri: _globalWindow2['default'].location.href, - playlists: [{ - uri: srcUrl - }] - }; - loader.master.playlists[srcUrl] = loader.master.playlists[0]; - loader.master.playlists[0].resolvedUri = srcUrl; - haveMetadata(req, srcUrl); - return loader.trigger('loadedmetadata'); - }); - }; -}; - -PlaylistLoader.prototype = new _videoJs.EventTarget(); - -exports['default'] = PlaylistLoader; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./playlist.js":10,"./resolve-url":14,"global/window":30,"m3u8-parser":31}],9:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _config = require('./config'); - -var _config2 = _interopRequireDefault(_config); - -var _playlist = require('./playlist'); - -var _playlist2 = _interopRequireDefault(_playlist); - -// Utilities - -/** - * Returns the CSS value for the specified property on an element - * using `getComputedStyle`. Firefox has a long-standing issue where - * getComputedStyle() may return null when running in an iframe with - * `display: none`. - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - * @param {HTMLElement} el the htmlelement to work on - * @param {string} the proprety to get the style for - */ -var safeGetComputedStyle = function safeGetComputedStyle(el, property) { - var result = undefined; - - if (!el) { - return ''; - } - - result = window.getComputedStyle(el); - if (!result) { - return ''; - } - - return result[property]; -}; - -/** - * Resuable stable sort function - * - * @param {Playlists} array - * @param {Function} sortFn Different comparators - * @function stableSort - */ -var stableSort = function stableSort(array, sortFn) { - var newArray = array.slice(); - - array.sort(function (left, right) { - var cmp = sortFn(left, right); - - if (cmp === 0) { - return newArray.indexOf(left) - newArray.indexOf(right); - } - return cmp; - }); -}; - -/** - * A comparator function to sort two playlist object by bandwidth. - * - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {Number} Greater than zero if the bandwidth attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the bandwidth of right is greater than left and - * exactly zero if the two are equal. - */ -var comparePlaylistBandwidth = function comparePlaylistBandwidth(left, right) { - var leftBandwidth = undefined; - var rightBandwidth = undefined; - - if (left.attributes && left.attributes.BANDWIDTH) { - leftBandwidth = left.attributes.BANDWIDTH; - } - leftBandwidth = leftBandwidth || window.Number.MAX_VALUE; - if (right.attributes && right.attributes.BANDWIDTH) { - rightBandwidth = right.attributes.BANDWIDTH; - } - rightBandwidth = rightBandwidth || window.Number.MAX_VALUE; - - return leftBandwidth - rightBandwidth; -}; - -exports.comparePlaylistBandwidth = comparePlaylistBandwidth; -/** - * A comparator function to sort two playlist object by resolution (width). - * @param {Object} left a media playlist object - * @param {Object} right a media playlist object - * @return {Number} Greater than zero if the resolution.width attribute of - * left is greater than the corresponding attribute of right. Less - * than zero if the resolution.width of right is greater than left and - * exactly zero if the two are equal. - */ -var comparePlaylistResolution = function comparePlaylistResolution(left, right) { - var leftWidth = undefined; - var rightWidth = undefined; - - if (left.attributes && left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) { - leftWidth = left.attributes.RESOLUTION.width; - } - - leftWidth = leftWidth || window.Number.MAX_VALUE; - - if (right.attributes && right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) { - rightWidth = right.attributes.RESOLUTION.width; - } - - rightWidth = rightWidth || window.Number.MAX_VALUE; - - // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions - // have the same media dimensions/ resolution - if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) { - return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH; - } - return leftWidth - rightWidth; -}; - -exports.comparePlaylistResolution = comparePlaylistResolution; -/** - * Chooses the appropriate media playlist based on bandwidth and player size - * - * @param {Object} master - * Object representation of the master manifest - * @param {Number} playerBandwidth - * Current calculated bandwidth of the player - * @param {Number} playerWidth - * Current width of the player element - * @param {Number} playerHeight - * Current height of the player element - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ -var simpleSelector = function simpleSelector(master, playerBandwidth, playerWidth, playerHeight) { - // convert the playlists to an intermediary representation to make comparisons easier - var sortedPlaylistReps = master.playlists.map(function (playlist) { - var width = undefined; - var height = undefined; - var bandwidth = undefined; - - if (playlist.attributes) { - width = playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width; - height = playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height; - bandwidth = playlist.attributes.BANDWIDTH; - } - - bandwidth = bandwidth || window.Number.MAX_VALUE; - - return { - bandwidth: bandwidth, - width: width, - height: height, - playlist: playlist - }; - }); - - stableSort(sortedPlaylistReps, function (left, right) { - return left.bandwidth - right.bandwidth; - }); - - // filter out any playlists that have been excluded due to - // incompatible configurations or playback errors - sortedPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return _playlist2['default'].isEnabled(rep.playlist); - }); - - // filter out any variant that has greater effective bitrate - // than the current estimated bandwidth - var bandwidthPlaylistReps = sortedPlaylistReps.filter(function (rep) { - return rep.bandwidth * _config2['default'].BANDWIDTH_VARIANCE < playerBandwidth; - }); - - var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; - - // get all of the renditions with the same (highest) bandwidth - // and then taking the very first element - var bandwidthBestRep = bandwidthPlaylistReps.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - - // filter out playlists without resolution information - var haveResolution = bandwidthPlaylistReps.filter(function (rep) { - return rep.width && rep.height; - }); - - // sort variants by resolution - stableSort(haveResolution, function (left, right) { - return left.width - right.width; - }); - - // if we have the exact resolution as the player use it - var resolutionBestRepList = haveResolution.filter(function (rep) { - return rep.width === playerWidth && rep.height === playerHeight; - }); - - highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; - // ensure that we pick the highest bandwidth variant that have exact resolution - var resolutionBestRep = resolutionBestRepList.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - - var resolutionPlusOneList = undefined; - var resolutionPlusOneSmallest = undefined; - var resolutionPlusOneRep = undefined; - - // find the smallest variant that is larger than the player - // if there is no match of exact resolution - if (!resolutionBestRep) { - resolutionPlusOneList = haveResolution.filter(function (rep) { - return rep.width > playerWidth || rep.height > playerHeight; - }); - - // find all the variants have the same smallest resolution - resolutionPlusOneSmallest = resolutionPlusOneList.filter(function (rep) { - return rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height; - }); - - // ensure that we also pick the highest bandwidth variant that - // is just-larger-than the video player - highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1]; - resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function (rep) { - return rep.bandwidth === highestRemainingBandwidthRep.bandwidth; - })[0]; - } - - // fallback chain of variants - return (resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || sortedPlaylistReps[0]).playlist; -}; - -// Playlist Selectors - -/** - * Chooses the appropriate media playlist based on the most recent - * bandwidth estimate and the player size. - * - * Expects to be called within the context of an instance of HlsHandler - * - * @return {Playlist} the highest bitrate playlist less than the - * currently detected bandwidth, accounting for some amount of - * bandwidth variance - */ -var lastBandwidthSelector = function lastBandwidthSelector() { - return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10), parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10)); -}; - -exports.lastBandwidthSelector = lastBandwidthSelector; -/** - * Chooses the appropriate media playlist based on an - * exponential-weighted moving average of the bandwidth after - * filtering for player size. - * - * Expects to be called within the context of an instance of HlsHandler - * - * @param {Number} decay - a number between 0 and 1. Higher values of - * this parameter will cause previous bandwidth estimates to lose - * significance more quickly. - * @return {Function} a function which can be invoked to create a new - * playlist selector function. - * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average - */ -var movingAverageBandwidthSelector = function movingAverageBandwidthSelector(decay) { - var average = -1; - - if (decay < 0 || decay > 1) { - throw new Error('Moving average bandwidth decay must be between 0 and 1.'); - } - - return function () { - if (average < 0) { - average = this.systemBandwidth; - } - - average = decay * this.systemBandwidth + (1 - decay) * average; - return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10), parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10)); - }; -}; - -exports.movingAverageBandwidthSelector = movingAverageBandwidthSelector; -/** - * Chooses the appropriate media playlist based on the potential to rebuffer - * - * @param {Object} settings - * Object of information required to use this selector - * @param {Object} settings.master - * Object representation of the master manifest - * @param {Number} settings.currentTime - * The current time of the player - * @param {Number} settings.bandwidth - * Current measured bandwidth - * @param {Number} settings.duration - * Duration of the media - * @param {Number} settings.segmentDuration - * Segment duration to be used in round trip time calculations - * @param {Number} settings.timeUntilRebuffer - * Time left in seconds until the player has to rebuffer - * @param {Number} settings.currentTimeline - * The current timeline segments are being loaded from - * @param {SyncController} settings.syncController - * SyncController for determining if we have a sync point for a given playlist - * @return {Object|null} - * {Object} return.playlist - * The highest bandwidth playlist with the least amount of rebuffering - * {Number} return.rebufferingImpact - * The amount of time in seconds switching to this playlist will rebuffer. A - * negative value means that switching will cause zero rebuffering. - */ -var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector(settings) { - var master = settings.master; - var currentTime = settings.currentTime; - var bandwidth = settings.bandwidth; - var duration = settings.duration; - var segmentDuration = settings.segmentDuration; - var timeUntilRebuffer = settings.timeUntilRebuffer; - var currentTimeline = settings.currentTimeline; - var syncController = settings.syncController; - - var bandwidthPlaylists = master.playlists.filter(_playlist2['default'].hasAttribute.bind(null, 'BANDWIDTH')); - - var rebufferingEstimates = bandwidthPlaylists.map(function (playlist) { - var syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); - // If there is no sync point for this playlist, switching to it will require a - // sync request first. This will double the request time - var numRequests = syncPoint ? 1 : 2; - var requestTimeEstimate = _playlist2['default'].estimateSegmentRequestTime(segmentDuration, bandwidth, playlist); - var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer; - - return { - playlist: playlist, - rebufferingImpact: rebufferingImpact - }; - }); - - var noRebufferingPlaylists = rebufferingEstimates.filter(function (estimate) { - return estimate.rebufferingImpact <= 0; - }); - - // Sort by bandwidth DESC - stableSort(noRebufferingPlaylists, function (a, b) { - return comparePlaylistBandwidth(b.playlist, a.playlist); - }); - - if (noRebufferingPlaylists.length) { - return noRebufferingPlaylists[0]; - } - - stableSort(rebufferingEstimates, function (a, b) { - return a.rebufferingImpact - b.rebufferingImpact; - }); - - return rebufferingEstimates[0] || null; -}; -exports.minRebufferMaxBandwidthSelector = minRebufferMaxBandwidthSelector; -},{"./config":3,"./playlist":10}],10:[function(require,module,exports){ -(function (global){ -/** - * @file playlist.js - * - * Playlist related utilities. - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var Playlist = { - /** - * The number of segments that are unsafe to start playback at in - * a live stream. Changing this value can cause playback stalls. - * See HTTP Live Streaming, "Playing the Media Playlist File" - * https://tools.ietf.org/html/draft-pantos-http-live-streaming-18#section-6.3.3 - */ - UNSAFE_LIVE_SEGMENTS: 3 -}; - -/** - * walk backward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {Number} endSequence the mediaSequence to stop walking on - */ - -var backwardDuration = function backwardDuration(playlist, endSequence) { - var result = 0; - var i = endSequence - playlist.mediaSequence; - // if a start time is available for segment immediately following - // the interval, use it - var segment = playlist.segments[i]; - - // Walk backward until we find the latest segment with timeline - // information that is earlier than endSequence - if (segment) { - if (typeof segment.start !== 'undefined') { - return { result: segment.start, precise: true }; - } - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - segment.duration, - precise: true - }; - } - } - while (i--) { - segment = playlist.segments[i]; - if (typeof segment.end !== 'undefined') { - return { result: result + segment.end, precise: true }; - } - - result += segment.duration; - - if (typeof segment.start !== 'undefined') { - return { result: result + segment.start, precise: true }; - } - } - return { result: result, precise: false }; -}; - -/** - * walk forward until we find a duration we can use - * or return a failure - * - * @param {Playlist} playlist the playlist to walk through - * @param {Number} endSequence the mediaSequence to stop walking on - */ -var forwardDuration = function forwardDuration(playlist, endSequence) { - var result = 0; - var segment = undefined; - var i = endSequence - playlist.mediaSequence; - // Walk forward until we find the earliest segment with timeline - // information - - for (; i < playlist.segments.length; i++) { - segment = playlist.segments[i]; - if (typeof segment.start !== 'undefined') { - return { - result: segment.start - result, - precise: true - }; - } - - result += segment.duration; - - if (typeof segment.end !== 'undefined') { - return { - result: segment.end - result, - precise: true - }; - } - } - // indicate we didn't find a useful duration estimate - return { result: -1, precise: false }; -}; - -/** - * Calculate the media duration from the segments associated with a - * playlist. The duration of a subinterval of the available segments - * may be calculated by specifying an end index. - * - * @param {Object} playlist a media playlist object - * @param {Number=} endSequence an exclusive upper boundary - * for the playlist. Defaults to playlist length. - * @param {Number} expired the amount of time that has dropped - * off the front of the playlist in a live scenario - * @return {Number} the duration between the first available segment - * and end index. - */ -var intervalDuration = function intervalDuration(playlist, endSequence, expired) { - var backward = undefined; - var forward = undefined; - - if (typeof endSequence === 'undefined') { - endSequence = playlist.mediaSequence + playlist.segments.length; - } - - if (endSequence < playlist.mediaSequence) { - return 0; - } - - // do a backward walk to estimate the duration - backward = backwardDuration(playlist, endSequence); - if (backward.precise) { - // if we were able to base our duration estimate on timing - // information provided directly from the Media Source, return - // it - return backward.result; - } - - // walk forward to see if a precise duration estimate can be made - // that way - forward = forwardDuration(playlist, endSequence); - if (forward.precise) { - // we found a segment that has been buffered and so it's - // position is known precisely - return forward.result; - } - - // return the less-precise, playlist-based duration estimate - return backward.result + expired; -}; - -/** - * Calculates the duration of a playlist. If a start and end index - * are specified, the duration will be for the subset of the media - * timeline between those two indices. The total duration for live - * playlists is always Infinity. - * - * @param {Object} playlist a media playlist object - * @param {Number=} endSequence an exclusive upper - * boundary for the playlist. Defaults to the playlist media - * sequence number plus its length. - * @param {Number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @return {Number} the duration between the start index and end - * index. - */ -var duration = function duration(playlist, endSequence, expired) { - if (!playlist) { - return 0; - } - - if (typeof expired !== 'number') { - expired = 0; - } - - // if a slice of the total duration is not requested, use - // playlist-level duration indicators when they're present - if (typeof endSequence === 'undefined') { - // if present, use the duration specified in the playlist - if (playlist.totalDuration) { - return playlist.totalDuration; - } - - // duration should be Infinity for live playlists - if (!playlist.endList) { - return _globalWindow2['default'].Infinity; - } - } - - // calculate the total duration based on the segment durations - return intervalDuration(playlist, endSequence, expired); -}; - -exports.duration = duration; -/** - * Calculate the time between two indexes in the current playlist - * neight the start- nor the end-index need to be within the current - * playlist in which case, the targetDuration of the playlist is used - * to approximate the durations of the segments - * - * @param {Object} playlist a media playlist object - * @param {Number} startIndex - * @param {Number} endIndex - * @return {Number} the number of seconds between startIndex and endIndex - */ -var sumDurations = function sumDurations(playlist, startIndex, endIndex) { - var durations = 0; - - if (startIndex > endIndex) { - var _ref = [endIndex, startIndex]; - startIndex = _ref[0]; - endIndex = _ref[1]; - } - - if (startIndex < 0) { - for (var i = startIndex; i < Math.min(0, endIndex); i++) { - durations += playlist.targetDuration; - } - startIndex = 0; - } - - for (var i = startIndex; i < endIndex; i++) { - durations += playlist.segments[i].duration; - } - - return durations; -}; - -exports.sumDurations = sumDurations; -/** - * Calculates the playlist end time - * - * @param {Object} playlist a media playlist object - * @param {Number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @param {Boolean|false} useSafeLiveEnd a boolean value indicating whether or not the - * playlist end calculation should consider the safe live end - * (truncate the playlist end by three segments). This is normally - * used for calculating the end of the playlist's seekable range. - * @returns {Number} the end time of playlist - * @function playlistEnd - */ -var playlistEnd = function playlistEnd(playlist, expired, useSafeLiveEnd) { - if (!playlist || !playlist.segments) { - return null; - } - if (playlist.endList) { - return duration(playlist); - } - - if (expired === null) { - return null; - } - - expired = expired || 0; - - var endSequence = useSafeLiveEnd ? Math.max(0, playlist.segments.length - Playlist.UNSAFE_LIVE_SEGMENTS) : Math.max(0, playlist.segments.length); - - return intervalDuration(playlist, playlist.mediaSequence + endSequence, expired); -}; - -exports.playlistEnd = playlistEnd; -/** - * Calculates the interval of time that is currently seekable in a - * playlist. The returned time ranges are relative to the earliest - * moment in the specified playlist that is still available. A full - * seekable implementation for live streams would need to offset - * these values by the duration of content that has expired from the - * stream. - * - * @param {Object} playlist a media playlist object - * dropped off the front of the playlist in a live scenario - * @param {Number=} expired the amount of time that has - * dropped off the front of the playlist in a live scenario - * @return {TimeRanges} the periods of time that are valid targets - * for seeking - */ -var seekable = function seekable(playlist, expired) { - var useSafeLiveEnd = true; - var seekableStart = expired || 0; - var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd); - - if (seekableEnd === null) { - return (0, _videoJs.createTimeRange)(); - } - return (0, _videoJs.createTimeRange)(seekableStart, seekableEnd); -}; - -exports.seekable = seekable; -var isWholeNumber = function isWholeNumber(num) { - return num - Math.floor(num) === 0; -}; - -var roundSignificantDigit = function roundSignificantDigit(increment, num) { - // If we have a whole number, just add 1 to it - if (isWholeNumber(num)) { - return num + increment * 0.1; - } - - var numDecimalDigits = num.toString().split('.')[1].length; - - for (var i = 1; i <= numDecimalDigits; i++) { - var scale = Math.pow(10, i); - var temp = num * scale; - - if (isWholeNumber(temp) || i === numDecimalDigits) { - return (temp + increment) / scale; - } - } -}; - -var ceilLeastSignificantDigit = roundSignificantDigit.bind(null, 1); -var floorLeastSignificantDigit = roundSignificantDigit.bind(null, -1); - -/** - * Determine the index and estimated starting time of the segment that - * contains a specified playback position in a media playlist. - * - * @param {Object} playlist the media playlist to query - * @param {Number} currentTime The number of seconds since the earliest - * possible position to determine the containing segment for - * @param {Number} startIndex - * @param {Number} startTime - * @return {Object} - */ -var getMediaInfoForTime = function getMediaInfoForTime(playlist, currentTime, startIndex, startTime) { - var i = undefined; - var segment = undefined; - var numSegments = playlist.segments.length; - - var time = currentTime - startTime; - - if (time < 0) { - // Walk backward from startIndex in the playlist, adding durations - // until we find a segment that contains `time` and return it - if (startIndex > 0) { - for (i = startIndex - 1; i >= 0; i--) { - segment = playlist.segments[i]; - time += floorLeastSignificantDigit(segment.duration); - if (time > 0) { - return { - mediaIndex: i, - startTime: startTime - sumDurations(playlist, startIndex, i) - }; - } - } - } - // We were unable to find a good segment within the playlist - // so select the first segment - return { - mediaIndex: 0, - startTime: currentTime - }; - } - - // When startIndex is negative, we first walk forward to first segment - // adding target durations. If we "run out of time" before getting to - // the first segment, return the first segment - if (startIndex < 0) { - for (i = startIndex; i < 0; i++) { - time -= playlist.targetDuration; - if (time < 0) { - return { - mediaIndex: 0, - startTime: currentTime - }; - } - } - startIndex = 0; - } - - // Walk forward from startIndex in the playlist, subtracting durations - // until we find a segment that contains `time` and return it - for (i = startIndex; i < numSegments; i++) { - segment = playlist.segments[i]; - time -= ceilLeastSignificantDigit(segment.duration); - if (time < 0) { - return { - mediaIndex: i, - startTime: startTime + sumDurations(playlist, startIndex, i) - }; - } - } - - // We are out of possible candidates so load the last one... - return { - mediaIndex: numSegments - 1, - startTime: currentTime - }; -}; - -exports.getMediaInfoForTime = getMediaInfoForTime; -/** - * Check whether the playlist is blacklisted or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is blacklisted or not - * @function isBlacklisted - */ -var isBlacklisted = function isBlacklisted(playlist) { - return playlist.excludeUntil && playlist.excludeUntil > Date.now(); -}; - -exports.isBlacklisted = isBlacklisted; -/** - * Check whether the playlist is enabled or not. - * - * @param {Object} playlist the media playlist object - * @return {boolean} whether the playlist is enabled or not - * @function isEnabled - */ -var isEnabled = function isEnabled(playlist) { - var blacklisted = isBlacklisted(playlist); - - return !playlist.disabled && !blacklisted; -}; - -exports.isEnabled = isEnabled; -/** - * Returns whether the current playlist is an AES encrypted HLS stream - * - * @return {Boolean} true if it's an AES encrypted HLS stream - */ -var isAes = function isAes(media) { - for (var i = 0; i < media.segments.length; i++) { - if (media.segments[i].key) { - return true; - } - } - return false; -}; - -exports.isAes = isAes; -/** - * Returns whether the current playlist contains fMP4 - * - * @return {Boolean} true if the playlist contains fMP4 - */ -var isFmp4 = function isFmp4(media) { - for (var i = 0; i < media.segments.length; i++) { - if (media.segments[i].map) { - return true; - } - } - return false; -}; - -exports.isFmp4 = isFmp4; -/** - * Checks if the playlist has a value for the specified attribute - * - * @param {String} attr - * Attribute to check for - * @param {Object} playlist - * The media playlist object - * @return {Boolean} - * Whether the playlist contains a value for the attribute or not - * @function hasAttribute - */ -var hasAttribute = function hasAttribute(attr, playlist) { - return playlist.attributes && playlist.attributes[attr]; -}; - -exports.hasAttribute = hasAttribute; -/** - * Estimates the time required to complete a segment download from the specified playlist - * - * @param {Number} segmentDuration - * Duration of requested segment - * @param {Number} bandwidth - * Current measured bandwidth of the player - * @param {Object} playlist - * The media playlist object - * @param {Number=} bytesReceived - * Number of bytes already received for the request. Defaults to 0 - * @return {Number|NaN} - * The estimated time to request the segment. NaN if bandwidth information for - * the given playlist is unavailable - * @function estimateSegmentRequestTime - */ -var estimateSegmentRequestTime = function estimateSegmentRequestTime(segmentDuration, bandwidth, playlist) { - var bytesReceived = arguments.length <= 3 || arguments[3] === undefined ? 0 : arguments[3]; - - if (!hasAttribute('BANDWIDTH', playlist)) { - return NaN; - } - - var size = segmentDuration * playlist.attributes.BANDWIDTH; - - return (size - bytesReceived * 8) / bandwidth; -}; - -exports.estimateSegmentRequestTime = estimateSegmentRequestTime; -Playlist.duration = duration; -Playlist.seekable = seekable; -Playlist.getMediaInfoForTime = getMediaInfoForTime; -Playlist.isEnabled = isEnabled; -Playlist.isBlacklisted = isBlacklisted; -Playlist.playlistEnd = playlistEnd; -Playlist.isAes = isAes; -Playlist.isFmp4 = isFmp4; -Playlist.hasAttribute = hasAttribute; -Playlist.estimateSegmentRequestTime = estimateSegmentRequestTime; - -// exports -exports['default'] = Playlist; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"global/window":30}],11:[function(require,module,exports){ -(function (global){ -/** - * ranges - * - * Utilities for working with TimeRanges. - * - */ - -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -// Fudge factor to account for TimeRanges rounding -var TIME_FUDGE_FACTOR = 1 / 30; - -/** - * Clamps a value to within a range - * @param {Number} num - the value to clamp - * @param {Number} start - the start of the range to clamp within, inclusive - * @param {Number} end - the end of the range to clamp within, inclusive - * @return {Number} - */ -var clamp = function clamp(num, _ref) { - var _ref2 = _slicedToArray(_ref, 2); - - var start = _ref2[0]; - var end = _ref2[1]; - - return Math.min(Math.max(start, num), end); -}; -var filterRanges = function filterRanges(timeRanges, predicate) { - var results = []; - var i = undefined; - - if (timeRanges && timeRanges.length) { - // Search for ranges that match the predicate - for (i = 0; i < timeRanges.length; i++) { - if (predicate(timeRanges.start(i), timeRanges.end(i))) { - results.push([timeRanges.start(i), timeRanges.end(i)]); - } - } - } - - return _videoJs2['default'].createTimeRanges(results); -}; - -/** - * Attempts to find the buffered TimeRange that contains the specified - * time. - * @param {TimeRanges} buffered - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @returns {TimeRanges} a new TimeRanges object - */ -var findRange = function findRange(buffered, time) { - return filterRanges(buffered, function (start, end) { - return start - TIME_FUDGE_FACTOR <= time && end + TIME_FUDGE_FACTOR >= time; - }); -}; - -/** - * Returns the TimeRanges that begin later than the specified time. - * @param {TimeRanges} timeRanges - the TimeRanges object to query - * @param {number} time - the time to filter on. - * @returns {TimeRanges} a new TimeRanges object. - */ -var findNextRange = function findNextRange(timeRanges, time) { - return filterRanges(timeRanges, function (start) { - return start - TIME_FUDGE_FACTOR >= time; - }); -}; - -/** - * Returns gaps within a list of TimeRanges - * @param {TimeRanges} buffered - the TimeRanges object - * @return {TimeRanges} a TimeRanges object of gaps - */ -var findGaps = function findGaps(buffered) { - if (buffered.length < 2) { - return _videoJs2['default'].createTimeRanges(); - } - - var ranges = []; - - for (var i = 1; i < buffered.length; i++) { - var start = buffered.end(i - 1); - var end = buffered.start(i); - - ranges.push([start, end]); - } - - return _videoJs2['default'].createTimeRanges(ranges); -}; - -/** - * Search for a likely end time for the segment that was just appened - * based on the state of the `buffered` property before and after the - * append. If we fin only one such uncommon end-point return it. - * @param {TimeRanges} original - the buffered time ranges before the update - * @param {TimeRanges} update - the buffered time ranges after the update - * @returns {Number|null} the end time added between `original` and `update`, - * or null if one cannot be unambiguously determined. - */ -var findSoleUncommonTimeRangesEnd = function findSoleUncommonTimeRangesEnd(original, update) { - var i = undefined; - var start = undefined; - var end = undefined; - var result = []; - var edges = []; - - // In order to qualify as a possible candidate, the end point must: - // 1) Not have already existed in the `original` ranges - // 2) Not result from the shrinking of a range that already existed - // in the `original` ranges - // 3) Not be contained inside of a range that existed in `original` - var overlapsCurrentEnd = function overlapsCurrentEnd(span) { - return span[0] <= end && span[1] >= end; - }; - - if (original) { - // Save all the edges in the `original` TimeRanges object - for (i = 0; i < original.length; i++) { - start = original.start(i); - end = original.end(i); - - edges.push([start, end]); - } - } - - if (update) { - // Save any end-points in `update` that are not in the `original` - // TimeRanges object - for (i = 0; i < update.length; i++) { - start = update.start(i); - end = update.end(i); - - if (edges.some(overlapsCurrentEnd)) { - continue; - } - - // at this point it must be a unique non-shrinking end edge - result.push(end); - } - } - - // we err on the side of caution and return null if didn't find - // exactly *one* differing end edge in the search above - if (result.length !== 1) { - return null; - } - - return result[0]; -}; - -/** - * Calculate the intersection of two TimeRanges - * @param {TimeRanges} bufferA - * @param {TimeRanges} bufferB - * @returns {TimeRanges} The interesection of `bufferA` with `bufferB` - */ -var bufferIntersection = function bufferIntersection(bufferA, bufferB) { - var start = null; - var end = null; - var arity = 0; - var extents = []; - var ranges = []; - - if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) { - return _videoJs2['default'].createTimeRange(); - } - - // Handle the case where we have both buffers and create an - // intersection of the two - var count = bufferA.length; - - // A) Gather up all start and end times - while (count--) { - extents.push({ time: bufferA.start(count), type: 'start' }); - extents.push({ time: bufferA.end(count), type: 'end' }); - } - count = bufferB.length; - while (count--) { - extents.push({ time: bufferB.start(count), type: 'start' }); - extents.push({ time: bufferB.end(count), type: 'end' }); - } - // B) Sort them by time - extents.sort(function (a, b) { - return a.time - b.time; - }); - - // C) Go along one by one incrementing arity for start and decrementing - // arity for ends - for (count = 0; count < extents.length; count++) { - if (extents[count].type === 'start') { - arity++; - - // D) If arity is ever incremented to 2 we are entering an - // overlapping range - if (arity === 2) { - start = extents[count].time; - } - } else if (extents[count].type === 'end') { - arity--; - - // E) If arity is ever decremented to 1 we leaving an - // overlapping range - if (arity === 1) { - end = extents[count].time; - } - } - - // F) Record overlapping ranges - if (start !== null && end !== null) { - ranges.push([start, end]); - start = null; - end = null; - } - } - - return _videoJs2['default'].createTimeRanges(ranges); -}; - -/** - * Calculates the percentage of `segmentRange` that overlaps the - * `buffered` time ranges. - * @param {TimeRanges} segmentRange - the time range that the segment - * covers adjusted according to currentTime - * @param {TimeRanges} referenceRange - the original time range that the - * segment covers - * @param {Number} currentTime - time in seconds where the current playback - * is at - * @param {TimeRanges} buffered - the currently buffered time ranges - * @returns {Number} percent of the segment currently buffered - */ -var calculateBufferedPercent = function calculateBufferedPercent(adjustedRange, referenceRange, currentTime, buffered) { - var referenceDuration = referenceRange.end(0) - referenceRange.start(0); - var adjustedDuration = adjustedRange.end(0) - adjustedRange.start(0); - var bufferMissingFromAdjusted = referenceDuration - adjustedDuration; - var adjustedIntersection = bufferIntersection(adjustedRange, buffered); - var referenceIntersection = bufferIntersection(referenceRange, buffered); - var adjustedOverlap = 0; - var referenceOverlap = 0; - - var count = adjustedIntersection.length; - - while (count--) { - adjustedOverlap += adjustedIntersection.end(count) - adjustedIntersection.start(count); - - // If the current overlap segment starts at currentTime, then increase the - // overlap duration so that it actually starts at the beginning of referenceRange - // by including the difference between the two Range's durations - // This is a work around for the way Flash has no buffer before currentTime - if (adjustedIntersection.start(count) === currentTime) { - adjustedOverlap += bufferMissingFromAdjusted; - } - } - - count = referenceIntersection.length; - - while (count--) { - referenceOverlap += referenceIntersection.end(count) - referenceIntersection.start(count); - } - - // Use whichever value is larger for the percentage-buffered since that value - // is likely more accurate because the only way - return Math.max(adjustedOverlap, referenceOverlap) / referenceDuration * 100; -}; - -/** - * Return the amount of a range specified by the startOfSegment and segmentDuration - * overlaps the current buffered content. - * - * @param {Number} startOfSegment - the time where the segment begins - * @param {Number} segmentDuration - the duration of the segment in seconds - * @param {Number} currentTime - time in seconds where the current playback - * is at - * @param {TimeRanges} buffered - the state of the buffer - * @returns {Number} percentage of the segment's time range that is - * already in `buffered` - */ -var getSegmentBufferedPercent = function getSegmentBufferedPercent(startOfSegment, segmentDuration, currentTime, buffered) { - var endOfSegment = startOfSegment + segmentDuration; - - // The entire time range of the segment - var originalSegmentRange = _videoJs2['default'].createTimeRanges([[startOfSegment, endOfSegment]]); - - // The adjusted segment time range that is setup such that it starts - // no earlier than currentTime - // Flash has no notion of a back-buffer so adjustedSegmentRange adjusts - // for that and the function will still return 100% if a only half of a - // segment is actually in the buffer as long as the currentTime is also - // half-way through the segment - var adjustedSegmentRange = _videoJs2['default'].createTimeRanges([[clamp(startOfSegment, [currentTime, endOfSegment]), endOfSegment]]); - - // This condition happens when the currentTime is beyond the segment's - // end time - if (adjustedSegmentRange.start(0) === adjustedSegmentRange.end(0)) { - return 0; - } - - var percent = calculateBufferedPercent(adjustedSegmentRange, originalSegmentRange, currentTime, buffered); - - // If the segment is reported as having a zero duration, return 0% - // since it is likely that we will need to fetch the segment - if (isNaN(percent) || percent === Infinity || percent === -Infinity) { - return 0; - } - - return percent; -}; - -/** - * Gets a human readable string for a TimeRange - * - * @param {TimeRange} range - * @returns {String} a human readable string - */ -var printableRange = function printableRange(range) { - var strArr = []; - - if (!range || !range.length) { - return ''; - } - - for (var i = 0; i < range.length; i++) { - strArr.push(range.start(i) + ' => ' + range.end(i)); - } - - return strArr.join(', '); -}; - -/** - * Calculates the amount of time left in seconds until the player hits the end of the - * buffer and causes a rebuffer - * - * @param {TimeRange} buffered - * The state of the buffer - * @param {Numnber} currentTime - * The current time of the player - * @param {Number} playbackRate - * The current playback rate of the player. Defaults to 1. - * @return {Number} - * Time until the player has to start rebuffering in seconds. - * @function timeUntilRebuffer - */ -var timeUntilRebuffer = function timeUntilRebuffer(buffered, currentTime) { - var playbackRate = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2]; - - var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0; - - return (bufferedEnd - currentTime) / playbackRate; -}; - -exports['default'] = { - findRange: findRange, - findNextRange: findNextRange, - findGaps: findGaps, - findSoleUncommonTimeRangesEnd: findSoleUncommonTimeRangesEnd, - getSegmentBufferedPercent: getSegmentBufferedPercent, - TIME_FUDGE_FACTOR: TIME_FUDGE_FACTOR, - printableRange: printableRange, - timeUntilRebuffer: timeUntilRebuffer -}; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],12:[function(require,module,exports){ -(function (global){ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var defaultOptions = { - errorInterval: 30, - getSource: function getSource(next) { - var tech = this.tech({ IWillNotUseThisInPlugins: true }); - var sourceObj = tech.currentSource_; - - return next(sourceObj); - } -}; - -/** - * Main entry point for the plugin - * - * @param {Player} player a reference to a videojs Player instance - * @param {Object} [options] an object with plugin options - * @private - */ -var initPlugin = function initPlugin(player, options) { - var lastCalled = 0; - var seekTo = 0; - var localOptions = _videoJs2['default'].mergeOptions(defaultOptions, options); - - player.ready(function () { - player.trigger({ type: 'usage', name: 'hls-error-reload-initialized' }); - }); - - /** - * Player modifications to perform that must wait until `loadedmetadata` - * has been triggered - * - * @private - */ - var loadedMetadataHandler = function loadedMetadataHandler() { - if (seekTo) { - player.currentTime(seekTo); - } - }; - - /** - * Set the source on the player element, play, and seek if necessary - * - * @param {Object} sourceObj An object specifying the source url and mime-type to play - * @private - */ - var setSource = function setSource(sourceObj) { - if (sourceObj === null || sourceObj === undefined) { - return; - } - seekTo = player.duration() !== Infinity && player.currentTime() || 0; - - player.one('loadedmetadata', loadedMetadataHandler); - - player.src(sourceObj); - player.trigger({ type: 'usage', name: 'hls-error-reload' }); - player.play(); - }; - - /** - * Attempt to get a source from either the built-in getSource function - * or a custom function provided via the options - * - * @private - */ - var errorHandler = function errorHandler() { - // Do not attempt to reload the source if a source-reload occurred before - // 'errorInterval' time has elapsed since the last source-reload - if (Date.now() - lastCalled < localOptions.errorInterval * 1000) { - player.trigger({ type: 'usage', name: 'hls-error-reload-canceled' }); - return; - } - - if (!localOptions.getSource || typeof localOptions.getSource !== 'function') { - _videoJs2['default'].log.error('ERROR: reloadSourceOnError - The option getSource must be a function!'); - return; - } - lastCalled = Date.now(); - - return localOptions.getSource.call(player, setSource); - }; - - /** - * Unbind any event handlers that were bound by the plugin - * - * @private - */ - var cleanupEvents = function cleanupEvents() { - player.off('loadedmetadata', loadedMetadataHandler); - player.off('error', errorHandler); - player.off('dispose', cleanupEvents); - }; - - /** - * Cleanup before re-initializing the plugin - * - * @param {Object} [newOptions] an object with plugin options - * @private - */ - var reinitPlugin = function reinitPlugin(newOptions) { - cleanupEvents(); - initPlugin(player, newOptions); - }; - - player.on('error', errorHandler); - player.on('dispose', cleanupEvents); - - // Overwrite the plugin function so that we can correctly cleanup before - // initializing the plugin - player.reloadSourceOnError = reinitPlugin; -}; - -/** - * Reload the source when an error is detected as long as there - * wasn't an error previously within the last 30 seconds - * - * @param {Object} [options] an object with plugin options - */ -var reloadSourceOnError = function reloadSourceOnError(options) { - initPlugin(this, options); -}; - -exports['default'] = reloadSourceOnError; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],13:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _playlistJs = require('./playlist.js'); - -/** - * Enable/disable playlist function. It is intended to have the first two - * arguments partially-applied in order to create the final per-playlist - * function. - * - * @param {PlaylistLoader} playlist - The rendition or media-playlist - * @param {Function} changePlaylistFn - A function to be called after a - * playlist's enabled-state has been changed. Will NOT be called if a - * playlist's enabled-state is unchanged - * @param {Boolean=} enable - Value to set the playlist enabled-state to - * or if undefined returns the current enabled-state for the playlist - * @return {Boolean} The current enabled-state of the playlist - */ -var enableFunction = function enableFunction(loader, playlistUri, changePlaylistFn, enable) { - var playlist = loader.master.playlists[playlistUri]; - var blacklisted = (0, _playlistJs.isBlacklisted)(playlist); - var currentlyEnabled = (0, _playlistJs.isEnabled)(playlist); - - if (typeof enable === 'undefined') { - return currentlyEnabled; - } - - if (enable) { - delete playlist.disabled; - } else { - playlist.disabled = true; - } - - if (enable !== currentlyEnabled && !blacklisted) { - // Ensure the outside world knows about our changes - changePlaylistFn(); - if (enable) { - loader.trigger('renditionenabled'); - } else { - loader.trigger('renditiondisabled'); - } - } - return enable; -}; - -/** - * The representation object encapsulates the publicly visible information - * in a media playlist along with a setter/getter-type function (enabled) - * for changing the enabled-state of a particular playlist entry - * - * @class Representation - */ - -var Representation = function Representation(hlsHandler, playlist, id) { - _classCallCheck(this, Representation); - - // Get a reference to a bound version of fastQualityChange_ - var fastChangeFunction = hlsHandler.masterPlaylistController_.fastQualityChange_.bind(hlsHandler.masterPlaylistController_); - - // Carefully descend into the playlist's attributes since most - // properties are optional - if (playlist.attributes) { - var attributes = playlist.attributes; - - if (attributes.RESOLUTION) { - var resolution = attributes.RESOLUTION; - - this.width = resolution.width; - this.height = resolution.height; - } - - this.bandwidth = attributes.BANDWIDTH; - } - - // The id is simply the ordinality of the media playlist - // within the master playlist - this.id = id; - - // Partially-apply the enableFunction to create a playlist- - // specific variant - this.enabled = enableFunction.bind(this, hlsHandler.playlists, playlist.uri, fastChangeFunction); -} - -/** - * A mixin function that adds the `representations` api to an instance - * of the HlsHandler class - * @param {HlsHandler} hlsHandler - An instance of HlsHandler to add the - * representation API into - */ -; - -var renditionSelectionMixin = function renditionSelectionMixin(hlsHandler) { - var playlists = hlsHandler.playlists; - - // Add a single API-specific function to the HlsHandler instance - hlsHandler.representations = function () { - return playlists.master.playlists.filter(function (media) { - return !(0, _playlistJs.isBlacklisted)(media); - }).map(function (e, i) { - return new Representation(hlsHandler, e, e.uri); - }); - }; -}; - -exports['default'] = renditionSelectionMixin; -module.exports = exports['default']; -},{"./playlist.js":10}],14:[function(require,module,exports){ -/** - * @file resolve-url.js - */ - -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _urlToolkit = require('url-toolkit'); - -var _urlToolkit2 = _interopRequireDefault(_urlToolkit); - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var resolveUrl = function resolveUrl(baseURL, relativeURL) { - // return early if we don't need to resolve - if (/^[a-z]+:/i.test(relativeURL)) { - return relativeURL; - } - - // if the base URL is relative then combine with the current location - if (!/\/\//i.test(baseURL)) { - baseURL = _urlToolkit2['default'].buildAbsoluteURL(_globalWindow2['default'].location.href, baseURL); - } - - return _urlToolkit2['default'].buildAbsoluteURL(baseURL, relativeURL); -}; - -exports['default'] = resolveUrl; -module.exports = exports['default']; -},{"global/window":30,"url-toolkit":61}],15:[function(require,module,exports){ -(function (global){ -/** - * @file segment-loader.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { var object = _x4, property = _x5, receiver = _x6; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _playlist = require('./playlist'); - -var _playlist2 = _interopRequireDefault(_playlist); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _sourceUpdater = require('./source-updater'); - -var _sourceUpdater2 = _interopRequireDefault(_sourceUpdater); - -var _config = require('./config'); - -var _config2 = _interopRequireDefault(_config); - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs = require('videojs-contrib-media-sources/es5/remove-cues-from-track.js'); - -var _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2 = _interopRequireDefault(_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs); - -var _binUtils = require('./bin-utils'); - -var _mediaSegmentRequest = require('./media-segment-request'); - -var _ranges = require('./ranges'); - -var _playlistSelectors = require('./playlist-selectors'); - -// in ms -var CHECK_BUFFER_DELAY = 500; - -/** - * Determines if we should call endOfStream on the media source based - * on the state of the buffer or if appened segment was the final - * segment in the playlist. - * - * @param {Object} playlist a media playlist object - * @param {Object} mediaSource the MediaSource object - * @param {Number} segmentIndex the index of segment we last appended - * @returns {Boolean} do we need to call endOfStream on the MediaSource - */ -var detectEndOfStream = function detectEndOfStream(playlist, mediaSource, segmentIndex) { - if (!playlist || !mediaSource) { - return false; - } - - var segments = playlist.segments; - - // determine a few boolean values to help make the branch below easier - // to read - var appendedLastSegment = segmentIndex === segments.length; - - // if we've buffered to the end of the video, we need to call endOfStream - // so that MediaSources can trigger the `ended` event when it runs out of - // buffered data instead of waiting for me - return playlist.endList && mediaSource.readyState === 'open' && appendedLastSegment; -}; - -var finite = function finite(num) { - return typeof num === 'number' && isFinite(num); -}; - -/** - * An object that manages segment loading and appending. - * - * @class SegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - -var SegmentLoader = (function (_videojs$EventTarget) { - _inherits(SegmentLoader, _videojs$EventTarget); - - function SegmentLoader(settings) { - var _this = this; - - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - _classCallCheck(this, SegmentLoader); - - _get(Object.getPrototypeOf(SegmentLoader.prototype), 'constructor', this).call(this); - // check pre-conditions - if (!settings) { - throw new TypeError('Initialization settings are required'); - } - if (typeof settings.currentTime !== 'function') { - throw new TypeError('No currentTime getter specified'); - } - if (!settings.mediaSource) { - throw new TypeError('No MediaSource specified'); - } - // public properties - this.state = 'INIT'; - this.bandwidth = settings.bandwidth; - this.throughput = { rate: 0, count: 0 }; - this.roundTrip = NaN; - this.resetStats_(); - this.mediaIndex = null; - - // private settings - this.hasPlayed_ = settings.hasPlayed; - this.currentTime_ = settings.currentTime; - this.seekable_ = settings.seekable; - this.seeking_ = settings.seeking; - this.duration_ = settings.duration; - this.mediaSource_ = settings.mediaSource; - this.hls_ = settings.hls; - this.loaderType_ = settings.loaderType; - this.segmentMetadataTrack_ = settings.segmentMetadataTrack; - this.goalBufferLength_ = settings.goalBufferLength; - - // private instance variables - this.checkBufferTimeout_ = null; - this.error_ = void 0; - this.currentTimeline_ = -1; - this.pendingSegment_ = null; - this.mimeType_ = null; - this.sourceUpdater_ = null; - this.xhrOptions_ = null; - - // Fragmented mp4 playback - this.activeInitSegmentId_ = null; - this.initSegments_ = {}; - - this.decrypter_ = settings.decrypter; - - // Manages the tracking and generation of sync-points, mappings - // between a time in the display time and a segment index within - // a playlist - this.syncController_ = settings.syncController; - this.syncPoint_ = { - segmentIndex: 0, - time: 0 - }; - - this.syncController_.on('syncinfoupdate', function () { - return _this.trigger('syncinfoupdate'); - }); - - this.mediaSource_.addEventListener('sourceopen', function () { - return _this.ended_ = false; - }); - - // ...for determining the fetch location - this.fetchAtBuffer_ = false; - - if (options.debug) { - this.logger_ = _videoJs2['default'].log.bind(_videoJs2['default'], 'segment-loader', this.loaderType_, '->'); - } - } - - /** - * reset all of our media stats - * - * @private - */ - - _createClass(SegmentLoader, [{ - key: 'resetStats_', - value: function resetStats_() { - this.mediaBytesTransferred = 0; - this.mediaRequests = 0; - this.mediaRequestsAborted = 0; - this.mediaRequestsTimedout = 0; - this.mediaRequestsErrored = 0; - this.mediaTransferDuration = 0; - this.mediaSecondsLoaded = 0; - } - - /** - * dispose of the SegmentLoader and reset to the default state - */ - }, { - key: 'dispose', - value: function dispose() { - this.state = 'DISPOSED'; - this.pause(); - this.abort_(); - if (this.sourceUpdater_) { - this.sourceUpdater_.dispose(); - } - this.resetStats_(); - } - - /** - * abort anything that is currently doing on with the SegmentLoader - * and reset to a default state - */ - }, { - key: 'abort', - value: function abort() { - if (this.state !== 'WAITING') { - if (this.pendingSegment_) { - this.pendingSegment_ = null; - } - return; - } - - this.abort_(); - - // We aborted the requests we were waiting on, so reset the loader's state to READY - // since we are no longer "waiting" on any requests. XHR callback is not always run - // when the request is aborted. This will prevent the loader from being stuck in the - // WAITING state indefinitely. - this.state = 'READY'; - - // don't wait for buffer check timeouts to begin fetching the - // next segment - if (!this.paused()) { - this.monitorBuffer_(); - } - } - - /** - * abort all pending xhr requests and null any pending segements - * - * @private - */ - }, { - key: 'abort_', - value: function abort_() { - if (this.pendingSegment_) { - this.pendingSegment_.abortRequests(); - } - - // clear out the segment being processed - this.pendingSegment_ = null; - } - - /** - * set an error on the segment loader and null out any pending segements - * - * @param {Error} error the error to set on the SegmentLoader - * @return {Error} the error that was set or that is currently set - */ - }, { - key: 'error', - value: function error(_error) { - if (typeof _error !== 'undefined') { - this.error_ = _error; - } - - this.pendingSegment_ = null; - return this.error_; - } - }, { - key: 'endOfStream', - value: function endOfStream() { - this.ended_ = true; - this.pause(); - this.trigger('ended'); - } - - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - }, { - key: 'buffered_', - value: function buffered_() { - if (!this.sourceUpdater_) { - return _videoJs2['default'].createTimeRanges(); - } - - return this.sourceUpdater_.buffered(); - } - - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {Boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - }, { - key: 'initSegment', - value: function initSegment(map) { - var set = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (!map) { - return null; - } - - var id = (0, _binUtils.initSegmentId)(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: map.bytes - }; - } - - return storedMap || map; - } - - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {Boolean} True if the all configuration is ready for loading - * @private - */ - }, { - key: 'couldBeginLoading_', - value: function couldBeginLoading_() { - return this.playlist_ && ( - // the source updater is created when init_ is called, so either having a - // source updater or being in the INIT state with a mimeType is enough - // to say we have all the needed configuration to start loading. - this.sourceUpdater_ || this.mimeType_ && this.state === 'INIT') && !this.paused(); - } - - /** - * load a playlist and start to fill the buffer - */ - }, { - key: 'load', - value: function load() { - // un-pause - this.monitorBuffer_(); - - // if we don't have a playlist yet, keep waiting for one to be - // specified - if (!this.playlist_) { - return; - } - - // not sure if this is the best place for this - this.syncController_.setDateTimeMapping(this.playlist_); - - // if all the configuration is ready, initialize and begin loading - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } - - // if we're in the middle of processing a segment already, don't - // kick off an additional segment request - if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') { - return; - } - - this.state = 'READY'; - } - - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - }, { - key: 'init_', - value: function init_() { - this.state = 'READY'; - this.sourceUpdater_ = new _sourceUpdater2['default'](this.mediaSource_, this.mimeType_); - this.resetEverything(); - return this.monitorBuffer_(); - } - - /** - * set a playlist on the segment loader - * - * @param {PlaylistLoader} media the playlist to set on the segment loader - */ - }, { - key: 'playlist', - value: function playlist(newPlaylist) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - if (!newPlaylist) { - return; - } - - var oldPlaylist = this.playlist_; - var segmentInfo = this.pendingSegment_; - - this.playlist_ = newPlaylist; - this.xhrOptions_ = options; - - // when we haven't started playing yet, the start of a live playlist - // is always our zero-time so force a sync update each time the playlist - // is refreshed from the server - if (!this.hasPlayed_()) { - newPlaylist.syncInfo = { - mediaSequence: newPlaylist.mediaSequence, - time: 0 - }; - } - - // in VOD, this is always a rendition switch (or we updated our syncInfo above) - // in LIVE, we always want to update with new playlists (including refreshes) - this.trigger('syncinfoupdate'); - - // if we were unpaused but waiting for a playlist, start - // buffering now - if (this.state === 'INIT' && this.couldBeginLoading_()) { - return this.init_(); - } - - if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) { - if (this.mediaIndex !== null) { - // we must "resync" the segment loader when we switch renditions and - // the segment loader is already synced to the previous rendition - this.resyncLoader(); - } - - // the rest of this function depends on `oldPlaylist` being defined - return; - } - - // we reloaded the same playlist so we are in a live scenario - // and we will likely need to adjust the mediaIndex - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - - this.logger_('mediaSequenceDiff', mediaSequenceDiff); - - // update the mediaIndex on the SegmentLoader - // this is important because we can abort a request and this value must be - // equal to the last appended mediaIndex - if (this.mediaIndex !== null) { - this.mediaIndex -= mediaSequenceDiff; - } - - // update the mediaIndex on the SegmentInfo object - // this is important because we will update this.mediaIndex with this value - // in `handleUpdateEnd_` after the segment has been successfully appended - if (segmentInfo) { - segmentInfo.mediaIndex -= mediaSequenceDiff; - - // we need to update the referenced segment so that timing information is - // saved for the new playlist's segment, however, if the segment fell off the - // playlist, we can leave the old reference and just lose the timing info - if (segmentInfo.mediaIndex >= 0) { - segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex]; - } - } - - this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist); - } - - /** - * Prevent the loader from fetching additional segments. If there - * is a segment request outstanding, it will finish processing - * before the loader halts. A segment loader can be unpaused by - * calling load(). - */ - }, { - key: 'pause', - value: function pause() { - if (this.checkBufferTimeout_) { - _globalWindow2['default'].clearTimeout(this.checkBufferTimeout_); - - this.checkBufferTimeout_ = null; - } - } - - /** - * Returns whether the segment loader is fetching additional - * segments when given the opportunity. This property can be - * modified through calls to pause() and load(). - */ - }, { - key: 'paused', - value: function paused() { - return this.checkBufferTimeout_ === null; - } - - /** - * create/set the following mimetype on the SourceBuffer through a - * SourceUpdater - * - * @param {String} mimeType the mime type string to use - */ - }, { - key: 'mimeType', - value: function mimeType(_mimeType) { - if (this.mimeType_) { - return; - } - - this.mimeType_ = _mimeType; - // if we were unpaused but waiting for a sourceUpdater, start - // buffering now - if (this.state === 'INIT' && this.couldBeginLoading_()) { - this.init_(); - } - } - - /** - * Delete all the buffered data and reset the SegmentLoader - */ - }, { - key: 'resetEverything', - value: function resetEverything() { - this.ended_ = false; - this.resetLoader(); - this.remove(0, Infinity); - } - - /** - * Force the SegmentLoader to resync and start loading around the currentTime instead - * of starting at the end of the buffer - * - * Useful for fast quality changes - */ - }, { - key: 'resetLoader', - value: function resetLoader() { - this.fetchAtBuffer_ = false; - this.resyncLoader(); - } - - /** - * Force the SegmentLoader to restart synchronization and make a conservative guess - * before returning to the simple walk-forward method - */ - }, { - key: 'resyncLoader', - value: function resyncLoader() { - this.mediaIndex = null; - this.syncPoint_ = null; - this.abort(); - } - - /** - * Remove any data in the source buffer between start and end times - * @param {Number} start - the start time of the region to remove from the buffer - * @param {Number} end - the end time of the region to remove from the buffer - */ - }, { - key: 'remove', - value: function remove(start, end) { - if (this.sourceUpdater_) { - this.sourceUpdater_.remove(start, end); - } - (0, _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2['default'])(start, end, this.segmentMetadataTrack_); - } - - /** - * (re-)schedule monitorBufferTick_ to run as soon as possible - * - * @private - */ - }, { - key: 'monitorBuffer_', - value: function monitorBuffer_() { - if (this.checkBufferTimeout_) { - _globalWindow2['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = _globalWindow2['default'].setTimeout(this.monitorBufferTick_.bind(this), 1); - } - - /** - * As long as the SegmentLoader is in the READY state, periodically - * invoke fillBuffer_(). - * - * @private - */ - }, { - key: 'monitorBufferTick_', - value: function monitorBufferTick_() { - if (this.state === 'READY') { - this.fillBuffer_(); - } - - if (this.checkBufferTimeout_) { - _globalWindow2['default'].clearTimeout(this.checkBufferTimeout_); - } - - this.checkBufferTimeout_ = _globalWindow2['default'].setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY); - } - - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - }, { - key: 'fillBuffer_', - value: function fillBuffer_() { - if (this.sourceUpdater_.updating()) { - return; - } - - if (!this.syncPoint_) { - this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()); - } - - // see if we need to begin loading immediately - var segmentInfo = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(), this.currentTime_(), this.syncPoint_); - - if (!segmentInfo) { - return; - } - - var isEndOfStream = detectEndOfStream(this.playlist_, this.mediaSource_, segmentInfo.mediaIndex); - - if (isEndOfStream) { - this.endOfStream(); - return; - } - - if (segmentInfo.mediaIndex === this.playlist_.segments.length - 1 && this.mediaSource_.readyState === 'ended' && !this.seeking_()) { - return; - } - - // We will need to change timestampOffset of the sourceBuffer if either of - // the following conditions are true: - // - The segment.timeline !== this.currentTimeline - // (we are crossing a discontinuity somehow) - // - The "timestampOffset" for the start of this segment is less than - // the currently set timestampOffset - if (segmentInfo.timeline !== this.currentTimeline_ || segmentInfo.startOfSegment !== null && segmentInfo.startOfSegment < this.sourceUpdater_.timestampOffset()) { - this.syncController_.reset(); - segmentInfo.timestampOffset = segmentInfo.startOfSegment; - } - - this.loadSegment_(segmentInfo); - } - - /** - * Determines what segment request should be made, given current playback - * state. - * - * @param {TimeRanges} buffered - the state of the buffer - * @param {Object} playlist - the playlist object to fetch segments from - * @param {Number} mediaIndex - the previous mediaIndex fetched or null - * @param {Boolean} hasPlayed - a flag indicating whether we have played or not - * @param {Number} currentTime - the playback position in seconds - * @param {Object} syncPoint - a segment info object that describes the - * @returns {Object} a segment request object that describes the segment to load - */ - }, { - key: 'checkBuffer_', - value: function checkBuffer_(buffered, playlist, mediaIndex, hasPlayed, currentTime, syncPoint) { - var lastBufferedEnd = 0; - var startOfSegment = undefined; - - if (buffered.length) { - lastBufferedEnd = buffered.end(buffered.length - 1); - } - - var bufferedTime = Math.max(0, lastBufferedEnd - currentTime); - - if (!playlist.segments.length) { - return null; - } - - // if there is plenty of content buffered, and the video has - // been played before relax for awhile - if (bufferedTime >= this.goalBufferLength_()) { - return null; - } - - // if the video has not yet played once, and we already have - // one segment downloaded do nothing - if (!hasPlayed && bufferedTime >= 1) { - return null; - } - - this.logger_('checkBuffer_', 'mediaIndex:', mediaIndex, 'hasPlayed:', hasPlayed, 'currentTime:', currentTime, 'syncPoint:', syncPoint, 'fetchAtBuffer:', this.fetchAtBuffer_, 'bufferedTime:', bufferedTime); - - // When the syncPoint is null, there is no way of determining a good - // conservative segment index to fetch from - // The best thing to do here is to get the kind of sync-point data by - // making a request - if (syncPoint === null) { - mediaIndex = this.getSyncSegmentCandidate_(playlist); - this.logger_('getSync', 'mediaIndex:', mediaIndex); - return this.generateSegmentInfo_(playlist, mediaIndex, null, true); - } - - // Under normal playback conditions fetching is a simple walk forward - if (mediaIndex !== null) { - this.logger_('walkForward', 'mediaIndex:', mediaIndex + 1); - var segment = playlist.segments[mediaIndex]; - - if (segment && segment.end) { - startOfSegment = segment.end; - } else { - startOfSegment = lastBufferedEnd; - } - return this.generateSegmentInfo_(playlist, mediaIndex + 1, startOfSegment, false); - } - - // There is a sync-point but the lack of a mediaIndex indicates that - // we need to make a good conservative guess about which segment to - // fetch - if (this.fetchAtBuffer_) { - // Find the segment containing the end of the buffer - var mediaSourceInfo = _playlist2['default'].getMediaInfoForTime(playlist, lastBufferedEnd, syncPoint.segmentIndex, syncPoint.time); - - mediaIndex = mediaSourceInfo.mediaIndex; - startOfSegment = mediaSourceInfo.startTime; - } else { - // Find the segment containing currentTime - var mediaSourceInfo = _playlist2['default'].getMediaInfoForTime(playlist, currentTime, syncPoint.segmentIndex, syncPoint.time); - - mediaIndex = mediaSourceInfo.mediaIndex; - startOfSegment = mediaSourceInfo.startTime; - } - this.logger_('getMediaIndexForTime', 'mediaIndex:', mediaIndex, 'startOfSegment:', startOfSegment); - - return this.generateSegmentInfo_(playlist, mediaIndex, startOfSegment, false); - } - - /** - * The segment loader has no recourse except to fetch a segment in the - * current playlist and use the internal timestamps in that segment to - * generate a syncPoint. This function returns a good candidate index - * for that process. - * - * @param {Object} playlist - the playlist object to look for a - * @returns {Number} An index of a segment from the playlist to load - */ - }, { - key: 'getSyncSegmentCandidate_', - value: function getSyncSegmentCandidate_(playlist) { - var _this2 = this; - - if (this.currentTimeline_ === -1) { - return 0; - } - - var segmentIndexArray = playlist.segments.map(function (s, i) { - return { - timeline: s.timeline, - segmentIndex: i - }; - }).filter(function (s) { - return s.timeline === _this2.currentTimeline_; - }); - - if (segmentIndexArray.length) { - return segmentIndexArray[Math.min(segmentIndexArray.length - 1, 1)].segmentIndex; - } - - return Math.max(playlist.segments.length - 1, 0); - } - }, { - key: 'generateSegmentInfo_', - value: function generateSegmentInfo_(playlist, mediaIndex, startOfSegment, isSyncRequest) { - if (mediaIndex < 0 || mediaIndex >= playlist.segments.length) { - return null; - } - - var segment = playlist.segments[mediaIndex]; - - return { - requestId: 'segment-loader-' + Math.random(), - // resolve the segment URL relative to the playlist - uri: segment.resolvedUri, - // the segment's mediaIndex at the time it was requested - mediaIndex: mediaIndex, - // whether or not to update the SegmentLoader's state with this - // segment's mediaIndex - isSyncRequest: isSyncRequest, - startOfSegment: startOfSegment, - // the segment's playlist - playlist: playlist, - // unencrypted bytes of the segment - bytes: null, - // when a key is defined for this segment, the encrypted bytes - encryptedBytes: null, - // The target timestampOffset for this segment when we append it - // to the source buffer - timestampOffset: null, - // The timeline that the segment is in - timeline: segment.timeline, - // The expected duration of the segment in seconds - duration: segment.duration, - // retain the segment in case the playlist updates while doing an async process - segment: segment - }; - } - - /** - * Determines if the network has enough bandwidth to complete the current segment - * request in a timely manner. If not, the request will be aborted early and bandwidth - * updated to trigger a playlist switch. - * - * @param {Object} stats - * Object containing stats about the request timing and size - * @return {Boolean} True if the request was aborted, false otherwise - * @private - */ - }, { - key: 'abortRequestEarly_', - value: function abortRequestEarly_(stats) { - if (this.hls_.tech_.paused() || - // Don't abort if the current playlist is on the lowestEnabledRendition - // TODO: Replace using timeout with a boolean indicating whether this playlist is - // the lowestEnabledRendition. - !this.xhrOptions_.timeout || - // Don't abort if we have no bandwidth information to estimate segment sizes - !(this.playlist_.attributes && this.playlist_.attributes.BANDWIDTH)) { - return false; - } - - // Wait at least 1 second since the first byte of data has been received before - // using the calculated bandwidth from the progress event to allow the bitrate - // to stabilize - if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) { - return false; - } - - var currentTime = this.currentTime_(); - var measuredBandwidth = stats.bandwidth; - var segmentDuration = this.pendingSegment_.duration; - - var requestTimeRemaining = _playlist2['default'].estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); - - // Subtract 1 from the timeUntilRebuffer so we still consider an early abort - // if we are only left with less than 1 second when the request completes. - // A negative timeUntilRebuffering indicates we are already rebuffering - var timeUntilRebuffer = (0, _ranges.timeUntilRebuffer)(this.buffered_(), currentTime, this.hls_.tech_.playbackRate()) - 1; - - // Only consider aborting early if the estimated time to finish the download - // is larger than the estimated time until the player runs out of forward buffer - if (requestTimeRemaining <= timeUntilRebuffer) { - return false; - } - - var switchCandidate = (0, _playlistSelectors.minRebufferMaxBandwidthSelector)({ - master: this.hls_.playlists.master, - currentTime: currentTime, - bandwidth: measuredBandwidth, - duration: this.duration_(), - segmentDuration: segmentDuration, - timeUntilRebuffer: timeUntilRebuffer, - currentTimeline: this.currentTimeline_, - syncController: this.syncController_ - }); - - if (!switchCandidate) { - return; - } - - var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer; - - var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact; - - var minimumTimeSaving = 0.5; - - // If we are already rebuffering, increase the amount of variance we add to the - // potential round trip time of the new request so that we are not too aggressive - // with switching to a playlist that might save us a fraction of a second. - if (timeUntilRebuffer <= _ranges.TIME_FUDGE_FACTOR) { - minimumTimeSaving = 1; - } - - if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) { - return false; - } - - // set the bandwidth to that of the desired playlist being sure to scale by - // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it - this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * _config2['default'].BANDWIDTH_VARIANCE + 1; - this.abort(); - this.trigger('bandwidthupdate'); - return true; - } - - /** - * XHR `progress` event handler - * - * @param {Event} - * The XHR `progress` event - * @param {Object} simpleSegment - * A simplified segment object copy - * @private - */ - }, { - key: 'handleProgress_', - value: function handleProgress_(event, simpleSegment) { - if (!this.pendingSegment_ || simpleSegment.requestId !== this.pendingSegment_.requestId || this.abortRequestEarly_(simpleSegment.stats)) { - return; - } - - this.trigger('progress'); - } - - /** - * load a specific segment from a request into the buffer - * - * @private - */ - }, { - key: 'loadSegment_', - value: function loadSegment_(segmentInfo) { - this.state = 'WAITING'; - this.pendingSegment_ = segmentInfo; - this.trimBackBuffer_(segmentInfo); - - segmentInfo.abortRequests = (0, _mediaSegmentRequest.mediaSegmentRequest)(this.hls_.xhr, this.xhrOptions_, this.decrypter_, this.createSimplifiedSegmentObj_(segmentInfo), - // progress callback - this.handleProgress_.bind(this), this.segmentRequestFinished_.bind(this)); - } - - /** - * trim the back buffer so that we don't have too much data - * in the source buffer - * - * @private - * - * @param {Object} segmentInfo - the current segment - */ - }, { - key: 'trimBackBuffer_', - value: function trimBackBuffer_(segmentInfo) { - var seekable = this.seekable_(); - var currentTime = this.currentTime_(); - var removeToTime = 0; - - // Chrome has a hard limit of 150MB of - // buffer and a very conservative "garbage collector" - // We manually clear out the old buffer to ensure - // we don't trigger the QuotaExceeded error - // on the source buffer during subsequent appends - - // If we have a seekable range use that as the limit for what can be removed safely - // otherwise remove anything older than 30 seconds before the current play head - if (seekable.length && seekable.start(0) > 0 && seekable.start(0) < currentTime) { - removeToTime = seekable.start(0); - } else { - removeToTime = currentTime - 30; - } - - if (removeToTime > 0) { - this.remove(0, removeToTime); - } - } - - /** - * created a simplified copy of the segment object with just the - * information necessary to perform the XHR and decryption - * - * @private - * - * @param {Object} segmentInfo - the current segment - * @returns {Object} a simplified segment object copy - */ - }, { - key: 'createSimplifiedSegmentObj_', - value: function createSimplifiedSegmentObj_(segmentInfo) { - var segment = segmentInfo.segment; - var simpleSegment = { - resolvedUri: segment.resolvedUri, - byterange: segment.byterange, - requestId: segmentInfo.requestId - }; - - if (segment.key) { - // if the media sequence is greater than 2^32, the IV will be incorrect - // assuming 10s segments, that would be about 1300 years - var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]); - - simpleSegment.key = { - resolvedUri: segment.key.resolvedUri, - iv: iv - }; - } - - if (segment.map) { - simpleSegment.map = this.initSegment(segment.map); - } - - return simpleSegment; - } - - /** - * Handle the callback from the segmentRequest function and set the - * associated SegmentLoader state and errors if necessary - * - * @private - */ - }, { - key: 'segmentRequestFinished_', - value: function segmentRequestFinished_(error, simpleSegment) { - // every request counts as a media request even if it has been aborted - // or canceled due to a timeout - this.mediaRequests += 1; - - if (simpleSegment.stats) { - this.mediaBytesTransferred += simpleSegment.stats.bytesReceived; - this.mediaTransferDuration += simpleSegment.stats.roundTripTime; - } - - // The request was aborted and the SegmentLoader has already been reset - if (!this.pendingSegment_) { - this.mediaRequestsAborted += 1; - return; - } - - // the request was aborted and the SegmentLoader has already started - // another request. this can happen when the timeout for an aborted - // request triggers due to a limitation in the XHR library - // do not count this as any sort of request or we risk double-counting - if (simpleSegment.requestId !== this.pendingSegment_.requestId) { - return; - } - - // an error occurred from the active pendingSegment_ so reset everything - if (error) { - this.pendingSegment_ = null; - this.state = 'READY'; - - // the requests were aborted just record the aborted stat and exit - // this is not a true error condition and nothing corrective needs - // to be done - if (error.code === _mediaSegmentRequest.REQUEST_ERRORS.ABORTED) { - this.mediaRequestsAborted += 1; - return; - } - - this.pause(); - - // the error is really just that at least one of the requests timed-out - // set the bandwidth to a very low value and trigger an ABR switch to - // take emergency action - if (error.code === _mediaSegmentRequest.REQUEST_ERRORS.TIMEOUT) { - this.mediaRequestsTimedout += 1; - this.bandwidth = 1; - this.roundTrip = NaN; - this.trigger('bandwidthupdate'); - return; - } - - // if control-flow has arrived here, then the error is real - // emit an error event to blacklist the current playlist - this.mediaRequestsErrored += 1; - this.error(error); - this.trigger('error'); - return; - } - - // the response was a success so set any bandwidth stats the request - // generated for ABR purposes - this.bandwidth = simpleSegment.stats.bandwidth; - this.roundTrip = simpleSegment.stats.roundTripTime; - - // if this request included an initialization segment, save that data - // to the initSegment cache - if (simpleSegment.map) { - simpleSegment.map = this.initSegment(simpleSegment.map, true); - } - - this.processSegmentResponse_(simpleSegment); - } - - /** - * Move any important data from the simplified segment object - * back to the real segment object for future phases - * - * @private - */ - }, { - key: 'processSegmentResponse_', - value: function processSegmentResponse_(simpleSegment) { - var segmentInfo = this.pendingSegment_; - - segmentInfo.bytes = simpleSegment.bytes; - if (simpleSegment.map) { - segmentInfo.segment.map.bytes = simpleSegment.map.bytes; - } - - segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests; - this.handleSegment_(); - } - - /** - * append a decrypted segement to the SourceBuffer through a SourceUpdater - * - * @private - */ - }, { - key: 'handleSegment_', - value: function handleSegment_() { - var _this3 = this; - - if (!this.pendingSegment_) { - this.state = 'READY'; - return; - } - - this.state = 'APPENDING'; - - var segmentInfo = this.pendingSegment_; - var segment = segmentInfo.segment; - - this.syncController_.probeSegmentInfo(segmentInfo); - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); - this.pendingSegment_ = null; - this.state = 'READY'; - return; - } - - if (segmentInfo.timestampOffset !== null && segmentInfo.timestampOffset !== this.sourceUpdater_.timestampOffset()) { - this.sourceUpdater_.timestampOffset(segmentInfo.timestampOffset); - // fired when a timestamp offset is set in HLS (can also identify discontinuities) - this.trigger('timestampoffset'); - } - - // if the media initialization segment is changing, append it - // before the content segment - if (segment.map) { - (function () { - var initId = (0, _binUtils.initSegmentId)(segment.map); - - if (!_this3.activeInitSegmentId_ || _this3.activeInitSegmentId_ !== initId) { - var initSegment = _this3.initSegment(segment.map); - - _this3.sourceUpdater_.appendBuffer(initSegment.bytes, function () { - _this3.activeInitSegmentId_ = initId; - }); - } - })(); - } - - segmentInfo.byteLength = segmentInfo.bytes.byteLength; - if (typeof segment.start === 'number' && typeof segment.end === 'number') { - this.mediaSecondsLoaded += segment.end - segment.start; - } else { - this.mediaSecondsLoaded += segment.duration; - } - - this.sourceUpdater_.appendBuffer(segmentInfo.bytes, this.handleUpdateEnd_.bind(this)); - } - - /** - * callback to run when appendBuffer is finished. detects if we are - * in a good state to do things with the data we got, or if we need - * to wait for more - * - * @private - */ - }, { - key: 'handleUpdateEnd_', - value: function handleUpdateEnd_() { - this.logger_('handleUpdateEnd_', 'segmentInfo:', this.pendingSegment_); - - if (!this.pendingSegment_) { - this.state = 'READY'; - if (!this.paused()) { - this.monitorBuffer_(); - } - return; - } - - var segmentInfo = this.pendingSegment_; - var segment = segmentInfo.segment; - var isWalkingForward = this.mediaIndex !== null; - - this.pendingSegment_ = null; - this.recordThroughput_(segmentInfo); - this.addSegmentMetadataCue_(segmentInfo); - - this.state = 'READY'; - - this.mediaIndex = segmentInfo.mediaIndex; - this.fetchAtBuffer_ = true; - this.currentTimeline_ = segmentInfo.timeline; - - // We must update the syncinfo to recalculate the seekable range before - // the following conditional otherwise it may consider this a bad "guess" - // and attempt to resync when the post-update seekable window and live - // point would mean that this was the perfect segment to fetch - this.trigger('syncinfoupdate'); - - // If we previously appended a segment that ends more than 3 targetDurations before - // the currentTime_ that means that our conservative guess was too conservative. - // In that case, reset the loader state so that we try to use any information gained - // from the previous request to create a new, more accurate, sync-point. - if (segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3) { - this.resetEverything(); - return; - } - - // Don't do a rendition switch unless we have enough time to get a sync segment - // and conservatively guess - if (isWalkingForward) { - this.trigger('bandwidthupdate'); - } - this.trigger('progress'); - - // any time an update finishes and the last segment is in the - // buffer, end the stream. this ensures the "ended" event will - // fire if playback reaches that point. - var isEndOfStream = detectEndOfStream(segmentInfo.playlist, this.mediaSource_, segmentInfo.mediaIndex + 1); - - if (isEndOfStream) { - this.endOfStream(); - } - - if (!this.paused()) { - this.monitorBuffer_(); - } - } - - /** - * Records the current throughput of the decrypt, transmux, and append - * portion of the semgment pipeline. `throughput.rate` is a the cumulative - * moving average of the throughput. `throughput.count` is the number of - * data points in the average. - * - * @private - * @param {Object} segmentInfo the object returned by loadSegment - */ - }, { - key: 'recordThroughput_', - value: function recordThroughput_(segmentInfo) { - var rate = this.throughput.rate; - // Add one to the time to ensure that we don't accidentally attempt to divide - // by zero in the case where the throughput is ridiculously high - var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; - // Multiply by 8000 to convert from bytes/millisecond to bits/second - var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); - - // This is just a cumulative moving average calculation: - // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1) - this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count; - } - - /** - * A debugging logger noop that is set to console.log only if debugging - * is enabled globally - * - * @private - */ - }, { - key: 'logger_', - value: function logger_() {} - - /** - * Adds a cue to the segment-metadata track with some metadata information about the - * segment - * - * @private - * @param {Object} segmentInfo - * the object returned by loadSegment - * @method addSegmentMetadataCue_ - */ - }, { - key: 'addSegmentMetadataCue_', - value: function addSegmentMetadataCue_(segmentInfo) { - if (!this.segmentMetadataTrack_) { - return; - } - - var segment = segmentInfo.segment; - var start = segment.start; - var end = segment.end; - - // Do not try adding the cue if the start and end times are invalid. - if (!finite(start) || !finite(end)) { - return; - } - - (0, _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2['default'])(start, end, this.segmentMetadataTrack_); - - var Cue = _globalWindow2['default'].WebKitDataCue || _globalWindow2['default'].VTTCue; - var value = { - uri: segmentInfo.uri, - timeline: segmentInfo.timeline, - playlist: segmentInfo.playlist.uri, - start: start, - end: end - }; - var data = JSON.stringify(value); - var cue = new Cue(start, end, data); - - // Attach the metadata to the value property of the cue to keep consistency between - // the differences of WebKitDataCue in safari and VTTCue in other browsers - cue.value = value; - - this.segmentMetadataTrack_.addCue(cue); - } - }]); - - return SegmentLoader; -})(_videoJs2['default'].EventTarget); - -exports['default'] = SegmentLoader; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./bin-utils":2,"./config":3,"./media-segment-request":6,"./playlist":10,"./playlist-selectors":9,"./ranges":11,"./source-updater":16,"global/window":30,"videojs-contrib-media-sources/es5/remove-cues-from-track.js":71}],16:[function(require,module,exports){ -(function (global){ -/** - * @file source-updater.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var noop = function noop() {}; - -/** - * A queue of callbacks to be serialized and applied when a - * MediaSource and its associated SourceBuffers are not in the - * updating state. It is used by the segment loader to update the - * underlying SourceBuffers when new data is loaded, for instance. - * - * @class SourceUpdater - * @param {MediaSource} mediaSource the MediaSource to create the - * SourceBuffer from - * @param {String} mimeType the desired MIME type of the underlying - * SourceBuffer - */ - -var SourceUpdater = (function () { - function SourceUpdater(mediaSource, mimeType) { - var _this = this; - - _classCallCheck(this, SourceUpdater); - - var createSourceBuffer = function createSourceBuffer() { - _this.sourceBuffer_ = mediaSource.addSourceBuffer(mimeType); - - // run completion handlers and process callbacks as updateend - // events fire - _this.onUpdateendCallback_ = function () { - var pendingCallback = _this.pendingCallback_; - - _this.pendingCallback_ = null; - - if (pendingCallback) { - pendingCallback(); - } - - _this.runCallback_(); - }; - - _this.sourceBuffer_.addEventListener('updateend', _this.onUpdateendCallback_); - - _this.runCallback_(); - }; - - this.callbacks_ = []; - this.pendingCallback_ = null; - this.timestampOffset_ = 0; - this.mediaSource = mediaSource; - this.processedAppend_ = false; - - if (mediaSource.readyState === 'closed') { - mediaSource.addEventListener('sourceopen', createSourceBuffer); - } else { - createSourceBuffer(); - } - } - - /** - * Aborts the current segment and resets the segment parser. - * - * @param {Function} done function to call when done - * @see http://w3c.github.io/media-source/#widl-SourceBuffer-abort-void - */ - - _createClass(SourceUpdater, [{ - key: 'abort', - value: function abort(done) { - var _this2 = this; - - if (this.processedAppend_) { - this.queueCallback_(function () { - _this2.sourceBuffer_.abort(); - }, done); - } - } - - /** - * Queue an update to append an ArrayBuffer. - * - * @param {ArrayBuffer} bytes - * @param {Function} done the function to call when done - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data - */ - }, { - key: 'appendBuffer', - value: function appendBuffer(bytes, done) { - var _this3 = this; - - this.processedAppend_ = true; - - this.queueCallback_(function () { - _this3.sourceBuffer_.appendBuffer(bytes); - }, done); - } - - /** - * Indicates what TimeRanges are buffered in the managed SourceBuffer. - * - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-buffered - */ - }, { - key: 'buffered', - value: function buffered() { - if (!this.sourceBuffer_) { - return _videoJs2['default'].createTimeRanges(); - } - return this.sourceBuffer_.buffered; - } - - /** - * Queue an update to remove a time range from the buffer. - * - * @param {Number} start where to start the removal - * @param {Number} end where to end the removal - * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end - */ - }, { - key: 'remove', - value: function remove(start, end) { - var _this4 = this; - - if (this.processedAppend_) { - this.queueCallback_(function () { - _this4.sourceBuffer_.remove(start, end); - }, noop); - } - } - - /** - * Whether the underlying sourceBuffer is updating or not - * - * @return {Boolean} the updating status of the SourceBuffer - */ - }, { - key: 'updating', - value: function updating() { - return !this.sourceBuffer_ || this.sourceBuffer_.updating || this.pendingCallback_; - } - - /** - * Set/get the timestampoffset on the SourceBuffer - * - * @return {Number} the timestamp offset - */ - }, { - key: 'timestampOffset', - value: function timestampOffset(offset) { - var _this5 = this; - - if (typeof offset !== 'undefined') { - this.queueCallback_(function () { - _this5.sourceBuffer_.timestampOffset = offset; - }); - this.timestampOffset_ = offset; - } - return this.timestampOffset_; - } - - /** - * Queue a callback to run - */ - }, { - key: 'queueCallback_', - value: function queueCallback_(callback, done) { - this.callbacks_.push([callback.bind(this), done]); - this.runCallback_(); - } - - /** - * Run a queued callback - */ - }, { - key: 'runCallback_', - value: function runCallback_() { - var callbacks = undefined; - - if (!this.updating() && this.callbacks_.length) { - callbacks = this.callbacks_.shift(); - this.pendingCallback_ = callbacks[1]; - callbacks[0](); - } - } - - /** - * dispose of the source updater and the underlying sourceBuffer - */ - }, { - key: 'dispose', - value: function dispose() { - this.sourceBuffer_.removeEventListener('updateend', this.onUpdateendCallback_); - if (this.sourceBuffer_ && this.mediaSource.readyState === 'open') { - this.sourceBuffer_.abort(); - } - } - }]); - - return SourceUpdater; -})(); - -exports['default'] = SourceUpdater; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],17:[function(require,module,exports){ -(function (global){ -/** - * @file sync-controller.js - */ - -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _muxJsLibMp4Probe = require('mux.js/lib/mp4/probe'); - -var _muxJsLibMp4Probe2 = _interopRequireDefault(_muxJsLibMp4Probe); - -var _muxJsLibToolsTsInspectorJs = require('mux.js/lib/tools/ts-inspector.js'); - -var _playlist = require('./playlist'); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var syncPointStrategies = [ -// Stategy "VOD": Handle the VOD-case where the sync-point is *always* -// the equivalence display-time 0 === segment-index 0 -{ - name: 'VOD', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (duration !== Infinity) { - var syncPoint = { - time: 0, - segmentIndex: 0 - }; - - return syncPoint; - } - return null; - } -}, -// Stategy "ProgramDateTime": We have a program-date-time tag in this playlist -{ - name: 'ProgramDateTime', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (syncController.datetimeToDisplayTime && playlist.dateTimeObject) { - var playlistTime = playlist.dateTimeObject.getTime() / 1000; - var playlistStart = playlistTime + syncController.datetimeToDisplayTime; - var syncPoint = { - time: playlistStart, - segmentIndex: 0 - }; - - return syncPoint; - } - return null; - } -}, -// Stategy "Segment": We have a known time mapping for a timeline and a -// segment in the current timeline with timing data -{ - name: 'Segment', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var segments = playlist.segments || []; - var syncPoint = null; - var lastDistance = null; - - currentTime = currentTime || 0; - - for (var i = 0; i < segments.length; i++) { - var segment = segments[i]; - - if (segment.timeline === currentTimeline && typeof segment.start !== 'undefined') { - var distance = Math.abs(currentTime - segment.start); - - // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: segment.start, - segmentIndex: i - }; - } - } - } - return syncPoint; - } -}, -// Stategy "Discontinuity": We have a discontinuity with a known -// display-time -{ - name: 'Discontinuity', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - var syncPoint = null; - - currentTime = currentTime || 0; - - if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) { - var lastDistance = null; - - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var discontinuitySync = syncController.discontinuities[discontinuity]; - - if (discontinuitySync) { - var distance = Math.abs(currentTime - discontinuitySync.time); - - // Once the distance begins to increase, we have passed - // currentTime and can stop looking for better candidates - if (lastDistance !== null && lastDistance < distance) { - break; - } - - if (!syncPoint || lastDistance === null || lastDistance >= distance) { - lastDistance = distance; - syncPoint = { - time: discontinuitySync.time, - segmentIndex: segmentIndex - }; - } - } - } - } - return syncPoint; - } -}, -// Stategy "Playlist": We have a playlist with a known mapping of -// segment index to display time -{ - name: 'Playlist', - run: function run(syncController, playlist, duration, currentTimeline, currentTime) { - if (playlist.syncInfo) { - var syncPoint = { - time: playlist.syncInfo.time, - segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence - }; - - return syncPoint; - } - return null; - } -}]; - -exports.syncPointStrategies = syncPointStrategies; - -var SyncController = (function (_videojs$EventTarget) { - _inherits(SyncController, _videojs$EventTarget); - - function SyncController() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - _classCallCheck(this, SyncController); - - _get(Object.getPrototypeOf(SyncController.prototype), 'constructor', this).call(this); - // Segment Loader state variables... - // ...for synching across variants - this.inspectCache_ = undefined; - - // ...for synching across variants - this.timelines = []; - this.discontinuities = []; - this.datetimeToDisplayTime = null; - - if (options.debug) { - this.logger_ = _videoJs2['default'].log.bind(_videoJs2['default'], 'sync-controller ->'); - } - } - - /** - * Find a sync-point for the playlist specified - * - * A sync-point is defined as a known mapping from display-time to - * a segment-index in the current playlist. - * - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {Number} duration - * Duration of the MediaSource (Infinite if playing a live source) - * @param {Number} currentTimeline - * The last timeline from which a segment was loaded - * @returns {Object} - * A sync-point object - */ - - _createClass(SyncController, [{ - key: 'getSyncPoint', - value: function getSyncPoint(playlist, duration, currentTimeline, currentTime) { - var syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime); - - if (!syncPoints.length) { - // Signal that we need to attempt to get a sync-point manually - // by fetching a segment in the playlist and constructing - // a sync-point from that information - return null; - } - - // Now find the sync-point that is closest to the currentTime because - // that should result in the most accurate guess about which segment - // to fetch - return this.selectSyncPoint_(syncPoints, { key: 'time', value: currentTime }); - } - - /** - * Calculate the amount of time that has expired off the playlist during playback - * - * @param {Playlist} playlist - * Playlist object to calculate expired from - * @param {Number} duration - * Duration of the MediaSource (Infinity if playling a live source) - * @returns {Number|null} - * The amount of time that has expired off the playlist during playback. Null - * if no sync-points for the playlist can be found. - */ - }, { - key: 'getExpiredTime', - value: function getExpiredTime(playlist, duration) { - if (!playlist || !playlist.segments) { - return null; - } - - var syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); - - // Without sync-points, there is not enough information to determine the expired time - if (!syncPoints.length) { - return null; - } - - var syncPoint = this.selectSyncPoint_(syncPoints, { - key: 'segmentIndex', - value: 0 - }); - - // If the sync-point is beyond the start of the playlist, we want to subtract the - // duration from index 0 to syncPoint.segmentIndex instead of adding. - if (syncPoint.segmentIndex > 0) { - syncPoint.time *= -1; - } - - return Math.abs(syncPoint.time + (0, _playlist.sumDurations)(playlist, syncPoint.segmentIndex, 0)); - } - - /** - * Runs each sync-point strategy and returns a list of sync-points returned by the - * strategies - * - * @private - * @param {Playlist} playlist - * The playlist that needs a sync-point - * @param {Number} duration - * Duration of the MediaSource (Infinity if playing a live source) - * @param {Number} currentTimeline - * The last timeline from which a segment was loaded - * @returns {Array} - * A list of sync-point objects - */ - }, { - key: 'runStrategies_', - value: function runStrategies_(playlist, duration, currentTimeline, currentTime) { - var syncPoints = []; - - // Try to find a sync-point in by utilizing various strategies... - for (var i = 0; i < syncPointStrategies.length; i++) { - var strategy = syncPointStrategies[i]; - var syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime); - - if (syncPoint) { - syncPoint.strategy = strategy.name; - syncPoints.push({ - strategy: strategy.name, - syncPoint: syncPoint - }); - this.logger_('syncPoint found via <' + strategy.name + '>:', syncPoint); - } - } - - return syncPoints; - } - - /** - * Selects the sync-point nearest the specified target - * - * @private - * @param {Array} syncPoints - * List of sync-points to select from - * @param {Object} target - * Object specifying the property and value we are targeting - * @param {String} target.key - * Specifies the property to target. Must be either 'time' or 'segmentIndex' - * @param {Number} target.value - * The value to target for the specified key. - * @returns {Object} - * The sync-point nearest the target - */ - }, { - key: 'selectSyncPoint_', - value: function selectSyncPoint_(syncPoints, target) { - var bestSyncPoint = syncPoints[0].syncPoint; - var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value); - var bestStrategy = syncPoints[0].strategy; - - for (var i = 1; i < syncPoints.length; i++) { - var newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value); - - if (newDistance < bestDistance) { - bestDistance = newDistance; - bestSyncPoint = syncPoints[i].syncPoint; - bestStrategy = syncPoints[i].strategy; - } - } - - this.logger_('syncPoint with strategy <' + bestStrategy + '> chosen: ', bestSyncPoint); - return bestSyncPoint; - } - - /** - * Save any meta-data present on the segments when segments leave - * the live window to the playlist to allow for synchronization at the - * playlist level later. - * - * @param {Playlist} oldPlaylist - The previous active playlist - * @param {Playlist} newPlaylist - The updated and most current playlist - */ - }, { - key: 'saveExpiredSegmentInfo', - value: function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) { - var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - - // When a segment expires from the playlist and it has a start time - // save that information as a possible sync-point reference in future - for (var i = mediaSequenceDiff - 1; i >= 0; i--) { - var lastRemovedSegment = oldPlaylist.segments[i]; - - if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') { - newPlaylist.syncInfo = { - mediaSequence: oldPlaylist.mediaSequence + i, - time: lastRemovedSegment.start - }; - this.logger_('playlist sync:', newPlaylist.syncInfo); - this.trigger('syncinfoupdate'); - break; - } - } - } - - /** - * Save the mapping from playlist's ProgramDateTime to display. This should - * only ever happen once at the start of playback. - * - * @param {Playlist} playlist - The currently active playlist - */ - }, { - key: 'setDateTimeMapping', - value: function setDateTimeMapping(playlist) { - if (!this.datetimeToDisplayTime && playlist.dateTimeObject) { - var playlistTimestamp = playlist.dateTimeObject.getTime() / 1000; - - this.datetimeToDisplayTime = -playlistTimestamp; - } - } - - /** - * Reset the state of the inspection cache when we do a rendition - * switch - */ - }, { - key: 'reset', - value: function reset() { - this.inspectCache_ = undefined; - } - - /** - * Probe or inspect a fmp4 or an mpeg2-ts segment to determine the start - * and end of the segment in it's internal "media time". Used to generate - * mappings from that internal "media time" to the display time that is - * shown on the player. - * - * @param {SegmentInfo} segmentInfo - The current active request information - */ - }, { - key: 'probeSegmentInfo', - value: function probeSegmentInfo(segmentInfo) { - var segment = segmentInfo.segment; - var timingInfo = undefined; - - if (segment.map) { - timingInfo = this.probeMp4Segment_(segmentInfo); - } else { - timingInfo = this.probeTsSegment_(segmentInfo); - } - - if (timingInfo) { - if (this.calculateSegmentTimeMapping_(segmentInfo, timingInfo)) { - this.saveDiscontinuitySyncInfo_(segmentInfo); - } - } - } - - /** - * Probe an fmp4 or an mpeg2-ts segment to determine the start of the segment - * in it's internal "media time". - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - * @return {object} The start and end time of the current segment in "media time" - */ - }, { - key: 'probeMp4Segment_', - value: function probeMp4Segment_(segmentInfo) { - var segment = segmentInfo.segment; - var timescales = _muxJsLibMp4Probe2['default'].timescale(segment.map.bytes); - var startTime = _muxJsLibMp4Probe2['default'].startTime(timescales, segmentInfo.bytes); - - if (segmentInfo.timestampOffset !== null) { - segmentInfo.timestampOffset -= startTime; - } - - return { - start: startTime, - end: startTime + segment.duration - }; - } - - /** - * Probe an mpeg2-ts segment to determine the start and end of the segment - * in it's internal "media time". - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - * @return {object} The start and end time of the current segment in "media time" - */ - }, { - key: 'probeTsSegment_', - value: function probeTsSegment_(segmentInfo) { - var timeInfo = (0, _muxJsLibToolsTsInspectorJs.inspect)(segmentInfo.bytes, this.inspectCache_); - var segmentStartTime = undefined; - var segmentEndTime = undefined; - - if (!timeInfo) { - return null; - } - - if (timeInfo.video && timeInfo.video.length === 2) { - this.inspectCache_ = timeInfo.video[1].dts; - segmentStartTime = timeInfo.video[0].dtsTime; - segmentEndTime = timeInfo.video[1].dtsTime; - } else if (timeInfo.audio && timeInfo.audio.length === 2) { - this.inspectCache_ = timeInfo.audio[1].dts; - segmentStartTime = timeInfo.audio[0].dtsTime; - segmentEndTime = timeInfo.audio[1].dtsTime; - } - - return { - start: segmentStartTime, - end: segmentEndTime - }; - } - }, { - key: 'timestampOffsetForTimeline', - value: function timestampOffsetForTimeline(timeline) { - if (typeof this.timelines[timeline] === 'undefined') { - return null; - } - return this.timelines[timeline].time; - } - - /** - * Use the "media time" for a segment to generate a mapping to "display time" and - * save that display time to the segment. - * - * @private - * @param {SegmentInfo} segmentInfo - * The current active request information - * @param {object} timingInfo - * The start and end time of the current segment in "media time" - * @returns {Boolean} - * Returns false if segment time mapping could not be calculated - */ - }, { - key: 'calculateSegmentTimeMapping_', - value: function calculateSegmentTimeMapping_(segmentInfo, timingInfo) { - var segment = segmentInfo.segment; - var mappingObj = this.timelines[segmentInfo.timeline]; - - if (segmentInfo.timestampOffset !== null) { - this.logger_('tsO:', segmentInfo.timestampOffset); - - mappingObj = { - time: segmentInfo.startOfSegment, - mapping: segmentInfo.startOfSegment - timingInfo.start - }; - this.timelines[segmentInfo.timeline] = mappingObj; - this.trigger('timestampoffset'); - - segment.start = segmentInfo.startOfSegment; - segment.end = timingInfo.end + mappingObj.mapping; - } else if (mappingObj) { - segment.start = timingInfo.start + mappingObj.mapping; - segment.end = timingInfo.end + mappingObj.mapping; - } else { - return false; - } - - return true; - } - - /** - * Each time we have discontinuity in the playlist, attempt to calculate the location - * in display of the start of the discontinuity and save that. We also save an accuracy - * value so that we save values with the most accuracy (closest to 0.) - * - * @private - * @param {SegmentInfo} segmentInfo - The current active request information - */ - }, { - key: 'saveDiscontinuitySyncInfo_', - value: function saveDiscontinuitySyncInfo_(segmentInfo) { - var playlist = segmentInfo.playlist; - var segment = segmentInfo.segment; - - // If the current segment is a discontinuity then we know exactly where - // the start of the range and it's accuracy is 0 (greater accuracy values - // mean more approximation) - if (segment.discontinuity) { - this.discontinuities[segment.timeline] = { - time: segment.start, - accuracy: 0 - }; - } else if (playlist.discontinuityStarts.length) { - // Search for future discontinuities that we can provide better timing - // information for and save that information for sync purposes - for (var i = 0; i < playlist.discontinuityStarts.length; i++) { - var segmentIndex = playlist.discontinuityStarts[i]; - var discontinuity = playlist.discontinuitySequence + i + 1; - var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex; - var accuracy = Math.abs(mediaIndexDiff); - - if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) { - var time = undefined; - - if (mediaIndexDiff < 0) { - time = segment.start - (0, _playlist.sumDurations)(playlist, segmentInfo.mediaIndex, segmentIndex); - } else { - time = segment.end + (0, _playlist.sumDurations)(playlist, segmentInfo.mediaIndex + 1, segmentIndex); - } - - this.discontinuities[discontinuity] = { - time: time, - accuracy: accuracy - }; - } - } - } - } - - /** - * A debugging logger noop that is set to console.log only if debugging - * is enabled globally - * - * @private - */ - }, { - key: 'logger_', - value: function logger_() {} - }]); - - return SyncController; -})(_videoJs2['default'].EventTarget); - -exports['default'] = SyncController; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./playlist":10,"mux.js/lib/mp4/probe":55,"mux.js/lib/tools/ts-inspector.js":57}],18:[function(require,module,exports){ -(function (global){ -/** - * @file vtt-segment-loader.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _segmentLoader = require('./segment-loader'); - -var _segmentLoader2 = _interopRequireDefault(_segmentLoader); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs = require('videojs-contrib-media-sources/es5/remove-cues-from-track.js'); - -var _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2 = _interopRequireDefault(_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs); - -var _binUtils = require('./bin-utils'); - -var VTT_LINE_TERMINATORS = new Uint8Array('\n\n'.split('').map(function (char) { - return char.charCodeAt(0); -})); - -var uintToString = function uintToString(uintArray) { - return String.fromCharCode.apply(null, uintArray); -}; - -/** - * An object that manages segment loading and appending. - * - * @class VTTSegmentLoader - * @param {Object} options required and optional options - * @extends videojs.EventTarget - */ - -var VTTSegmentLoader = (function (_SegmentLoader) { - _inherits(VTTSegmentLoader, _SegmentLoader); - - function VTTSegmentLoader(settings) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - _classCallCheck(this, VTTSegmentLoader); - - _get(Object.getPrototypeOf(VTTSegmentLoader.prototype), 'constructor', this).call(this, settings, options); - - // SegmentLoader requires a MediaSource be specified or it will throw an error; - // however, VTTSegmentLoader has no need of a media source, so delete the reference - this.mediaSource_ = null; - - this.subtitlesTrack_ = null; - } - - /** - * Indicates which time ranges are buffered - * - * @return {TimeRange} - * TimeRange object representing the current buffered ranges - */ - - _createClass(VTTSegmentLoader, [{ - key: 'buffered_', - value: function buffered_() { - if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length) { - return _videoJs2['default'].createTimeRanges(); - } - - var cues = this.subtitlesTrack_.cues; - var start = cues[0].startTime; - var end = cues[cues.length - 1].startTime; - - return _videoJs2['default'].createTimeRanges([[start, end]]); - } - - /** - * Gets and sets init segment for the provided map - * - * @param {Object} map - * The map object representing the init segment to get or set - * @param {Boolean=} set - * If true, the init segment for the provided map should be saved - * @return {Object} - * map object for desired init segment - */ - }, { - key: 'initSegment', - value: function initSegment(map) { - var set = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (!map) { - return null; - } - - var id = (0, _binUtils.initSegmentId)(map); - var storedMap = this.initSegments_[id]; - - if (set && !storedMap && map.bytes) { - // append WebVTT line terminators to the media initialization segment if it exists - // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that - // requires two or more WebVTT line terminators between the WebVTT header and the - // rest of the file - var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength; - var combinedSegment = new Uint8Array(combinedByteLength); - - combinedSegment.set(map.bytes); - combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength); - - this.initSegments_[id] = storedMap = { - resolvedUri: map.resolvedUri, - byterange: map.byterange, - bytes: combinedSegment - }; - } - - return storedMap || map; - } - - /** - * Returns true if all configuration required for loading is present, otherwise false. - * - * @return {Boolean} True if the all configuration is ready for loading - * @private - */ - }, { - key: 'couldBeginLoading_', - value: function couldBeginLoading_() { - return this.playlist_ && this.subtitlesTrack_ && !this.paused(); - } - - /** - * Once all the starting parameters have been specified, begin - * operation. This method should only be invoked from the INIT - * state. - * - * @private - */ - }, { - key: 'init_', - value: function init_() { - this.state = 'READY'; - this.resetEverything(); - return this.monitorBuffer_(); - } - - /** - * Set a subtitle track on the segment loader to add subtitles to - * - * @param {TextTrack} track - * The text track to add loaded subtitles to - */ - }, { - key: 'track', - value: function track(_track) { - this.subtitlesTrack_ = _track; - - // if we were unpaused but waiting for a sourceUpdater, start - // buffering now - if (this.state === 'INIT' && this.couldBeginLoading_()) { - this.init_(); - } - } - - /** - * Remove any data in the source buffer between start and end times - * @param {Number} start - the start time of the region to remove from the buffer - * @param {Number} end - the end time of the region to remove from the buffer - */ - }, { - key: 'remove', - value: function remove(start, end) { - (0, _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2['default'])(start, end, this.subtitlesTrack_); - } - - /** - * fill the buffer with segements unless the sourceBuffers are - * currently updating - * - * Note: this function should only ever be called by monitorBuffer_ - * and never directly - * - * @private - */ - }, { - key: 'fillBuffer_', - value: function fillBuffer_() { - var _this = this; - - if (!this.syncPoint_) { - this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()); - } - - // see if we need to begin loading immediately - var segmentInfo = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(), this.currentTime_(), this.syncPoint_); - - segmentInfo = this.skipEmptySegments_(segmentInfo); - - if (!segmentInfo) { - return; - } - - if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) { - // We don't have the timestamp offset that we need to sync subtitles. - // Rerun on a timestamp offset or user interaction. - var checkTimestampOffset = function checkTimestampOffset() { - _this.state = 'READY'; - if (!_this.paused()) { - // if not paused, queue a buffer check as soon as possible - _this.monitorBuffer_(); - } - }; - - this.syncController_.one('timestampoffset', checkTimestampOffset); - this.state = 'WAITING_ON_TIMELINE'; - return; - } - - this.loadSegment_(segmentInfo); - } - - /** - * Prevents the segment loader from requesting segments we know contain no subtitles - * by walking forward until we find the next segment that we don't know whether it is - * empty or not. - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @return {Object} - * a segment info object that describes the current segment - */ - }, { - key: 'skipEmptySegments_', - value: function skipEmptySegments_(segmentInfo) { - while (segmentInfo && segmentInfo.segment.empty) { - segmentInfo = this.generateSegmentInfo_(segmentInfo.playlist, segmentInfo.mediaIndex + 1, segmentInfo.startOfSegment + segmentInfo.duration, segmentInfo.isSyncRequest); - } - return segmentInfo; - } - - /** - * append a decrypted segement to the SourceBuffer through a SourceUpdater - * - * @private - */ - }, { - key: 'handleSegment_', - value: function handleSegment_() { - var _this2 = this; - - if (!this.pendingSegment_) { - this.state = 'READY'; - return; - } - - this.state = 'APPENDING'; - - var segmentInfo = this.pendingSegment_; - var segment = segmentInfo.segment; - - // Make sure that vttjs has loaded, otherwise, wait till it finished loading - if (typeof _globalWindow2['default'].WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) { - var _ret = (function () { - - var loadHandler = function loadHandler() { - _this2.handleSegment_(); - }; - - _this2.state = 'WAITING_ON_VTTJS'; - _this2.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler); - _this2.subtitlesTrack_.tech_.one('vttjserror', function () { - _this2.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler); - _this2.error({ - message: 'Error loading vtt.js' - }); - _this2.state = 'READY'; - _this2.pause(); - _this2.trigger('error'); - }); - - return { - v: undefined - }; - })(); - - if (typeof _ret === 'object') return _ret.v; - } - - segment.requested = true; - - try { - this.parseVTTCues_(segmentInfo); - } catch (e) { - this.error({ - message: e.message - }); - this.state = 'READY'; - this.pause(); - return this.trigger('error'); - } - - this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_); - - if (segmentInfo.isSyncRequest) { - this.trigger('syncinfoupdate'); - this.pendingSegment_ = null; - this.state = 'READY'; - return; - } - - segmentInfo.byteLength = segmentInfo.bytes.byteLength; - - this.mediaSecondsLoaded += segment.duration; - - segmentInfo.cues.forEach(function (cue) { - _this2.subtitlesTrack_.addCue(cue); - }); - - this.handleUpdateEnd_(); - } - - /** - * Uses the WebVTT parser to parse the segment response - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @private - */ - }, { - key: 'parseVTTCues_', - value: function parseVTTCues_(segmentInfo) { - var decoder = undefined; - var decodeBytesToString = false; - - if (typeof _globalWindow2['default'].TextDecoder === 'function') { - decoder = new _globalWindow2['default'].TextDecoder('utf8'); - } else { - decoder = _globalWindow2['default'].WebVTT.StringDecoder(); - decodeBytesToString = true; - } - - var parser = new _globalWindow2['default'].WebVTT.Parser(_globalWindow2['default'], _globalWindow2['default'].vttjs, decoder); - - segmentInfo.cues = []; - segmentInfo.timestampmap = { MPEGTS: 0, LOCAL: 0 }; - - parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues); - parser.ontimestampmap = function (map) { - return segmentInfo.timestampmap = map; - }; - parser.onparsingerror = function (error) { - _videoJs2['default'].log.warn('Error encountered when parsing cues: ' + error.message); - }; - - if (segmentInfo.segment.map) { - var mapData = segmentInfo.segment.map.bytes; - - if (decodeBytesToString) { - mapData = uintToString(mapData); - } - - parser.parse(mapData); - } - - var segmentData = segmentInfo.bytes; - - if (decodeBytesToString) { - segmentData = uintToString(segmentData); - } - - parser.parse(segmentData); - parser.flush(); - } - - /** - * Updates the start and end times of any cues parsed by the WebVTT parser using - * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping - * from the SyncController - * - * @param {Object} segmentInfo - * a segment info object that describes the current segment - * @param {Object} mappingObj - * object containing a mapping from TS to media time - * @param {Object} playlist - * the playlist object containing the segment - * @private - */ - }, { - key: 'updateTimeMapping_', - value: function updateTimeMapping_(segmentInfo, mappingObj, playlist) { - var segment = segmentInfo.segment; - - if (!mappingObj) { - // If the sync controller does not have a mapping of TS to Media Time for the - // timeline, then we don't have enough information to update the cue - // start/end times - return; - } - - if (!segmentInfo.cues.length) { - // If there are no cues, we also do not have enough information to figure out - // segment timing. Mark that the segment contains no cues so we don't re-request - // an empty segment. - segment.empty = true; - return; - } - - var timestampmap = segmentInfo.timestampmap; - var diff = timestampmap.MPEGTS / 90000 - timestampmap.LOCAL + mappingObj.mapping; - - segmentInfo.cues.forEach(function (cue) { - // First convert cue time to TS time using the timestamp-map provided within the vtt - cue.startTime += diff; - cue.endTime += diff; - }); - - if (!playlist.syncInfo) { - var firstStart = segmentInfo.cues[0].startTime; - var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime; - - playlist.syncInfo = { - mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex, - time: Math.min(firstStart, lastStart - segment.duration) - }; - } - } - }]); - - return VTTSegmentLoader; -})(_segmentLoader2['default']); - -exports['default'] = VTTSegmentLoader; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./bin-utils":2,"./segment-loader":15,"global/window":30,"videojs-contrib-media-sources/es5/remove-cues-from-track.js":71}],19:[function(require,module,exports){ -(function (global){ -/** - * @file xhr.js - */ - -/** - * A wrapper for videojs.xhr that tracks bandwidth. - * - * @param {Object} options options for the XHR - * @param {Function} callback the callback to call when done - * @return {Request} the xhr request that is going to be made - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var xhrFactory = function xhrFactory() { - var xhr = function XhrFunction(options, callback) { - // Add a default timeout for all hls requests - options = (0, _videoJs.mergeOptions)({ - timeout: 45e3 - }, options); - - // Allow an optional user-specified function to modify the option - // object before we construct the xhr request - var beforeRequest = XhrFunction.beforeRequest || _videoJs2['default'].Hls.xhr.beforeRequest; - - if (beforeRequest && typeof beforeRequest === 'function') { - var newOptions = beforeRequest(options); - - if (newOptions) { - options = newOptions; - } - } - - var request = (0, _videoJs.xhr)(options, function (error, response) { - var reqResponse = request.response; - - if (!error && reqResponse) { - request.responseTime = Date.now(); - request.roundTripTime = request.responseTime - request.requestTime; - request.bytesReceived = reqResponse.byteLength || reqResponse.length; - if (!request.bandwidth) { - request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000); - } - } - - // videojs.xhr now uses a specific code on the error - // object to signal that a request has timed out instead - // of setting a boolean on the request object - if (error && error.code === 'ETIMEDOUT') { - request.timedout = true; - } - - // videojs.xhr no longer considers status codes outside of 200 and 0 - // (for file uris) to be errors, but the old XHR did, so emulate that - // behavior. Status 206 may be used in response to byterange requests. - if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) { - error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText))); - } - - callback(error, request); - }); - var originalAbort = request.abort; - - request.abort = function () { - request.aborted = true; - return originalAbort.apply(request, arguments); - }; - request.uri = options.uri; - request.requestTime = Date.now(); - return request; - }; - - return xhr; -}; - -exports['default'] = xhrFactory; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],20:[function(require,module,exports){ -/** - * @file aes.js - * - * This file contains an adaptation of the AES decryption algorithm - * from the Standford Javascript Cryptography Library. That work is - * covered by the following copyright and permissions notice: - * - * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the authors. - */ - -/** - * Expand the S-box tables. - * - * @private - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var precompute = function precompute() { - var tables = [[[], [], [], [], []], [[], [], [], [], []]]; - var encTable = tables[0]; - var decTable = tables[1]; - var sbox = encTable[4]; - var sboxInv = decTable[4]; - var i = undefined; - var x = undefined; - var xInv = undefined; - var d = []; - var th = []; - var x2 = undefined; - var x4 = undefined; - var x8 = undefined; - var s = undefined; - var tEnc = undefined; - var tDec = undefined; - - // Compute double and third tables - for (i = 0; i < 256; i++) { - th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; - } - - for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { - // Compute sbox - s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; - s = s >> 8 ^ s & 255 ^ 99; - sbox[x] = s; - sboxInv[s] = x; - - // Compute MixColumns - x8 = d[x4 = d[x2 = d[x]]]; - tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - tEnc = d[s] * 0x101 ^ s * 0x1010100; - - for (i = 0; i < 4; i++) { - encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; - decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; - } - } - - // Compactify. Considerable speedup on Firefox. - for (i = 0; i < 5; i++) { - encTable[i] = encTable[i].slice(0); - decTable[i] = decTable[i].slice(0); - } - return tables; -}; -var aesTables = null; - -/** - * Schedule out an AES key for both encryption and decryption. This - * is a low-level class. Use a cipher mode to do bulk encryption. - * - * @class AES - * @param key {Array} The key as an array of 4, 6 or 8 words. - */ - -var AES = (function () { - function AES(key) { - _classCallCheck(this, AES); - - /** - * The expanded S-box and inverse S-box tables. These will be computed - * on the client so that we don't have to send them down the wire. - * - * There are two tables, _tables[0] is for encryption and - * _tables[1] is for decryption. - * - * The first 4 sub-tables are the expanded S-box with MixColumns. The - * last (_tables[01][4]) is the S-box itself. - * - * @private - */ - // if we have yet to precompute the S-box tables - // do so now - if (!aesTables) { - aesTables = precompute(); - } - // then make a copy of that object for use - this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]]; - var i = undefined; - var j = undefined; - var tmp = undefined; - var encKey = undefined; - var decKey = undefined; - var sbox = this._tables[0][4]; - var decTable = this._tables[1]; - var keyLen = key.length; - var rcon = 1; - - if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { - throw new Error('Invalid aes key size'); - } - - encKey = key.slice(0); - decKey = []; - this._key = [encKey, decKey]; - - // schedule encryption keys - for (i = keyLen; i < 4 * keyLen + 28; i++) { - tmp = encKey[i - 1]; - - // apply sbox - if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { - tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; - - // shift rows and add rcon - if (i % keyLen === 0) { - tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; - rcon = rcon << 1 ^ (rcon >> 7) * 283; - } - } - - encKey[i] = encKey[i - keyLen] ^ tmp; - } - - // schedule decryption keys - for (j = 0; i; j++, i--) { - tmp = encKey[j & 3 ? i : i - 4]; - if (i <= 4 || j < 4) { - decKey[j] = tmp; - } else { - decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; - } - } - } - - /** - * Decrypt 16 bytes, specified as four 32-bit words. - * - * @param {Number} encrypted0 the first word to decrypt - * @param {Number} encrypted1 the second word to decrypt - * @param {Number} encrypted2 the third word to decrypt - * @param {Number} encrypted3 the fourth word to decrypt - * @param {Int32Array} out the array to write the decrypted words - * into - * @param {Number} offset the offset into the output array to start - * writing results - * @return {Array} The plaintext. - */ - - _createClass(AES, [{ - key: 'decrypt', - value: function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { - var key = this._key[1]; - // state variables a,b,c,d are loaded with pre-whitened data - var a = encrypted0 ^ key[0]; - var b = encrypted3 ^ key[1]; - var c = encrypted2 ^ key[2]; - var d = encrypted1 ^ key[3]; - var a2 = undefined; - var b2 = undefined; - var c2 = undefined; - - // key.length === 2 ? - var nInnerRounds = key.length / 4 - 2; - var i = undefined; - var kIndex = 4; - var table = this._tables[1]; - - // load up the tables - var table0 = table[0]; - var table1 = table[1]; - var table2 = table[2]; - var table3 = table[3]; - var sbox = table[4]; - - // Inner rounds. Cribbed from OpenSSL. - for (i = 0; i < nInnerRounds; i++) { - a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; - b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; - c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; - d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; - kIndex += 4; - a = a2;b = b2;c = c2; - } - - // Last round. - for (i = 0; i < 4; i++) { - out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; - a2 = a;a = b;b = c;c = d;d = a2; - } - } - }]); - - return AES; -})(); - -exports['default'] = AES; -module.exports = exports['default']; -},{}],21:[function(require,module,exports){ -/** - * @file async-stream.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _stream = require('./stream'); - -var _stream2 = _interopRequireDefault(_stream); - -/** - * A wrapper around the Stream class to use setTiemout - * and run stream "jobs" Asynchronously - * - * @class AsyncStream - * @extends Stream - */ - -var AsyncStream = (function (_Stream) { - _inherits(AsyncStream, _Stream); - - function AsyncStream() { - _classCallCheck(this, AsyncStream); - - _get(Object.getPrototypeOf(AsyncStream.prototype), 'constructor', this).call(this, _stream2['default']); - this.jobs = []; - this.delay = 1; - this.timeout_ = null; - } - - /** - * process an async job - * - * @private - */ - - _createClass(AsyncStream, [{ - key: 'processJob_', - value: function processJob_() { - this.jobs.shift()(); - if (this.jobs.length) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } else { - this.timeout_ = null; - } - } - - /** - * push a job into the stream - * - * @param {Function} job the job to push into the stream - */ - }, { - key: 'push', - value: function push(job) { - this.jobs.push(job); - if (!this.timeout_) { - this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay); - } - } - }]); - - return AsyncStream; -})(_stream2['default']); - -exports['default'] = AsyncStream; -module.exports = exports['default']; -},{"./stream":24}],22:[function(require,module,exports){ -/** - * @file decrypter.js - * - * An asynchronous implementation of AES-128 CBC decryption with - * PKCS#7 padding. - */ - -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _aes = require('./aes'); - -var _aes2 = _interopRequireDefault(_aes); - -var _asyncStream = require('./async-stream'); - -var _asyncStream2 = _interopRequireDefault(_asyncStream); - -var _pkcs7 = require('pkcs7'); - -/** - * Convert network-order (big-endian) bytes into their little-endian - * representation. - */ -var ntoh = function ntoh(word) { - return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; -}; - -/** - * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * use for the first round of CBC. - * @return {Uint8Array} the decrypted bytes - * - * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard - * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 - * @see https://tools.ietf.org/html/rfc2315 - */ -var decrypt = function decrypt(encrypted, key, initVector) { - // word-level access to the encrypted bytes - var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2); - - var decipher = new _aes2['default'](Array.prototype.slice.call(key)); - - // byte and word-level access for the decrypted output - var decrypted = new Uint8Array(encrypted.byteLength); - var decrypted32 = new Int32Array(decrypted.buffer); - - // temporary variables for working with the IV, encrypted, and - // decrypted data - var init0 = undefined; - var init1 = undefined; - var init2 = undefined; - var init3 = undefined; - var encrypted0 = undefined; - var encrypted1 = undefined; - var encrypted2 = undefined; - var encrypted3 = undefined; - - // iteration variable - var wordIx = undefined; - - // pull out the words of the IV to ensure we don't modify the - // passed-in reference and easier access - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; - - // decrypt four word sequences, applying cipher-block chaining (CBC) - // to each decrypted block - for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { - // convert big-endian (network order) words into little-endian - // (javascript order) - encrypted0 = ntoh(encrypted32[wordIx]); - encrypted1 = ntoh(encrypted32[wordIx + 1]); - encrypted2 = ntoh(encrypted32[wordIx + 2]); - encrypted3 = ntoh(encrypted32[wordIx + 3]); - - // decrypt the block - decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); - - // XOR with the IV, and restore network byte-order to obtain the - // plaintext - decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0); - decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1); - decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2); - decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); - - // setup the IV for the next round - init0 = encrypted0; - init1 = encrypted1; - init2 = encrypted2; - init3 = encrypted3; - } - - return decrypted; -}; - -exports.decrypt = decrypt; -/** - * The `Decrypter` class that manages decryption of AES - * data through `AsyncStream` objects and the `decrypt` - * function - * - * @param {Uint8Array} encrypted the encrypted bytes - * @param {Uint32Array} key the bytes of the decryption key - * @param {Uint32Array} initVector the initialization vector (IV) to - * @param {Function} done the function to run when done - * @class Decrypter - */ - -var Decrypter = (function () { - function Decrypter(encrypted, key, initVector, done) { - _classCallCheck(this, Decrypter); - - var step = Decrypter.STEP; - var encrypted32 = new Int32Array(encrypted.buffer); - var decrypted = new Uint8Array(encrypted.byteLength); - var i = 0; - - this.asyncStream_ = new _asyncStream2['default'](); - - // split up the encryption job and do the individual chunks asynchronously - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - for (i = step; i < encrypted32.length; i += step) { - initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]); - this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted)); - } - // invoke the done() callback when everything is finished - this.asyncStream_.push(function () { - // remove pkcs#7 padding from the decrypted bytes - done(null, (0, _pkcs7.unpad)(decrypted)); - }); - } - - /** - * a getter for step the maximum number of bytes to process at one time - * - * @return {Number} the value of step 32000 - */ - - _createClass(Decrypter, [{ - key: 'decryptChunk_', - - /** - * @private - */ - value: function decryptChunk_(encrypted, key, initVector, decrypted) { - return function () { - var bytes = decrypt(encrypted, key, initVector); - - decrypted.set(bytes, encrypted.byteOffset); - }; - } - }], [{ - key: 'STEP', - get: function get() { - // 4 * 8000; - return 32000; - } - }]); - - return Decrypter; -})(); - -exports.Decrypter = Decrypter; -exports['default'] = { - Decrypter: Decrypter, - decrypt: decrypt -}; -},{"./aes":20,"./async-stream":21,"pkcs7":26}],23:[function(require,module,exports){ -/** - * @file index.js - * - * Index module to easily import the primary components of AES-128 - * decryption. Like this: - * - * ```js - * import {Decrypter, decrypt, AsyncStream} from 'aes-decrypter'; - * ``` - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _decrypter = require('./decrypter'); - -var _asyncStream = require('./async-stream'); - -var _asyncStream2 = _interopRequireDefault(_asyncStream); - -exports['default'] = { - decrypt: _decrypter.decrypt, - Decrypter: _decrypter.Decrypter, - AsyncStream: _asyncStream2['default'] -}; -module.exports = exports['default']; -},{"./async-stream":21,"./decrypter":22}],24:[function(require,module,exports){ -/** - * @file stream.js - */ -/** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var Stream = (function () { - function Stream() { - _classCallCheck(this, Stream); - - this.listeners = {}; - } - - /** - * Add a listener for a specified event type. - * - * @param {String} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - _createClass(Stream, [{ - key: 'on', - value: function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - this.listeners[type].push(listener); - } - - /** - * Remove a listener for a specified event type. - * - * @param {String} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {Boolean} if we could turn it off or not - */ - }, { - key: 'off', - value: function off(type, listener) { - var index = undefined; - - if (!this.listeners[type]) { - return false; - } - index = this.listeners[type].indexOf(listener); - this.listeners[type].splice(index, 1); - return index > -1; - } - - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {String} type the event name - */ - }, { - key: 'trigger', - value: function trigger(type) { - var callbacks = undefined; - var i = undefined; - var length = undefined; - var args = undefined; - - callbacks = this.listeners[type]; - if (!callbacks) { - return; - } - // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - if (arguments.length === 2) { - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = Array.prototype.slice.call(arguments, 1); - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - } - - /** - * Destroys the stream and cleans up. - */ - }, { - key: 'dispose', - value: function dispose() { - this.listeners = {}; - } - - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - }, { - key: 'pipe', - value: function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - } - }]); - - return Stream; -})(); - -exports['default'] = Stream; -module.exports = exports['default']; -},{}],25:[function(require,module,exports){ -/* - * pkcs7.pad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ - -'use strict'; - -var PADDING; - -/** - * Returns a new Uint8Array that is padded with PKCS#7 padding. - * @param plaintext {Uint8Array} the input bytes before encryption - * @return {Uint8Array} the padded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ -module.exports = function pad(plaintext) { - var padding = PADDING[(plaintext.byteLength % 16) || 0], - result = new Uint8Array(plaintext.byteLength + padding.length); - result.set(plaintext); - result.set(padding, plaintext.byteLength); - return result; -}; - -// pre-define the padding values -PADDING = [ - [16, 16, 16, 16, - 16, 16, 16, 16, - 16, 16, 16, 16, - 16, 16, 16, 16], - - [15, 15, 15, 15, - 15, 15, 15, 15, - 15, 15, 15, 15, - 15, 15, 15], - - [14, 14, 14, 14, - 14, 14, 14, 14, - 14, 14, 14, 14, - 14, 14], - - [13, 13, 13, 13, - 13, 13, 13, 13, - 13, 13, 13, 13, - 13], - - [12, 12, 12, 12, - 12, 12, 12, 12, - 12, 12, 12, 12], - - [11, 11, 11, 11, - 11, 11, 11, 11, - 11, 11, 11], - - [10, 10, 10, 10, - 10, 10, 10, 10, - 10, 10], - - [9, 9, 9, 9, - 9, 9, 9, 9, - 9], - - [8, 8, 8, 8, - 8, 8, 8, 8], - - [7, 7, 7, 7, - 7, 7, 7], - - [6, 6, 6, 6, - 6, 6], - - [5, 5, 5, 5, - 5], - - [4, 4, 4, 4], - - [3, 3, 3], - - [2, 2], - - [1] -]; - -},{}],26:[function(require,module,exports){ -/* - * pkcs7 - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ - -'use strict'; - -exports.pad = require('./pad.js'); -exports.unpad = require('./unpad.js'); - -},{"./pad.js":25,"./unpad.js":27}],27:[function(require,module,exports){ -/* - * pkcs7.unpad - * https://github.com/brightcove/pkcs7 - * - * Copyright (c) 2014 Brightcove - * Licensed under the apache2 license. - */ - -'use strict'; - -/** - * Returns the subarray of a Uint8Array without PKCS#7 padding. - * @param padded {Uint8Array} unencrypted bytes that have been padded - * @return {Uint8Array} the unpadded bytes - * @see http://tools.ietf.org/html/rfc5652 - */ -module.exports = function unpad(padded) { - return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); -}; - -},{}],28:[function(require,module,exports){ - -},{}],29:[function(require,module,exports){ -(function (global){ -var topLevel = typeof global !== 'undefined' ? global : - typeof window !== 'undefined' ? window : {} -var minDoc = require('min-document'); - -var doccy; - -if (typeof document !== 'undefined') { - doccy = document; -} else { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; - - if (!doccy) { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; - } -} - -module.exports = doccy; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"min-document":28}],30:[function(require,module,exports){ -(function (global){ -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof global !== "undefined") { - win = global; -} else if (typeof self !== "undefined"){ - win = self; -} else { - win = {}; -} - -module.exports = win; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],31:[function(require,module,exports){ -'use strict'; - -var _lineStream = require('./line-stream'); - -var _lineStream2 = _interopRequireDefault(_lineStream); - -var _parseStream = require('./parse-stream'); - -var _parseStream2 = _interopRequireDefault(_parseStream); - -var _parser = require('./parser'); - -var _parser2 = _interopRequireDefault(_parser); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -module.exports = { - LineStream: _lineStream2['default'], - ParseStream: _parseStream2['default'], - Parser: _parser2['default'] -}; /** - * @file m3u8/index.js - * - * Utilities for parsing M3U8 files. If the entire manifest is available, - * `Parser` will create an object representation with enough detail for managing - * playback. `ParseStream` and `LineStream` are lower-level parsing primitives - * that do not assume the entirety of the manifest is ready and expose a - * ReadableStream-like interface. - */ -},{"./line-stream":32,"./parse-stream":33,"./parser":34}],32:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _stream = require('./stream'); - -var _stream2 = _interopRequireDefault(_stream); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** - * @file m3u8/line-stream.js - */ - - -/** - * A stream that buffers string input and generates a `data` event for each - * line. - * - * @class LineStream - * @extends Stream - */ -var LineStream = function (_Stream) { - _inherits(LineStream, _Stream); - - function LineStream() { - _classCallCheck(this, LineStream); - - var _this = _possibleConstructorReturn(this, (LineStream.__proto__ || Object.getPrototypeOf(LineStream)).call(this)); - - _this.buffer = ''; - return _this; - } - - /** - * Add new data to be parsed. - * - * @param {String} data the text to process - */ - - - _createClass(LineStream, [{ - key: 'push', - value: function push(data) { - var nextNewline = void 0; - - this.buffer += data; - nextNewline = this.buffer.indexOf('\n'); - - for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\n')) { - this.trigger('data', this.buffer.substring(0, nextNewline)); - this.buffer = this.buffer.substring(nextNewline + 1); - } - } - }]); - - return LineStream; -}(_stream2['default']); - -exports['default'] = LineStream; -},{"./stream":35}],33:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _stream = require('./stream'); - -var _stream2 = _interopRequireDefault(_stream); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** - * @file m3u8/parse-stream.js - */ - - -/** - * "forgiving" attribute list psuedo-grammar: - * attributes -> keyvalue (',' keyvalue)* - * keyvalue -> key '=' value - * key -> [^=]* - * value -> '"' [^"]* '"' | [^,]* - */ -var attributeSeparator = function attributeSeparator() { - var key = '[^=]*'; - var value = '"[^"]*"|[^,]*'; - var keyvalue = '(?:' + key + ')=(?:' + value + ')'; - - return new RegExp('(?:^|,)(' + keyvalue + ')'); -}; - -/** - * Parse attributes from a line given the seperator - * - * @param {String} attributes the attibute line to parse - */ -var parseAttributes = function parseAttributes(attributes) { - // split the string using attributes as the separator - var attrs = attributes.split(attributeSeparator()); - var result = {}; - var i = attrs.length; - var attr = void 0; - - while (i--) { - // filter out unmatched portions of the string - if (attrs[i] === '') { - continue; - } - - // split the key and value - attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); - // trim whitespace and remove optional quotes around the value - attr[0] = attr[0].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^\s+|\s+$/g, ''); - attr[1] = attr[1].replace(/^['"](.*)['"]$/g, '$1'); - result[attr[0]] = attr[1]; - } - return result; -}; - -/** - * A line-level M3U8 parser event stream. It expects to receive input one - * line at a time and performs a context-free parse of its contents. A stream - * interpretation of a manifest can be useful if the manifest is expected to - * be too large to fit comfortably into memory or the entirety of the input - * is not immediately available. Otherwise, it's probably much easier to work - * with a regular `Parser` object. - * - * Produces `data` events with an object that captures the parser's - * interpretation of the input. That object has a property `tag` that is one - * of `uri`, `comment`, or `tag`. URIs only have a single additional - * property, `line`, which captures the entirety of the input without - * interpretation. Comments similarly have a single additional property - * `text` which is the input without the leading `#`. - * - * Tags always have a property `tagType` which is the lower-cased version of - * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, - * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized - * tags are given the tag type `unknown` and a single additional property - * `data` with the remainder of the input. - * - * @class ParseStream - * @extends Stream - */ - -var ParseStream = function (_Stream) { - _inherits(ParseStream, _Stream); - - function ParseStream() { - _classCallCheck(this, ParseStream); - - return _possibleConstructorReturn(this, (ParseStream.__proto__ || Object.getPrototypeOf(ParseStream)).call(this)); - } - - /** - * Parses an additional line of input. - * - * @param {String} line a single line of an M3U8 file to parse - */ - - - _createClass(ParseStream, [{ - key: 'push', - value: function push(line) { - var match = void 0; - var event = void 0; - - // strip whitespace - line = line.replace(/^[\u0000\s]+|[\u0000\s]+$/g, ''); - if (line.length === 0) { - // ignore empty lines - return; - } - - // URIs - if (line[0] !== '#') { - this.trigger('data', { - type: 'uri', - uri: line - }); - return; - } - - // Comments - if (line.indexOf('#EXT') !== 0) { - this.trigger('data', { - type: 'comment', - text: line.slice(1) - }); - return; - } - - // strip off any carriage returns here so the regex matching - // doesn't have to account for them. - line = line.replace('\r', ''); - - // Tags - match = /^#EXTM3U/.exec(line); - if (match) { - this.trigger('data', { - type: 'tag', - tagType: 'm3u' - }); - return; - } - match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'inf' - }; - if (match[1]) { - event.duration = parseFloat(match[1]); - } - if (match[2]) { - event.title = match[2]; - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'targetduration' - }; - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'totalduration' - }; - if (match[1]) { - event.duration = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'version' - }; - if (match[1]) { - event.version = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'media-sequence' - }; - if (match[1]) { - event.number = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'discontinuity-sequence' - }; - if (match[1]) { - event.number = parseInt(match[1], 10); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'playlist-type' - }; - if (match[1]) { - event.playlistType = match[1]; - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'byterange' - }; - if (match[1]) { - event.length = parseInt(match[1], 10); - } - if (match[2]) { - event.offset = parseInt(match[2], 10); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'allow-cache' - }; - if (match[1]) { - event.allowed = !/NO/.test(match[1]); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-MAP:?(.*)$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'map' - }; - - if (match[1]) { - var attributes = parseAttributes(match[1]); - - if (attributes.URI) { - event.uri = attributes.URI; - } - if (attributes.BYTERANGE) { - var _attributes$BYTERANGE = attributes.BYTERANGE.split('@'), - _attributes$BYTERANGE2 = _slicedToArray(_attributes$BYTERANGE, 2), - length = _attributes$BYTERANGE2[0], - offset = _attributes$BYTERANGE2[1]; - - event.byterange = {}; - if (length) { - event.byterange.length = parseInt(length, 10); - } - if (offset) { - event.byterange.offset = parseInt(offset, 10); - } - } - } - - this.trigger('data', event); - return; - } - match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'stream-inf' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - - if (event.attributes.RESOLUTION) { - var split = event.attributes.RESOLUTION.split('x'); - var resolution = {}; - - if (split[0]) { - resolution.width = parseInt(split[0], 10); - } - if (split[1]) { - resolution.height = parseInt(split[1], 10); - } - event.attributes.RESOLUTION = resolution; - } - if (event.attributes.BANDWIDTH) { - event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10); - } - if (event.attributes['PROGRAM-ID']) { - event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10); - } - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-MEDIA:?(.*)$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'media' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-ENDLIST/.exec(line); - if (match) { - this.trigger('data', { - type: 'tag', - tagType: 'endlist' - }); - return; - } - match = /^#EXT-X-DISCONTINUITY/.exec(line); - if (match) { - this.trigger('data', { - type: 'tag', - tagType: 'discontinuity' - }); - return; - } - match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'program-date-time' - }; - if (match[1]) { - event.dateTimeString = match[1]; - event.dateTimeObject = new Date(match[1]); - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-KEY:?(.*)$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'key' - }; - if (match[1]) { - event.attributes = parseAttributes(match[1]); - // parse the IV string into a Uint32Array - if (event.attributes.IV) { - if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') { - event.attributes.IV = event.attributes.IV.substring(2); - } - - event.attributes.IV = event.attributes.IV.match(/.{8}/g); - event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16); - event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16); - event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16); - event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16); - event.attributes.IV = new Uint32Array(event.attributes.IV); - } - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'cue-out-cont' - }; - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'cue-out' - }; - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - this.trigger('data', event); - return; - } - match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(line); - if (match) { - event = { - type: 'tag', - tagType: 'cue-in' - }; - if (match[1]) { - event.data = match[1]; - } else { - event.data = ''; - } - this.trigger('data', event); - return; - } - - // unknown tag type - this.trigger('data', { - type: 'tag', - data: line.slice(4) - }); - } - }]); - - return ParseStream; -}(_stream2['default']); - -exports['default'] = ParseStream; -},{"./stream":35}],34:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _stream = require('./stream'); - -var _stream2 = _interopRequireDefault(_stream); - -var _lineStream = require('./line-stream'); - -var _lineStream2 = _interopRequireDefault(_lineStream); - -var _parseStream = require('./parse-stream'); - -var _parseStream2 = _interopRequireDefault(_parseStream); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** - * @file m3u8/parser.js - */ - - -/** - * A parser for M3U8 files. The current interpretation of the input is - * exposed as a property `manifest` on parser objects. It's just two lines to - * create and parse a manifest once you have the contents available as a string: - * - * ```js - * var parser = new m3u8.Parser(); - * parser.push(xhr.responseText); - * ``` - * - * New input can later be applied to update the manifest object by calling - * `push` again. - * - * The parser attempts to create a usable manifest object even if the - * underlying input is somewhat nonsensical. It emits `info` and `warning` - * events during the parse if it encounters input that seems invalid or - * requires some property of the manifest object to be defaulted. - * - * @class Parser - * @extends Stream - */ -var Parser = function (_Stream) { - _inherits(Parser, _Stream); - - function Parser() { - _classCallCheck(this, Parser); - - var _this = _possibleConstructorReturn(this, (Parser.__proto__ || Object.getPrototypeOf(Parser)).call(this)); - - _this.lineStream = new _lineStream2['default'](); - _this.parseStream = new _parseStream2['default'](); - _this.lineStream.pipe(_this.parseStream); - /* eslint-disable consistent-this */ - var self = _this; - /* eslint-enable consistent-this */ - var uris = []; - var currentUri = {}; - // if specified, the active EXT-X-MAP definition - var currentMap = void 0; - // if specified, the active decryption key - var _key = void 0; - var noop = function noop() {}; - var defaultMediaGroups = { - 'AUDIO': {}, - 'VIDEO': {}, - 'CLOSED-CAPTIONS': {}, - 'SUBTITLES': {} - }; - // group segments into numbered timelines delineated by discontinuities - var currentTimeline = 0; - - // the manifest is empty until the parse stream begins delivering data - _this.manifest = { - allowCache: true, - discontinuityStarts: [], - segments: [] - }; - - // update the manifest with the m3u8 entry from the parse stream - _this.parseStream.on('data', function (entry) { - var mediaGroup = void 0; - var rendition = void 0; - - ({ - tag: function tag() { - // switch based on the tag type - (({ - 'allow-cache': function allowCache() { - this.manifest.allowCache = entry.allowed; - if (!('allowed' in entry)) { - this.trigger('info', { - message: 'defaulting allowCache to YES' - }); - this.manifest.allowCache = true; - } - }, - byterange: function byterange() { - var byterange = {}; - - if ('length' in entry) { - currentUri.byterange = byterange; - byterange.length = entry.length; - - if (!('offset' in entry)) { - this.trigger('info', { - message: 'defaulting offset to zero' - }); - entry.offset = 0; - } - } - if ('offset' in entry) { - currentUri.byterange = byterange; - byterange.offset = entry.offset; - } - }, - endlist: function endlist() { - this.manifest.endList = true; - }, - inf: function inf() { - if (!('mediaSequence' in this.manifest)) { - this.manifest.mediaSequence = 0; - this.trigger('info', { - message: 'defaulting media sequence to zero' - }); - } - if (!('discontinuitySequence' in this.manifest)) { - this.manifest.discontinuitySequence = 0; - this.trigger('info', { - message: 'defaulting discontinuity sequence to zero' - }); - } - if (entry.duration > 0) { - currentUri.duration = entry.duration; - } - - if (entry.duration === 0) { - currentUri.duration = 0.01; - this.trigger('info', { - message: 'updating zero segment duration to a small value' - }); - } - - this.manifest.segments = uris; - }, - key: function key() { - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring key declaration without attribute list' - }); - return; - } - // clear the active encryption key - if (entry.attributes.METHOD === 'NONE') { - _key = null; - return; - } - if (!entry.attributes.URI) { - this.trigger('warn', { - message: 'ignoring key declaration without URI' - }); - return; - } - if (!entry.attributes.METHOD) { - this.trigger('warn', { - message: 'defaulting key method to AES-128' - }); - } - - // setup an encryption key for upcoming segments - _key = { - method: entry.attributes.METHOD || 'AES-128', - uri: entry.attributes.URI - }; - - if (typeof entry.attributes.IV !== 'undefined') { - _key.iv = entry.attributes.IV; - } - }, - 'media-sequence': function mediaSequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid media sequence: ' + entry.number - }); - return; - } - this.manifest.mediaSequence = entry.number; - }, - 'discontinuity-sequence': function discontinuitySequence() { - if (!isFinite(entry.number)) { - this.trigger('warn', { - message: 'ignoring invalid discontinuity sequence: ' + entry.number - }); - return; - } - this.manifest.discontinuitySequence = entry.number; - currentTimeline = entry.number; - }, - 'playlist-type': function playlistType() { - if (!/VOD|EVENT/.test(entry.playlistType)) { - this.trigger('warn', { - message: 'ignoring unknown playlist type: ' + entry.playlist - }); - return; - } - this.manifest.playlistType = entry.playlistType; - }, - map: function map() { - currentMap = {}; - if (entry.uri) { - currentMap.uri = entry.uri; - } - if (entry.byterange) { - currentMap.byterange = entry.byterange; - } - }, - 'stream-inf': function streamInf() { - this.manifest.playlists = uris; - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!entry.attributes) { - this.trigger('warn', { - message: 'ignoring empty stream-inf attributes' - }); - return; - } - - if (!currentUri.attributes) { - currentUri.attributes = {}; - } - _extends(currentUri.attributes, entry.attributes); - }, - media: function media() { - this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; - - if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) { - this.trigger('warn', { - message: 'ignoring incomplete or missing media group' - }); - return; - } - - // find the media group, creating defaults as necessary - var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE]; - - mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {}; - mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; - - // collect the rendition metadata - rendition = { - 'default': /yes/i.test(entry.attributes.DEFAULT) - }; - if (rendition['default']) { - rendition.autoselect = true; - } else { - rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT); - } - if (entry.attributes.LANGUAGE) { - rendition.language = entry.attributes.LANGUAGE; - } - if (entry.attributes.URI) { - rendition.uri = entry.attributes.URI; - } - if (entry.attributes['INSTREAM-ID']) { - rendition.instreamId = entry.attributes['INSTREAM-ID']; - } - if (entry.attributes.CHARACTERISTICS) { - rendition.characteristics = entry.attributes.CHARACTERISTICS; - } - if (entry.attributes.FORCED) { - rendition.forced = /yes/i.test(entry.attributes.FORCED); - } - - // insert the new rendition - mediaGroup[entry.attributes.NAME] = rendition; - }, - discontinuity: function discontinuity() { - currentTimeline += 1; - currentUri.discontinuity = true; - this.manifest.discontinuityStarts.push(uris.length); - }, - 'program-date-time': function programDateTime() { - this.manifest.dateTimeString = entry.dateTimeString; - this.manifest.dateTimeObject = entry.dateTimeObject; - }, - targetduration: function targetduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid target duration: ' + entry.duration - }); - return; - } - this.manifest.targetDuration = entry.duration; - }, - totalduration: function totalduration() { - if (!isFinite(entry.duration) || entry.duration < 0) { - this.trigger('warn', { - message: 'ignoring invalid total duration: ' + entry.duration - }); - return; - } - this.manifest.totalDuration = entry.duration; - }, - 'cue-out': function cueOut() { - currentUri.cueOut = entry.data; - }, - 'cue-out-cont': function cueOutCont() { - currentUri.cueOutCont = entry.data; - }, - 'cue-in': function cueIn() { - currentUri.cueIn = entry.data; - } - })[entry.tagType] || noop).call(self); - }, - uri: function uri() { - currentUri.uri = entry.uri; - uris.push(currentUri); - - // if no explicit duration was declared, use the target duration - if (this.manifest.targetDuration && !('duration' in currentUri)) { - this.trigger('warn', { - message: 'defaulting segment duration to the target duration' - }); - currentUri.duration = this.manifest.targetDuration; - } - // annotate with encryption information, if necessary - if (_key) { - currentUri.key = _key; - } - currentUri.timeline = currentTimeline; - // annotate with initialization segment information, if necessary - if (currentMap) { - currentUri.map = currentMap; - } - - // prepare for the next URI - currentUri = {}; - }, - comment: function comment() { - // comments are not important for playback - } - })[entry.type].call(self); - }); - - return _this; - } - - /** - * Parse the input string and update the manifest object. - * - * @param {String} chunk a potentially incomplete portion of the manifest - */ - - - _createClass(Parser, [{ - key: 'push', - value: function push(chunk) { - this.lineStream.push(chunk); - } - - /** - * Flush any remaining input. This can be handy if the last line of an M3U8 - * manifest did not contain a trailing newline but the file has been - * completely received. - */ - - }, { - key: 'end', - value: function end() { - // flush any buffered input - this.lineStream.push('\n'); - } - }]); - - return Parser; -}(_stream2['default']); - -exports['default'] = Parser; -},{"./line-stream":32,"./parse-stream":33,"./stream":35}],35:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * @file stream.js - */ -/** - * A lightweight readable stream implemention that handles event dispatching. - * - * @class Stream - */ -var Stream = function () { - function Stream() { - _classCallCheck(this, Stream); - - this.listeners = {}; - } - - /** - * Add a listener for a specified event type. - * - * @param {String} type the event name - * @param {Function} listener the callback to be invoked when an event of - * the specified type occurs - */ - - - _createClass(Stream, [{ - key: 'on', - value: function on(type, listener) { - if (!this.listeners[type]) { - this.listeners[type] = []; - } - this.listeners[type].push(listener); - } - - /** - * Remove a listener for a specified event type. - * - * @param {String} type the event name - * @param {Function} listener a function previously registered for this - * type of event through `on` - * @return {Boolean} if we could turn it off or not - */ - - }, { - key: 'off', - value: function off(type, listener) { - if (!this.listeners[type]) { - return false; - } - - var index = this.listeners[type].indexOf(listener); - - this.listeners[type].splice(index, 1); - return index > -1; - } - - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * - * @param {String} type the event name - */ - - }, { - key: 'trigger', - value: function trigger(type) { - var callbacks = this.listeners[type]; - var i = void 0; - var length = void 0; - var args = void 0; - - if (!callbacks) { - return; - } - // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - if (arguments.length === 2) { - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = Array.prototype.slice.call(arguments, 1); - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - } - - /** - * Destroys the stream and cleans up. - */ - - }, { - key: 'dispose', - value: function dispose() { - this.listeners = {}; - } - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * - * @param {Stream} destination the stream that will receive all `data` events - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - }, { - key: 'pipe', - value: function pipe(destination) { - this.on('data', function (data) { - destination.push(data); - }); - } - }]); - - return Stream; -}(); - -exports['default'] = Stream; -},{}],36:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2016 Brightcove - * All rights reserved. - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; -var Stream = require('../utils/stream.js'); - -// Constants -var AacStream; - -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - -AacStream = function() { - var - everything = new Uint8Array(), - timeStamp = 0; - - AacStream.prototype.init.call(this); - - this.setTimestamp = function(timestamp) { - timeStamp = timestamp; - }; - - this.parseId3TagSize = function(header, byteIndex) { - var - returnSize = (header[byteIndex + 6] << 21) | - (header[byteIndex + 7] << 14) | - (header[byteIndex + 8] << 7) | - (header[byteIndex + 9]), - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - return returnSize + 10; - }; - - this.parseAdtsSize = function(header, byteIndex) { - var - lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - - return (highTwo | middle) | lowThree; - }; - - this.push = function(bytes) { - var - frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; - - // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if ((everything[byteIndex] === 'I'.charCodeAt(0)) && - (everything[byteIndex + 1] === 'D'.charCodeAt(0)) && - (everything[byteIndex + 2] === '3'.charCodeAt(0))) { - - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } - - // check framesize - frameSize = this.parseId3TagSize(everything, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > everything.length) { - break; - } - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff === 0xff) && - ((everything[byteIndex + 1] & 0xf0) === 0xf0)) { - - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = this.parseAdtsSize(everything, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - byteIndex++; - } - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; -}; - -AacStream.prototype = new Stream(); - -module.exports = AacStream; - -},{"../utils/stream.js":60}],37:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2016 Brightcove - * All rights reserved. - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350 -]; - -var parseSyncSafeInteger = function(data) { - return (data[0] << 21) | - (data[1] << 14) | - (data[2] << 7) | - (data[3]); -}; - -// return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -var percentEncode = function(bytes, start, end) { - var i, result = ''; - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - return result; -}; - -// return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -var parseIso88591 = function(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseId3TagSize = function(header, byteIndex) { - var - returnSize = (header[byteIndex + 6] << 21) | - (header[byteIndex + 7] << 14) | - (header[byteIndex + 8] << 7) | - (header[byteIndex + 9]), - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; - - if (footerPresent) { - return returnSize + 20; - } - return returnSize + 10; -}; - -var parseAdtsSize = function(header, byteIndex) { - var - lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - - return (highTwo | middle) | lowThree; -}; - -var parseType = function(header, byteIndex) { - if ((header[byteIndex] === 'I'.charCodeAt(0)) && - (header[byteIndex + 1] === 'D'.charCodeAt(0)) && - (header[byteIndex + 2] === '3'.charCodeAt(0))) { - return 'timed-metadata'; - } else if ((header[byteIndex] & 0xff === 0xff) && - ((header[byteIndex + 1] & 0xf0) === 0xf0)) { - return 'audio'; - } - return null; -}; - -var parseSampleRate = function(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function(packet) { - var frameStart, frameSize, frame, frameHeader; - - // find the start of the first frame and the end of the tag - frameStart = 10; - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - return null; - } - frameHeader = String.fromCharCode(packet[frameStart], - packet[frameStart + 1], - packet[frameStart + 2], - packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = ((d[3] & 0x01) << 30) | - (d[4] << 22) | - (d[5] << 14) | - (d[6] << 6) | - (d[7] >>> 2); - size *= 4; - size += d[7] & 0x03; - - return size; - } - break; - } - } - } - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - return null; -}; - -module.exports = { - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; - -},{}],38:[function(require,module,exports){ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var AdtsStream; - -var - ADTS_SAMPLING_FREQUENCIES = [ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350 - ]; - -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ -AdtsStream = function() { - var buffer; - - AdtsStream.prototype.init.call(this); - - this.push = function(packet) { - var - i = 0, - frameNum = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } - - // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - if (buffer) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } - - // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - while (i + 5 < buffer.length) { - - // Loook for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; - - // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - frameLength = ((buffer[i + 3] & 0x03) << 11) | - (buffer[i + 4] << 3) | - ((buffer[i + 5] & 0xe0) >> 5); - - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = (sampleCount * 90000) / - ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - - frameEnd = i + frameLength; - - // If we don't have enough data to actually finish this ADTS frame, return - // and wait for more data - if (buffer.byteLength < frameEnd) { - return; - } - - // Otherwise, deliver the complete AAC frame - this.trigger('data', { - pts: packet.pts + (frameNum * adtsFrameDuration), - dts: packet.dts + (frameNum * adtsFrameDuration), - sampleCount: sampleCount, - audioobjecttype: ((buffer[i + 2] >>> 6) & 0x03) + 1, - channelcount: ((buffer[i + 2] & 1) << 2) | - ((buffer[i + 3] & 0xc0) >>> 6), - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - data: buffer.subarray(i + 7 + protectionSkipBytes, frameEnd) - }); - - // If the buffer is empty, clear it and return - if (buffer.byteLength === frameEnd) { - buffer = undefined; - return; - } - - frameNum++; - - // Remove the finished frame from the buffer and start the process again - buffer = buffer.subarray(frameEnd); - } - }; - this.flush = function() { - this.trigger('done'); - }; -}; - -AdtsStream.prototype = new Stream(); - -module.exports = AdtsStream; - -},{"../utils/stream.js":60}],39:[function(require,module,exports){ -'use strict'; - -var Stream = require('../utils/stream.js'); -var ExpGolomb = require('../utils/exp-golomb.js'); - -var H264Stream, NalByteStream; -var PROFILES_WITH_OPTIONAL_SPS_DATA; - -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ -NalByteStream = function() { - var - syncPoint = 0, - i, - buffer; - NalByteStream.prototype.init.call(this); - - this.push = function(data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - - // advance the sync point to a NAL start, if necessary - for (; syncPoint < buffer.byteLength - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < buffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } - - // deliver the NAL unit if it isn't empty - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } - - // drop trailing zeroes - do { - i++; - } while (buffer[i] !== 1 && i < buffer.length); - syncPoint = i - 2; - i += 3; - break; - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || - buffer[i - 2] !== 0) { - i += 3; - break; - } - - // deliver the NAL unit - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } - // filter out the NAL units that were delivered - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.flush = function() { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } - // reset the stream state - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; -}; -NalByteStream.prototype = new Stream(); - -// values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - 138: true, - 139: true, - 134: true -}; - -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ -H264Stream = function() { - var - nalByteStream = new NalByteStream(), - self, - trackId, - currentPts, - currentDts, - - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - H264Stream.prototype.init.call(this); - self = this; - - this.push = function(packet) { - if (packet.type !== 'video') { - return; - } - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - - nalByteStream.push(packet); - }; - - nalByteStream.on('data', function(data) { - var - event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data - }; - - switch (data[0] & 0x1f) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - - default: - break; - } - self.trigger('data', event); - }); - nalByteStream.on('done', function() { - self.trigger('done'); - }); - - this.flush = function() { - nalByteStream.flush(); - }; - - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - skipScalingList = function(count, expGolombDecoder) { - var - lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = (nextScale === 0) ? lastScale : nextScale; - } - }; - - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - discardEmulationPreventionBytes = function(data) { - var - length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, newData; - - // Find all `Emulation Prevention Bytes` - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } - - // If no Emulation Prevention Bytes were found just return the original - // array - if (emulationPreventionBytesPositions.length === 0) { - return data; - } - - // Create a new array to hold the NAL unit data - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; - // Remove this position index - emulationPreventionBytesPositions.shift(); - } - newData[i] = data[sourceIndex]; - } - - return newData; - }; - - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - readSequenceParameterSet = function(data) { - var - frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, profileIdc, levelIdc, profileCompatibility, - chromaFormatIdc, picOrderCntType, - numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio, - aspectRatioIdc, - i; - - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - - // some profiles have more optional data we don't need - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - if (expGolombDecoder.readBoolean()) { // seq_scaling_matrix_present_flag - scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12; - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - if (expGolombDecoder.readBoolean()) { // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - switch (aspectRatioIdc) { - case 1: sarRatio = [1, 1]; break; - case 2: sarRatio = [12, 11]; break; - case 3: sarRatio = [10, 11]; break; - case 4: sarRatio = [16, 11]; break; - case 5: sarRatio = [40, 33]; break; - case 6: sarRatio = [24, 11]; break; - case 7: sarRatio = [20, 11]; break; - case 8: sarRatio = [32, 11]; break; - case 9: sarRatio = [80, 33]; break; - case 10: sarRatio = [18, 11]; break; - case 11: sarRatio = [15, 11]; break; - case 12: sarRatio = [64, 33]; break; - case 13: sarRatio = [160, 99]; break; - case 14: sarRatio = [4, 3]; break; - case 15: sarRatio = [3, 2]; break; - case 16: sarRatio = [2, 1]; break; - case 255: { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | - expGolombDecoder.readUnsignedByte(), - expGolombDecoder.readUnsignedByte() << 8 | - expGolombDecoder.readUnsignedByte() ]; - break; - } - } - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: Math.ceil((((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), - height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - (frameCropTopOffset * 2) - (frameCropBottomOffset * 2) - }; - }; - -}; -H264Stream.prototype = new Stream(); - -module.exports = { - H264Stream: H264Stream, - NalByteStream: NalByteStream -}; - -},{"../utils/exp-golomb.js":59,"../utils/stream.js":60}],40:[function(require,module,exports){ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; -var zeroFill = function(count) { - var a = []; - while (count--) { - a.push(0); - } - return a; -}; - -var makeTable = function(metaTable) { - return Object.keys(metaTable).reduce(function(obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - -// Frames-of-silence to use for filling in missing AAC frames -var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]], - 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] -}; - -module.exports = makeTable(coneOfSilence); - -},{}],41:[function(require,module,exports){ -'use strict'; - -var Stream = require('../utils/stream.js'); - -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ -var CoalesceStream = function(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - - CoalesceStream.prototype.init.call(this); - - // Take output from multiple - this.push = function(output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } - // buffer incoming id3 tags until the final flush - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); -CoalesceStream.prototype.flush = function(flushSource) { - var - id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && - flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; - - // Translate caption PTS times into second offsets into the - // video timeline for the segment - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captions.push(caption); - } - - // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } - // We add this to every single emitted segment even though we only need - // it for the first - event.metadata.dispatchType = this.metadataStream.dispatchType; - - // Reset stream state - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; - - // Emit the final segment - this.trigger('data', event); - - this.trigger('done'); -}; - -module.exports = CoalesceStream; - -},{"../utils/stream.js":60}],42:[function(require,module,exports){ -'use strict'; - -var FlvTag = require('./flv-tag.js'); - -// For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array -var getFlvHeader = function(duration, audio, video) { // :ByteArray { - var - headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; - - // default arguments - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; - - // signature - head.setUint8(0, 0x46); // 'F' - head.setUint8(1, 0x4c); // 'L' - head.setUint8(2, 0x56); // 'V' - - // version - head.setUint8(3, 0x01); - - // flags - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); - - // data offset, should be 9 for FLV v1 - head.setUint32(5, headBytes.byteLength); - - // init the first FLV tag - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } - - // write out the duration metadata tag - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - - return result; -}; - -module.exports = getFlvHeader; - -},{"./flv-tag.js":43}],43:[function(require,module,exports){ -/** - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var FlvTag; - -// (type:uint, extraData:Boolean = false) extends ByteArray -FlvTag = function(type, extraData) { - var - // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, // :uint - - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function(flv, count) { - var - bytes, - minLength = flv.position + count; - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } - - // allocate a new buffer and copy over the data that will not be modified - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - - // commonly used metadata properties - widthBytes = FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - FlvTag.widthBytes = widthBytes; - FlvTag.heightBytes = heightBytes; - FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case FlvTag.VIDEO_TAG: - this.length = 16; - // Start the buffer at 256k - bufferStartSize *= 6; - break; - case FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - case FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - - // presentation timestamp - this.pts = 0; - // decoder timestamp - this.dts = 0; - - // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - this.writeBytes = function(bytes, offset, length) { - var - start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - - this.position += length; - this.length = Math.max(this.length, this.position); - }; - - // ByteArray#writeByte(value:int):void - this.writeByte = function(byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; - - // ByteArray#writeShort(value:int):void - this.writeShort = function(short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; - - // Negative index into array - // (pos:uint):int - this.negIndex = function(pos) { - return this.bytes[this.length - pos]; - }; - - // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - this.nalUnitSize = function() { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function() { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } - - // reserve 4 bytes for nal unit size - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; - - // (nal:ByteArray = null):void - this.endNalUnit = function(nalContainer) { - var - nalStart, // :uint - nalLength; // :uint - - // Rewind to the marker and write the size - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - this.writeMetaDataDouble = function(key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); - - // write size of property name - this.view.setUint16(this.position, key.length); - this.position += 2; - - // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - - // write property name - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } - - // skip null byte - this.position++; - - // write property value - this.view.setFloat64(this.position, val); - this.position += 8; - - // update flv tag length - this.length = Math.max(this.length, this.position); - ++adHoc; - }; - - // (key:String, val:Boolean):void - this.writeMetaDataBoolean = function(key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; - - // ():ByteArray - this.finalize = function() { - var - dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = ((this.keyFrame || extraData) ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - this.position += 2; - // set "onMetaData" - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x61, 0x44, 0x61, - 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - this.length = this.position; - break; - } - - len = this.length - 11; - - // write the DataSize field - this.bytes[ 1] = (len & 0x00FF0000) >>> 16; - this.bytes[ 2] = (len & 0x0000FF00) >>> 8; - this.bytes[ 3] = (len & 0x000000FF) >>> 0; - // write the Timestamp - this.bytes[ 4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[ 5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[ 6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[ 7] = (this.dts & 0xFF000000) >>> 24; - // write the StreamID - this.bytes[ 8] = 0; - this.bytes[ 9] = 0; - this.bytes[10] = 0; - - // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; - - // trim down the byte buffer to what is actually being used - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = FlvTag.frameTime(this.bytes); - // if bytes.bytelength isn't equal to this.length, handle error - return this; - }; -}; - -FlvTag.AUDIO_TAG = 0x08; // == 8, :uint -FlvTag.VIDEO_TAG = 0x09; // == 9, :uint -FlvTag.METADATA_TAG = 0x12; // == 18, :uint - -// (tag:ByteArray):Boolean { -FlvTag.isAudioFrame = function(tag) { - return FlvTag.AUDIO_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isVideoFrame = function(tag) { - return FlvTag.VIDEO_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isMetaData = function(tag) { - return FlvTag.METADATA_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isKeyFrame = function(tag) { - if (FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (FlvTag.isAudioFrame(tag)) { - return true; - } - - if (FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; - -// (tag:ByteArray):uint { -FlvTag.frameTime = function(tag) { - var pts = tag[ 4] << 16; // :uint - pts |= tag[ 5] << 8; - pts |= tag[ 6] << 0; - pts |= tag[ 7] << 24; - return pts; -}; - -module.exports = FlvTag; - -},{}],44:[function(require,module,exports){ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; - -},{"./flv-header":42,"./flv-tag":43,"./transmuxer":46}],45:[function(require,module,exports){ -'use strict'; - -var TagList = function() { - var self = this; - - this.list = []; - - this.push = function(tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function() { - return self.list.length; - } - }); -}; - -module.exports = TagList; - -},{}],46:[function(require,module,exports){ -'use strict'; - -var Stream = require('../utils/stream.js'); -var FlvTag = require('./flv-tag.js'); -var m2ts = require('../m2ts/m2ts.js'); -var AdtsStream = require('../codecs/adts.js'); -var H264Stream = require('../codecs/h264').H264Stream; -var CoalesceStream = require('./coalesce-stream.js'); -var TagList = require('./tag-list.js'); - -var - Transmuxer, - VideoSegmentStream, - AudioSegmentStream, - collectTimelineInfo, - metaDataTag, - extraDataTag; - -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ -collectTimelineInfo = function(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = - Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = - Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function(track, pts) { - var - tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - - return tag; -}; - -extraDataTag = function(track, pts) { - var - i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - - tag.dts = pts; - tag.pts = pts; - - tag.writeByte(0x01);// version - tag.writeByte(track.profileIdc);// profile - tag.writeByte(track.profileCompatibility);// compatibility - tag.writeByte(track.levelIdc);// level - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - tag.writeShort(track.sps[0].length); // data of SPS - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; - -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ -AudioSegmentStream = function(track) { - var - adtsFrames = [], - oldExtraData; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - collectTimelineInfo(track, data); - - if (track && track.channelcount === undefined) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = (track.audioobjecttype << 11) | - (track.samplingfrequencyindex << 7) | - (track.channelcount << 3); - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.flush = function() { - var currentFrame, adtsFrame, lastMetaPts, tags = new TagList(); - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); - - // write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - - // AAC is always 10 - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); - // Is AAC always 16 bit? - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - - tags.push(adtsFrame.finalize()); - - oldExtraData = track.extraData; - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); - // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - - tags.push(adtsFrame.finalize()); - - lastMetaPts = currentFrame.pts; - } - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - - adtsFrame.writeBytes(currentFrame.data); - - tags.push(adtsFrame.finalize()); - } - - oldExtraData = null; - this.trigger('data', {track: track, tags: tags.list}); - - this.trigger('done', 'AudioSegmentStream'); - }; -}; -AudioSegmentStream.prototype = new Stream(); - -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ -VideoSegmentStream = function(track) { - var - nalUnits = [], - config, - h264Frame; - VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function(tags, frame) { - if (!frame) { - return; - } - // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - if (config && track && track.newMetadata && - (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - - metaTag.metaDataTag = extraTag.metaDataTag = true; - - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function(data) { - collectTimelineInfo(track, data); - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); - - // buffer video until flush() is called - nalUnits.push(data); - }; - - this.flush = function() { - var - currentNal, - tags = new TagList(); - - // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // return early if no video data has been observed - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); - - // record the track config - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - h264Frame.endNalUnit(); - } - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', {track: track, tags: tags.list}); - - // Continue with the flush process now - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ -Transmuxer = function(options) { - var - self = this, - - packetStream, parseStream, elementaryStream, - videoTimestampRolloverStream, audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, h264Stream, - videoSegmentStream, audioSegmentStream, captionStream, - coalesceStream; - - Transmuxer.prototype.init.call(this); - - options = options || {}; - - // expose the metadata stream - this.metadataStream = new m2ts.MetadataStream(); - - options.metadataStream = this.metadataStream; - - // set up the parsing pipeline - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); - - // disassemble MPEG2-TS packets into elementary streams - packetStream - .pipe(parseStream) - .pipe(elementaryStream); - - // !!THIS ORDER IS IMPORTANT!! - // demux the streams - elementaryStream - .pipe(videoTimestampRolloverStream) - .pipe(h264Stream); - elementaryStream - .pipe(audioTimestampRolloverStream) - .pipe(adtsStream); - - elementaryStream - .pipe(timedMetadataTimestampRolloverStream) - .pipe(this.metadataStream) - .pipe(coalesceStream); - // if CEA-708 parsing is available, hook up a caption stream - captionStream = new m2ts.CaptionStream(); - h264Stream.pipe(captionStream) - .pipe(coalesceStream); - - // hook up the segment streams once track metadata is delivered - elementaryStream.on('data', function(data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; - - // scan the tracks listed in the metadata - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } - - // hook up the video segment stream to the first track with h264 data - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new VideoSegmentStream(videoTrack); - - // Set up the final part of the video pipeline - h264Stream - .pipe(videoSegmentStream) - .pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new AudioSegmentStream(audioTrack); - - // Set up the final part of the audio pipeline - adtsStream - .pipe(audioSegmentStream) - .pipe(coalesceStream); - } - } - }); - - // feed incoming data to the front of the parsing pipeline - this.push = function(data) { - packetStream.push(data); - }; - - // flush any buffered data - this.flush = function() { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; - - // Re-emit any data coming from the coalesce stream to the outside world - coalesceStream.on('data', function(event) { - self.trigger('data', event); - }); - - // Let the consumer know we have finished flushing the entire pipeline - coalesceStream.on('done', function() { - self.trigger('done'); - }); -}; -Transmuxer.prototype = new Stream(); - -// forward compatibility -module.exports = Transmuxer; - -},{"../codecs/adts.js":38,"../codecs/h264":39,"../m2ts/m2ts.js":48,"../utils/stream.js":60,"./coalesce-stream.js":41,"./flv-tag.js":43,"./tag-list.js":45}],47:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2015 Brightcove - * All rights reserved. - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ - -'use strict'; - -// ----------------- -// Link To Transport -// ----------------- - -// Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128, - Stream = require('../utils/stream'); - -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ -var parseSei = function(bytes) { - var - i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; - - // go through the sei_rbsp parsing each each individual sei_message - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } - - // Parse payload type - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - payloadType += bytes[i++]; - - // Parse payload size - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - payloadSize += bytes[i++]; - - // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } - - // skip the payload and parse the next message - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; - -// see ANSI/SCTE 128-1 (2013), section 8.1 -var parseUserData = function(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } - - // itu_t_t35_provider_code should be 49 (ATSC) for captions - if (((sei.payload[1] << 8) | sei.payload[2]) !== 49) { - return null; - } - - // the user_identifier should be "GA94" to indicate ATSC1 data - if (String.fromCharCode(sei.payload[3], - sei.payload[4], - sei.payload[5], - sei.payload[6]) !== 'GA94') { - return null; - } - - // finally, user_data_type_code should be 0x03 for caption data - if (sei.payload[7] !== 0x03) { - return null; - } - - // return the user_data_type_structure and strip the trailing - // marker bits - return sei.payload.subarray(8, sei.payload.length - 1); -}; - -// see CEA-708-D, section 4.4 -var parseCaptionPackets = function(pts, userData) { - var results = [], i, count, offset, data; - - // if this is just filler, return immediately - if (!(userData[0] & 0x40)) { - return results; - } - - // parse out the cc_data_1 and cc_data_2 fields - count = userData[0] & 0x1f; - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; - - // capture cc data when cc_valid is 1 - if (userData[offset + 2] & 0x04) { - data.ccData = (userData[offset + 3] << 8) | userData[offset + 4]; - results.push(data); - } - } - return results; -}; - -var CaptionStream = function() { - CaptionStream.prototype.init.call(this); - - this.captionPackets_ = []; - - this.field1_ = new Cea608Stream(); // eslint-disable-line no-use-before-define - - // forward data and done events from field1_ to this CaptionStream - this.field1_.on('data', this.trigger.bind(this, 'data')); - this.field1_.on('done', this.trigger.bind(this, 'done')); -}; -CaptionStream.prototype = new Stream(); -CaptionStream.prototype.push = function(event) { - var sei, userData; - - // only examine SEI NALs - if (event.nalUnitType !== 'sei_rbsp') { - return; - } - - // parse the sei - sei = parseSei(event.escapedRBSP); - - // ignore everything but user_data_registered_itu_t_t35 - if (sei.payloadType !== USER_DATA_REGISTERED_ITU_T_T35) { - return; - } - - // parse out the user data payload - userData = parseUserData(sei); - - // ignore unrecognized userData - if (!userData) { - return; - } - - // parse out CC data packets and save them for later - this.captionPackets_ = this.captionPackets_.concat(parseCaptionPackets(event.pts, userData)); -}; - -CaptionStream.prototype.flush = function() { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.field1_.flush(); - return; - } - - // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - this.captionPackets_.forEach(function(elem, idx) { - elem.presortIndex = idx; - }); - - // sort caption byte-pairs based on their PTS values - this.captionPackets_.sort(function(a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - return a.pts - b.pts; - }); - - // Push each caption into Cea608Stream - this.captionPackets_.forEach(this.field1_.push, this.field1_); - - this.captionPackets_.length = 0; - this.field1_.flush(); - return; -}; -// ---------------------- -// Session to Application -// ---------------------- - -var BASIC_CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - 0x5c: 0xe9, - 0x5e: 0xed, - 0x5f: 0xf3, - 0x60: 0xfa, - 0x7b: 0xe7, - 0x7c: 0xf7, - 0x7d: 0xd1, - 0x7e: 0xf1, - 0x7f: 0x2588 -}; - -var getCharFromCode = function(code) { - if (code === null) { - return ''; - } - code = BASIC_CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; - -// Constants for the byte codes recognized by Cea608Stream. This -// list is not exhaustive. For a more comprehensive listing and -// semantics see -// http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf -var PADDING = 0x0000, - - // Pop-on Mode - RESUME_CAPTION_LOADING = 0x1420, - END_OF_CAPTION = 0x142f, - - // Roll-up Mode - ROLL_UP_2_ROWS = 0x1425, - ROLL_UP_3_ROWS = 0x1426, - ROLL_UP_4_ROWS = 0x1427, - CARRIAGE_RETURN = 0x142d, - // Erasure - BACKSPACE = 0x1421, - ERASE_DISPLAYED_MEMORY = 0x142c, - ERASE_NON_DISPLAYED_MEMORY = 0x142e; - -// the index of the last row in a CEA-608 display buffer -var BOTTOM_ROW = 14; -// CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. -var createDisplayBuffer = function() { - var result = [], i = BOTTOM_ROW + 1; - while (i--) { - result.push(''); - } - return result; -}; - -var Cea608Stream = function() { - Cea608Stream.prototype.init.call(this); - - this.mode_ = 'popOn'; - // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; - - this.push = function(packet) { - // Ignore other channels - if (packet.type !== 0) { - return; - } - var data, swap, char0, char1; - // remove the parity bits - data = packet.ccData & 0x7f7f; - - // ignore duplicate control codes - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } - - // Store control codes - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else { - this.lastControlCode_ = null; - } - - switch (data) { - case PADDING: - break; - case RESUME_CAPTION_LOADING: - this.mode_ = 'popOn'; - break; - case END_OF_CAPTION: - // if a caption was being displayed, it's gone now - this.flushDisplayed(packet.pts); - - // flip memory - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; - - // start measuring the time to display the caption - this.startPts_ = packet.pts; - break; - - case ROLL_UP_2_ROWS: - this.topRow_ = BOTTOM_ROW - 1; - this.mode_ = 'rollUp'; - break; - case ROLL_UP_3_ROWS: - this.topRow_ = BOTTOM_ROW - 2; - this.mode_ = 'rollUp'; - break; - case ROLL_UP_4_ROWS: - this.topRow_ = BOTTOM_ROW - 3; - this.mode_ = 'rollUp'; - break; - case CARRIAGE_RETURN: - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - break; - - case BACKSPACE: - if (this.mode_ === 'popOn') { - this.nonDisplayed_[BOTTOM_ROW] = this.nonDisplayed_[BOTTOM_ROW].slice(0, -1); - } else { - this.displayed_[BOTTOM_ROW] = this.displayed_[BOTTOM_ROW].slice(0, -1); - } - break; - case ERASE_DISPLAYED_MEMORY: - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - break; - case ERASE_NON_DISPLAYED_MEMORY: - this.nonDisplayed_ = createDisplayBuffer(); - break; - default: - char0 = data >>> 8; - char1 = data & 0xff; - - // Look for a Channel 1 Preamble Address Code - if (char0 >= 0x10 && char0 <= 0x17 && - char1 >= 0x40 && char1 <= 0x7F && - (char0 !== 0x10 || char1 < 0x60)) { - // Follow Safari's lead and replace the PAC with a space - char0 = 0x20; - // we only want one space so make the second character null - // which will get become '' in getCharFromCode - char1 = null; - } - - // Look for special character sets - if ((char0 === 0x11 || char0 === 0x19) && - (char1 >= 0x30 && char1 <= 0x3F)) { - // Put in eigth note and space - char0 = 0x266A; - char1 = ''; - } - - // ignore unsupported control codes - if ((char0 & 0xf0) === 0x10) { - return; - } - - // remove null chars - if (char0 === 0x00) { - char0 = null; - } - if (char1 === 0x00) { - char1 = null; - } - - // character handling is dependent on the current mode - this[this.mode_](packet.pts, char0, char1); - break; - } - }; -}; -Cea608Stream.prototype = new Stream(); -// Trigger a cue point that captures the current state of the -// display buffer -Cea608Stream.prototype.flushDisplayed = function(pts) { - var content = this.displayed_ - // remove spaces from the start and end of the string - .map(function(row) { - return row.trim(); - }) - // remove empty rows - .filter(function(row) { - return row.length; - }) - // combine all text rows to display in one cue - .join('\n'); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - text: content - }); - } -}; - -// Mode Implementations -Cea608Stream.prototype.popOn = function(pts, char0, char1) { - var baseRow = this.nonDisplayed_[BOTTOM_ROW]; - - // buffer characters - baseRow += getCharFromCode(char0); - baseRow += getCharFromCode(char1); - this.nonDisplayed_[BOTTOM_ROW] = baseRow; -}; - -Cea608Stream.prototype.rollUp = function(pts, char0, char1) { - var baseRow = this.displayed_[BOTTOM_ROW]; - if (baseRow === '') { - // we're starting to buffer new display input, so flush out the - // current display - this.flushDisplayed(pts); - - this.startPts_ = pts; - } - - baseRow += getCharFromCode(char0); - baseRow += getCharFromCode(char1); - - this.displayed_[BOTTOM_ROW] = baseRow; -}; -Cea608Stream.prototype.shiftRowsUp_ = function() { - var i; - // clear out inactive rows - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; - } - // shift displayed rows up - for (i = this.topRow_; i < BOTTOM_ROW; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } - // clear out the bottom row - this.displayed_[BOTTOM_ROW] = ''; -}; - -// exports -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream -}; - -},{"../utils/stream":60}],48:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2015 Brightcove - * All rights reserved. - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; - -var m2tsStreamTypes = require('./stream-types.js'); - -// object types -var TransportPacketStream, TransportParseStream, ElementaryStream; - -// constants -var - MP2T_PACKET_LENGTH = 188, // bytes - SYNC_BYTE = 0x47; - -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ -TransportPacketStream = function() { - var - buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - TransportPacketStream.prototype.init.call(this); - - // Deliver new bytes to the stream. - - this.push = function(bytes) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; - - // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } - - // While we have enough data for a packet - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - - this.flush = function() { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - this.trigger('done'); - }; -}; -TransportPacketStream.prototype = new Stream(); - -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ -TransportParseStream = function() { - var parsePsi, parsePat, parsePmt, self; - TransportParseStream.prototype.init.call(this); - self = this; - - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function(payload, psi) { - var offset = 0; - - // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - - // skip the PSI header and parse the first PMT entry - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - parsePmt = function(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; - - // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - if (!(payload[5] & 0x01)) { - return; - } - - // overwrite any existing program map table - self.programMapTable = {}; - - // the mapping table ends at the end of the current section - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; - - // to determine where the table is, we have to figure out how - // long the program info descriptors are - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; - - // advance the offset to the first entry in the mapping table - offset = 12 + programInfoLength; - while (offset < tableEnd) { - // add an entry that maps the elementary_pid to the stream_type - self.programMapTable[(payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]] = payload[offset]; - - // move to the next table entry - // skip past the elementary stream descriptors, if present - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } - - // record the map on the packet as well - pmt.programMapTable = self.programMapTable; - - // if there are any packets waiting for a PMT to be found, process them now - while (self.packetsWaitingForPmt.length) { - self.processPes_.apply(self, self.packetsWaitingForPmt.shift()); - } - }; - - /** - * Deliver a new MP2T packet to the stream. - */ - this.push = function(packet) { - var - result = {}, - offset = 4; - - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); - - // pid is a 13-bit field starting at the last bit of packet[1] - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; - - // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - if (((packet[3] & 0x30) >>> 4) > 0x01) { - offset += packet[offset] + 1; - } - - // parse the rest of the packet based on the type - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function(packet, offset, result) { - result.streamType = this.programMapTable[result.pid]; - result.type = 'pes'; - result.data = packet.subarray(offset); - - this.trigger('data', result); - }; - -}; -TransportParseStream.prototype = new Stream(); -TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; - -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ -ElementaryStream = function() { - var - self = this, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - parsePes = function(payload, pes) { - var ptsDtsFlags; - - // get the packet length, this will be 0 for video - pes.packetLength = 6 + ((payload[4] << 8) | payload[5]); - - // find out if this packets starts a new keyframe - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; - // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - ptsDtsFlags = payload[7]; - - // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | - (payload[10] & 0xFF) << 20 | - (payload[11] & 0xFE) << 12 | - (payload[12] & 0xFF) << 5 | - (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - pes.dts = pes.pts; - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | - (payload[15] & 0xFF) << 20 | - (payload[16] & 0xFE) << 12 | - (payload[17] & 0xFF) << 5 | - (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } - // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - pes.data = payload.subarray(9 + payload[8]); - }, - flushStream = function(stream, type, forceFlush) { - var - packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; - - // do nothing if there is not enough buffered data for a complete - // PES header - if (!stream.data.length || stream.size < 9) { - return; - } - event.trackId = stream.data[0].pid; - - // reassemble the packet - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } - - // parse assembled packet's PES header - parsePes(packetData, event); - - // non-video PES packets MUST have a non-zero PES_packet_length - // check that they match before we do a flush - packetFlushable = type === 'video' || event.packetLength === stream.size; - - // flush pending packets if the conditions are right - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } - - // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - if (packetFlushable) { - self.trigger('data', event); - } - }; - - ElementaryStream.prototype.init.call(this); - - this.push = function(data) { - ({ - pat: function() { - // we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - case m2tsStreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - default: - // ignore unknown stream types - return; - } - - // if a new packet is starting, we can flush the completed - // packet - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } - - // buffer this fragment until we are sure we've received the - // complete payload - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function() { - var - event = { - type: 'metadata', - tracks: [] - }, - programMapTable = data.programMapTable, - k, - track; - - // translate streams to tracks - for (k in programMapTable) { - if (programMapTable.hasOwnProperty(k)) { - track = { - timelineStartInfo: { - baseMediaDecodeTime: 0 - } - }; - track.id = +k; - if (programMapTable[k] === m2tsStreamTypes.H264_STREAM_TYPE) { - track.codec = 'avc'; - track.type = 'video'; - } else if (programMapTable[k] === m2tsStreamTypes.ADTS_STREAM_TYPE) { - track.codec = 'adts'; - track.type = 'audio'; - } - event.tracks.push(track); - } - } - self.trigger('data', event); - } - })[data.type](); - }; - - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - this.flush = function() { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - this.trigger('done'); - }; -}; -ElementaryStream.prototype = new Stream(); - -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: TransportPacketStream, - TransportParseStream: TransportParseStream, - ElementaryStream: ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; - -},{"../utils/stream.js":60,"./caption-stream":47,"./metadata-stream":49,"./stream-types":51,"./stream-types.js":51,"./timestamp-rollover-stream":52}],49:[function(require,module,exports){ -/** - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; -var - Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - percentEncode = function(bytes, start, end) { - var i, result = ''; - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function(data) { - return (data[0] << 21) | - (data[1] << 14) | - (data[2] << 7) | - (data[3]); - }, - tagParsers = { - TXXX: function(tag) { - var i; - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the text fields - tag.description = parseUtf8(tag.data, 1, i); - // do not include the null terminator in the tag value - tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\0*$/, ''); - break; - } - } - tag.data = tag.value; - }, - WXXX: function(tag) { - var i; - if (tag.data[0] !== 3) { - // ignore frames with unrecognized character encodings - return; - } - - for (i = 1; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.description = parseUtf8(tag.data, 1, i); - tag.url = parseUtf8(tag.data, i + 1, tag.data.length); - break; - } - } - }, - PRIV: function(tag) { - var i; - - for (i = 0; i < tag.data.length; i++) { - if (tag.data[i] === 0) { - // parse the description and URL fields - tag.owner = parseIso88591(tag.data, 0, i); - break; - } - } - tag.privateData = tag.data.subarray(i + 1); - tag.data = tag.privateData; - } - }, - MetadataStream; - -MetadataStream = function(options) { - var - settings = { - debug: !!(options && options.debug), - - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - MetadataStream.prototype.init.call(this); - - // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function(chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - if (chunk.type !== 'timed-metadata') { - return; - } - - // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } - - // ignore events that don't look like ID3 data - if (buffer.length === 0 && - (chunk.data.length < 10 || - chunk.data[0] !== 'I'.charCodeAt(0) || - chunk.data[1] !== 'D'.charCodeAt(0) || - chunk.data[2] !== '3'.charCodeAt(0))) { - if (settings.debug) { - // eslint-disable-next-line no-console - console.log('Skipping unrecognized metadata packet'); - } - return; - } - - // add this chunk to the data we've collected so far - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; - - // grab the size of the entire frame from the ID3 header - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(chunk.data.subarray(6, 10)); - - // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - tagSize += 10; - } - - // if the entire frame has not arrived, wait for more data - if (bufferSize < tagSize) { - return; - } - - // collect the entire frame so it can be parsed - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } - - // find the start of the first frame and the end of the tag - frameStart = 10; - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += parseSyncSafeInteger(tag.data.subarray(10, 14)); - - // clip any padding off the end - tagSize -= parseSyncSafeInteger(tag.data.subarray(16, 20)); - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - // eslint-disable-next-line no-console - return console.log('Malformed ID3 frame encountered. Skipping metadata parsing.'); - } - frameHeader = String.fromCharCode(tag.data[frameStart], - tag.data[frameStart + 1], - tag.data[frameStart + 2], - tag.data[frameStart + 3]); - - - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - if (tagParsers[frame.id]) { - tagParsers[frame.id](frame); - - // handle the special PRIV frame used to indicate the start - // time for raw AAC data - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var - d = frame.data, - size = ((d[3] & 0x01) << 30) | - (d[4] << 22) | - (d[5] << 14) | - (d[6] << 6) | - (d[7] >>> 2); - - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; - // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - this.trigger('timestamp', frame); - } - } - tag.frames.push(frame); - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - this.trigger('data', tag); - }; -}; -MetadataStream.prototype = new Stream(); - -module.exports = MetadataStream; - -},{"../utils/stream":60,"./stream-types":51}],50:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2016 Brightcove - * All rights reserved. - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function(packet) { - var offset = 0; - // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - if (((packet[3] & 0x30) >>> 4) > 0x01) { - offset += packet[4] + 1; - } - return offset; -}; - -var parseType = function(packet, pmtPid) { - var pid = parsePid(packet); - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - return null; -}; - -var parsePat = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } - - // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; - // the mapping table ends at the end of the current section - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; - - // to determine where the table is, we have to figure out how - // long the program info descriptors are - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; - - // advance the offset to the first entry in the mapping table - var offset = 12 + programInfoLength; - while (offset < tableEnd) { - var i = payloadOffset + offset; - // add an entry that maps the elementary_pid to the stream_type - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; - - // move to the next table entry - // skip past the elementary stream descriptors, if present - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - return programMapTable; -}; - -var parsePesType = function(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - default: - return null; - } -}; - -var parsePesTime = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; - - // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - ptsDtsFlags = packet[offset + 7]; - - // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - if (ptsDtsFlags & 0xC0) { - pes = {}; - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (packet[offset + 9] & 0x0E) << 27 | - (packet[offset + 10] & 0xFF) << 20 | - (packet[offset + 11] & 0xFE) << 12 | - (packet[offset + 12] & 0xFF) << 5 | - (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - pes.dts = pes.pts; - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | - (packet[offset + 15] & 0xFF) << 20 | - (packet[offset + 16] & 0xFE) << 12 | - (packet[offset + 17] & 0xFF) << 5 | - (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - return pes; -}; - -var parseNalUnitType = function(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - case 0x06: - return 'sei_rbsp'; - case 0x07: - return 'seq_parameter_set_rbsp'; - case 0x08: - return 'pic_parameter_set_rbsp'; - case 0x09: - return 'access_unit_delimiter_rbsp'; - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; - - // advance the sync point to a NAL start, if necessary - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - // drop trailing zeroes - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - frameSyncPoint = frameI - 2; - frameI += 3; - break; - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || - frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - frameSyncPoint = frameI - 2; - frameI += 3; - break; - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; - // parse the final nal - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; - -},{"./stream-types.js":51}],51:[function(require,module,exports){ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; - -},{}],52:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2016 Brightcove - * All rights reserved. - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ - -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; - -var RO_THRESH = 4294967296; - -var handleRollover = function(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } - - // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - while (Math.abs(reference - value) > RO_THRESH) { - value += (direction * MAX_TS); - } - - return value; -}; - -var TimestampRolloverStream = function(type) { - var lastDTS, referenceDTS; - - TimestampRolloverStream.prototype.init.call(this); - - this.type_ = type; - - this.push = function(data) { - if (data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - - lastDTS = data.dts; - - this.trigger('data', data); - }; - - this.flush = function() { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.discontinuity = function() { - referenceDTS = void 0; - lastDTS = void 0; - }; - -}; - -TimestampRolloverStream.prototype = new Stream(); - -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; - -},{"../utils/stream":60}],53:[function(require,module,exports){ -module.exports = { - generator: require('./mp4-generator'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream -}; - -},{"./mp4-generator":54,"./transmuxer":56}],54:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2015 Brightcove - * All rights reserved. - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var UINT32_MAX = Math.pow(2, 32) - 1; - -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, - trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, - trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, - AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; - -// pre-calculate constants -(function() { - var i; - types = { - avc1: [], // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], // codingname - mvex: [], - mvhd: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; - - // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [ - i.charCodeAt(0), - i.charCodeAt(1), - i.charCodeAt(2), - i.charCodeAt(3) - ]; - } - } - - MAJOR_BRAND = new Uint8Array([ - 'i'.charCodeAt(0), - 's'.charCodeAt(0), - 'o'.charCodeAt(0), - 'm'.charCodeAt(0) - ]); - AVC1_BRAND = new Uint8Array([ - 'a'.charCodeAt(0), - 'v'.charCodeAt(0), - 'c'.charCodeAt(0), - '1'.charCodeAt(0) - ]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, - 0x6f, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, - 0x64, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 // opcolor - ]); -}()); - -box = function(type) { - var - payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; - - // calculate the total size we need to allocate - while (i--) { - size += payload[i].byteLength; - } - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); - - // copy the payload into the result - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - return result; -}; - -dinf = function() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function(track) { - return box(types.esds, new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - (track.audioobjecttype << 3) | (track.samplingfrequencyindex >>> 1), - (track.samplingfrequencyindex << 7) | (track.channelcount << 3), - 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; -mdat = function(data) { - return box(types.mdat, data); -}; -mdhd = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - - (track.duration >>> 24) & 0xFF, - (track.duration >>> 16) & 0xFF, - (track.duration >>> 8) & 0xFF, - track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00 - ]); - - // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - if (track.samplerate) { - result[12] = (track.samplerate >>> 24) & 0xFF; - result[13] = (track.samplerate >>> 16) & 0xFF; - result[14] = (track.samplerate >>> 8) & 0xFF; - result[15] = (track.samplerate) & 0xFF; - } - - return box(types.mdhd, result); -}; -mdia = function(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; -mfhd = function(sequenceNumber) { - return box(types.mfhd, new Uint8Array([ - 0x00, - 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, - (sequenceNumber & 0xFF0000) >> 16, - (sequenceNumber & 0xFF00) >> 8, - sequenceNumber & 0xFF // sequence_number - ])); -}; -minf = function(track) { - return box(types.minf, - track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), - dinf(), - stbl(track)); -}; -moof = function(sequenceNumber, tracks) { - var - trackFragments = [], - i = tracks.length; - // build traf boxes for each track fragment - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - return box.apply(null, [ - types.moof, - mfhd(sequenceNumber) - ].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ -moov = function(tracks) { - var - i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; -mvex = function(tracks) { - var - i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - return box.apply(null, [types.mvex].concat(boxes)); -}; -mvhd = function(duration) { - var - bytes = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, - (duration & 0xFF0000) >> 16, - (duration & 0xFF00) >> 8, - duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function(track) { - var - samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; - - // leave the full box header (4 bytes) all zero - - // write the sample table - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - - bytes[i + 4] = (flags.dependsOn << 4) | - (flags.isDependedOn << 2) | - (flags.hasRedundancy); - } - - return box(types.sdtp, - bytes); -}; - -stbl = function(track) { - return box(types.stbl, - stsd(track), - box(types.stts, STTS), - box(types.stsc, STSC), - box(types.stsz, STSZ), - box(types.stco, STCO)); -}; - -(function() { - var videoSample, audioSample; - - stsd = function(track) { - - return box(types.stsd, new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01 - ]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function(track) { - var - sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i; - - // assemble the SPSs - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push((sps[i].byteLength & 0xFF)); // sequenceParameterSetLength - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } - - // assemble the PPSs - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push((pps[i].byteLength & 0xFF)); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - return box(types.avc1, new Uint8Array([ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, - track.width & 0xff, // width - (track.height & 0xff00) >> 8, - track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, - 0x76, 0x69, 0x64, 0x65, - 0x6f, 0x6a, 0x73, 0x2d, - 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x69, 0x62, 0x2d, - 0x68, 0x6c, 0x73, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([ - 0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([ - sps.length // numOfSequenceParameterSets - ]).concat(sequenceParameterSets).concat([ - pps.length // numOfPictureParameterSets - ]).concat(pictureParameterSets))), // "PPS" - box(types.btrt, new Uint8Array([ - 0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 - ])) // avgBitrate - ); - }; - - audioSample = function(track) { - return box(types.mp4a, new Uint8Array([ - - // SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, - (track.channelcount & 0xff), // channelcount - - (track.samplesize & 0xff00) >> 8, - (track.samplesize & 0xff), // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - - (track.samplerate & 0xff00) >> 8, - (track.samplerate & 0xff), - 0x00, 0x00 // samplerate, 16.16 - - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -}()); - -tkhd = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, - (track.duration & 0xFF0000) >> 16, - (track.duration & 0xFF00) >> 8, - track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, - track.width & 0xFF, - 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, - track.height & 0xFF, - 0x00, 0x00 // height - ]); - - return box(types.tkhd, result); -}; - -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ -traf = function(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, - sampleDependencyTable, dataOffset, - upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - - trackFragmentHeader = box(types.tfhd, new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - (track.id & 0xFF), // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (UINT32_MAX + 1)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (UINT32_MAX + 1)); - - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([ - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - (upperWordBaseMediaDecodeTime >>> 24) & 0xFF, - (upperWordBaseMediaDecodeTime >>> 16) & 0xFF, - (upperWordBaseMediaDecodeTime >>> 8) & 0xFF, - upperWordBaseMediaDecodeTime & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 24) & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 16) & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 8) & 0xFF, - lowerWordBaseMediaDecodeTime & 0xFF - ])); - - // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - dataOffset = (32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8); // mdat header - - // audio tracks require less metadata - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, - trackFragmentHeader, - trackFragmentDecodeTime, - trackFragmentRun); - } - - // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, - sampleDependencyTable.length + dataOffset); - return box(types.traf, - trackFragmentHeader, - trackFragmentDecodeTime, - trackFragmentRun, - sampleDependencyTable); -}; - -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ -trak = function(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, - tkhd(track), - mdia(track)); -}; - -trex = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - (track.id & 0xFF), // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); - // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function() { - var audioTrun, videoTrun, trunHeader; - - // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - trunHeader = function(samples, offset) { - var durationPresent = 0, sizePresent = 0, - flagsPresent = 0, compositionTimeOffset = 0; - - // trun flag constants - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [ - 0x00, // version 0 - 0x00, - durationPresent | sizePresent | flagsPresent | compositionTimeOffset, - 0x01, // flags - (samples.length & 0xFF000000) >>> 24, - (samples.length & 0xFF0000) >>> 16, - (samples.length & 0xFF00) >>> 8, - samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, - (offset & 0xFF0000) >>> 16, - (offset & 0xFF00) >>> 8, - offset & 0xFF // data_offset - ]; - }; - - videoTrun = function(track, offset) { - var bytes, samples, sample, i; - - samples = track.samples || []; - offset += 8 + 12 + (16 * samples.length); - - bytes = trunHeader(samples, offset); - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes = bytes.concat([ - (sample.duration & 0xFF000000) >>> 24, - (sample.duration & 0xFF0000) >>> 16, - (sample.duration & 0xFF00) >>> 8, - sample.duration & 0xFF, // sample_duration - (sample.size & 0xFF000000) >>> 24, - (sample.size & 0xFF0000) >>> 16, - (sample.size & 0xFF00) >>> 8, - sample.size & 0xFF, // sample_size - (sample.flags.isLeading << 2) | sample.flags.dependsOn, - (sample.flags.isDependedOn << 6) | - (sample.flags.hasRedundancy << 4) | - (sample.flags.paddingValue << 1) | - sample.flags.isNonSyncSample, - sample.flags.degradationPriority & 0xF0 << 8, - sample.flags.degradationPriority & 0x0F, // sample_flags - (sample.compositionTimeOffset & 0xFF000000) >>> 24, - (sample.compositionTimeOffset & 0xFF0000) >>> 16, - (sample.compositionTimeOffset & 0xFF00) >>> 8, - sample.compositionTimeOffset & 0xFF // sample_composition_time_offset - ]); - } - return box(types.trun, new Uint8Array(bytes)); - }; - - audioTrun = function(track, offset) { - var bytes, samples, sample, i; - - samples = track.samples || []; - offset += 8 + 12 + (8 * samples.length); - - bytes = trunHeader(samples, offset); - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes = bytes.concat([ - (sample.duration & 0xFF000000) >>> 24, - (sample.duration & 0xFF0000) >>> 16, - (sample.duration & 0xFF00) >>> 8, - sample.duration & 0xFF, // sample_duration - (sample.size & 0xFF000000) >>> 24, - (sample.size & 0xFF0000) >>> 16, - (sample.size & 0xFF00) >>> 8, - sample.size & 0xFF]); // sample_size - } - - return box(types.trun, new Uint8Array(bytes)); - }; - - trun = function(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -}()); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function(tracks) { - var - fileType = ftyp(), - movie = moov(tracks), - result; - - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; - -},{}],55:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2015 Brightcove - * All rights reserved. - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var findBox, parseType, timescale, startTime; - -// Find the data for a box specified by its path -findBox = function(data, path) { - var results = [], - i, size, type, end, subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = data[i] << 24; - size |= data[i + 1] << 16; - size |= data[i + 2] << 8; - size |= data[i + 3]; - - type = parseType(data.subarray(i + 4, i + 8)); - - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - if (subresults.length) { - results = results.concat(subresults); - } - } - } - i = end; - } - - // we've finished searching all of data - return results; -}; - -/** - * Returns the string representation of an ASCII encoded four byte buffer. - * @param buffer {Uint8Array} a four-byte buffer to translate - * @return {string} the corresponding string - */ -parseType = function(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ -timescale = function(init) { - var - result = {}, - traks = findBox(init, ['moov', 'trak']); - - // mdhd timescale - return traks.reduce(function(result, trak) { - var tkhd, version, index, id, mdhd; - - tkhd = findBox(trak, ['tkhd'])[0]; - if (!tkhd) { - return null; - } - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = tkhd[index] << 24 | - tkhd[index + 1] << 16 | - tkhd[index + 2] << 8 | - tkhd[index + 3]; - - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - if (!mdhd) { - return null; - } - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = mdhd[index] << 24 | - mdhd[index + 1] << 16 | - mdhd[index + 2] << 8 | - mdhd[index + 3]; - return result; - }, result); -}; - -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ -startTime = function(timescale, fragment) { - var trafs, baseTimes, result; - - // we need info from two childrend of each track fragment box - trafs = findBox(fragment, ['moof', 'traf']); - - // determine the start times for each track - baseTimes = [].concat.apply([], trafs.map(function(traf) { - return findBox(traf, ['tfhd']).map(function(tfhd) { - var id, scale, baseTime; - - // get the track id from the tfhd - id = tfhd[4] << 24 | - tfhd[5] << 16 | - tfhd[6] << 8 | - tfhd[7]; - // assume a 90kHz clock if no timescale was specified - scale = timescale[id] || 90e3; - - // get the base media decode time from the tfdt - baseTime = findBox(traf, ['tfdt']).map(function(tfdt) { - var version, result; - - version = tfdt[0]; - result = tfdt[4] << 24 | - tfdt[5] << 16 | - tfdt[6] << 8 | - tfdt[7]; - if (version === 1) { - result *= Math.pow(2, 32); - result += tfdt[8] << 24 | - tfdt[9] << 16 | - tfdt[10] << 8 | - tfdt[11]; - } - return result; - })[0]; - baseTime = baseTime || Infinity; - - // convert base time to seconds - return baseTime / scale; - }); - })); - - // return the minimum - result = Math.min.apply(null, baseTimes); - return isFinite(result) ? result : 0; -}; - -module.exports = { - parseType: parseType, - timescale: timescale, - startTime: startTime -}; - -},{}],56:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2015 Brightcove - * All rights reserved. - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('./mp4-generator.js'); -var m2ts = require('../m2ts/m2ts.js'); -var AdtsStream = require('../codecs/adts.js'); -var H264Stream = require('../codecs/h264').H264Stream; -var AacStream = require('../aac'); -var coneOfSilence = require('../data/silence'); -var clock = require('../utils/clock'); - -// constants -var AUDIO_PROPERTIES = [ - 'audioobjecttype', - 'channelcount', - 'samplerate', - 'samplingfrequencyindex', - 'samplesize' -]; - -var VIDEO_PROPERTIES = [ - 'width', - 'height', - 'profileIdc', - 'levelIdc', - 'profileCompatibility' -]; - -var ONE_SECOND_IN_TS = 90000; // 90kHz clock - -// object types -var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream; - -// Helper functions -var - createDefaultSample, - isLikelyAacData, - collectDtsInfo, - clearDtsInfo, - calculateTrackBaseMediaDecodeTime, - arrayEquals, - sumFrameByteLengths; - -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ -createDefaultSample = function() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0 - } - }; -}; - -isLikelyAacData = function(data) { - if ((data[0] === 'I'.charCodeAt(0)) && - (data[1] === 'D'.charCodeAt(0)) && - (data[2] === '3'.charCodeAt(0))) { - return true; - } - return false; -}; - -/** - * Compare two arrays (even typed) for same-ness - */ -arrayEquals = function(a, b) { - var - i; - - if (a.length !== b.length) { - return false; - } - - // compare the value of each element in the array - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ -sumFrameByteLengths = function(array) { - var - i, - currentObj, - sum = 0; - - // sum the byteLength's all each nal unit in the frame - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; - -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ -AudioSegmentStream = function(track) { - var - adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function(prop) { - track[prop] = data[prop]; - }); - } - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.setEarliestDts = function(earliestDts) { - earliestAllowedDts = earliestDts - track.timelineStartInfo.baseMediaDecodeTime; - }; - - this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function(timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function() { - var - frames, - moof, - mdat, - boxes; - - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = this.trimAdtsFramesByEarliestDts_(adtsFrames); - track.baseMediaDecodeTime = calculateTrackBaseMediaDecodeTime(track); - - this.prefixWithSilence_(track, frames); - - // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - track.samples = this.generateSampleTable_(frames); - - // concatenate the audio data to constuct the mdat - mdat = mp4.mdat(this.concatenateFrameData_(frames)); - - adtsFrames = []; - - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - // bump the sequence number for next time - sequenceNumber++; - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - clearDtsInfo(track); - - this.trigger('data', {track: track, boxes: boxes}); - this.trigger('done', 'AudioSegmentStream'); - }; - - // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - this.prefixWithSilence_ = function(track, frames) { - var - baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); - // determine frame clock duration based on sample rate, round up to avoid overfills - frameDuration = Math.ceil(ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = - baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); - // number of full frames in the audio gap - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } - - // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - if (audioFillFrameCount < 1 || audioFillDuration > ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - frames.splice(i, 0, { - data: silentFrame - }); - } - - track.baseMediaDecodeTime -= - Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - }; - - // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - this.trimAdtsFramesByEarliestDts_ = function(adtsFrames) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } - - // We will need to recalculate the earliest segment Dts - track.minSegmentDts = Infinity; - - return adtsFrames.filter(function(currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } - // Otherwise, discard it - return false; - }); - }; - - // generate the track's raw mdat data from an array of frames - this.generateSampleTable_ = function(frames) { - var - i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - }); - } - return samples; - }; - - // generate the track's sample table from an array of frames - this.concatenateFrameData_ = function(frames) { - var - i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - return data; - }; -}; - -AudioSegmentStream.prototype = new Stream(); - -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - */ -VideoSegmentStream = function(track) { - var - sequenceNumber = 0, - nalUnits = [], - config, - pps; - - VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - - this.gopCache_ = []; - - this.push = function(nalUnit) { - collectDtsInfo(track, nalUnit); - - // record the track config - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - - VIDEO_PROPERTIES.forEach(function(prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && - !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } - - // buffer video until flush() is called - nalUnits.push(nalUnit); - }; - - this.flush = function() { - var - frames, - gopForFusion, - gops, - moof, - mdat, - boxes; - - // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // Return early if no video data has been observed - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } - - // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - frames = this.groupNalsIntoFrames_(nalUnits); - gops = this.groupFramesIntoGops_(frames); - - // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - gops.unshift(gopForFusion); - // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyrame-pulling - gops = this.extendFirstKeyFrame_(gops); - } - } - collectDtsInfo(track, gops); - - // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - track.samples = this.generateSampleTable_(gops); - - // Concatenate the video data and construct the mdat - mdat = mp4.mdat(this.concatenateNalData_(gops)); - - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); - - // Keep a maximum of 6 GOPs in the cache - this.gopCache_.length = Math.min(6, this.gopCache_.length); - - // Clear nalUnits - nalUnits = []; - - track.baseMediaDecodeTime = calculateTrackBaseMediaDecodeTime(track); - - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - - moof = mp4.moof(sequenceNumber, [track]); - - // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - // Bump the sequence number for next time - sequenceNumber++; - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - this.trigger('data', {track: track, boxes: boxes}); - - this.resetStream_(); - - // Continue with the flush process now - this.trigger('done', 'VideoSegmentStream'); - }; - - this.resetStream_ = function() { - clearDtsInfo(track); - - // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - config = undefined; - pps = undefined; - }; - - // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - this.getGopForFusion_ = function(nalUnit) { - var - halfSecond = 45000, // Half-a-second in a 90khz clock - allowableOverlap = 10000, // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; - - // Search for the GOP nearest to the beginning of this nal unit - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; - - // Reject Gops with different SPS or PPS - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || - !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } - - // Reject Gops that would require a negative baseMediaDecodeTime - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } - - // The distance between the end of the gop and the start of the nalUnit - dtsDistance = (nalUnit.dts - currentGop.dts) - currentGop.duration; - - // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - if (dtsDistance >= -allowableOverlap && - dtsDistance <= halfSecond) { - - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || - nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - return null; - }; - - this.extendFirstKeyFrame_ = function(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; - - // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - this.groupNalsIntoFrames_ = function(nalUnits) { - var - i, - currentNal, - currentFrame = [], - frames = []; - - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; - - // Split on 'aud'-type nal units - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; - frames.push(currentFrame); - } - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } - - // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - if (frames.length && - (!currentFrame.duration || - currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } - - // Push the final frame - frames.push(currentFrame); - return frames; - }; - - // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - this.groupFramesIntoGops_ = function(frames) { - var - i, - currentFrame, - currentGop = [], - gops = []; - - // We must pre-set some of the values on the Gop since we - // keep running totals of these values - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; - - // store some metadata about all the Gops - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - - // push the final Gop - gops.push(currentGop); - return gops; - }; - - // generate the track's sample table from an array of gops - this.generateSampleTable_ = function(gops, baseDataOffset) { - var - h, i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - - sample = createDefaultSample(); - - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = currentFrame.pts - currentFrame.dts; - sample.duration = currentFrame.duration; - sample.size = 4 * currentFrame.length; // Space for nal unit size - sample.size += currentFrame.byteLength; - - if (currentFrame.keyFrame) { - sample.flags.dependsOn = 2; - } - - dataOffset += sample.size; - - samples.push(sample); - } - } - return samples; - }; - - // generate the track's raw mdat data from an array of gops - this.concatenateNalData_ = function(gops) { - var - h, i, j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); - - // For each Gop.. - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - // For each Frame.. - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - - // For each NAL.. - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - return data; - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ -collectDtsInfo = function(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; - -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ -clearDtsInfo = function(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; - -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - */ -calculateTrackBaseMediaDecodeTime = function(track) { - var - baseMediaDecodeTime, - scale, - // Calculate the distance, in time, that this segment starts from the start - // of the timeline (earliest time seen since the transmuxer initialized) - timeSinceStartOfTimeline = track.minSegmentDts - track.timelineStartInfo.dts; - - // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; - - // Add to that the distance this segment is from the very first - baseMediaDecodeTime += timeSinceStartOfTimeline; - - // baseMediaDecodeTime must not become negative - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - */ -CoalesceStream = function(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - CoalesceStream.prototype.init.call(this); - - // Take output from multiple - this.push = function(output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.text) { - return this.pendingCaptions.push(output); - } - // buffer incoming id3 tags until the final flush - if (output.frames) { - return this.pendingMetadata.push(output); - } - - // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - this.pendingTracks.push(output.track); - this.pendingBoxes.push(output.boxes); - this.pendingBytes += output.boxes.byteLength; - - if (output.track.type === 'video') { - this.videoTrack = output.track; - } - if (output.track.type === 'audio') { - this.audioTrack = output.track; - } - }; -}; - -CoalesceStream.prototype = new Stream(); -CoalesceStream.prototype.flush = function(flushSource) { - var - offset = 0, - event = { - captions: [], - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && - flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function(prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function(prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - - initSegment = mp4.initSegment(this.pendingTracks); - - // Create a new typed array to hold the init segment - event.initSegment = new Uint8Array(initSegment.byteLength); - - // Create an init segment containing a moov - // and track definitions - event.initSegment.set(initSegment); - - // Create a new typed array to hold the moof+mdats - event.data = new Uint8Array(this.pendingBytes); - - // Append each moof+mdat (one per track) together - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } - - // Translate caption PTS times into second offsets into the - // video timeline for the segment - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = (caption.startPts - timelineStartPts); - caption.startTime /= 90e3; - caption.endTime = (caption.endPts - timelineStartPts); - caption.endTime /= 90e3; - event.captions.push(caption); - } - - // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = (id3.pts - timelineStartPts); - id3.cueTime /= 90e3; - event.metadata.push(id3); - } - // We add this to every single emitted segment even though we only need - // it for the first - event.metadata.dispatchType = this.metadataStream.dispatchType; - - // Reset stream state - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; - - // Emit the built segment - this.trigger('data', event); - - // Only emit `done` if all tracks have been flushed and emitted - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ -Transmuxer = function(options) { - var - self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function() { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); - - // set up the parsing pipeline - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - - pipeline.aacStream - .pipe(pipeline.audioTimestampRolloverStream) - .pipe(pipeline.adtsStream); - pipeline.aacStream - .pipe(pipeline.timedMetadataTimestampRolloverStream) - .pipe(pipeline.metadataStream) - .pipe(pipeline.coalesceStream); - - pipeline.metadataStream.on('timestamp', function(frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - - pipeline.aacStream.on('data', function(data) { - if (data.type === 'timed-metadata' && !pipeline.audioSegmentStream) { - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack); - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream) - .pipe(pipeline.coalesceStream); - } - }); - - // Re-emit any data coming from the coalesce stream to the outside world - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - // Let the consumer know we have finished flushing the entire pipeline - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - this.setupTsPipeline = function() { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); - - // set up the parsing pipeline - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(); - pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; - - // disassemble MPEG2-TS packets into elementary streams - pipeline.packetStream - .pipe(pipeline.parseStream) - .pipe(pipeline.elementaryStream); - - // !!THIS ORDER IS IMPORTANT!! - // demux the streams - pipeline.elementaryStream - .pipe(pipeline.videoTimestampRolloverStream) - .pipe(pipeline.h264Stream); - pipeline.elementaryStream - .pipe(pipeline.audioTimestampRolloverStream) - .pipe(pipeline.adtsStream); - - pipeline.elementaryStream - .pipe(pipeline.timedMetadataTimestampRolloverStream) - .pipe(pipeline.metadataStream) - .pipe(pipeline.coalesceStream); - - // Hook up CEA-608/708 caption stream - pipeline.h264Stream.pipe(pipeline.captionStream) - .pipe(pipeline.coalesceStream); - - pipeline.elementaryStream.on('data', function(data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; - - // scan the tracks listed in the metadata - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } - - // hook up the video segment stream to the first track with h264 data - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack); - - pipeline.videoSegmentStream.on('timelineStartInfo', function(timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. - if (audioTrack) { - audioTrack.timelineStartInfo = timelineStartInfo; - // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts); - } - }); - - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function(baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - - // Set up the final part of the video pipeline - pipeline.h264Stream - .pipe(pipeline.videoSegmentStream) - .pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream) - .pipe(pipeline.coalesceStream); - } - } - }); - - // Re-emit any data coming from the coalesce stream to the outside world - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - // Let the consumer know we have finished flushing the entire pipeline - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - }; - - // hook up the segment streams once track metadata is delivered - this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - this.baseMediaDecodeTime = baseMediaDecodeTime; - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - clearDtsInfo(audioTrack); - audioTrack.timelineStartInfo.baseMediaDecodeTime = baseMediaDecodeTime; - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - pipeline.videoTimestampRolloverStream.discontinuity(); - } - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - clearDtsInfo(videoTrack); - videoTrack.timelineStartInfo.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (pipeline.timedMetadataTimestampRolloverStream) { - pipeline.timedMetadataTimestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function(timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - // feed incoming data to the front of the parsing pipeline - this.push = function(data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - hasFlushed = false; - } - this.transmuxPipeline_.headOfPipeline.push(data); - }; - - // flush any buffered data - this.flush = function() { - hasFlushed = true; - // Start at the top of the pipeline and flush all pending work - this.transmuxPipeline_.headOfPipeline.flush(); - }; -}; -Transmuxer.prototype = new Stream(); - -module.exports = { - Transmuxer: Transmuxer, - VideoSegmentStream: VideoSegmentStream, - AudioSegmentStream: AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES -}; - -},{"../aac":36,"../codecs/adts.js":38,"../codecs/h264":39,"../data/silence":40,"../m2ts/m2ts.js":48,"../utils/clock":58,"../utils/stream.js":60,"./mp4-generator.js":54}],57:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2016 Brightcove - * All rights reserved. - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/probe.js'); - - -var - PES_TIMESCALE = 90000, - MP2T_PACKET_LENGTH = 188, // bytes - SYNC_BYTE = 0x47; - -var isLikelyAacData = function(data) { - if ((data[0] === 'I'.charCodeAt(0)) && - (data[1] === 'D'.charCodeAt(0)) && - (data[2] === '3'.charCodeAt(0))) { - return true; - } - return false; -}; - -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ -var parsePsi_ = function(bytes, pmt) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - if (!pmt.pid) { - pmt.pid = probe.ts.parsePat(packet); - } - break; - case 'pmt': - if (!pmt.table) { - pmt.table = probe.ts.parsePmt(packet); - } - break; - default: - break; - } - - // Found the pat and pmt, we can stop walking the segment - if (pmt.pid && pmt.table) { - return; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } -}; - -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ -var parseAudioPes_ = function(bytes, pmt, result) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type, pesType, pusi, parsed; - - var endLoop = false; - - // Start walking from start of segment to get first audio packet - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // Start walking from end of segment to get last audio packet - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex--; - endIndex--; - } -}; - -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ -var parseVideoPes_ = function(bytes, pmt, result) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type, pesType, pusi, parsed, frame, i, pes; - - var endLoop = false; - - var currentFrame = { - data: [], - size: 0 - }; - - // Start walking from start of segment to get first video packet - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - result.firstKeyFrame = probe.ts.parsePesTime(frame); - result.firstKeyFrame.type = 'video'; - } - currentFrame.size = 0; - } - } - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - break; - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // Start walking from end of segment to get last video packet - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex--; - endIndex--; - } -}; - -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ -var adjustTimestamp_ = function(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - if (typeof audioBaseTimestamp === 'undefined') { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - segmentInfo.audio.forEach(function(info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); - // time in seconds - info.dtsTime = info.dts / PES_TIMESCALE; - info.ptsTime = info.pts / PES_TIMESCALE; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - if (typeof videoBaseTimestamp === 'undefined') { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - segmentInfo.video.forEach(function(info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); - // time in seconds - info.dtsTime = info.dts / PES_TIMESCALE; - info.ptsTime = info.pts / PES_TIMESCALE; - }); - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); - // time in seconds - frame.dtsTime = frame.dts / PES_TIMESCALE; - frame.ptsTime = frame.dts / PES_TIMESCALE; - } - } -}; - -/** - * inspects the aac data stream for start and end time information - */ -var inspectAac_ = function(bytes) { - var - endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > bytes.length) { - endLoop = true; - break; - } - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - byteIndex += frameSize; - break; - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > bytes.length) { - endLoop = true; - break; - } - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - audioCount++; - byteIndex += frameSize; - break; - default: - byteIndex++; - break; - } - if (endLoop) { - return null; - } - } - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = PES_TIMESCALE / sampleRate; - - var result = { - audio: [ - { - type: 'audio', - dts: timestamp, - pts: timestamp - }, - { - type: 'audio', - dts: timestamp + (audioCount * 1024 * audioTimescale), - pts: timestamp + (audioCount * 1024 * audioTimescale) - } - ] - }; - - return result; -}; - -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ -var inspectTs_ = function(bytes) { - var pmt = { - pid: null, - table: null - }; - - var result = {}; - - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - if (result.video.length === 0) { - delete result.video; - } - break; - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - if (result.audio.length === 0) { - delete result.audio; - } - break; - default: - break; - } - } - } - return result; -}; - -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ -var inspect = function(bytes, baseTimestamp) { - var isAacData = isLikelyAacData(bytes); - - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || (!result.audio && !result.video)) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - - return result; -}; - -module.exports = { - inspect: inspect -}; - -},{"../aac/probe.js":37,"../m2ts/probe.js":50,"../m2ts/stream-types.js":51,"../m2ts/timestamp-rollover-stream.js":52}],58:[function(require,module,exports){ -var - ONE_SECOND_IN_TS = 90000, // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs; - -secondsToVideoTs = function(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; - -module.exports = { - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs -}; - -},{}],59:[function(require,module,exports){ -'use strict'; - -var ExpGolomb; - -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ -ExpGolomb = function(workingData) { - var - // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - - // the current word being examined - workingWord = 0, // :uint - - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - - // ():uint - this.length = function() { - return (8 * workingBytesAvailable); - }; - - // ():uint - this.bitsAvailable = function() { - return (8 * workingBytesAvailable) + workingBitsAvailable; - }; - - // ():void - this.loadWord = function() { - var - position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, - position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); - - // track the amount of workingData that has been processed - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; - - // (count:int):void - this.skipBits = function(count) { - var skipBytes; // :int - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - - count -= (skipBytes * 8); - workingBytesAvailable -= skipBytes; - - this.loadWord(); - - workingWord <<= count; - workingBitsAvailable -= count; - } - }; - - // (size:int):uint - this.readBits = function(size) { - var - bits = Math.min(workingBitsAvailable, size), // :uint - valu = workingWord >>> (32 - bits); // :uint - // if size > 31, handle error - workingBitsAvailable -= bits; - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - return valu; - }; - - // ():uint - this.skipLeadingZeros = function() { - var leadingZeroCount; // :uint - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & (0x80000000 >>> leadingZeroCount)) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } - - // we exhausted workingWord and still have not found a 1 - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; - - // ():void - this.skipUnsignedExpGolomb = function() { - this.skipBits(1 + this.skipLeadingZeros()); - }; - - // ():void - this.skipExpGolomb = function() { - this.skipBits(1 + this.skipLeadingZeros()); - }; - - // ():uint - this.readUnsignedExpGolomb = function() { - var clz = this.skipLeadingZeros(); // :uint - return this.readBits(clz + 1) - 1; - }; - - // ():int - this.readExpGolomb = function() { - var valu = this.readUnsignedExpGolomb(); // :int - if (0x01 & valu) { - // the number is odd if the low order bit is set - return (1 + valu) >>> 1; // add 1 to make it even, and divide by 2 - } - return -1 * (valu >>> 1); // divide by two then make it negative - }; - - // Some convenience functions - // :Boolean - this.readBoolean = function() { - return this.readBits(1) === 1; - }; - - // ():int - this.readUnsignedByte = function() { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; - -},{}],60:[function(require,module,exports){ -/** - * mux.js - * - * Copyright (c) 2014 Brightcove - * All rights reserved. - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function() { - this.init = function() { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - this.on = function(type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - this.off = function(type, listener) { - var index; - if (!listeners[type]) { - return false; - } - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - this.trigger = function(type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - if (!callbacks) { - return; - } - // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - if (arguments.length === 2) { - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - this.dispose = function() { - listeners = {}; - }; - }; -}; - -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ -Stream.prototype.pipe = function(destination) { - this.on('data', function(data) { - destination.push(data); - }); - - this.on('done', function(flushSource) { - destination.flush(flushSource); - }); - - return destination; -}; - -// Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. -Stream.prototype.push = function(data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function(flushSource) { - this.trigger('done', flushSource); -}; - -module.exports = Stream; - -},{}],61:[function(require,module,exports){ -/* jshint ignore:start */ -(function(root) { -/* jshint ignore:end */ - var URLToolkit = { - // build an absolute URL from a relative one using the provided baseURL - // if relativeURL is an absolute URL it will be returned as is. - buildAbsoluteURL: function(baseURL, relativeURL) { - // remove any remaining space and CRLF - relativeURL = relativeURL.trim(); - if (/^[a-z]+:/i.test(relativeURL)) { - // complete url, not relative - return relativeURL; - } - - var relativeURLQuery = null; - var relativeURLHash = null; - - var relativeURLHashSplit = /^([^#]*)(.*)$/.exec(relativeURL); - if (relativeURLHashSplit) { - relativeURLHash = relativeURLHashSplit[2]; - relativeURL = relativeURLHashSplit[1]; - } - var relativeURLQuerySplit = /^([^\?]*)(.*)$/.exec(relativeURL); - if (relativeURLQuerySplit) { - relativeURLQuery = relativeURLQuerySplit[2]; - relativeURL = relativeURLQuerySplit[1]; - } - - var baseURLHashSplit = /^([^#]*)(.*)$/.exec(baseURL); - if (baseURLHashSplit) { - baseURL = baseURLHashSplit[1]; - } - var baseURLQuerySplit = /^([^\?]*)(.*)$/.exec(baseURL); - if (baseURLQuerySplit) { - baseURL = baseURLQuerySplit[1]; - } - - var baseURLDomainSplit = /^(([a-z]+:)?\/\/[^:\/]+(:[0-9]+)?)?(\/?.*)$/i.exec(baseURL); - if (!baseURLDomainSplit) { - throw new Error('Error trying to parse base URL.'); - } - - // e.g. 'http:', 'https:', '' - var baseURLProtocol = baseURLDomainSplit[2] || ''; - // e.g. 'http://example.com', '//example.com', '' - var baseURLProtocolDomain = baseURLDomainSplit[1] || ''; - // e.g. '/a/b/c/playlist.m3u8', 'a/b/c/playlist.m3u8' - var baseURLPath = baseURLDomainSplit[4]; - if (baseURLPath.indexOf('/') !== 0 && baseURLProtocolDomain !== '') { - // this handles a base url of http://example.com (missing last slash) - baseURLPath = '/'+baseURLPath; - } - - var builtURL = null; - if (/^\/\//.test(relativeURL)) { - // relative url starts wth '//' so copy protocol (which may be '' if baseUrl didn't provide one) - builtURL = baseURLProtocol+'//'+URLToolkit.buildAbsolutePath('', relativeURL.substring(2)); - } - else if (/^\//.test(relativeURL)) { - // relative url starts with '/' so start from root of domain - builtURL = baseURLProtocolDomain+'/'+URLToolkit.buildAbsolutePath('', relativeURL.substring(1)); - } - else { - builtURL = URLToolkit.buildAbsolutePath(baseURLProtocolDomain+baseURLPath, relativeURL); - } - - // put the query and hash parts back - if (relativeURLQuery) { - builtURL += relativeURLQuery; - } - if (relativeURLHash) { - builtURL += relativeURLHash; - } - return builtURL; - }, - - // build an absolute path using the provided basePath - // adapted from https://developer.mozilla.org/en-US/docs/Web/API/document/cookie#Using_relative_URLs_in_the_path_parameter - // this does not handle the case where relativePath is "/" or "//". These cases should be handled outside this. - buildAbsolutePath: function(basePath, relativePath) { - var sRelPath = relativePath; - var nUpLn, sDir = '', sPath = basePath.replace(/[^\/]*$/, sRelPath.replace(/(\/|^)(?:\.?\/+)+/g, '$1')); - for (var nEnd, nStart = 0; nEnd = sPath.indexOf('/../', nStart), nEnd > -1; nStart = nEnd + nUpLn) { - nUpLn = /^\/(?:\.\.\/)*/.exec(sPath.slice(nEnd))[0].length; - sDir = (sDir + sPath.substring(nStart, nEnd)).replace(new RegExp('(?:\\\/+[^\\\/]*){0,' + ((nUpLn - 1) / 3) + '}$'), '/'); - } - return sDir + sPath.substr(nStart); - } - }; - -/* jshint ignore:start */ - if(typeof exports === 'object' && typeof module === 'object') - module.exports = URLToolkit; - else if(typeof define === 'function' && define.amd) - define([], function() { return URLToolkit; }); - else if(typeof exports === 'object') - exports["URLToolkit"] = URLToolkit; - else - root["URLToolkit"] = URLToolkit; -})(this); -/* jshint ignore:end */ - -},{}],62:[function(require,module,exports){ -(function (global){ -/** - * @file add-text-track-data.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -/** - * Define properties on a cue for backwards compatability, - * but warn the user that the way that they are using it - * is depricated and will be removed at a later date. - * - * @param {Cue} cue the cue to add the properties on - * @private - */ -var deprecateOldCue = function deprecateOldCue(cue) { - Object.defineProperties(cue.frame, { - id: { - get: function get() { - _videoJs2['default'].log.warn('cue.frame.id is deprecated. Use cue.value.key instead.'); - return cue.value.key; - } - }, - value: { - get: function get() { - _videoJs2['default'].log.warn('cue.frame.value is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - }, - privateData: { - get: function get() { - _videoJs2['default'].log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.'); - return cue.value.data; - } - } - }); -}; - -var durationOfVideo = function durationOfVideo(duration) { - var dur = undefined; - - if (isNaN(duration) || Math.abs(duration) === Infinity) { - dur = Number.MAX_VALUE; - } else { - dur = duration; - } - return dur; -}; -/** - * Add text track data to a source handler given the captions and - * metadata from the buffer. - * - * @param {Object} sourceHandler the flash or virtual source buffer - * @param {Array} captionArray an array of caption data - * @param {Array} metadataArray an array of meta data - * @private - */ -var addTextTrackData = function addTextTrackData(sourceHandler, captionArray, metadataArray) { - var Cue = _globalWindow2['default'].WebKitDataCue || _globalWindow2['default'].VTTCue; - - if (captionArray) { - captionArray.forEach(function (caption) { - this.inbandTextTrack_.addCue(new Cue(caption.startTime + this.timestampOffset, caption.endTime + this.timestampOffset, caption.text)); - }, sourceHandler); - } - - if (metadataArray) { - (function () { - var videoDuration = durationOfVideo(sourceHandler.mediaSource_.duration); - - metadataArray.forEach(function (metadata) { - var time = metadata.cueTime + this.timestampOffset; - - metadata.frames.forEach(function (frame) { - var cue = new Cue(time, time, frame.value || frame.url || frame.data || ''); - - cue.frame = frame; - cue.value = frame; - deprecateOldCue(cue); - - this.metadataTrack_.addCue(cue); - }, this); - }, sourceHandler); - - // Updating the metadeta cues so that - // the endTime of each cue is the startTime of the next cue - // the endTime of last cue is the duration of the video - if (sourceHandler.metadataTrack_ && sourceHandler.metadataTrack_.cues && sourceHandler.metadataTrack_.cues.length) { - (function () { - var cues = sourceHandler.metadataTrack_.cues; - var cuesArray = []; - - // Create a copy of the TextTrackCueList... - // ...disregarding cues with a falsey value - for (var i = 0; i < cues.length; i++) { - if (cues[i]) { - cuesArray.push(cues[i]); - } - } - - // Group cues by their startTime value - var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) { - var timeSlot = obj[cue.startTime] || []; - - timeSlot.push(cue); - obj[cue.startTime] = timeSlot; - - return obj; - }, {}); - - // Sort startTimes by ascending order - var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) { - return Number(a) - Number(b); - }); - - // Map each cue group's endTime to the next group's startTime - sortedStartTimes.forEach(function (startTime, idx) { - var cueGroup = cuesGroupedByStartTime[startTime]; - var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration; - - // Map each cue's endTime the next group's startTime - cueGroup.forEach(function (cue) { - cue.endTime = nextTime; - }); - }); - })(); - } - })(); - } -}; - -exports['default'] = { - addTextTrackData: addTextTrackData, - durationOfVideo: durationOfVideo -}; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"global/window":30}],63:[function(require,module,exports){ -/** - * Remove the text track from the player if one with matching kind and - * label properties already exists on the player - * - * @param {Object} player the video.js player object - * @param {String} kind to be considered the text track's `kind` must match - * @param {String} label to be considered the text track's `label` must match - * @private - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -var removeExistingTrack = function removeExistingTrack(player, kind, label) { - var tracks = player.remoteTextTracks() || []; - - for (var i = 0; i < tracks.length; i++) { - var track = tracks[i]; - - if (track.kind === kind && track.label === label) { - player.removeRemoteTextTrack(track); - } - } -}; - -exports.removeExistingTrack = removeExistingTrack; -/** - * Cleaup text tracks on video.js if they exist - * - * @param {Object} player the video.js player object - * @private - */ -var cleanupTextTracks = function cleanupTextTracks(player) { - removeExistingTrack(player, 'captions', 'cc1'); - removeExistingTrack(player, 'metadata', 'Timed Metadata'); -}; -exports.cleanupTextTracks = cleanupTextTracks; -},{}],64:[function(require,module,exports){ -/** - * @file codec-utils.js - */ - -/** - * Check if a codec string refers to an audio codec. - * - * @param {String} codec codec string to check - * @return {Boolean} if this is an audio codec - * @private - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -var isAudioCodec = function isAudioCodec(codec) { - return (/mp4a\.\d+.\d+/i.test(codec) - ); -}; - -/** - * Check if a codec string refers to a video codec. - * - * @param {String} codec codec string to check - * @return {Boolean} if this is a video codec - * @private - */ -var isVideoCodec = function isVideoCodec(codec) { - return (/avc1\.[\da-f]+/i.test(codec) - ); -}; - -/** - * Parse a content type header into a type and parameters - * object - * - * @param {String} type the content type header - * @return {Object} the parsed content-type - * @private - */ -var parseContentType = function parseContentType(type) { - var object = { type: '', parameters: {} }; - var parameters = type.trim().split(';'); - - // first parameter should always be content-type - object.type = parameters.shift().trim(); - parameters.forEach(function (parameter) { - var pair = parameter.trim().split('='); - - if (pair.length > 1) { - var _name = pair[0].replace(/"/g, '').trim(); - var value = pair[1].replace(/"/g, '').trim(); - - object.parameters[_name] = value; - } - }); - - return object; -}; - -/** - * Replace the old apple-style `avc1.<dd>.<dd>` codec string with the standard - * `avc1.<hhhhhh>` - * - * @param {Array} codecs an array of codec strings to fix - * @return {Array} the translated codec array - * @private - */ -var translateLegacyCodecs = function translateLegacyCodecs(codecs) { - return codecs.map(function (codec) { - return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) { - var profileHex = ('00' + Number(profile).toString(16)).slice(-2); - var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2); - - return 'avc1.' + profileHex + '00' + avcLevelHex; - }); - }); -}; - -exports['default'] = { - isAudioCodec: isAudioCodec, - parseContentType: parseContentType, - isVideoCodec: isVideoCodec, - translateLegacyCodecs: translateLegacyCodecs -}; -module.exports = exports['default']; -},{}],65:[function(require,module,exports){ -/** - * @file create-text-tracks-if-necessary.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _cleanupTextTracks = require('./cleanup-text-tracks'); - -/** - * Create text tracks on video.js if they exist on a segment. - * - * @param {Object} sourceBuffer the VSB or FSB - * @param {Object} mediaSource the HTML or Flash media source - * @param {Object} segment the segment that may contain the text track - * @private - */ -var createTextTracksIfNecessary = function createTextTracksIfNecessary(sourceBuffer, mediaSource, segment) { - var player = mediaSource.player_; - - // create an in-band caption track if one is present in the segment - if (segment.captions && segment.captions.length && !sourceBuffer.inbandTextTrack_) { - (0, _cleanupTextTracks.removeExistingTrack)(player, 'captions', 'cc1'); - sourceBuffer.inbandTextTrack_ = player.addRemoteTextTrack({ - kind: 'captions', - label: 'cc1' - }, false).track; - player.tech_.trigger({ type: 'usage', name: 'hls-608' }); - } - - if (segment.metadata && segment.metadata.length && !sourceBuffer.metadataTrack_) { - (0, _cleanupTextTracks.removeExistingTrack)(player, 'metadata', 'Timed Metadata', true); - sourceBuffer.metadataTrack_ = player.addRemoteTextTrack({ - kind: 'metadata', - label: 'Timed Metadata' - }, false).track; - sourceBuffer.metadataTrack_.inBandMetadataTrackDispatchType = segment.metadata.dispatchType; - } -}; - -exports['default'] = createTextTracksIfNecessary; -module.exports = exports['default']; -},{"./cleanup-text-tracks":63}],66:[function(require,module,exports){ -/** - * @file flash-constants.js - */ -/** - * The maximum size in bytes for append operations to the video.js - * SWF. Calling through to Flash blocks and can be expensive so - * we chunk data and pass through 4KB at a time, yielding to the - * browser between chunks. This gives a theoretical maximum rate of - * 1MB/s into Flash. Any higher and we begin to drop frames and UI - * responsiveness suffers. - * - * @private - */ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var flashConstants = { - // times in milliseconds - TIME_BETWEEN_CHUNKS: 1, - BYTES_PER_CHUNK: 1024 * 32 -}; - -exports["default"] = flashConstants; -module.exports = exports["default"]; -},{}],67:[function(require,module,exports){ -(function (global){ -/** - * @file flash-media-source.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _globalDocument = require('global/document'); - -var _globalDocument2 = _interopRequireDefault(_globalDocument); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _flashSourceBuffer = require('./flash-source-buffer'); - -var _flashSourceBuffer2 = _interopRequireDefault(_flashSourceBuffer); - -var _flashConstants = require('./flash-constants'); - -var _flashConstants2 = _interopRequireDefault(_flashConstants); - -var _codecUtils = require('./codec-utils'); - -var _cleanupTextTracks = require('./cleanup-text-tracks'); - -/** - * A flash implmentation of HTML MediaSources and a polyfill - * for browsers that don't support native or HTML MediaSources.. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource - * @class FlashMediaSource - * @extends videojs.EventTarget - */ - -var FlashMediaSource = (function (_videojs$EventTarget) { - _inherits(FlashMediaSource, _videojs$EventTarget); - - function FlashMediaSource() { - var _this = this; - - _classCallCheck(this, FlashMediaSource); - - _get(Object.getPrototypeOf(FlashMediaSource.prototype), 'constructor', this).call(this); - this.sourceBuffers = []; - this.readyState = 'closed'; - - this.on(['sourceopen', 'webkitsourceopen'], function (event) { - // find the swf where we will push media data - _this.swfObj = _globalDocument2['default'].getElementById(event.swfId); - _this.player_ = (0, _videoJs2['default'])(_this.swfObj.parentNode); - _this.tech_ = _this.swfObj.tech; - _this.readyState = 'open'; - - _this.tech_.on('seeking', function () { - var i = _this.sourceBuffers.length; - - while (i--) { - _this.sourceBuffers[i].abort(); - } - }); - - if (_this.tech_.hls) { - _this.tech_.hls.on('dispose', function () { - (0, _cleanupTextTracks.cleanupTextTracks)(_this.player_); - }); - } - - // trigger load events - if (_this.swfObj) { - _this.swfObj.vjs_load(); - } - }); - } - - /** - * Set or return the presentation duration. - * - * @param {Double} value the duration of the media in seconds - * @param {Double} the current presentation duration - * @link http://www.w3.org/TR/media-source/#widl-MediaSource-duration - */ - - /** - * We have this function so that the html and flash interfaces - * are the same. - * - * @private - */ - - _createClass(FlashMediaSource, [{ - key: 'addSeekableRange_', - value: function addSeekableRange_() {} - // intentional no-op - - /** - * Create a new flash source buffer and add it to our flash media source. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/addSourceBuffer - * @param {String} type the content-type of the source - * @return {Object} the flash source buffer - */ - - }, { - key: 'addSourceBuffer', - value: function addSourceBuffer(type) { - var parsedType = (0, _codecUtils.parseContentType)(type); - var sourceBuffer = undefined; - - // if this is an FLV type, we'll push data to flash - if (parsedType.type === 'video/mp2t') { - // Flash source buffers - sourceBuffer = new _flashSourceBuffer2['default'](this); - } else { - throw new Error('NotSupportedError (Video.js)'); - } - - this.sourceBuffers.push(sourceBuffer); - return sourceBuffer; - } - - /** - * Signals the end of the stream. - * - * @link https://w3c.github.io/media-source/#widl-MediaSource-endOfStream-void-EndOfStreamError-error - * @param {String=} error Signals that a playback error - * has occurred. If specified, it must be either "network" or - * "decode". - */ - }, { - key: 'endOfStream', - value: function endOfStream(error) { - if (error === 'network') { - // MEDIA_ERR_NETWORK - this.tech_.error(2); - } else if (error === 'decode') { - // MEDIA_ERR_DECODE - this.tech_.error(3); - } - if (this.readyState !== 'ended') { - this.readyState = 'ended'; - this.swfObj.vjs_endOfStream(); - } - } - }]); - - return FlashMediaSource; -})(_videoJs2['default'].EventTarget); - -exports['default'] = FlashMediaSource; -try { - Object.defineProperty(FlashMediaSource.prototype, 'duration', { - /** - * Return the presentation duration. - * - * @return {Double} the duration of the media in seconds - * @link http://www.w3.org/TR/media-source/#widl-MediaSource-duration - */ - get: function get() { - if (!this.swfObj) { - return NaN; - } - // get the current duration from the SWF - return this.swfObj.vjs_getProperty('duration'); - }, - /** - * Set the presentation duration. - * - * @param {Double} value the duration of the media in seconds - * @return {Double} the duration of the media in seconds - * @link http://www.w3.org/TR/media-source/#widl-MediaSource-duration - */ - set: function set(value) { - var i = undefined; - var oldDuration = this.swfObj.vjs_getProperty('duration'); - - this.swfObj.vjs_setProperty('duration', value); - - if (value < oldDuration) { - // In MSE, this triggers the range removal algorithm which causes - // an update to occur - for (i = 0; i < this.sourceBuffers.length; i++) { - this.sourceBuffers[i].remove(value, oldDuration); - } - } - - return value; - } - }); -} catch (e) { - // IE8 throws if defineProperty is called on a non-DOM node. We - // don't support IE8 but we shouldn't throw an error if loaded - // there. - FlashMediaSource.prototype.duration = NaN; -} - -for (var property in _flashConstants2['default']) { - FlashMediaSource[property] = _flashConstants2['default'][property]; -} -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./cleanup-text-tracks":63,"./codec-utils":64,"./flash-constants":66,"./flash-source-buffer":68,"global/document":29}],68:[function(require,module,exports){ -(function (global){ -/** - * @file flash-source-buffer.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _muxJsLibFlv = require('mux.js/lib/flv'); - -var _muxJsLibFlv2 = _interopRequireDefault(_muxJsLibFlv); - -var _removeCuesFromTrack = require('./remove-cues-from-track'); - -var _removeCuesFromTrack2 = _interopRequireDefault(_removeCuesFromTrack); - -var _createTextTracksIfNecessary = require('./create-text-tracks-if-necessary'); - -var _createTextTracksIfNecessary2 = _interopRequireDefault(_createTextTracksIfNecessary); - -var _addTextTrackData = require('./add-text-track-data'); - -var _flashTransmuxerWorker = require('./flash-transmuxer-worker'); - -var _flashTransmuxerWorker2 = _interopRequireDefault(_flashTransmuxerWorker); - -var _webworkify = require('webworkify'); - -var _webworkify2 = _interopRequireDefault(_webworkify); - -var _flashConstants = require('./flash-constants'); - -var _flashConstants2 = _interopRequireDefault(_flashConstants); - -/** - * A wrapper around the setTimeout function that uses - * the flash constant time between ticks value. - * - * @param {Function} func the function callback to run - * @private - */ -var scheduleTick = function scheduleTick(func) { - // Chrome doesn't invoke requestAnimationFrame callbacks - // in background tabs, so use setTimeout. - _globalWindow2['default'].setTimeout(func, _flashConstants2['default'].TIME_BETWEEN_CHUNKS); -}; - -/** - * Generates a random string of max length 6 - * - * @return {String} the randomly generated string - * @function generateRandomString - * @private - */ -var generateRandomString = function generateRandomString() { - return Math.random().toString(36).slice(2, 8); -}; - -/** - * Round a number to a specified number of places much like - * toFixed but return a number instead of a string representation. - * - * @param {Number} num A number - * @param {Number} places The number of decimal places which to - * round - * @private - */ -var toDecimalPlaces = function toDecimalPlaces(num, places) { - if (typeof places !== 'number' || places < 0) { - places = 0; - } - - var scale = Math.pow(10, places); - - return Math.round(num * scale) / scale; -}; - -/** - * A SourceBuffer implementation for Flash rather than HTML. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource - * @param {Object} mediaSource the flash media source - * @class FlashSourceBuffer - * @extends videojs.EventTarget - */ - -var FlashSourceBuffer = (function (_videojs$EventTarget) { - _inherits(FlashSourceBuffer, _videojs$EventTarget); - - function FlashSourceBuffer(mediaSource) { - var _this = this; - - _classCallCheck(this, FlashSourceBuffer); - - _get(Object.getPrototypeOf(FlashSourceBuffer.prototype), 'constructor', this).call(this); - var encodedHeader = undefined; - - // Start off using the globally defined value but refine - // as we append data into flash - this.chunkSize_ = _flashConstants2['default'].BYTES_PER_CHUNK; - - // byte arrays queued to be appended - this.buffer_ = []; - - // the total number of queued bytes - this.bufferSize_ = 0; - - // to be able to determine the correct position to seek to, we - // need to retain information about the mapping between the - // media timeline and PTS values - this.basePtsOffset_ = NaN; - - this.mediaSource_ = mediaSource; - - this.audioBufferEnd_ = NaN; - this.videoBufferEnd_ = NaN; - - // indicates whether the asynchronous continuation of an operation - // is still being processed - // see https://w3c.github.io/media-source/#widl-SourceBuffer-updating - this.updating = false; - this.timestampOffset_ = 0; - - encodedHeader = _globalWindow2['default'].btoa(String.fromCharCode.apply(null, Array.prototype.slice.call(_muxJsLibFlv2['default'].getFlvHeader()))); - - // create function names with added randomness for the global callbacks flash will use - // to get data from javascript into the swf. Random strings are added as a safety - // measure for pages with multiple players since these functions will be global - // instead of per instance. When making a call to the swf, the browser generates a - // try catch code snippet, but just takes the function name and writes out an unquoted - // call to that function. If the player id has any special characters, this will result - // in an error, so safePlayerId replaces all special characters to '_' - var safePlayerId = this.mediaSource_.player_.id().replace(/[^a-zA-Z0-9]/g, '_'); - - this.flashEncodedHeaderName_ = 'vjs_flashEncodedHeader_' + safePlayerId + generateRandomString(); - this.flashEncodedDataName_ = 'vjs_flashEncodedData_' + safePlayerId + generateRandomString(); - - _globalWindow2['default'][this.flashEncodedHeaderName_] = function () { - delete _globalWindow2['default'][_this.flashEncodedHeaderName_]; - return encodedHeader; - }; - - this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedHeaderName_); - - this.transmuxer_ = (0, _webworkify2['default'])(_flashTransmuxerWorker2['default']); - this.transmuxer_.postMessage({ action: 'init', options: {} }); - this.transmuxer_.onmessage = function (event) { - if (event.data.action === 'data') { - _this.receiveBuffer_(event.data.segment); - } - }; - - this.one('updateend', function () { - _this.mediaSource_.tech_.trigger('loadedmetadata'); - }); - - Object.defineProperty(this, 'timestampOffset', { - get: function get() { - return this.timestampOffset_; - }, - set: function set(val) { - if (typeof val === 'number' && val >= 0) { - this.timestampOffset_ = val; - // We have to tell flash to expect a discontinuity - this.mediaSource_.swfObj.vjs_discontinuity(); - // the media <-> PTS mapping must be re-established after - // the discontinuity - this.basePtsOffset_ = NaN; - this.audioBufferEnd_ = NaN; - this.videoBufferEnd_ = NaN; - - this.transmuxer_.postMessage({ action: 'reset' }); - } - } - }); - - Object.defineProperty(this, 'buffered', { - get: function get() { - if (!this.mediaSource_ || !this.mediaSource_.swfObj || !('vjs_getProperty' in this.mediaSource_.swfObj)) { - return _videoJs2['default'].createTimeRange(); - } - - var buffered = this.mediaSource_.swfObj.vjs_getProperty('buffered'); - - if (buffered && buffered.length) { - buffered[0][0] = toDecimalPlaces(buffered[0][0], 3); - buffered[0][1] = toDecimalPlaces(buffered[0][1], 3); - } - return _videoJs2['default'].createTimeRanges(buffered); - } - }); - - // On a seek we remove all text track data since flash has no concept - // of a buffered-range and everything else is reset on seek - this.mediaSource_.player_.on('seeked', function () { - (0, _removeCuesFromTrack2['default'])(0, Infinity, _this.metadataTrack_); - (0, _removeCuesFromTrack2['default'])(0, Infinity, _this.inbandTextTrack_); - }); - - this.mediaSource_.player_.tech_.hls.on('dispose', function () { - _this.transmuxer_.terminate(); - }); - } - - /** - * Append bytes to the sourcebuffers buffer, in this case we - * have to append it to swf object. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/appendBuffer - * @param {Array} bytes - */ - - _createClass(FlashSourceBuffer, [{ - key: 'appendBuffer', - value: function appendBuffer(bytes) { - var error = undefined; - - if (this.updating) { - error = new Error('SourceBuffer.append() cannot be called ' + 'while an update is in progress'); - error.name = 'InvalidStateError'; - error.code = 11; - throw error; - } - this.updating = true; - this.mediaSource_.readyState = 'open'; - this.trigger({ type: 'update' }); - - this.transmuxer_.postMessage({ - action: 'push', - data: bytes.buffer, - byteOffset: bytes.byteOffset, - byteLength: bytes.byteLength - }, [bytes.buffer]); - this.transmuxer_.postMessage({ action: 'flush' }); - } - - /** - * Reset the parser and remove any data queued to be sent to the SWF. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/abort - */ - }, { - key: 'abort', - value: function abort() { - this.buffer_ = []; - this.bufferSize_ = 0; - this.mediaSource_.swfObj.vjs_abort(); - - // report any outstanding updates have ended - if (this.updating) { - this.updating = false; - this.trigger({ type: 'updateend' }); - } - } - - /** - * Flash cannot remove ranges already buffered in the NetStream - * but seeking clears the buffer entirely. For most purposes, - * having this operation act as a no-op is acceptable. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/remove - * @param {Double} start start of the section to remove - * @param {Double} end end of the section to remove - */ - }, { - key: 'remove', - value: function remove(start, end) { - (0, _removeCuesFromTrack2['default'])(start, end, this.metadataTrack_); - (0, _removeCuesFromTrack2['default'])(start, end, this.inbandTextTrack_); - this.trigger({ type: 'update' }); - this.trigger({ type: 'updateend' }); - } - - /** - * Receive a buffer from the flv. - * - * @param {Object} segment - * @private - */ - }, { - key: 'receiveBuffer_', - value: function receiveBuffer_(segment) { - var _this2 = this; - - // create an in-band caption track if one is present in the segment - (0, _createTextTracksIfNecessary2['default'])(this, this.mediaSource_, segment); - (0, _addTextTrackData.addTextTrackData)(this, segment.captions, segment.metadata); - - // Do this asynchronously since convertTagsToData_ can be time consuming - scheduleTick(function () { - var flvBytes = _this2.convertTagsToData_(segment); - - if (_this2.buffer_.length === 0) { - scheduleTick(_this2.processBuffer_.bind(_this2)); - } - - if (flvBytes) { - _this2.buffer_.push(flvBytes); - _this2.bufferSize_ += flvBytes.byteLength; - } - }); - } - - /** - * Append a portion of the current buffer to the SWF. - * - * @private - */ - }, { - key: 'processBuffer_', - value: function processBuffer_() { - var _this3 = this; - - var chunkSize = _flashConstants2['default'].BYTES_PER_CHUNK; - - if (!this.buffer_.length) { - if (this.updating !== false) { - this.updating = false; - this.trigger({ type: 'updateend' }); - } - // do nothing if the buffer is empty - return; - } - - // concatenate appends up to the max append size - var chunk = this.buffer_[0].subarray(0, chunkSize); - - // requeue any bytes that won't make it this round - if (chunk.byteLength < chunkSize || this.buffer_[0].byteLength === chunkSize) { - this.buffer_.shift(); - } else { - this.buffer_[0] = this.buffer_[0].subarray(chunkSize); - } - - this.bufferSize_ -= chunk.byteLength; - - // base64 encode the bytes - var binary = []; - var length = chunk.byteLength; - - for (var i = 0; i < length; i++) { - binary.push(String.fromCharCode(chunk[i])); - } - var b64str = _globalWindow2['default'].btoa(binary.join('')); - - _globalWindow2['default'][this.flashEncodedDataName_] = function () { - // schedule another processBuffer to process any left over data or to - // trigger updateend - scheduleTick(_this3.processBuffer_.bind(_this3)); - delete _globalWindow2['default'][_this3.flashEncodedDataName_]; - return b64str; - }; - - // Notify the swf that segment data is ready to be appended - this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedDataName_); - } - - /** - * Turns an array of flv tags into a Uint8Array representing the - * flv data. Also removes any tags that are before the current - * time so that playback begins at or slightly after the right - * place on a seek - * - * @private - * @param {Object} segmentData object of segment data - */ - }, { - key: 'convertTagsToData_', - value: function convertTagsToData_(segmentData) { - var segmentByteLength = 0; - var tech = this.mediaSource_.tech_; - var videoTargetPts = 0; - var segment = undefined; - var videoTags = segmentData.tags.videoTags; - var audioTags = segmentData.tags.audioTags; - - // Establish the media timeline to PTS translation if we don't - // have one already - if (isNaN(this.basePtsOffset_) && (videoTags.length || audioTags.length)) { - // We know there is at least one video or audio tag, but since we may not have both, - // we use pts: Infinity for the missing tag. The will force the following Math.min - // call will to use the proper pts value since it will always be less than Infinity - var firstVideoTag = videoTags[0] || { pts: Infinity }; - var firstAudioTag = audioTags[0] || { pts: Infinity }; - - this.basePtsOffset_ = Math.min(firstAudioTag.pts, firstVideoTag.pts); - } - - if (tech.seeking()) { - // Do not use previously saved buffer end values while seeking since buffer - // is cleared on all seeks - this.videoBufferEnd_ = NaN; - this.audioBufferEnd_ = NaN; - } - - if (isNaN(this.videoBufferEnd_)) { - if (tech.buffered().length) { - videoTargetPts = tech.buffered().end(0) - this.timestampOffset; - } - - // Trim to currentTime if seeking - if (tech.seeking()) { - videoTargetPts = Math.max(videoTargetPts, tech.currentTime() - this.timestampOffset); - } - - // PTS values are represented in milliseconds - videoTargetPts *= 1e3; - videoTargetPts += this.basePtsOffset_; - } else { - // Add a fudge factor of 0.1 to the last video pts appended since a rendition change - // could append an overlapping segment, in which case there is a high likelyhood - // a tag could have a matching pts to videoBufferEnd_, which would cause - // that tag to get appended by the tag.pts >= targetPts check below even though it - // is a duplicate of what was previously appended - videoTargetPts = this.videoBufferEnd_ + 0.1; - } - - // filter complete GOPs with a presentation time less than the seek target/end of buffer - var currentIndex = videoTags.length; - - // if the last tag is beyond videoTargetPts, then do not search the list for a GOP - // since our videoTargetPts lies in a future segment - if (currentIndex && videoTags[currentIndex - 1].pts >= videoTargetPts) { - // Start by walking backwards from the end of the list until we reach a tag that - // is equal to or less than videoTargetPts - while (--currentIndex) { - var currentTag = videoTags[currentIndex]; - - if (currentTag.pts > videoTargetPts) { - continue; - } - - // if we see a keyFrame or metadata tag once we've gone below videoTargetPts, - // exit the loop as this is the start of the GOP that we want to append - if (currentTag.keyFrame || currentTag.metaDataTag) { - break; - } - } - - // We need to check if there are any metadata tags that come before currentIndex - // as those will be metadata tags associated with the GOP we are appending - // There could be 0 to 2 metadata tags that come before the currentIndex depending - // on what videoTargetPts is and whether the transmuxer prepended metadata tags to this - // key frame - while (currentIndex) { - var nextTag = videoTags[currentIndex - 1]; - - if (!nextTag.metaDataTag) { - break; - } - - currentIndex--; - } - } - - var filteredVideoTags = videoTags.slice(currentIndex); - - var audioTargetPts = undefined; - - if (isNaN(this.audioBufferEnd_)) { - audioTargetPts = videoTargetPts; - } else { - // Add a fudge factor of 0.1 to the last video pts appended since a rendition change - // could append an overlapping segment, in which case there is a high likelyhood - // a tag could have a matching pts to videoBufferEnd_, which would cause - // that tag to get appended by the tag.pts >= targetPts check below even though it - // is a duplicate of what was previously appended - audioTargetPts = this.audioBufferEnd_ + 0.1; - } - - if (filteredVideoTags.length) { - // If targetPts intersects a GOP and we appended the tags for the GOP that came - // before targetPts, we want to make sure to trim audio tags at the pts - // of the first video tag to avoid brief moments of silence - audioTargetPts = Math.min(audioTargetPts, filteredVideoTags[0].pts); - } - - // skip tags with a presentation time less than the seek target/end of buffer - currentIndex = 0; - - while (currentIndex < audioTags.length) { - if (audioTags[currentIndex].pts >= audioTargetPts) { - break; - } - - currentIndex++; - } - - var filteredAudioTags = audioTags.slice(currentIndex); - - // update the audio and video buffer ends - if (filteredAudioTags.length) { - this.audioBufferEnd_ = filteredAudioTags[filteredAudioTags.length - 1].pts; - } - if (filteredVideoTags.length) { - this.videoBufferEnd_ = filteredVideoTags[filteredVideoTags.length - 1].pts; - } - - var tags = this.getOrderedTags_(filteredVideoTags, filteredAudioTags); - - if (tags.length === 0) { - return; - } - - // If we are appending data that comes before our target pts, we want to tell - // the swf to adjust its notion of current time to account for the extra tags - // we are appending to complete the GOP that intersects with targetPts - if (tags[0].pts < videoTargetPts && tech.seeking()) { - var fudgeFactor = 1 / 30; - var currentTime = tech.currentTime(); - var diff = (videoTargetPts - tags[0].pts) / 1e3; - var adjustedTime = currentTime - diff; - - if (adjustedTime < fudgeFactor) { - adjustedTime = 0; - } - - try { - this.mediaSource_.swfObj.vjs_adjustCurrentTime(adjustedTime); - } catch (e) { - // no-op for backwards compatability of swf. If adjustCurrentTime fails, - // the swf may incorrectly report currentTime and buffered ranges - // but should not affect playback over than the time displayed on the - // progress bar is inaccurate - } - } - - // concatenate the bytes into a single segment - for (var i = 0; i < tags.length; i++) { - segmentByteLength += tags[i].bytes.byteLength; - } - segment = new Uint8Array(segmentByteLength); - for (var i = 0, j = 0; i < tags.length; i++) { - segment.set(tags[i].bytes, j); - j += tags[i].bytes.byteLength; - } - - return segment; - } - - /** - * Assemble the FLV tags in decoder order. - * - * @private - * @param {Array} videoTags list of video tags - * @param {Array} audioTags list of audio tags - */ - }, { - key: 'getOrderedTags_', - value: function getOrderedTags_(videoTags, audioTags) { - var tag = undefined; - var tags = []; - - while (videoTags.length || audioTags.length) { - if (!videoTags.length) { - // only audio tags remain - tag = audioTags.shift(); - } else if (!audioTags.length) { - // only video tags remain - tag = videoTags.shift(); - } else if (audioTags[0].dts < videoTags[0].dts) { - // audio should be decoded next - tag = audioTags.shift(); - } else { - // video should be decoded next - tag = videoTags.shift(); - } - - tags.push(tag); - } - - return tags; - } - }]); - - return FlashSourceBuffer; -})(_videoJs2['default'].EventTarget); - -exports['default'] = FlashSourceBuffer; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./add-text-track-data":62,"./create-text-tracks-if-necessary":65,"./flash-constants":66,"./flash-transmuxer-worker":69,"./remove-cues-from-track":71,"global/window":30,"mux.js/lib/flv":44,"webworkify":75}],69:[function(require,module,exports){ -/** - * @file flash-transmuxer-worker.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _muxJsLibFlv = require('mux.js/lib/flv'); - -var _muxJsLibFlv2 = _interopRequireDefault(_muxJsLibFlv); - -/** - * Re-emits transmuxer events by converting them into messages to the - * world outside the worker. - * - * @param {Object} transmuxer the transmuxer to wire events on - * @private - */ -var wireTransmuxerEvents = function wireTransmuxerEvents(transmuxer) { - transmuxer.on('data', function (segment) { - _globalWindow2['default'].postMessage({ - action: 'data', - segment: segment - }); - }); - - transmuxer.on('done', function (data) { - _globalWindow2['default'].postMessage({ action: 'done' }); - }); -}; - -/** - * All incoming messages route through this hash. If no function exists - * to handle an incoming message, then we ignore the message. - * - * @class MessageHandlers - * @param {Object} options the options to initialize with - */ - -var MessageHandlers = (function () { - function MessageHandlers(options) { - _classCallCheck(this, MessageHandlers); - - this.options = options || {}; - this.init(); - } - - /** - * Our web wroker interface so that things can talk to mux.js - * that will be running in a web worker. The scope is passed to this by - * webworkify. - * - * @param {Object} self the scope for the web worker - */ - - /** - * initialize our web worker and wire all the events. - */ - - _createClass(MessageHandlers, [{ - key: 'init', - value: function init() { - if (this.transmuxer) { - this.transmuxer.dispose(); - } - this.transmuxer = new _muxJsLibFlv2['default'].Transmuxer(this.options); - wireTransmuxerEvents(this.transmuxer); - } - - /** - * Adds data (a ts segment) to the start of the transmuxer pipeline for - * processing. - * - * @param {ArrayBuffer} data data to push into the muxer - */ - }, { - key: 'push', - value: function push(data) { - // Cast array buffer to correct type for transmuxer - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - - this.transmuxer.push(segment); - } - - /** - * Recreate the transmuxer so that the next segment added via `push` - * start with a fresh transmuxer. - */ - }, { - key: 'reset', - value: function reset() { - this.init(); - } - - /** - * Forces the pipeline to finish processing the last segment and emit its - * results. - */ - }, { - key: 'flush', - value: function flush() { - this.transmuxer.flush(); - } - }]); - - return MessageHandlers; -})(); - -var FlashTransmuxerWorker = function FlashTransmuxerWorker(self) { - self.onmessage = function (event) { - if (event.data.action === 'init' && event.data.options) { - this.messageHandlers = new MessageHandlers(event.data.options); - return; - } - - if (!this.messageHandlers) { - this.messageHandlers = new MessageHandlers(); - } - - if (event.data && event.data.action && event.data.action !== 'init') { - if (this.messageHandlers[event.data.action]) { - this.messageHandlers[event.data.action](event.data); - } - } - }; -}; - -exports['default'] = function (self) { - return new FlashTransmuxerWorker(self); -}; - -module.exports = exports['default']; -},{"global/window":30,"mux.js/lib/flv":44}],70:[function(require,module,exports){ -(function (global){ -/** - * @file html-media-source.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _globalDocument = require('global/document'); - -var _globalDocument2 = _interopRequireDefault(_globalDocument); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _virtualSourceBuffer = require('./virtual-source-buffer'); - -var _virtualSourceBuffer2 = _interopRequireDefault(_virtualSourceBuffer); - -var _addTextTrackData = require('./add-text-track-data'); - -var _codecUtils = require('./codec-utils'); - -var _cleanupTextTracks = require('./cleanup-text-tracks'); - -/** - * Our MediaSource implementation in HTML, mimics native - * MediaSource where/if possible. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource - * @class HtmlMediaSource - * @extends videojs.EventTarget - */ - -var HtmlMediaSource = (function (_videojs$EventTarget) { - _inherits(HtmlMediaSource, _videojs$EventTarget); - - function HtmlMediaSource() { - var _this = this; - - _classCallCheck(this, HtmlMediaSource); - - _get(Object.getPrototypeOf(HtmlMediaSource.prototype), 'constructor', this).call(this); - var property = undefined; - - this.nativeMediaSource_ = new _globalWindow2['default'].MediaSource(); - // delegate to the native MediaSource's methods by default - for (property in this.nativeMediaSource_) { - if (!(property in HtmlMediaSource.prototype) && typeof this.nativeMediaSource_[property] === 'function') { - this[property] = this.nativeMediaSource_[property].bind(this.nativeMediaSource_); - } - } - - // emulate `duration` and `seekable` until seeking can be - // handled uniformly for live streams - // see https://github.com/w3c/media-source/issues/5 - this.duration_ = NaN; - Object.defineProperty(this, 'duration', { - get: function get() { - if (this.duration_ === Infinity) { - return this.duration_; - } - return this.nativeMediaSource_.duration; - }, - set: function set(duration) { - this.duration_ = duration; - if (duration !== Infinity) { - this.nativeMediaSource_.duration = duration; - return; - } - } - }); - Object.defineProperty(this, 'seekable', { - get: function get() { - if (this.duration_ === Infinity) { - return _videoJs2['default'].createTimeRanges([[0, this.nativeMediaSource_.duration]]); - } - return this.nativeMediaSource_.seekable; - } - }); - - Object.defineProperty(this, 'readyState', { - get: function get() { - return this.nativeMediaSource_.readyState; - } - }); - - Object.defineProperty(this, 'activeSourceBuffers', { - get: function get() { - return this.activeSourceBuffers_; - } - }); - - // the list of virtual and native SourceBuffers created by this - // MediaSource - this.sourceBuffers = []; - - this.activeSourceBuffers_ = []; - - /** - * update the list of active source buffers based upon various - * imformation from HLS and video.js - * - * @private - */ - this.updateActiveSourceBuffers_ = function () { - // Retain the reference but empty the array - _this.activeSourceBuffers_.length = 0; - - // By default, the audio in the combined virtual source buffer is enabled - // and the audio-only source buffer (if it exists) is disabled. - var combined = false; - var audioOnly = true; - - // TODO: maybe we can store the sourcebuffers on the track objects? - // safari may do something like this - for (var i = 0; i < _this.player_.audioTracks().length; i++) { - var track = _this.player_.audioTracks()[i]; - - if (track.enabled && track.kind !== 'main') { - // The enabled track is an alternate audio track so disable the audio in - // the combined source buffer and enable the audio-only source buffer. - combined = true; - audioOnly = false; - break; - } - } - - // Since we currently support a max of two source buffers, add all of the source - // buffers (in order). - _this.sourceBuffers.forEach(function (sourceBuffer) { - /* eslinst-disable */ - // TODO once codecs are required, we can switch to using the codecs to determine - // what stream is the video stream, rather than relying on videoTracks - /* eslinst-enable */ - - sourceBuffer.appendAudioInitSegment_ = true; - - if (sourceBuffer.videoCodec_ && sourceBuffer.audioCodec_) { - // combined - sourceBuffer.audioDisabled_ = combined; - } else if (sourceBuffer.videoCodec_ && !sourceBuffer.audioCodec_) { - // If the "combined" source buffer is video only, then we do not want - // disable the audio-only source buffer (this is mostly for demuxed - // audio and video hls) - sourceBuffer.audioDisabled_ = true; - audioOnly = false; - } else if (!sourceBuffer.videoCodec_ && sourceBuffer.audioCodec_) { - // audio only - sourceBuffer.audioDisabled_ = audioOnly; - if (audioOnly) { - return; - } - } - - _this.activeSourceBuffers_.push(sourceBuffer); - }); - }; - - this.onPlayerMediachange_ = function () { - _this.sourceBuffers.forEach(function (sourceBuffer) { - sourceBuffer.appendAudioInitSegment_ = true; - }); - }; - - // Re-emit MediaSource events on the polyfill - ['sourceopen', 'sourceclose', 'sourceended'].forEach(function (eventName) { - this.nativeMediaSource_.addEventListener(eventName, this.trigger.bind(this)); - }, this); - - // capture the associated player when the MediaSource is - // successfully attached - this.on('sourceopen', function (event) { - // Get the player this MediaSource is attached to - var video = _globalDocument2['default'].querySelector('[src="' + _this.url_ + '"]'); - - if (!video) { - return; - } - - _this.player_ = (0, _videoJs2['default'])(video.parentNode); - - if (_this.player_.audioTracks && _this.player_.audioTracks()) { - _this.player_.audioTracks().on('change', _this.updateActiveSourceBuffers_); - _this.player_.audioTracks().on('addtrack', _this.updateActiveSourceBuffers_); - _this.player_.audioTracks().on('removetrack', _this.updateActiveSourceBuffers_); - } - - _this.player_.on('mediachange', _this.onPlayerMediachange_); - }); - - this.on('sourceended', function (event) { - var duration = (0, _addTextTrackData.durationOfVideo)(_this.duration); - - for (var i = 0; i < _this.sourceBuffers.length; i++) { - var sourcebuffer = _this.sourceBuffers[i]; - var cues = sourcebuffer.metadataTrack_ && sourcebuffer.metadataTrack_.cues; - - if (cues && cues.length) { - cues[cues.length - 1].endTime = duration; - } - } - }); - - // explicitly terminate any WebWorkers that were created - // by SourceHandlers - this.on('sourceclose', function (event) { - this.sourceBuffers.forEach(function (sourceBuffer) { - if (sourceBuffer.transmuxer_) { - sourceBuffer.transmuxer_.terminate(); - } - }); - - this.sourceBuffers.length = 0; - if (!this.player_) { - return; - } - - (0, _cleanupTextTracks.cleanupTextTracks)(this.player_); - - if (this.player_.audioTracks && this.player_.audioTracks()) { - this.player_.audioTracks().off('change', this.updateActiveSourceBuffers_); - this.player_.audioTracks().off('addtrack', this.updateActiveSourceBuffers_); - this.player_.audioTracks().off('removetrack', this.updateActiveSourceBuffers_); - } - - // We can only change this if the player hasn't been disposed of yet - // because `off` eventually tries to use the el_ property. If it has - // been disposed of, then don't worry about it because there are no - // event handlers left to unbind anyway - if (this.player_.el_) { - this.player_.off('mediachange', this.onPlayerMediachange_); - } - }); - } - - /** - * Add a range that that can now be seeked to. - * - * @param {Double} start where to start the addition - * @param {Double} end where to end the addition - * @private - */ - - _createClass(HtmlMediaSource, [{ - key: 'addSeekableRange_', - value: function addSeekableRange_(start, end) { - var error = undefined; - - if (this.duration !== Infinity) { - error = new Error('MediaSource.addSeekableRange() can only be invoked ' + 'when the duration is Infinity'); - error.name = 'InvalidStateError'; - error.code = 11; - throw error; - } - - if (end > this.nativeMediaSource_.duration || isNaN(this.nativeMediaSource_.duration)) { - this.nativeMediaSource_.duration = end; - } - } - - /** - * Add a source buffer to the media source. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/addSourceBuffer - * @param {String} type the content-type of the content - * @return {Object} the created source buffer - */ - }, { - key: 'addSourceBuffer', - value: function addSourceBuffer(type) { - var buffer = undefined; - var parsedType = (0, _codecUtils.parseContentType)(type); - - // Create a VirtualSourceBuffer to transmux MPEG-2 transport - // stream segments into fragmented MP4s - if (/^(video|audio)\/mp2t$/i.test(parsedType.type)) { - var codecs = []; - - if (parsedType.parameters && parsedType.parameters.codecs) { - codecs = parsedType.parameters.codecs.split(','); - codecs = (0, _codecUtils.translateLegacyCodecs)(codecs); - codecs = codecs.filter(function (codec) { - return (0, _codecUtils.isAudioCodec)(codec) || (0, _codecUtils.isVideoCodec)(codec); - }); - } - - if (codecs.length === 0) { - codecs = ['avc1.4d400d', 'mp4a.40.2']; - } - - buffer = new _virtualSourceBuffer2['default'](this, codecs); - - if (this.sourceBuffers.length !== 0) { - // If another VirtualSourceBuffer already exists, then we are creating a - // SourceBuffer for an alternate audio track and therefore we know that - // the source has both an audio and video track. - // That means we should trigger the manual creation of the real - // SourceBuffers instead of waiting for the transmuxer to return data - this.sourceBuffers[0].createRealSourceBuffers_(); - buffer.createRealSourceBuffers_(); - - // Automatically disable the audio on the first source buffer if - // a second source buffer is ever created - this.sourceBuffers[0].audioDisabled_ = true; - } - } else { - // delegate to the native implementation - buffer = this.nativeMediaSource_.addSourceBuffer(type); - } - - this.sourceBuffers.push(buffer); - return buffer; - } - }]); - - return HtmlMediaSource; -})(_videoJs2['default'].EventTarget); - -exports['default'] = HtmlMediaSource; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./add-text-track-data":62,"./cleanup-text-tracks":63,"./codec-utils":64,"./virtual-source-buffer":74,"global/document":29,"global/window":30}],71:[function(require,module,exports){ -/** - * @file remove-cues-from-track.js - */ - -/** - * Remove cues from a track on video.js. - * - * @param {Double} start start of where we should remove the cue - * @param {Double} end end of where the we should remove the cue - * @param {Object} track the text track to remove the cues from - * @private - */ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var removeCuesFromTrack = function removeCuesFromTrack(start, end, track) { - var i = undefined; - var cue = undefined; - - if (!track) { - return; - } - - if (!track.cues) { - return; - } - - i = track.cues.length; - - while (i--) { - cue = track.cues[i]; - - // Remove any overlapping cue - if (cue.startTime <= end && cue.endTime >= start) { - track.removeCue(cue); - } - } -}; - -exports["default"] = removeCuesFromTrack; -module.exports = exports["default"]; -},{}],72:[function(require,module,exports){ -/** - * @file transmuxer-worker.js - */ - -/** - * videojs-contrib-media-sources - * - * Copyright (c) 2015 Brightcove - * All rights reserved. - * - * Handles communication between the browser-world and the mux.js - * transmuxer running inside of a WebWorker by exposing a simple - * message-based interface to a Transmuxer object. - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _muxJsLibMp4 = require('mux.js/lib/mp4'); - -var _muxJsLibMp42 = _interopRequireDefault(_muxJsLibMp4); - -/** - * Re-emits transmuxer events by converting them into messages to the - * world outside the worker. - * - * @param {Object} transmuxer the transmuxer to wire events on - * @private - */ -var wireTransmuxerEvents = function wireTransmuxerEvents(transmuxer) { - transmuxer.on('data', function (segment) { - // transfer ownership of the underlying ArrayBuffer - // instead of doing a copy to save memory - // ArrayBuffers are transferable but generic TypedArrays are not - // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects) - var initArray = segment.initSegment; - - segment.initSegment = { - data: initArray.buffer, - byteOffset: initArray.byteOffset, - byteLength: initArray.byteLength - }; - - var typedArray = segment.data; - - segment.data = typedArray.buffer; - _globalWindow2['default'].postMessage({ - action: 'data', - segment: segment, - byteOffset: typedArray.byteOffset, - byteLength: typedArray.byteLength - }, [segment.data]); - }); - - if (transmuxer.captionStream) { - transmuxer.captionStream.on('data', function (caption) { - _globalWindow2['default'].postMessage({ - action: 'caption', - data: caption - }); - }); - } - - transmuxer.on('done', function (data) { - _globalWindow2['default'].postMessage({ action: 'done' }); - }); -}; - -/** - * All incoming messages route through this hash. If no function exists - * to handle an incoming message, then we ignore the message. - * - * @class MessageHandlers - * @param {Object} options the options to initialize with - */ - -var MessageHandlers = (function () { - function MessageHandlers(options) { - _classCallCheck(this, MessageHandlers); - - this.options = options || {}; - this.init(); - } - - /** - * Our web wroker interface so that things can talk to mux.js - * that will be running in a web worker. the scope is passed to this by - * webworkify. - * - * @param {Object} self the scope for the web worker - */ - - /** - * initialize our web worker and wire all the events. - */ - - _createClass(MessageHandlers, [{ - key: 'init', - value: function init() { - if (this.transmuxer) { - this.transmuxer.dispose(); - } - this.transmuxer = new _muxJsLibMp42['default'].Transmuxer(this.options); - wireTransmuxerEvents(this.transmuxer); - } - - /** - * Adds data (a ts segment) to the start of the transmuxer pipeline for - * processing. - * - * @param {ArrayBuffer} data data to push into the muxer - */ - }, { - key: 'push', - value: function push(data) { - // Cast array buffer to correct type for transmuxer - var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength); - - this.transmuxer.push(segment); - } - - /** - * Recreate the transmuxer so that the next segment added via `push` - * start with a fresh transmuxer. - */ - }, { - key: 'reset', - value: function reset() { - this.init(); - } - - /** - * Set the value that will be used as the `baseMediaDecodeTime` time for the - * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime` - * set relative to the first based on the PTS values. - * - * @param {Object} data used to set the timestamp offset in the muxer - */ - }, { - key: 'setTimestampOffset', - value: function setTimestampOffset(data) { - var timestampOffset = data.timestampOffset || 0; - - this.transmuxer.setBaseMediaDecodeTime(Math.round(timestampOffset * 90000)); - } - }, { - key: 'setAudioAppendStart', - value: function setAudioAppendStart(data) { - this.transmuxer.setAudioAppendStart(Math.ceil(data.appendStart * 90000)); - } - - /** - * Forces the pipeline to finish processing the last segment and emit it's - * results. - * - * @param {Object} data event data, not really used - */ - }, { - key: 'flush', - value: function flush(data) { - this.transmuxer.flush(); - } - }]); - - return MessageHandlers; -})(); - -var TransmuxerWorker = function TransmuxerWorker(self) { - self.onmessage = function (event) { - if (event.data.action === 'init' && event.data.options) { - this.messageHandlers = new MessageHandlers(event.data.options); - return; - } - - if (!this.messageHandlers) { - this.messageHandlers = new MessageHandlers(); - } - - if (event.data && event.data.action && event.data.action !== 'init') { - if (this.messageHandlers[event.data.action]) { - this.messageHandlers[event.data.action](event.data); - } - } - }; -}; - -exports['default'] = function (self) { - return new TransmuxerWorker(self); -}; - -module.exports = exports['default']; -},{"global/window":30,"mux.js/lib/mp4":53}],73:[function(require,module,exports){ -(function (global){ -/** - * @file videojs-contrib-media-sources.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _flashMediaSource = require('./flash-media-source'); - -var _flashMediaSource2 = _interopRequireDefault(_flashMediaSource); - -var _htmlMediaSource = require('./html-media-source'); - -var _htmlMediaSource2 = _interopRequireDefault(_htmlMediaSource); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var urlCount = 0; - -// ------------ -// Media Source -// ------------ - -var defaults = { - // how to determine the MediaSource implementation to use. There - // are three available modes: - // - auto: use native MediaSources where available and Flash - // everywhere else - // - html5: always use native MediaSources - // - flash: always use the Flash MediaSource polyfill - mode: 'auto' -}; - -// store references to the media sources so they can be connected -// to a video element (a swf object) -// TODO: can we store this somewhere local to this module? -_videoJs2['default'].mediaSources = {}; - -/** - * Provide a method for a swf object to notify JS that a - * media source is now open. - * - * @param {String} msObjectURL string referencing the MSE Object URL - * @param {String} swfId the swf id - */ -var open = function open(msObjectURL, swfId) { - var mediaSource = _videoJs2['default'].mediaSources[msObjectURL]; - - if (mediaSource) { - mediaSource.trigger({ type: 'sourceopen', swfId: swfId }); - } else { - throw new Error('Media Source not found (Video.js)'); - } -}; - -/** - * Check to see if the native MediaSource object exists and supports - * an MP4 container with both H.264 video and AAC-LC audio. - * - * @return {Boolean} if native media sources are supported - */ -var supportsNativeMediaSources = function supportsNativeMediaSources() { - return !!_globalWindow2['default'].MediaSource && !!_globalWindow2['default'].MediaSource.isTypeSupported && _globalWindow2['default'].MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"'); -}; - -/** - * An emulation of the MediaSource API so that we can support - * native and non-native functionality such as flash and - * video/mp2t videos. returns an instance of HtmlMediaSource or - * FlashMediaSource depending on what is supported and what options - * are passed in. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/MediaSource - * @param {Object} options options to use during setup. - */ -var MediaSource = function MediaSource(options) { - var settings = _videoJs2['default'].mergeOptions(defaults, options); - - this.MediaSource = { - open: open, - supportsNativeMediaSources: supportsNativeMediaSources - }; - - // determine whether HTML MediaSources should be used - if (settings.mode === 'html5' || settings.mode === 'auto' && supportsNativeMediaSources()) { - return new _htmlMediaSource2['default'](); - } else if (_videoJs2['default'].getTech('Flash')) { - return new _flashMediaSource2['default'](); - } - - throw new Error('Cannot use Flash or Html5 to create a MediaSource for this video'); -}; - -exports.MediaSource = MediaSource; -MediaSource.open = open; -MediaSource.supportsNativeMediaSources = supportsNativeMediaSources; - -/** - * A wrapper around the native URL for our MSE object - * implementation, this object is exposed under videojs.URL - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/URL/URL - */ -var URL = { - /** - * A wrapper around the native createObjectURL for our objects. - * This function maps a native or emulated mediaSource to a blob - * url so that it can be loaded into video.js - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL - * @param {MediaSource} object the object to create a blob url to - */ - createObjectURL: function createObjectURL(object) { - var objectUrlPrefix = 'blob:vjs-media-source/'; - var url = undefined; - - // use the native MediaSource to generate an object URL - if (object instanceof _htmlMediaSource2['default']) { - url = _globalWindow2['default'].URL.createObjectURL(object.nativeMediaSource_); - object.url_ = url; - return url; - } - // if the object isn't an emulated MediaSource, delegate to the - // native implementation - if (!(object instanceof _flashMediaSource2['default'])) { - url = _globalWindow2['default'].URL.createObjectURL(object); - object.url_ = url; - return url; - } - - // build a URL that can be used to map back to the emulated - // MediaSource - url = objectUrlPrefix + urlCount; - - urlCount++; - - // setup the mapping back to object - _videoJs2['default'].mediaSources[url] = object; - - return url; - } -}; - -exports.URL = URL; -_videoJs2['default'].MediaSource = MediaSource; -_videoJs2['default'].URL = URL; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./flash-media-source":67,"./html-media-source":70,"global/window":30}],74:[function(require,module,exports){ -(function (global){ -/** - * @file virtual-source-buffer.js - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _createTextTracksIfNecessary = require('./create-text-tracks-if-necessary'); - -var _createTextTracksIfNecessary2 = _interopRequireDefault(_createTextTracksIfNecessary); - -var _removeCuesFromTrack = require('./remove-cues-from-track'); - -var _removeCuesFromTrack2 = _interopRequireDefault(_removeCuesFromTrack); - -var _addTextTrackData = require('./add-text-track-data'); - -var _webworkify = require('webworkify'); - -var _webworkify2 = _interopRequireDefault(_webworkify); - -var _transmuxerWorker = require('./transmuxer-worker'); - -var _transmuxerWorker2 = _interopRequireDefault(_transmuxerWorker); - -var _codecUtils = require('./codec-utils'); - -// We create a wrapper around the SourceBuffer so that we can manage the -// state of the `updating` property manually. We have to do this because -// Firefox changes `updating` to false long before triggering `updateend` -// events and that was causing strange problems in videojs-contrib-hls -var makeWrappedSourceBuffer = function makeWrappedSourceBuffer(mediaSource, mimeType) { - var sourceBuffer = mediaSource.addSourceBuffer(mimeType); - var wrapper = Object.create(null); - - wrapper.updating = false; - wrapper.realBuffer_ = sourceBuffer; - - var _loop = function (key) { - if (typeof sourceBuffer[key] === 'function') { - wrapper[key] = function () { - return sourceBuffer[key].apply(sourceBuffer, arguments); - }; - } else if (typeof wrapper[key] === 'undefined') { - Object.defineProperty(wrapper, key, { - get: function get() { - return sourceBuffer[key]; - }, - set: function set(v) { - return sourceBuffer[key] = v; - } - }); - } - }; - - for (var key in sourceBuffer) { - _loop(key); - } - - return wrapper; -}; - -/** - * VirtualSourceBuffers exist so that we can transmux non native formats - * into a native format, but keep the same api as a native source buffer. - * It creates a transmuxer, that works in its own thread (a web worker) and - * that transmuxer muxes the data into a native format. VirtualSourceBuffer will - * then send all of that data to the naive sourcebuffer so that it is - * indestinguishable from a natively supported format. - * - * @param {HtmlMediaSource} mediaSource the parent mediaSource - * @param {Array} codecs array of codecs that we will be dealing with - * @class VirtualSourceBuffer - * @extends video.js.EventTarget - */ - -var VirtualSourceBuffer = (function (_videojs$EventTarget) { - _inherits(VirtualSourceBuffer, _videojs$EventTarget); - - function VirtualSourceBuffer(mediaSource, codecs) { - var _this = this; - - _classCallCheck(this, VirtualSourceBuffer); - - _get(Object.getPrototypeOf(VirtualSourceBuffer.prototype), 'constructor', this).call(this, _videoJs2['default'].EventTarget); - this.timestampOffset_ = 0; - this.pendingBuffers_ = []; - this.bufferUpdating_ = false; - - this.mediaSource_ = mediaSource; - this.codecs_ = codecs; - this.audioCodec_ = null; - this.videoCodec_ = null; - this.audioDisabled_ = false; - this.appendAudioInitSegment_ = true; - - var options = { - remux: false - }; - - this.codecs_.forEach(function (codec) { - if ((0, _codecUtils.isAudioCodec)(codec)) { - _this.audioCodec_ = codec; - } else if ((0, _codecUtils.isVideoCodec)(codec)) { - _this.videoCodec_ = codec; - } - }); - - // append muxed segments to their respective native buffers as - // soon as they are available - this.transmuxer_ = (0, _webworkify2['default'])(_transmuxerWorker2['default']); - this.transmuxer_.postMessage({ action: 'init', options: options }); - - this.transmuxer_.onmessage = function (event) { - if (event.data.action === 'data') { - return _this.data_(event); - } - - if (event.data.action === 'done') { - return _this.done_(event); - } - }; - - // this timestampOffset is a property with the side-effect of resetting - // baseMediaDecodeTime in the transmuxer on the setter - Object.defineProperty(this, 'timestampOffset', { - get: function get() { - return this.timestampOffset_; - }, - set: function set(val) { - if (typeof val === 'number' && val >= 0) { - this.timestampOffset_ = val; - this.appendAudioInitSegment_ = true; - - // We have to tell the transmuxer to set the baseMediaDecodeTime to - // the desired timestampOffset for the next segment - this.transmuxer_.postMessage({ - action: 'setTimestampOffset', - timestampOffset: val - }); - } - } - }); - - // setting the append window affects both source buffers - Object.defineProperty(this, 'appendWindowStart', { - get: function get() { - return (this.videoBuffer_ || this.audioBuffer_).appendWindowStart; - }, - set: function set(start) { - if (this.videoBuffer_) { - this.videoBuffer_.appendWindowStart = start; - } - if (this.audioBuffer_) { - this.audioBuffer_.appendWindowStart = start; - } - } - }); - - // this buffer is "updating" if either of its native buffers are - Object.defineProperty(this, 'updating', { - get: function get() { - return !!(this.bufferUpdating_ || !this.audioDisabled_ && this.audioBuffer_ && this.audioBuffer_.updating || this.videoBuffer_ && this.videoBuffer_.updating); - } - }); - - // the buffered property is the intersection of the buffered - // ranges of the native source buffers - Object.defineProperty(this, 'buffered', { - get: function get() { - var start = null; - var end = null; - var arity = 0; - var extents = []; - var ranges = []; - - // neither buffer has been created yet - if (!this.videoBuffer_ && !this.audioBuffer_) { - return _videoJs2['default'].createTimeRange(); - } - - // only one buffer is configured - if (!this.videoBuffer_) { - return this.audioBuffer_.buffered; - } - if (!this.audioBuffer_) { - return this.videoBuffer_.buffered; - } - - // both buffers are configured - if (this.audioDisabled_) { - return this.videoBuffer_.buffered; - } - - // both buffers are empty - if (this.videoBuffer_.buffered.length === 0 && this.audioBuffer_.buffered.length === 0) { - return _videoJs2['default'].createTimeRange(); - } - - // Handle the case where we have both buffers and create an - // intersection of the two - var videoBuffered = this.videoBuffer_.buffered; - var audioBuffered = this.audioBuffer_.buffered; - var count = videoBuffered.length; - - // A) Gather up all start and end times - while (count--) { - extents.push({ time: videoBuffered.start(count), type: 'start' }); - extents.push({ time: videoBuffered.end(count), type: 'end' }); - } - count = audioBuffered.length; - while (count--) { - extents.push({ time: audioBuffered.start(count), type: 'start' }); - extents.push({ time: audioBuffered.end(count), type: 'end' }); - } - // B) Sort them by time - extents.sort(function (a, b) { - return a.time - b.time; - }); - - // C) Go along one by one incrementing arity for start and decrementing - // arity for ends - for (count = 0; count < extents.length; count++) { - if (extents[count].type === 'start') { - arity++; - - // D) If arity is ever incremented to 2 we are entering an - // overlapping range - if (arity === 2) { - start = extents[count].time; - } - } else if (extents[count].type === 'end') { - arity--; - - // E) If arity is ever decremented to 1 we leaving an - // overlapping range - if (arity === 1) { - end = extents[count].time; - } - } - - // F) Record overlapping ranges - if (start !== null && end !== null) { - ranges.push([start, end]); - start = null; - end = null; - } - } - - return _videoJs2['default'].createTimeRanges(ranges); - } - }); - } - - /** - * When we get a data event from the transmuxer - * we call this function and handle the data that - * was sent to us - * - * @private - * @param {Event} event the data event from the transmuxer - */ - - _createClass(VirtualSourceBuffer, [{ - key: 'data_', - value: function data_(event) { - var segment = event.data.segment; - - // Cast ArrayBuffer to TypedArray - segment.data = new Uint8Array(segment.data, event.data.byteOffset, event.data.byteLength); - - segment.initSegment = new Uint8Array(segment.initSegment.data, segment.initSegment.byteOffset, segment.initSegment.byteLength); - - (0, _createTextTracksIfNecessary2['default'])(this, this.mediaSource_, segment); - - // Add the segments to the pendingBuffers array - this.pendingBuffers_.push(segment); - return; - } - - /** - * When we get a done event from the transmuxer - * we call this function and we process all - * of the pending data that we have been saving in the - * data_ function - * - * @private - * @param {Event} event the done event from the transmuxer - */ - }, { - key: 'done_', - value: function done_(event) { - // All buffers should have been flushed from the muxer - // start processing anything we have received - this.processPendingSegments_(); - return; - } - - /** - * Create our internal native audio/video source buffers and add - * event handlers to them with the following conditions: - * 1. they do not already exist on the mediaSource - * 2. this VSB has a codec for them - * - * @private - */ - }, { - key: 'createRealSourceBuffers_', - value: function createRealSourceBuffers_() { - var _this2 = this; - - var types = ['audio', 'video']; - - types.forEach(function (type) { - // Don't create a SourceBuffer of this type if we don't have a - // codec for it - if (!_this2[type + 'Codec_']) { - return; - } - - // Do nothing if a SourceBuffer of this type already exists - if (_this2[type + 'Buffer_']) { - return; - } - - var buffer = null; - - // If the mediasource already has a SourceBuffer for the codec - // use that - if (_this2.mediaSource_[type + 'Buffer_']) { - buffer = _this2.mediaSource_[type + 'Buffer_']; - // In multiple audio track cases, the audio source buffer is disabled - // on the main VirtualSourceBuffer by the HTMLMediaSource much earlier - // than createRealSourceBuffers_ is called to create the second - // VirtualSourceBuffer because that happens as a side-effect of - // videojs-contrib-hls starting the audioSegmentLoader. As a result, - // the audioBuffer is essentially "ownerless" and no one will toggle - // the `updating` state back to false once the `updateend` event is received - // - // Setting `updating` to false manually will work around this - // situation and allow work to continue - buffer.updating = false; - } else { - var codecProperty = type + 'Codec_'; - var mimeType = type + '/mp4;codecs="' + _this2[codecProperty] + '"'; - - buffer = makeWrappedSourceBuffer(_this2.mediaSource_.nativeMediaSource_, mimeType); - - _this2.mediaSource_[type + 'Buffer_'] = buffer; - } - - _this2[type + 'Buffer_'] = buffer; - - // Wire up the events to the SourceBuffer - ['update', 'updatestart', 'updateend'].forEach(function (event) { - buffer.addEventListener(event, function () { - // if audio is disabled - if (type === 'audio' && _this2.audioDisabled_) { - return; - } - - if (event === 'updateend') { - _this2[type + 'Buffer_'].updating = false; - } - - var shouldTrigger = types.every(function (t) { - // skip checking audio's updating status if audio - // is not enabled - if (t === 'audio' && _this2.audioDisabled_) { - return true; - } - // if the other type if updating we don't trigger - if (type !== t && _this2[t + 'Buffer_'] && _this2[t + 'Buffer_'].updating) { - return false; - } - return true; - }); - - if (shouldTrigger) { - return _this2.trigger(event); - } - }); - }); - }); - } - - /** - * Emulate the native mediasource function, but our function will - * send all of the proposed segments to the transmuxer so that we - * can transmux them before we append them to our internal - * native source buffers in the correct format. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/appendBuffer - * @param {Uint8Array} segment the segment to append to the buffer - */ - }, { - key: 'appendBuffer', - value: function appendBuffer(segment) { - // Start the internal "updating" state - this.bufferUpdating_ = true; - - if (this.audioBuffer_ && this.audioBuffer_.buffered.length) { - var audioBuffered = this.audioBuffer_.buffered; - - this.transmuxer_.postMessage({ - action: 'setAudioAppendStart', - appendStart: audioBuffered.end(audioBuffered.length - 1) - }); - } - - this.transmuxer_.postMessage({ - action: 'push', - // Send the typed-array of data as an ArrayBuffer so that - // it can be sent as a "Transferable" and avoid the costly - // memory copy - data: segment.buffer, - - // To recreate the original typed-array, we need information - // about what portion of the ArrayBuffer it was a view into - byteOffset: segment.byteOffset, - byteLength: segment.byteLength - }, [segment.buffer]); - this.transmuxer_.postMessage({ action: 'flush' }); - } - - /** - * Emulate the native mediasource function and remove parts - * of the buffer from any of our internal buffers that exist - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/remove - * @param {Double} start position to start the remove at - * @param {Double} end position to end the remove at - */ - }, { - key: 'remove', - value: function remove(start, end) { - if (this.videoBuffer_) { - this.videoBuffer_.updating = true; - this.videoBuffer_.remove(start, end); - } - if (!this.audioDisabled_ && this.audioBuffer_) { - this.audioBuffer_.updating = true; - this.audioBuffer_.remove(start, end); - } - - // Remove Metadata Cues (id3) - (0, _removeCuesFromTrack2['default'])(start, end, this.metadataTrack_); - - // Remove Any Captions - (0, _removeCuesFromTrack2['default'])(start, end, this.inbandTextTrack_); - } - - /** - * Process any segments that the muxer has output - * Concatenate segments together based on type and append them into - * their respective sourceBuffers - * - * @private - */ - }, { - key: 'processPendingSegments_', - value: function processPendingSegments_() { - var sortedSegments = { - video: { - segments: [], - bytes: 0 - }, - audio: { - segments: [], - bytes: 0 - }, - captions: [], - metadata: [] - }; - - // Sort segments into separate video/audio arrays and - // keep track of their total byte lengths - sortedSegments = this.pendingBuffers_.reduce(function (segmentObj, segment) { - var type = segment.type; - var data = segment.data; - var initSegment = segment.initSegment; - - segmentObj[type].segments.push(data); - segmentObj[type].bytes += data.byteLength; - - segmentObj[type].initSegment = initSegment; - - // Gather any captions into a single array - if (segment.captions) { - segmentObj.captions = segmentObj.captions.concat(segment.captions); - } - - if (segment.info) { - segmentObj[type].info = segment.info; - } - - // Gather any metadata into a single array - if (segment.metadata) { - segmentObj.metadata = segmentObj.metadata.concat(segment.metadata); - } - - return segmentObj; - }, sortedSegments); - - // Create the real source buffers if they don't exist by now since we - // finally are sure what tracks are contained in the source - if (!this.videoBuffer_ && !this.audioBuffer_) { - // Remove any codecs that may have been specified by default but - // are no longer applicable now - if (sortedSegments.video.bytes === 0) { - this.videoCodec_ = null; - } - if (sortedSegments.audio.bytes === 0) { - this.audioCodec_ = null; - } - - this.createRealSourceBuffers_(); - } - - if (sortedSegments.audio.info) { - this.mediaSource_.trigger({ type: 'audioinfo', info: sortedSegments.audio.info }); - } - if (sortedSegments.video.info) { - this.mediaSource_.trigger({ type: 'videoinfo', info: sortedSegments.video.info }); - } - - if (this.appendAudioInitSegment_) { - if (!this.audioDisabled_ && this.audioBuffer_) { - sortedSegments.audio.segments.unshift(sortedSegments.audio.initSegment); - sortedSegments.audio.bytes += sortedSegments.audio.initSegment.byteLength; - } - this.appendAudioInitSegment_ = false; - } - - // Merge multiple video and audio segments into one and append - if (this.videoBuffer_) { - sortedSegments.video.segments.unshift(sortedSegments.video.initSegment); - sortedSegments.video.bytes += sortedSegments.video.initSegment.byteLength; - this.concatAndAppendSegments_(sortedSegments.video, this.videoBuffer_); - // TODO: are video tracks the only ones with text tracks? - (0, _addTextTrackData.addTextTrackData)(this, sortedSegments.captions, sortedSegments.metadata); - } - - if (!this.audioDisabled_ && this.audioBuffer_) { - this.concatAndAppendSegments_(sortedSegments.audio, this.audioBuffer_); - } - - this.pendingBuffers_.length = 0; - - // We are no longer in the internal "updating" state - this.bufferUpdating_ = false; - } - - /** - * Combine all segments into a single Uint8Array and then append them - * to the destination buffer - * - * @param {Object} segmentObj - * @param {SourceBuffer} destinationBuffer native source buffer to append data to - * @private - */ - }, { - key: 'concatAndAppendSegments_', - value: function concatAndAppendSegments_(segmentObj, destinationBuffer) { - var offset = 0; - var tempBuffer = undefined; - - if (segmentObj.bytes) { - tempBuffer = new Uint8Array(segmentObj.bytes); - - // Combine the individual segments into one large typed-array - segmentObj.segments.forEach(function (segment) { - tempBuffer.set(segment, offset); - offset += segment.byteLength; - }); - - try { - destinationBuffer.updating = true; - destinationBuffer.appendBuffer(tempBuffer); - } catch (error) { - if (this.mediaSource_.player_) { - this.mediaSource_.player_.error({ - code: -3, - type: 'APPEND_BUFFER_ERR', - message: error.message, - originalError: error - }); - } - } - } - } - - /** - * Emulate the native mediasource function. abort any soureBuffer - * actions and throw out any un-appended data. - * - * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/abort - */ - }, { - key: 'abort', - value: function abort() { - if (this.videoBuffer_) { - this.videoBuffer_.abort(); - } - if (!this.audioDisabled_ && this.audioBuffer_) { - this.audioBuffer_.abort(); - } - if (this.transmuxer_) { - this.transmuxer_.postMessage({ action: 'reset' }); - } - this.pendingBuffers_.length = 0; - this.bufferUpdating_ = false; - } - }]); - - return VirtualSourceBuffer; -})(_videoJs2['default'].EventTarget); - -exports['default'] = VirtualSourceBuffer; -module.exports = exports['default']; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./add-text-track-data":62,"./codec-utils":64,"./create-text-tracks-if-necessary":65,"./remove-cues-from-track":71,"./transmuxer-worker":72,"webworkify":75}],75:[function(require,module,exports){ -var bundleFn = arguments[3]; -var sources = arguments[4]; -var cache = arguments[5]; - -var stringify = JSON.stringify; - -module.exports = function (fn) { - var keys = []; - var wkey; - var cacheKeys = Object.keys(cache); - - for (var i = 0, l = cacheKeys.length; i < l; i++) { - var key = cacheKeys[i]; - if (cache[key].exports === fn) { - wkey = key; - break; - } - } - - if (!wkey) { - wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); - var wcache = {}; - for (var i = 0, l = cacheKeys.length; i < l; i++) { - var key = cacheKeys[i]; - wcache[key] = key; - } - sources[wkey] = [ - Function(['require','module','exports'], '(' + fn + ')(self)'), - wcache - ]; - } - var skey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); - - var scache = {}; scache[wkey] = wkey; - sources[skey] = [ - Function(['require'],'require(' + stringify(wkey) + ')(self)'), - scache - ]; - - var src = '(' + bundleFn + ')({' - + Object.keys(sources).map(function (key) { - return stringify(key) + ':[' - + sources[key][0] - + ',' + stringify(sources[key][1]) + ']' - ; - }).join(',') - + '},{},[' + stringify(skey) + '])' - ; - - var URL = window.URL || window.webkitURL || window.mozURL || window.msURL; - - return new Worker(URL.createObjectURL( - new Blob([src], { type: 'text/javascript' }) - )); -}; - -},{}],76:[function(require,module,exports){ -(function (global){ -/** - * @file videojs-contrib-hls.js - * - * The main file for the HLS project. - * License: https://github.com/videojs/videojs-contrib-hls/blob/master/LICENSE - */ -'use strict'; - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { var object = _x4, property = _x5, receiver = _x6; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _globalDocument = require('global/document'); - -var _globalDocument2 = _interopRequireDefault(_globalDocument); - -var _playlistLoader = require('./playlist-loader'); - -var _playlistLoader2 = _interopRequireDefault(_playlistLoader); - -var _playlist = require('./playlist'); - -var _playlist2 = _interopRequireDefault(_playlist); - -var _xhr = require('./xhr'); - -var _xhr2 = _interopRequireDefault(_xhr); - -var _aesDecrypter = require('aes-decrypter'); - -var _binUtils = require('./bin-utils'); - -var _binUtils2 = _interopRequireDefault(_binUtils); - -var _videojsContribMediaSources = require('videojs-contrib-media-sources'); - -var _m3u8Parser = require('m3u8-parser'); - -var _m3u8Parser2 = _interopRequireDefault(_m3u8Parser); - -var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); - -var _videoJs2 = _interopRequireDefault(_videoJs); - -var _masterPlaylistController = require('./master-playlist-controller'); - -var _config = require('./config'); - -var _config2 = _interopRequireDefault(_config); - -var _renditionMixin = require('./rendition-mixin'); - -var _renditionMixin2 = _interopRequireDefault(_renditionMixin); - -var _globalWindow = require('global/window'); - -var _globalWindow2 = _interopRequireDefault(_globalWindow); - -var _playbackWatcher = require('./playback-watcher'); - -var _playbackWatcher2 = _interopRequireDefault(_playbackWatcher); - -var _reloadSourceOnError = require('./reload-source-on-error'); - -var _reloadSourceOnError2 = _interopRequireDefault(_reloadSourceOnError); - -var _playlistSelectorsJs = require('./playlist-selectors.js'); - -// 0.5 MB/s -var INITIAL_BANDWIDTH_DESKTOP = 4194304; -// 0.0625 MB/s -var INITIAL_BANDWIDTH_MOBILE = 500000; - -var Hls = { - PlaylistLoader: _playlistLoader2['default'], - Playlist: _playlist2['default'], - Decrypter: _aesDecrypter.Decrypter, - AsyncStream: _aesDecrypter.AsyncStream, - decrypt: _aesDecrypter.decrypt, - utils: _binUtils2['default'], - - STANDARD_PLAYLIST_SELECTOR: _playlistSelectorsJs.lastBandwidthSelector, - comparePlaylistBandwidth: _playlistSelectorsJs.comparePlaylistBandwidth, - comparePlaylistResolution: _playlistSelectorsJs.comparePlaylistResolution, - - xhr: (0, _xhr2['default'])() -}; - -// Define getter/setters for config properites -['GOAL_BUFFER_LENGTH', 'MAX_GOAL_BUFFER_LENGTH', 'GOAL_BUFFER_LENGTH_RATE', 'BUFFER_LOW_WATER_LINE', 'MAX_BUFFER_LOW_WATER_LINE', 'BUFFER_LOW_WATER_LINE_RATE', 'BANDWIDTH_VARIANCE'].forEach(function (prop) { - Object.defineProperty(Hls, prop, { - get: function get() { - _videoJs2['default'].log.warn('using Hls.' + prop + ' is UNSAFE be sure you know what you are doing'); - return _config2['default'][prop]; - }, - set: function set(value) { - _videoJs2['default'].log.warn('using Hls.' + prop + ' is UNSAFE be sure you know what you are doing'); - - if (typeof value !== 'number' || value < 0) { - _videoJs2['default'].log.warn('value of Hls.' + prop + ' must be greater than or equal to 0'); - return; - } - - _config2['default'][prop] = value; - } - }); -}); - -/** - * Updates the selectedIndex of the QualityLevelList when a mediachange happens in hls. - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to update. - * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info. - * @function handleHlsMediaChange - */ -var handleHlsMediaChange = function handleHlsMediaChange(qualityLevels, playlistLoader) { - var newPlaylist = playlistLoader.media(); - var selectedIndex = -1; - - for (var i = 0; i < qualityLevels.length; i++) { - if (qualityLevels[i].id === newPlaylist.uri) { - selectedIndex = i; - break; - } - } - - qualityLevels.selectedIndex_ = selectedIndex; - qualityLevels.trigger({ - selectedIndex: selectedIndex, - type: 'change' - }); -}; - -/** - * Adds quality levels to list once playlist metadata is available - * - * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to. - * @param {Object} hls Hls object to listen to for media events. - * @function handleHlsLoadedMetadata - */ -var handleHlsLoadedMetadata = function handleHlsLoadedMetadata(qualityLevels, hls) { - hls.representations().forEach(function (rep) { - qualityLevels.addQualityLevel(rep); - }); - handleHlsMediaChange(qualityLevels, hls.playlists); -}; - -// HLS is a source handler, not a tech. Make sure attempts to use it -// as one do not cause exceptions. -Hls.canPlaySource = function () { - return _videoJs2['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); -}; - -/** - * Whether the browser has built-in HLS support. - */ -Hls.supportsNativeHls = (function () { - var video = _globalDocument2['default'].createElement('video'); - - // native HLS is definitely not supported if HTML5 video isn't - if (!_videoJs2['default'].getTech('Html5').isSupported()) { - return false; - } - - // HLS manifests can go by many mime-types - var canPlay = [ - // Apple santioned - 'application/vnd.apple.mpegurl', - // Apple sanctioned for backwards compatibility - 'audio/mpegurl', - // Very common - 'audio/x-mpegurl', - // Very common - 'application/x-mpegurl', - // Included for completeness - 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl']; - - return canPlay.some(function (canItPlay) { - return (/maybe|probably/i.test(video.canPlayType(canItPlay)) - ); - }); -})(); - -/** - * HLS is a source handler, not a tech. Make sure attempts to use it - * as one do not cause exceptions. - */ -Hls.isSupported = function () { - return _videoJs2['default'].log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\'s techOrder.'); -}; - -var USER_AGENT = _globalWindow2['default'].navigator && _globalWindow2['default'].navigator.userAgent || ''; - -/** - * Determines whether the browser supports a change in the audio configuration - * during playback. Currently only Firefox 48 and below do not support this. - * window.isSecureContext is a propterty that was added to window in firefox 49, - * so we can use it to detect Firefox 49+. - * - * @return {Boolean} Whether the browser supports audio config change during playback - */ -Hls.supportsAudioInfoChange_ = function () { - if (_videoJs2['default'].browser.IS_FIREFOX) { - var firefoxVersionMap = /Firefox\/([\d.]+)/i.exec(USER_AGENT); - var version = parseInt(firefoxVersionMap[1], 10); - - return version >= 49; - } - return true; -}; - -var Component = _videoJs2['default'].getComponent('Component'); - -/** - * The Hls Handler object, where we orchestrate all of the parts - * of HLS to interact with video.js - * - * @class HlsHandler - * @extends videojs.Component - * @param {Object} source the soruce object - * @param {Tech} tech the parent tech object - * @param {Object} options optional and required options - */ - -var HlsHandler = (function (_Component) { - _inherits(HlsHandler, _Component); - - function HlsHandler(source, tech, options) { - var _this = this; - - _classCallCheck(this, HlsHandler); - - _get(Object.getPrototypeOf(HlsHandler.prototype), 'constructor', this).call(this, tech, options.hls); - - // tech.player() is deprecated but setup a reference to HLS for - // backwards-compatibility - if (tech.options_ && tech.options_.playerId) { - var _player = (0, _videoJs2['default'])(tech.options_.playerId); - - if (!_player.hasOwnProperty('hls')) { - Object.defineProperty(_player, 'hls', { - get: function get() { - _videoJs2['default'].log.warn('player.hls is deprecated. Use player.tech_.hls instead.'); - tech.trigger({ type: 'usage', name: 'hls-player-access' }); - return _this; - } - }); - } - } - - this.tech_ = tech; - this.source_ = source; - this.stats = {}; - this.ignoreNextSeekingEvent_ = false; - this.setOptions_(); - - // overriding native HLS only works if audio tracks have been emulated - // error early if we're misconfigured: - if (this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) { - throw new Error('Overriding native HLS requires emulated tracks. ' + 'See https://git.io/vMpjB'); - } - - // listen for fullscreenchange events for this player so that we - // can adjust our quality selection quickly - this.on(_globalDocument2['default'], ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], function (event) { - var fullscreenElement = _globalDocument2['default'].fullscreenElement || _globalDocument2['default'].webkitFullscreenElement || _globalDocument2['default'].mozFullScreenElement || _globalDocument2['default'].msFullscreenElement; - - if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) { - _this.masterPlaylistController_.fastQualityChange_(); - } - }); - - this.on(this.tech_, 'seeking', function () { - if (this.ignoreNextSeekingEvent_) { - this.ignoreNextSeekingEvent_ = false; - return; - } - - this.setCurrentTime(this.tech_.currentTime()); - }); - this.on(this.tech_, 'error', function () { - if (this.masterPlaylistController_) { - this.masterPlaylistController_.pauseLoading(); - } - }); - - this.audioTrackChange_ = function () { - _this.masterPlaylistController_.setupAudio(); - _this.tech_.trigger({ type: 'usage', name: 'hls-audio-change' }); - }; - - this.textTrackChange_ = function () { - _this.masterPlaylistController_.setupSubtitles(); - }; - - this.on(this.tech_, 'play', this.play); - } - - /** - * The Source Handler object, which informs video.js what additional - * MIME types are supported and sets up playback. It is registered - * automatically to the appropriate tech based on the capabilities of - * the browser it is running in. It is not necessary to use or modify - * this object in normal usage. - */ - - _createClass(HlsHandler, [{ - key: 'setOptions_', - value: function setOptions_() { - var _this2 = this; - - // defaults - this.options_.withCredentials = this.options_.withCredentials || false; - - if (typeof this.options_.blacklistDuration !== 'number') { - this.options_.blacklistDuration = 5 * 60; - } - - // start playlist selection at a reasonable bandwidth for - // broadband internet (0.5 MB/s) or mobile (0.0625 MB/s) - if (typeof this.options_.bandwidth !== 'number') { - // only use Android for mobile because iOS does not support MSE (and uses - // native HLS) - this.options_.bandwidth = _videoJs2['default'].browser.IS_ANDROID ? INITIAL_BANDWIDTH_MOBILE : INITIAL_BANDWIDTH_DESKTOP; - } - - // grab options passed to player.src - ['withCredentials', 'bandwidth'].forEach(function (option) { - if (typeof _this2.source_[option] !== 'undefined') { - _this2.options_[option] = _this2.source_[option]; - } - }); - - this.bandwidth = this.options_.bandwidth; - } - - /** - * called when player.src gets called, handle a new source - * - * @param {Object} src the source object to handle - */ - }, { - key: 'src', - value: function src(_src) { - var _this3 = this; - - // do nothing if the src is falsey - if (!_src) { - return; - } - this.setOptions_(); - // add master playlist controller options - this.options_.url = this.source_.src; - this.options_.tech = this.tech_; - this.options_.externHls = Hls; - - this.masterPlaylistController_ = new _masterPlaylistController.MasterPlaylistController(this.options_); - this.playbackWatcher_ = new _playbackWatcher2['default'](_videoJs2['default'].mergeOptions(this.options_, { - seekable: function seekable() { - return _this3.seekable(); - } - })); - - this.masterPlaylistController_.on('error', function () { - var player = _videoJs2['default'].players[_this3.tech_.options_.playerId]; - - player.error(_this3.masterPlaylistController_.error); - }); - - // `this` in selectPlaylist should be the HlsHandler for backwards - // compatibility with < v2 - this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : Hls.STANDARD_PLAYLIST_SELECTOR.bind(this); - - // re-expose some internal objects for backwards compatibility with < v2 - this.playlists = this.masterPlaylistController_.masterPlaylistLoader_; - this.mediaSource = this.masterPlaylistController_.mediaSource; - - // Proxy assignment of some properties to the master playlist - // controller. Using a custom property for backwards compatibility - // with < v2 - Object.defineProperties(this, { - selectPlaylist: { - get: function get() { - return this.masterPlaylistController_.selectPlaylist; - }, - set: function set(selectPlaylist) { - this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this); - } - }, - throughput: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate; - }, - set: function set(throughput) { - this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput; - // By setting `count` to 1 the throughput value becomes the starting value - // for the cumulative average - this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1; - } - }, - bandwidth: { - get: function get() { - return this.masterPlaylistController_.mainSegmentLoader_.bandwidth; - }, - set: function set(bandwidth) { - this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth; - // setting the bandwidth manually resets the throughput counter - // `count` is set to zero that current value of `rate` isn't included - // in the cumulative average - this.masterPlaylistController_.mainSegmentLoader_.throughput = { - rate: 0, - count: 0 - }; - } - }, - /** - * `systemBandwidth` is a combination of two serial processes bit-rates. The first - * is the network bitrate provided by `bandwidth` and the second is the bitrate of - * the entire process after that - decryption, transmuxing, and appending - provided - * by `throughput`. - * - * Since the two process are serial, the overall system bandwidth is given by: - * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput) - */ - systemBandwidth: { - get: function get() { - var invBandwidth = 1 / (this.bandwidth || 1); - var invThroughput = undefined; - - if (this.throughput > 0) { - invThroughput = 1 / this.throughput; - } else { - invThroughput = 0; - } - - var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput)); - - return systemBitrate; - }, - set: function set() { - _videoJs2['default'].log.error('The "systemBandwidth" property is read-only'); - } - } - }); - - Object.defineProperties(this.stats, { - bandwidth: { - get: function get() { - return _this3.bandwidth || 0; - }, - enumerable: true - }, - mediaRequests: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequests_() || 0; - }, - enumerable: true - }, - mediaRequestsAborted: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0; - }, - enumerable: true - }, - mediaRequestsTimedout: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0; - }, - enumerable: true - }, - mediaRequestsErrored: { - get: function get() { - return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0; - }, - enumerable: true - }, - mediaTransferDuration: { - get: function get() { - return _this3.masterPlaylistController_.mediaTransferDuration_() || 0; - }, - enumerable: true - }, - mediaBytesTransferred: { - get: function get() { - return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0; - }, - enumerable: true - }, - mediaSecondsLoaded: { - get: function get() { - return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0; - }, - enumerable: true - } - }); - - this.tech_.one('canplay', this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)); - - this.masterPlaylistController_.on('sourceopen', function () { - _this3.tech_.audioTracks().addEventListener('change', _this3.audioTrackChange_); - _this3.tech_.remoteTextTracks().addEventListener('change', _this3.textTrackChange_); - }); - - this.masterPlaylistController_.on('selectedinitialmedia', function () { - // Add the manual rendition mix-in to HlsHandler - (0, _renditionMixin2['default'])(_this3); - }); - - this.masterPlaylistController_.on('audioupdate', function () { - // clear current audioTracks - _this3.tech_.clearTracks('audio'); - _this3.masterPlaylistController_.activeAudioGroup().forEach(function (audioTrack) { - _this3.tech_.audioTracks().addTrack(audioTrack); - }); - }); - - // the bandwidth of the primary segment loader is our best - // estimate of overall bandwidth - this.on(this.masterPlaylistController_, 'progress', function () { - this.tech_.trigger('progress'); - }); - - // In the live case, we need to ignore the very first `seeking` event since - // that will be the result of the seek-to-live behavior - this.on(this.masterPlaylistController_, 'firstplay', function () { - this.ignoreNextSeekingEvent_ = true; - }); - - this.tech_.ready(function () { - return _this3.setupQualityLevels_(); - }); - - // do nothing if the tech has been disposed already - // this can occur if someone sets the src in player.ready(), for instance - if (!this.tech_.el()) { - return; - } - - this.tech_.src(_videoJs2['default'].URL.createObjectURL(this.masterPlaylistController_.mediaSource)); - } - - /** - * Initializes the quality levels and sets listeners to update them. - * - * @method setupQualityLevels_ - * @private - */ - }, { - key: 'setupQualityLevels_', - value: function setupQualityLevels_() { - var _this4 = this; - - var player = _videoJs2['default'].players[this.tech_.options_.playerId]; - - if (player && player.qualityLevels) { - this.qualityLevels_ = player.qualityLevels(); - - this.masterPlaylistController_.on('selectedinitialmedia', function () { - handleHlsLoadedMetadata(_this4.qualityLevels_, _this4); - }); - - this.playlists.on('mediachange', function () { - handleHlsMediaChange(_this4.qualityLevels_, _this4.playlists); - }); - } - } - - /** - * a helper for grabbing the active audio group from MasterPlaylistController - * - * @private - */ - }, { - key: 'activeAudioGroup_', - value: function activeAudioGroup_() { - return this.masterPlaylistController_.activeAudioGroup(); - } - - /** - * Begin playing the video. - */ - }, { - key: 'play', - value: function play() { - this.masterPlaylistController_.play(); - } - - /** - * a wrapper around the function in MasterPlaylistController - */ - }, { - key: 'setCurrentTime', - value: function setCurrentTime(currentTime) { - this.masterPlaylistController_.setCurrentTime(currentTime); - } - - /** - * a wrapper around the function in MasterPlaylistController - */ - }, { - key: 'duration', - value: function duration() { - return this.masterPlaylistController_.duration(); - } - - /** - * a wrapper around the function in MasterPlaylistController - */ - }, { - key: 'seekable', - value: function seekable() { - return this.masterPlaylistController_.seekable(); - } - - /** - * Abort all outstanding work and cleanup. - */ - }, { - key: 'dispose', - value: function dispose() { - if (this.playbackWatcher_) { - this.playbackWatcher_.dispose(); - } - if (this.masterPlaylistController_) { - this.masterPlaylistController_.dispose(); - } - if (this.qualityLevels_) { - this.qualityLevels_.dispose(); - } - this.tech_.audioTracks().removeEventListener('change', this.audioTrackChange_); - this.tech_.remoteTextTracks().removeEventListener('change', this.textTrackChange_); - _get(Object.getPrototypeOf(HlsHandler.prototype), 'dispose', this).call(this); - } - }]); - - return HlsHandler; -})(Component); - -var HlsSourceHandler = function HlsSourceHandler(mode) { - return { - canHandleSource: function canHandleSource(srcObj) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var localOptions = _videoJs2['default'].mergeOptions(_videoJs2['default'].options, options); - - // this forces video.js to skip this tech/mode if its not the one we have been - // overriden to use, by returing that we cannot handle the source. - if (localOptions.hls && localOptions.hls.mode && localOptions.hls.mode !== mode) { - return false; - } - return HlsSourceHandler.canPlayType(srcObj.type, localOptions); - }, - handleSource: function handleSource(source, tech) { - var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - - var localOptions = _videoJs2['default'].mergeOptions(_videoJs2['default'].options, options, { hls: { mode: mode } }); - - if (mode === 'flash') { - // We need to trigger this asynchronously to give others the chance - // to bind to the event when a source is set at player creation - tech.setTimeout(function () { - tech.trigger('loadstart'); - }, 1); - } - - tech.hls = new HlsHandler(source, tech, localOptions); - tech.hls.xhr = (0, _xhr2['default'])(); - - tech.hls.src(source.src); - return tech.hls; - }, - canPlayType: function canPlayType(type) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var localOptions = _videoJs2['default'].mergeOptions(_videoJs2['default'].options, options); - - if (HlsSourceHandler.canPlayType(type, localOptions)) { - return 'maybe'; - } - return ''; - } - }; -}; - -HlsSourceHandler.canPlayType = function (type, options) { - // No support for IE 10 or below - if (_videoJs2['default'].browser.IE_VERSION && _videoJs2['default'].browser.IE_VERSION <= 10) { - return false; - } - - var mpegurlRE = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; - - // favor native HLS support if it's available - if (!options.hls.overrideNative && Hls.supportsNativeHls) { - return false; - } - return mpegurlRE.test(type); -}; - -if (typeof _videoJs2['default'].MediaSource === 'undefined' || typeof _videoJs2['default'].URL === 'undefined') { - _videoJs2['default'].MediaSource = _videojsContribMediaSources.MediaSource; - _videoJs2['default'].URL = _videojsContribMediaSources.URL; -} - -var flashTech = _videoJs2['default'].getTech('Flash'); - -// register source handlers with the appropriate techs -if (_videojsContribMediaSources.MediaSource.supportsNativeMediaSources()) { - _videoJs2['default'].getTech('Html5').registerSourceHandler(HlsSourceHandler('html5'), 0); -} -if (_globalWindow2['default'].Uint8Array && flashTech) { - flashTech.registerSourceHandler(HlsSourceHandler('flash')); -} - -_videoJs2['default'].HlsHandler = HlsHandler; -_videoJs2['default'].HlsSourceHandler = HlsSourceHandler; -_videoJs2['default'].Hls = Hls; -if (!_videoJs2['default'].use) { - _videoJs2['default'].registerComponent('Hls', Hls); -} -_videoJs2['default'].m3u8 = _m3u8Parser2['default']; -_videoJs2['default'].options.hls = _videoJs2['default'].options.hls || {}; - -if (_videoJs2['default'].registerPlugin) { - _videoJs2['default'].registerPlugin('reloadSourceOnError', _reloadSourceOnError2['default']); -} else { - _videoJs2['default'].plugin('reloadSourceOnError', _reloadSourceOnError2['default']); -} - -module.exports = { - Hls: Hls, - HlsHandler: HlsHandler, - HlsSourceHandler: HlsSourceHandler -}; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./bin-utils":2,"./config":3,"./master-playlist-controller":5,"./playback-watcher":7,"./playlist":10,"./playlist-loader":8,"./playlist-selectors.js":9,"./reload-source-on-error":12,"./rendition-mixin":13,"./xhr":19,"aes-decrypter":23,"global/document":29,"global/window":30,"m3u8-parser":31,"videojs-contrib-media-sources":73}]},{},[76])(76) -}); \ No newline at end of file diff --git a/embed/players/videojs-contrib-hls.min.js b/embed/players/videojs-contrib-hls.min.js deleted file mode 100644 index 89353b39..00000000 --- a/embed/players/videojs-contrib-hls.min.js +++ /dev/null @@ -1,7 +0,0 @@ -!function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var l=i[s]={exports:{}};t[s][0].call(l.exports,function(e){var i=t[s][1][e];return r(i||e)},l,l.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){var i=[],n=!0,r=!1,a=undefined;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(u){r=!0,a=u}finally{try{!n&&o["return"]&&o["return"]()}finally{if(r)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=e(30),a=function(e){return e&&e.__esModule?e:{"default":e}}(r),s=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},o=function(e,t){var i=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(e.segments)for(var r=i,o=undefined,u=0;u<e.segments.length;u++){var d=e.segments[u];if(o||(o=s(t,r+d.duration/2)),o){if("cueIn"in d){o.endTime=r,o.adEndTime=r,r+=d.duration,o=null;continue}if(r<o.endTime){r+=d.duration;continue}o.endTime+=d.duration}else if("cueOut"in d&&(o=new a["default"].VTTCue(r,r+d.duration,d.cueOut),o.adStartTime=r,o.adEndTime=r+parseFloat(d.cueOut),t.addCue(o)),"cueOutCont"in d){var l=undefined,f=undefined,c=d.cueOutCont.split("/").map(parseFloat),h=n(c,2);l=h[0],f=h[1],o=new a["default"].VTTCue(r,r+d.duration,""),o.adStartTime=r-l,o.adEndTime=o.adStartTime+f,t.addCue(o)}r+=d.duration}};i["default"]={updateAdCues:o,findAdCue:s},t.exports=i["default"]},{}],2:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(e,t){return e.start(t)+"-"+e.end(t)},r=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},a=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},s=function(e){var t={};return Object.keys(e).forEach(function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n}),t},o=function(e){var t=e.byterange||{length:Infinity,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},u={hexDump:function(e){for(var t=Array.prototype.slice.call(e),i="",n=undefined,s=undefined,o=0;o<t.length/16;o++)n=t.slice(16*o,16*o+16).map(r).join(""),s=t.slice(16*o,16*o+16).map(a).join(""),i+=n+" "+s+"\n";return i},tagDump:function(e){return u.hexDump(e.bytes)},textRanges:function(e){var t="",i=undefined;for(i=0;i<e.length;i++)t+=n(e,i)+" ";return t},createTransferableMessage:s,initSegmentId:o};i["default"]=u,t.exports=i["default"]},{}],3:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i["default"]={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},t.exports=i["default"]},{}],4:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e(30),r=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=e(23),s=e(2),o=function(e){e.onmessage=function(e){var t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),n=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),o=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new a.Decrypter(i,n,o,function(e,i){r["default"].postMessage((0,s.createTransferableMessage)({source:t.source,decrypted:i}),[i.buffer])})}};i["default"]=function(e){return new o(e)},t.exports=i["default"]},{}],5:[function(e,t,i){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},u=e(8),d=n(u),l=e(15),f=n(l),c=e(18),h=n(c),p=e(11),m=n(p),g="undefined"!=typeof window?window.videojs:void 0!==t?t.videojs:null,y=n(g),_=e(1),v=n(_),b=e(17),T=n(b),S=e(64),w=e(75),k=n(w),O=e(4),E=n(O),A=e(3),L=n(A),P=undefined,I={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},C=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],U=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},x=function(e,t){if(typeof e!=typeof t)return!0;if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var i in e)if(e[i]!==t[i])return!0;return!1},M=function(e){var t={codecCount:0},i=undefined;return t.codecCount=e.split(",").length,t.codecCount=t.codecCount||2,i=/(^|\s|,)+(avc1)([^ ,]*)/i.exec(e),i&&(t.videoCodec=i[2],t.videoObjectTypeIndicator=i[3]),t.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(e),t.audioProfile=t.audioProfile&&t.audioProfile[2],t},D=function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e){return(0,S.translateLegacyCodecs)([e])[0]})};i.mapLegacyAvcCodecs_=D;var R=function(e,t,i){return e+"/"+t+'; codecs="'+i.filter(function(e){return!!e}).join(", ")+'"'},B=function(e){return e.segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t"},j=function(e){var t=e.attributes||{};return t.CODECS?M(t.CODECS):I},N=function(e,t){var i=B(t),n=j(t),r=t.attributes||{},a=!0,s=!1;if(!t)return[];if(e.mediaGroups.AUDIO&&r.AUDIO){var o=e.mediaGroups.AUDIO[r.AUDIO];if(o){s=!0,a=!1;for(var u in o)if(!o[u].uri){a=!0;break}}}s&&!n.audioProfile&&(y["default"].log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),n.audioProfile=I.audioProfile);var d={};n.videoCodec&&(d.video=""+n.videoCodec+n.videoObjectTypeIndicator),n.audioProfile&&(d.audio="mp4a.40."+n.audioProfile);var l=R("audio",i,[d.audio]),f=R("video",i,[d.video]),c=R("video",i,[d.video,d.audio]);return s?!a&&d.video?[f,l]:[c,l]:d.video?[c]:[l]};i.mimeTypesForPlaylist_=N;var F=function(e){function t(e){var i=this;r(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var n=e.url,a=e.withCredentials,s=e.mode,u=e.tech,l=e.bandwidth,c=e.externHls,p=e.useCueTags,m=e.blacklistDuration;if(!n)throw new Error("A non-empty playlist URL is required");P=c,this.withCredentials=a,this.tech_=u,this.hls_=u.hls,this.mode_=s,this.useCueTags_=p,this.blacklistDuration=m,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:this.withCredentials,timeout:null},this.audioGroups_={},this.subtitleGroups_={groups:{},tracks:{}},this.mediaSource=new y["default"].MediaSource({mode:s}),this.audioinfo_=null,this.mediaSource.on("audioinfo",this.handleAudioinfoUpdate_.bind(this)),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_.bind(this)),this.seekable_=y["default"].createTimeRanges(),this.hasPlayed_=function(){return!1},this.syncController_=new T["default"](e),this.segmentMetadataTrack_=u.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!0).track,this.decrypter_=(0,k["default"])(E["default"]);var g={hls:this.hls_,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.mediaSource.duration},hasPlayed:function(){return i.hasPlayed_()},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:l,syncController:this.syncController_,decrypter:this.decrypter_};this.masterPlaylistLoader_=new d["default"](n,this.hls_,this.withCredentials),this.setupMasterPlaylistLoaderListeners_(),this.audioPlaylistLoader_=null,this.subtitlePlaylistLoader_=null,this.mainSegmentLoader_=new f["default"](y["default"].mergeOptions(g,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new f["default"](y["default"].mergeOptions(g,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new h["default"](y["default"].mergeOptions(g,{loaderType:"vtt"}),e),this.setupSegmentLoaderListeners_(),C.forEach(function(e){i[e+"_"]=U.bind(i,e)}),this.masterPlaylistLoader_.load()}return a(t,e),s(t,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=e.masterPlaylistLoader_.media(),i=1.5*e.masterPlaylistLoader_.targetDuration*1e3;e.masterPlaylistLoader_.isLowestEnabledRendition_()?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),e.fillAudioTracks_(),e.setupAudio(),e.fillSubtitleTracks_(),e.setupSubtitles(),e.triggerPresenceUsage_(e.master(),t);try{e.setupSourceBuffers_()}catch(n){return y["default"].log.warn("Failed to create SourceBuffers",n),e.mediaSource.endOfStream("decode")}e.setupFirstPlay(),e.trigger("audioupdate"),e.trigger("selectedinitialmedia")}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var t=e.masterPlaylistLoader_.media();if(!t)return e.initialMedia_=e.selectPlaylist(),void e.masterPlaylistLoader_.media(e.initialMedia_);e.useCueTags_&&e.updateAdCues_(t),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.updateDuration(),e.tech_.paused()||e.mainSegmentLoader_.load(),t.endList||function(){var t=function(){var t=e.seekable();0!==t.length&&e.mediaSource.addSeekableRange_(t.start(0),t.end(0))};e.duration()!==Infinity?function(){var i=function n(){e.duration()===Infinity?t():e.tech_.one("durationchange",n)};e.tech_.one("durationchange",i)}():t()}()}),this.masterPlaylistLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var t=e.masterPlaylistLoader_.media(),i=1.5*e.masterPlaylistLoader_.targetDuration*1e3,n=undefined,r=undefined;e.masterPlaylistLoader_.isLowestEnabledRendition_()?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),n=e.activeAudioGroup(),r=n.filter(function(e){return e.enabled})[0],r||(e.mediaGroupChanged(),e.trigger("audioupdate")),e.setupSubtitles(),e.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var t=e.masterPlaylistLoader_.media();e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),e.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a]){var o=i.AUDIO[a][s];o.uri||(n=!1)}n&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),P.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),P.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var t=e.selectPlaylist(),i=e.masterPlaylistLoader_.media(),n=e.tech_.buffered(),r=n.length?n.end(n.length-1)-e.tech_.currentTime():0,a=e.bufferLowWaterLine();(!i.endList||e.duration()<L["default"].MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<i.attributes.BANDWIDTH||r>=a)&&e.masterPlaylistLoader_.media(t),e.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){e.onEndOfStream()}),this.audioSegmentLoader_.on("ended",function(){e.onEndOfStream()}),this.audioSegmentLoader_.on("error",function(){y["default"].log.warn("Problem encountered with the current alternate audio track. Switching back to default."),e.audioSegmentLoader_.abort(),e.audioPlaylistLoader_=null,e.setupAudio()}),this.subtitleSegmentLoader_.on("error",this.handleSubtitleError_.bind(this))}},{key:"handleAudioinfoUpdate_",value:function(e){if(P.supportsAudioInfoChange_()||!this.audioInfo_||!x(this.audioInfo_,e.info))return void(this.audioInfo_=e.info);var t="had different audio properties (channels, sample rate, etc.) or changed in some other way. This behavior is currently unsupported in Firefox 48 and below due to an issue: \n\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=1247138\n\n",i=this.activeAudioGroup().map(function(e){return e.enabled}).indexOf(!0),n=this.activeAudioGroup()[i],r=this.activeAudioGroup().filter(function(e){return e.properties_&&e.properties_["default"]})[0];this.audioPlaylistLoader_?(t="The audio track '"+n.label+"' that we tried to switch to "+t+" Unfortunately this means we will have to return you to the main track '"+r.label+"'. Sorry!",r.enabled=!0,this.activeAudioGroup().splice(i,1),this.trigger("audioupdate")):(t="The rendition that we tried to switch to "+t+"Unfortunately that means we will have to blacklist the current playlist and switch to another. Sorry!",this.blacklistCurrentPlaylist()),y["default"].log.warn(t),this.setupAudio()}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"fillAudioTracks_",value:function(){var e=this.master(),t=e.mediaGroups||{};t&&t.AUDIO&&0!==Object.keys(t.AUDIO).length&&"html5"===this.mode_||(t.AUDIO={main:{"default":{"default":!0}}});for(var i in t.AUDIO){this.audioGroups_[i]||(this.audioGroups_[i]=[]);for(var n in t.AUDIO[i]){var r=t.AUDIO[i][n],a=new y["default"].AudioTrack({id:n,kind:this.audioTrackKind_(r),enabled:!1,language:r.language,label:n});a.properties_=r,this.audioGroups_[i].push(a)}}(this.activeAudioGroup().filter(function(e){return e.properties_["default"]})[0]||this.activeAudioGroup()[0]).enabled=!0}},{key:"audioTrackKind_",value:function(e){var t=e["default"]?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t}},{key:"fillSubtitleTracks_",value:function(){var e=this.master(),t=e.mediaGroups||{};for(var i in t.SUBTITLES){this.subtitleGroups_.groups[i]||(this.subtitleGroups_.groups[i]=[]);for(var n in t.SUBTITLES[i]){var r=t.SUBTITLES[i][n];if(!r.forced&&(this.subtitleGroups_.groups[i].push(y["default"].mergeOptions({id:n},r)),"undefined"==typeof this.subtitleGroups_.tracks[n])){var a=this.tech_.addRemoteTextTrack({id:n,kind:"subtitles",enabled:!1,language:r.language,label:n},!0).track;this.subtitleGroups_.tracks[n]=a}}}}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.load(),this.subtitlePlaylistLoader_&&this.subtitleSegmentLoader_.load()}},{key:"activeAudioGroup",value:function(){var e=this.masterPlaylistLoader_.media(),t=undefined;return e.attributes&&e.attributes.AUDIO&&(t=this.audioGroups_[e.attributes.AUDIO]),t||this.audioGroups_.main}},{key:"activeSubtitleGroup_",value:function(){var e=this.masterPlaylistLoader_.media(),t=undefined;return e?(e.attributes&&e.attributes.SUBTITLES&&(t=this.subtitleGroups_.groups[e.attributes.SUBTITLES]),t||this.subtitleGroups_.groups.main):null}},{key:"activeSubtitleTrack_",value:function(){for(var e in this.subtitleGroups_.tracks)if("showing"===this.subtitleGroups_.tracks[e].mode)return this.subtitleGroups_.tracks[e];return null}},{key:"handleSubtitleError_",value:function(){y["default"].log.warn("Problem encountered loading the subtitle track. Switching back to default."),this.subtitleSegmentLoader_.abort();var e=this.activeSubtitleTrack_();e&&(e.mode="disabled"),this.setupSubtitles()}},{key:"mediaGroupChanged",value:function(){var e=this.getActiveAudioTrack_();this.stopAudioLoaders_(),this.resyncAudioLoaders_(e)}},{key:"setupAudio",value:function(){var e=this.getActiveAudioTrack_();this.stopAudioLoaders_(),this.resetAudioLoaders_(e)}},{key:"getActiveAudioTrack_",value:function(){var e=this.activeAudioGroup(),t=e.filter(function(e){return e.enabled})[0];return t||(t=e.filter(function(e){return e.properties_["default"]})[0]||e[0],t.enabled=!0),t}},{key:"stopAudioLoaders_",value:function(){this.audioPlaylistLoader_&&(this.audioPlaylistLoader_.dispose(),this.audioPlaylistLoader_=null),this.audioSegmentLoader_.pause()}},{key:"resetAudioLoaders_",value:function(e){if(!e.properties_.resolvedUri)return void this.mainSegmentLoader_.resetEverything();this.audioSegmentLoader_.resetEverything(),this.setupAudioPlaylistLoader_(e)}},{key:"resyncAudioLoaders_",value:function(e){e.properties_.resolvedUri&&(this.audioSegmentLoader_.resyncLoader(),this.setupAudioPlaylistLoader_(e))}},{key:"setupAudioPlaylistLoader_",value:function(e){var t=this;this.audioPlaylistLoader_=new d["default"](e.properties_.resolvedUri,this.hls_,this.withCredentials),this.audioPlaylistLoader_.load(),this.audioPlaylistLoader_.on("loadedmetadata",function(){var e=t.audioPlaylistLoader_.media();t.audioSegmentLoader_.playlist(e,t.requestOptions_),(!t.tech_.paused()||e.endList&&"none"!==t.tech_.preload())&&t.audioSegmentLoader_.load(),e.endList||t.audioPlaylistLoader_.trigger("firstplay")}),this.audioPlaylistLoader_.on("loadedplaylist",function(){var e=undefined;if(t.audioPlaylistLoader_&&(e=t.audioPlaylistLoader_.media()),!e)return void t.audioPlaylistLoader_.media(t.audioPlaylistLoader_.playlists.master.playlists[0]);t.audioSegmentLoader_.playlist(e,t.requestOptions_)}),this.audioPlaylistLoader_.on("error",function(){y["default"].log.warn("Problem encountered loading the alternate audio track. Switching back to default."),t.audioSegmentLoader_.abort(),t.setupAudio()})}},{key:"setupSubtitles",value:function(){var e=this,t=this.activeSubtitleGroup_(),i=this.activeSubtitleTrack_();if(this.subtitleSegmentLoader_.pause(),!i)return void(this.subtitlePlaylistLoader_&&(this.subtitlePlaylistLoader_.dispose(),this.subtitlePlaylistLoader_=null));var n=t.filter(function(e){return e.id===i.id})[0];this.subtitlePlaylistLoader_&&this.subtitlePlaylistLoader_.media()&&this.subtitlePlaylistLoader_.media().resolvedUri===n.resolvedUri||(this.subtitlePlaylistLoader_&&this.subtitlePlaylistLoader_.dispose(),this.subtitleSegmentLoader_.resetEverything(),this.subtitlePlaylistLoader_=new d["default"](n.resolvedUri,this.hls_,this.withCredentials),this.subtitlePlaylistLoader_.on("loadedmetadata",function(){var t=e.subtitlePlaylistLoader_.media();e.subtitleSegmentLoader_.playlist(t,e.requestOptions_),e.subtitleSegmentLoader_.track(e.activeSubtitleTrack_()),(!e.tech_.paused()||t.endList&&"none"!==e.tech_.preload())&&e.subtitleSegmentLoader_.load()}),this.subtitlePlaylistLoader_.on("loadedplaylist",function(){var t=undefined;e.subtitlePlaylistLoader_&&(t=e.subtitlePlaylistLoader_.media()),t&&e.subtitleSegmentLoader_.playlist(t,e.requestOptions_)}),this.subtitlePlaylistLoader_.on("error",this.handleSubtitleError_.bind(this))),this.subtitlePlaylistLoader_.media()&&this.subtitlePlaylistLoader_.media().resolvedUri===n.resolvedUri?this.subtitleSegmentLoader_.load():this.subtitlePlaylistLoader_.load()}},{key:"fastQualityChange_",value:function(){var e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetLoader())}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_()&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===Infinity&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=undefined,t=this.masterPlaylistLoader_.media();return!(!t||this.tech_.paused()||this.hasPlayed_())&&(t.endList||(this.trigger("firstplay"),e=this.seekable(),e.length&&this.tech_.setCurrentTime(e.end(0))),this.hasPlayed_=function(){return!0},this.load(),!0)}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(e){return y["default"].log.warn("Failed to create Source Buffers",e),this.mediaSource.endOfStream("decode")}this.tech_.autoplay()&&this.tech_.play(),this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;this.audioPlaylistLoader_&&(e=e&&this.audioSegmentLoader_.ended_),e&&this.mediaSource.endOfStream()}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null===t)return!1;var i=P.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=m["default"].TIME_FUDGE_FACTOR;var a=r.end(r.length-1);return a-n<=m["default"].TIME_FUDGE_FACTOR&&i-a<=m["default"].TIME_FUDGE_FACTOR}},{key:"blacklistCurrentPlaylist",value:function(){var e=arguments.length<=0||arguments[0]===undefined?{}:arguments[0],t=undefined,i=undefined;if(!(t=e.playlist||this.masterPlaylistLoader_.media())){this.error=e;try{return this.mediaSource.endOfStream("network")}catch(r){return this.trigger("error")}}var n=this.masterPlaylistLoader_.isFinalRendition_();return n?(y["default"].log.warn("Problem encountered with the current HLS playlist. Trying again since it is the final playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(n)):(t.excludeUntil=Date.now()+1e3*this.blacklistDuration,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),i=this.selectPlaylist(),y["default"].log.warn("Problem encountered with the current HLS playlist."+(e.message?" "+e.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(i))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.pause(),this.subtitlePlaylistLoader_&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(e){var t=m["default"].findRange(this.tech_.buffered(),e);if(!this.masterPlaylistLoader_||!this.masterPlaylistLoader_.media())return 0;if(!this.masterPlaylistLoader_.media().segments)return 0;var i="flash"===this.mode_||"auto"===this.mode_&&!y["default"].MediaSource.supportsNativeMediaSources();if(t&&t.length&&!i)return e;this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.audioPlaylistLoader_&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.subtitlePlaylistLoader_&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.load(),this.subtitlePlaylistLoader_&&this.subtitleSegmentLoader_.load())}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:P.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e=undefined,t=undefined;if(this.masterPlaylistLoader_){var i=this.masterPlaylistLoader_.media();if(i){var n=this.syncController_.getExpiredTime(i,this.mediaSource.duration);if(null!==n&&(e=P.Playlist.seekable(i,n),0!==e.length)){if(this.audioPlaylistLoader_){if(i=this.audioPlaylistLoader_.media(),null===(n=this.syncController_.getExpiredTime(i,this.mediaSource.duration)))return;if(t=P.Playlist.seekable(i,n),0===t.length)return}t?t.start(0)>e.end(0)||e.start(0)>t.end(0)?this.seekable_=e:this.seekable_=y["default"].createTimeRanges([[t.start(0)>e.start(0)?t.start(0):e.start(0),t.end(0)<e.end(0)?t.end(0):e.end(0)]]):this.seekable_=e,this.tech_.trigger("seekablechanged")}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=P.Playlist.duration(this.masterPlaylistLoader_.media()),n=this.tech_.buffered(),r=function a(){e.mediaSource.duration=i,e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",a)};n.length>0&&(i=Math.max(i,n.end(n.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",r):r())}},{key:"dispose",value:function(){this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.audioPlaylistLoader_&&this.audioPlaylistLoader_.dispose(),this.subtitlePlaylistLoader_&&this.subtitlePlaylistLoader_.dispose(),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var e=this.masterPlaylistLoader_.media(),t=undefined;if(e&&"open"===this.mediaSource.readyState){if(t=N(this.masterPlaylistLoader_.master,e),t.length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+e.resolvedUri,this.mediaSource.endOfStream("decode");this.mainSegmentLoader_.mimeType(t[0]),t[1]&&this.audioSegmentLoader_.mimeType(t[1]),this.excludeIncompatibleVariants_(e)}}},{key:"excludeIncompatibleVariants_",value:function(e){var t=this.masterPlaylistLoader_.master,i=2,n=null,r=undefined;e.attributes&&e.attributes.CODECS&&(r=M(e.attributes.CODECS),n=r.videoCodec,i=r.codecCount),t.playlists.forEach(function(e){var t={codecCount:2,videoCodec:null};if(e.attributes&&e.attributes.CODECS){var r=e.attributes.CODECS;t=M(r),window.MediaSource&&window.MediaSource.isTypeSupported&&!window.MediaSource.isTypeSupported('video/mp4; codecs="'+D(r)+'"')&&(e.excludeUntil=Infinity)}t.codecCount!==i&&(e.excludeUntil=Infinity),t.videoCodec!==n&&(e.excludeUntil=Infinity)})}},{key:"updateAdCues_",value:function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),v["default"].updateAdCues(e,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=L["default"].GOAL_BUFFER_LENGTH,i=L["default"].GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,L["default"].MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=L["default"].BUFFER_LOW_WATER_LINE,i=L["default"].BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,L["default"].MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,n)}}]),t}(y["default"].EventTarget);i.MasterPlaylistController=F}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,i){(function(t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="undefined"!=typeof window?window.videojs:void 0!==t?t.videojs:null,r=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=e(2),s={FAILURE:2,TIMEOUT:-101,ABORTED:-102};i.REQUEST_ERRORS=s;var o=function(e){var t=(undefined,undefined);return t=e.offset+e.length-1,"bytes="+e.offset+"-"+t},u=function(e){var t={};return e.byterange&&(t.Range=o(e.byterange)),t},d=function(e){e.forEach(function(e){e.abort()})},l=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}},f=function(e){var t=e.target,i=Date.now()-t.requestTime,n={bandwidth:Infinity,bytesReceived:0,roundTripTime:i||0};return n.bytesReceived=e.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n},c=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:s.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:s.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:s.FAILURE,xhr:t}:null},h=function(e,t){return function(i,n){var r=n.response,a=c(i,n);if(a)return t(a,e);if(16!==r.byteLength)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:s.FAILURE,xhr:n},e);var o=new DataView(r);return e.key.bytes=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]),t(null,e)}},p=function(e,t){return function(i,n){var r=n.response,a=c(i,n);return a?t(a,e):0===r.byteLength?t({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:s.FAILURE,xhr:n},e):(e.map.bytes=new Uint8Array(n.response),t(null,e))}},m=function(e,t){return function(i,n){var r=n.response,a=c(i,n);return a?t(a,e):0===r.byteLength?t({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:s.FAILURE,xhr:n},e):(e.stats=l(n),e.key?e.encryptedBytes=new Uint8Array(n.response):e.bytes=new Uint8Array(n.response),t(null,e))}},g=function(e,t,i){var n=function r(n){if(n.data.source===t.requestId){e.removeEventListener("message",r);var a=n.data.decrypted;return t.bytes=new Uint8Array(a.bytes,a.byteOffset,a.byteLength),i(null,t)}};e.addEventListener("message",n),e.postMessage((0,a.createTransferableMessage)({source:t.requestId,encrypted:t.encryptedBytes,key:t.key.bytes,iv:t.key.iv}),[t.encryptedBytes.buffer,t.key.bytes.buffer])},y=function(e){return e.reduce(function(e,t){return t.code>e.code?t:e})},_=function(e,t,i){var n=[],r=0;return function(a,s){if(a&&(d(e),n.push(a)),(r+=1)===e.length){if(s.endOfAllRequests=Date.now(),n.length>0){var o=y(n);return i(o,s)}return s.encryptedBytes?g(t,s,i):i(null,s)}}},v=function(e,t){return function(i){return e.stats=r["default"].mergeOptions(e.stats,f(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}},b=function(e,t,i,n,a,s){var o=[],l=_(o,i,s);if(n.key){var f=r["default"].mergeOptions(t,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),c=h(n,l),g=e(f,c);o.push(g)}if(n.map&&!n.map.bytes){var y=r["default"].mergeOptions(t,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:u(n.map)}),b=p(n,l),T=e(y,b);o.push(T)}var S=r["default"].mergeOptions(t,{uri:n.resolvedUri,responseType:"arraybuffer",headers:u(n)}),w=m(n,l),k=e(S,w);return k.addEventListener("progress",v(n,a)),o.push(k),function(){return d(o)}};i.mediaSegmentRequest=b}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,i){(function(n){"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")}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=e(30),u=r(o),d=e(11),l=r(d),f="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,c=r(f),h=["seeking","seeked","pause","playing","error"],p=function(){function e(t){var i=this;a(this,e),this.tech_=t.tech,this.seekable=t.seekable,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,t.debug&&(this.logger_=c["default"].log.bind(c["default"],"playback-watcher ->")),this.logger_("initialize");var n=function(){return i.techWaiting_()},r=function(){return i.cancelTimer_()},s=function(){return i.fixesBadSeeks_()};this.tech_.on("seekablechanged",s),this.tech_.on("waiting",n),this.tech_.on(h,r),this.monitorCurrentTime_(),this.dispose=function(){i.logger_("dispose"),i.tech_.off("seekablechanged",s),i.tech_.off("waiting",n),i.tech_.off(h,r),i.checkCurrentTimeTimeout_&&u["default"].clearTimeout(i.checkCurrentTimeTimeout_),i.cancelTimer_()}}return s(e,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&u["default"].clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=u["default"].setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.outsideOfSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+l["default"].printableRange(e)+". Seeking to "+i+"."),this.tech_.setCurrentTime(i),!0}return!1}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=l["default"].findRange(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.fellOutOfLiveWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.buffered(),r=l["default"].findNextRange(n,t);if(this.videoUnderflow_(r,n,t))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(r.length>0){var a=r.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+a+", seeking to "+r.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*a,t),!0}return!1}},{key:"outsideOfSeekableWindow_",value:function(e,t){return!!e.length&&(t<e.start(0)-.1||t>e.end(e.length-1)+.1)}},{key:"fellOutOfLiveWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0))}},{key:"videoUnderflow_",value:function(e,t,i){if(0===e.length){var n=this.gapFromVideoUnderflow_(t,i);if(n)return this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=l["default"].findNextRange(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+l["default"].TIME_FUDGE_FACTOR),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var i=l["default"].findGaps(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:a}}return null}},{key:"logger_",value:function(){}}]),e}();i["default"]=p,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,t,i){(function(n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(i,"__esModule",{value:!0});var a=e(14),s=r(a),o="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,u=e(10),d=e(31),l=r(d),f=e(30),c=r(f),h=function(e,t,i){var n=t.slice(),r=undefined,a=undefined;for(i=i||0,r=Math.min(e.length,t.length+i),a=i;a<r;a++)n[a-i]=(0,o.mergeOptions)(e[a],n[a-i]);return n},p=function(e,t){for(var i=!1,n=(0,o.mergeOptions)(e,{}),r=e.playlists.length,a=undefined,u=undefined,d=undefined;r--;)if(a=n.playlists[r],a.uri===t.uri){if(a.segments&&t.segments&&a.segments.length===t.segments.length&&a.mediaSequence===t.mediaSequence)continue;for(n.playlists[r]=(0,o.mergeOptions)(a,t),n.playlists[t.uri]=n.playlists[r],a.segments&&(n.playlists[r].segments=h(a.segments,t.segments,t.mediaSequence-a.mediaSequence)),d=0,n.playlists[r].segments&&(d=n.playlists[r].segments.length);d--;)u=n.playlists[r].segments[d],u.resolvedUri||(u.resolvedUri=(0,s["default"])(a.resolvedUri,u.uri)),u.key&&!u.key.resolvedUri&&(u.key.resolvedUri=(0,s["default"])(a.resolvedUri,u.key.uri)),u.map&&!u.map.resolvedUri&&(u.map.resolvedUri=(0,s["default"])(a.resolvedUri,u.map.uri));i=!0}return i?n:null},m=function g(e,t,i){var n=this,r=this,a=undefined,o=undefined,d=undefined,f=undefined;if(g.prototype.constructor.call(this),this.hls_=t,!e)throw new Error("A non-empty playlist URL is required");d=function(e,t,i){r.setBandwidth(o||e),o=null,i&&(r.state=i),r.error={playlist:r.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t,responseText:e.responseText,code:e.status>=500?4:2},r.trigger("error")},f=function(e,t){var i=undefined,n=undefined,s=undefined;r.setBandwidth(o||e),o=null,r.state="HAVE_METADATA",i=new l["default"].Parser,i.push(e.responseText),i.end(),i.manifest.uri=t,s=p(r.master,i.manifest),n=1e3*(i.manifest.targetDuration||10),r.targetDuration=i.manifest.targetDuration,s?(r.master=s,r.media_=r.master.playlists[i.manifest.uri]):(n/=2,r.trigger("playlistunchanged")),r.media().endList||(c["default"].clearTimeout(a),a=c["default"].setTimeout(function(){r.trigger("mediaupdatetimeout")},n)),r.trigger("loadedplaylist")},r.state="HAVE_NOTHING",r.dispose=function(){r.stopRequest(),c["default"].clearTimeout(a),r.off()},r.stopRequest=function(){if(o){var e=o;o=null,e.onreadystatechange=null,e.abort()}},r.enabledPlaylists_=function(){return r.master.playlists.filter(u.isEnabled).length},r.isLowestEnabledRendition_=function(){if(1===r.master.playlists.length)return!0;var e=r.media(),t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===r.master.playlists.filter(function(e){if(!(0,u.isEnabled)(e))return!1;var i=0;return e&&e.attributes&&(i=e.attributes.BANDWIDTH),i<t}).length},r.isFinalRendition_=function(){return 1===r.master.playlists.filter(u.isEnabled).length},r.media=function(e){var t=r.state,n=undefined;if(!e)return r.media_;if("HAVE_NOTHING"===r.state)throw new Error("Cannot switch media playlist from "+r.state);if("string"==typeof e){if(!r.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=r.master.playlists[e]}if(n=!r.media_||e.uri!==r.media_.uri,r.master.playlists[e.uri].endList)return o&&(o.onreadystatechange=null,o.abort(),o=null),r.state="HAVE_METADATA",r.media_=e,void(n&&(r.trigger("mediachanging"),r.trigger("mediachange")));if(n){if(r.state="SWITCHING_MEDIA",o){if((0,s["default"])(r.master.uri,e.uri)===o.url)return;o.onreadystatechange=null,o.abort(),o=null}this.media_&&this.trigger("mediachanging"),o=this.hls_.xhr({uri:(0,s["default"])(r.master.uri,e.uri),withCredentials:i},function(i,n){if(o){if(i)return d(o,e.uri,t);f(n,e.uri),"HAVE_MASTER"===t?r.trigger("loadedmetadata"):r.trigger("mediachange")}})}},r.setBandwidth=function(e){r.bandwidth=e.bandwidth},r.on("mediaupdatetimeout",function(){"HAVE_METADATA"===r.state&&(r.state="HAVE_CURRENT_METADATA",o=this.hls_.xhr({uri:(0,s["default"])(r.master.uri,r.media().uri),withCredentials:i},function(e,t){if(o)return e?d(o,r.media().uri,"HAVE_METADATA"):void f(o,r.media().uri)}))}),r.on("firstplay",function(){var e=r.media();e&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0})}),r.pause=function(){r.stopRequest(),c["default"].clearTimeout(a),"HAVE_NOTHING"===r.state&&(r.started=!1)},r.load=function(e){var t=r.media();if(c["default"].clearTimeout(a),e){var i=t?t.targetDuration/2*1e3:5e3;return void(a=c["default"].setTimeout(r.load.bind(null,!1),i))}if(!r.started)return void r.start();t&&!t.endList?r.trigger("mediaupdatetimeout"):r.trigger("loadedplaylist")},r.start=function(){r.started=!0,o=n.hls_.xhr({uri:e,withCredentials:i},function(t,i){var n=undefined,a=undefined,u=undefined;if(o){if(o=null,t)return r.error={status:i.status,message:"HLS playlist request error at URL: "+e,responseText:i.responseText,code:2},"HAVE_NOTHING"===r.state&&(r.started=!1),r.trigger("error");if(n=new l["default"].Parser,n.push(i.responseText),n.end(),r.state="HAVE_MASTER",n.manifest.uri=e,n.manifest.playlists){for(r.master=n.manifest,u=r.master.playlists.length;u--;)a=r.master.playlists[u],r.master.playlists[a.uri]=a,a.resolvedUri=(0,s["default"])(r.master.uri,a.uri);return["AUDIO","SUBTITLES"].forEach(function(e){for(var t in r.master.mediaGroups[e])for(var i in r.master.mediaGroups[e][t]){var n=r.master.mediaGroups[e][t][i];n.uri&&(n.resolvedUri=(0,s["default"])(r.master.uri,n.uri))}}),r.trigger("loadedplaylist"),void(o||r.media(n.manifest.playlists[0]))}return r.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:c["default"].location.href,playlists:[{uri:e}]},r.master.playlists[e]=r.master.playlists[0],r.master.playlists[0].resolvedUri=e,f(i,e),r.trigger("loadedmetadata")}})}};m.prototype=new o.EventTarget,i["default"]=m,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(i,"__esModule",{value:!0});var r=e(3),a=n(r),s=e(10),o=n(s),u=function(e,t){var i=undefined;return e?(i=window.getComputedStyle(e),i?i[t]:""):""},d=function(e,t){var i=e.slice();e.sort(function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r})},l=function(e,t){var i=undefined,n=undefined;return e.attributes&&e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||window.Number.MAX_VALUE,t.attributes&&t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||window.Number.MAX_VALUE,i-n};i.comparePlaylistBandwidth=l;var f=function(e,t){var i=undefined,n=undefined;return e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||window.Number.MAX_VALUE,t.attributes&&t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||window.Number.MAX_VALUE,i===n&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n};i.comparePlaylistResolution=f;var c=function(e,t,i,n){var r=e.playlists.map(function(e){var t=undefined,i=undefined,n=undefined;return e.attributes&&(t=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,n=e.attributes.BANDWIDTH),n=n||window.Number.MAX_VALUE,{bandwidth:n,width:t,height:i,playlist:e}});d(r,function(e,t){return e.bandwidth-t.bandwidth}),r=r.filter(function(e){return o["default"].isEnabled(e.playlist)});var s=r.filter(function(e){return e.bandwidth*a["default"].BANDWIDTH_VARIANCE<t}),u=s[s.length-1],l=s.filter(function(e){return e.bandwidth===u.bandwidth})[0],f=s.filter(function(e){return e.width&&e.height});d(f,function(e,t){return e.width-t.width});var c=f.filter(function(e){return e.width===i&&e.height===n});u=c[c.length-1];var h=c.filter(function(e){return e.bandwidth===u.bandwidth})[0],p=undefined,m=undefined,g=undefined;return h||(p=f.filter(function(e){return e.width>i||e.height>n}),m=p.filter(function(e){return e.width===p[0].width&&e.height===p[0].height}),u=m[m.length-1],g=m.filter(function(e){return e.bandwidth===u.bandwidth})[0]),(g||h||l||r[0]).playlist},h=function(){return c(this.playlists.master,this.systemBandwidth,parseInt(u(this.tech_.el(),"width"),10),parseInt(u(this.tech_.el(),"height"),10))};i.lastBandwidthSelector=h;var p=function(e){var t=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){return t<0&&(t=this.systemBandwidth),t=e*this.systemBandwidth+(1-e)*t,c(this.playlists.master,t,parseInt(u(this.tech_.el(),"width"),10),parseInt(u(this.tech_.el(),"height"),10))}};i.movingAverageBandwidthSelector=p;var m=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,u=e.currentTimeline,f=e.syncController,c=t.playlists.filter(o["default"].hasAttribute.bind(null,"BANDWIDTH")),h=c.map(function(e){var t=f.getSyncPoint(e,r,u,i),d=t?1:2;return{playlist:e,rebufferingImpact:o["default"].estimateSegmentRequestTime(a,n,e)*d-s}}),p=h.filter(function(e){return e.rebufferingImpact<=0});return d(p,function(e,t){return l(t.playlist,e.playlist)}),p.length?p[0]:(d(h,function(e,t){return e.rebufferingImpact-t.rebufferingImpact}),h[0]||null)};i.minRebufferMaxBandwidthSelector=m},{}],10:[function(e,t,i){(function(t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="undefined"!=typeof window?window.videojs:void 0!==t?t.videojs:null,r=e(30),a=function(e){return e&&e.__esModule?e:{"default":e}}(r),s={UNSAFE_LIVE_SEGMENTS:3},o=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if("undefined"!=typeof r.start)return{result:r.start,precise:!0};if("undefined"!=typeof r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(r=e.segments[n],"undefined"!=typeof r.end)return{result:i+r.end,precise:!0};if(i+=r.duration,"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},u=function(e,t){for(var i=0,n=undefined,r=t-e.mediaSequence;r<e.segments.length;r++){if(n=e.segments[r],"undefined"!=typeof n.start)return{result:n.start-i,precise:!0};if(i+=n.duration,"undefined"!=typeof n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}},d=function(e,t,i){var n=undefined,r=undefined;return void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(n=o(e,t),n.precise?n.result:(r=u(e,t),r.precise?r.result:n.result+i))},l=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return a["default"].Infinity}return d(e,t,i)};i.duration=l;var f=function(e,t,i){var n=0;if(t>i){var r=[i,t];t=r[0],i=r[1]}if(t<0){for(var a=t;a<Math.min(0,i);a++)n+=e.targetDuration;t=0}for(var a=t;a<i;a++)n+=e.segments[a].duration;return n};i.sumDurations=f;var c=function(e,t,i){if(!e||!e.segments)return null;if(e.endList)return l(e);if(null===t)return null;t=t||0;var n=i?Math.max(0,e.segments.length-s.UNSAFE_LIVE_SEGMENTS):Math.max(0,e.segments.length);return d(e,e.mediaSequence+n,t)};i.playlistEnd=c;var h=function(e,t){var i=t||0,r=c(e,t,!0);return null===r?(0,n.createTimeRange)():(0,n.createTimeRange)(i,r)};i.seekable=h;var p=function(e){return e-Math.floor(e)==0},m=function(e,t){if(p(t))return t+.1*e;for(var i=t.toString().split(".")[1].length,n=1;n<=i;n++){var r=Math.pow(10,n),a=t*r;if(p(a)||n===i)return(a+e)/r}},g=m.bind(null,1),y=m.bind(null,-1),_=function(e,t,i,n){var r=undefined,a=undefined,s=e.segments.length,o=t-n;if(o<0){if(i>0)for(r=i-1;r>=0;r--)if(a=e.segments[r],(o+=y(a.duration))>0)return{mediaIndex:r,startTime:n-f(e,i,r)};return{mediaIndex:0,startTime:t}}if(i<0){for(r=i;r<0;r++)if((o-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(r=i;r<s;r++)if(a=e.segments[r],(o-=g(a.duration))<0)return{mediaIndex:r,startTime:n+f(e,i,r)};return{mediaIndex:s-1,startTime:t}};i.getMediaInfoForTime=_;var v=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()};i.isBlacklisted=v;var b=function(e){var t=v(e);return!e.disabled&&!t};i.isEnabled=b;var T=function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1};i.isAes=T;var S=function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].map)return!0;return!1};i.isFmp4=S;var w=function(e,t){return t.attributes&&t.attributes[e]};i.hasAttribute=w;var k=function(e,t,i){var n=arguments.length<=3||arguments[3]===undefined?0:arguments[3];return w("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN};i.estimateSegmentRequestTime=k,s.duration=l,s.seekable=h,s.getMediaInfoForTime=_,s.isEnabled=b,s.isBlacklisted=v,s.playlistEnd=c,s.isAes=T,s.isFmp4=S,s.hasAttribute=w,s.estimateSegmentRequestTime=k,i["default"]=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){var i=[],n=!0,r=!1,a=undefined;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(u){r=!0,a=u}finally{try{!n&&o["return"]&&o["return"]()}finally{if(r)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,a=function(e){return e&&e.__esModule?e:{"default":e}}(r),s=function(e,t){var i=n(t,2),r=i[0],a=i[1];return Math.min(Math.max(r,e),a)},o=function(e,t){var i=[],n=undefined;if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return a["default"].createTimeRanges(i)},u=function(e,t){return o(e,function(e,i){return e-1/30<=t&&i+1/30>=t})},d=function(e,t){return o(e,function(e){return e-1/30>=t})},l=function(e){if(e.length<2)return a["default"].createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return a["default"].createTimeRanges(t)},f=function(e,t){var i=undefined,n=undefined,r=undefined,a=[],s=[],o=function(e){return e[0]<=r&&e[1]>=r};if(e)for(i=0;i<e.length;i++)n=e.start(i),r=e.end(i),s.push([n,r]);if(t)for(i=0;i<t.length;i++)n=t.start(i),r=t.end(i),s.some(o)||a.push(r);return 1!==a.length?null:a[0]},c=function(e,t){var i=null,n=null,r=0,s=[],o=[];if(!(e&&e.length&&t&&t.length))return a["default"].createTimeRange();for(var u=e.length;u--;)s.push({time:e.start(u),type:"start"}),s.push({time:e.end(u),type:"end"});for(u=t.length;u--;)s.push({time:t.start(u),type:"start"}),s.push({time:t.end(u),type:"end"});for(s.sort(function(e,t){return e.time-t.time}),u=0;u<s.length;u++)"start"===s[u].type?2===++r&&(i=s[u].time):"end"===s[u].type&&1===--r&&(n=s[u].time),null!==i&&null!==n&&(o.push([i,n]),i=null,n=null);return a["default"].createTimeRanges(o)},h=function(e,t,i,n){for(var r=t.end(0)-t.start(0),a=e.end(0)-e.start(0),s=r-a,o=c(e,n),u=c(t,n),d=0,l=0,f=o.length;f--;)d+=o.end(f)-o.start(f),o.start(f)===i&&(d+=s);for(f=u.length;f--;)l+=u.end(f)-u.start(f);return Math.max(d,l)/r*100},p=function(e,t,i,n){var r=e+t,o=a["default"].createTimeRanges([[e,r]]),u=a["default"].createTimeRanges([[s(e,[i,r]),r]]);if(u.start(0)===u.end(0))return 0;var d=h(u,o,i,n);return isNaN(d)||d===Infinity||d===-Infinity?0:d},m=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},g=function(e,t){var i=arguments.length<=2||arguments[2]===undefined?1:arguments[2];return((e.length?e.end(e.length-1):0)-t)/i};i["default"]={findRange:u,findNextRange:d,findGaps:l,findSoleUncommonTimeRangesEnd:f,getSegmentBufferedPercent:p,TIME_FUDGE_FACTOR:1/30,printableRange:m,timeUntilRebuffer:g},t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,r=function(e){return e&&e.__esModule?e:{"default":e}}(n),a={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},s=function u(e,t){var i=0,n=0,s=r["default"].mergeOptions(a,t);e.ready(function(){e.trigger({type:"usage",name:"hls-error-reload-initialized"})});var o=function(){n&&e.currentTime(n)},d=function(t){null!==t&&t!==undefined&&(n=e.duration()!==Infinity&&e.currentTime()||0,e.one("loadedmetadata",o),e.src(t),e.trigger({type:"usage",name:"hls-error-reload"}),e.play())},l=function(){return Date.now()-i<1e3*s.errorInterval?void e.trigger({type:"usage",name:"hls-error-reload-canceled"}):s.getSource&&"function"==typeof s.getSource?(i=Date.now(),s.getSource.call(e,d)):void r["default"].log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},f=function h(){e.off("loadedmetadata",o),e.off("error",l),e.off("dispose",h)},c=function(t){f(),u(e,t)};e.on("error",l),e.on("dispose",f),e.reloadSourceOnError=c},o=function(e){s(this,e)};i["default"]=o,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var r=e(10),a=function(e,t,i,n){var a=e.master.playlists[t],s=(0,r.isBlacklisted)(a),o=(0,r.isEnabled)(a);return void 0===n?o:(n?delete a.disabled:a.disabled=!0,n===o||s||(i(),n?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),n)},s=function u(e,t,i){n(this,u);var r=e.masterPlaylistController_.fastQualityChange_.bind(e.masterPlaylistController_);if(t.attributes){var s=t.attributes;if(s.RESOLUTION){var o=s.RESOLUTION;this.width=o.width,this.height=o.height}this.bandwidth=s.BANDWIDTH}this.id=i,this.enabled=a.bind(this,e.playlists,t.uri,r)},o=function(e){var t=e.playlists;e.representations=function(){return t.master.playlists.filter(function(e){return!(0,r.isBlacklisted)(e)}).map(function(t,i){return new s(e,t,t.uri)})}};i["default"]=o,t.exports=i["default"]},{}],14:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(i,"__esModule",{value:!0});var r=e(61),a=n(r),s=e(30),o=n(s),u=function(e,t){return/^[a-z]+:/i.test(t)?t:(/\/\//i.test(e)||(e=a["default"].buildAbsoluteURL(o["default"].location.href,e)),a["default"].buildAbsoluteURL(e,t))};i["default"]=u,t.exports=i["default"]},{}],15:[function(e,t,i){(function(n){"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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},d=e(10),l=r(d),f="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,c=r(f),h=e(16),p=r(h),m=e(3),g=r(m),y=e(30),_=r(y),v=e(71),b=r(v),T=e(2),S=e(6),w=e(11),k=e(9),O=function(e,t,i){if(!e||!t)return!1;var n=e.segments,r=i===n.length;return e.endList&&"open"===t.readyState&&r},E=function(e){return"number"==typeof e&&isFinite(e)},A=function(e){function t(e){var i=this,n=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];if(a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.state="INIT",this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.hls_=e.hls,this.loaderType_=e.loaderType,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.mimeType_=null,this.sourceUpdater_=null,this.xhrOptions_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.syncController_.on("syncinfoupdate",function(){return i.trigger("syncinfoupdate")}),this.mediaSource_.addEventListener("sourceopen",function(){return i.ended_=!1}),this.fetchAtBuffer_=!1,n.debug&&(this.logger_=c["default"].log.bind(c["default"],"segment-loader",this.loaderType_,"->"))}return s(t,e),o(t,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_()}},{key:"abort",value:function(){if("WAITING"!==this.state)return void(this.pendingSegment_&&(this.pendingSegment_=null));this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(e){return void 0!==e&&(this.error_=e),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():c["default"].createTimeRanges()}},{key:"initSegment",value:function(e){var t=!(arguments.length<=1||arguments[1]===undefined)&&arguments[1];if(!e)return null;var i=(0,T.initSegmentId)(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes}),n||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new p["default"](this.mediaSource_,this.mimeType_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];if(e){var i=this.playlist_,n=this.pendingSegment_;if(this.playlist_=e,this.xhrOptions_=t,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0}),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return void(null!==this.mediaIndex&&this.resyncLoader());var r=e.mediaSequence-i.mediaSequence;this.logger_("mediaSequenceDiff",r),null!==this.mediaIndex&&(this.mediaIndex-=r),n&&(n.mediaIndex-=r,n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,e)}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(_["default"].clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e){this.mimeType_||(this.mimeType_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(){this.ended_=!1,this.resetLoader(),this.remove(0,Infinity)}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(e,t){this.sourceUpdater_&&this.sourceUpdater_.remove(e,t),(0,b["default"])(e,t,this.segmentMetadataTrack_)}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&_["default"].clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=_["default"].setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&_["default"].clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=_["default"].setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(e){if(O(this.playlist_,this.mediaSource_,e.mediaIndex))return void this.endOfStream();(e.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&((e.timeline!==this.currentTimeline_||null!==e.startOfSegment&&e.startOfSegment<this.sourceUpdater_.timestampOffset())&&(this.syncController_.reset(),e.timestampOffset=e.startOfSegment),this.loadSegment_(e))}}}},{key:"checkBuffer_",value:function(e,t,i,n,r,a){var s=0,o=undefined;e.length&&(s=e.end(e.length-1));var u=Math.max(0,s-r);if(!t.segments.length)return null;if(u>=this.goalBufferLength_())return null;if(!n&&u>=1)return null;if(this.logger_("checkBuffer_","mediaIndex:",i,"hasPlayed:",n,"currentTime:",r,"syncPoint:",a,"fetchAtBuffer:",this.fetchAtBuffer_,"bufferedTime:",u),null===a)return i=this.getSyncSegmentCandidate_(t),this.logger_("getSync","mediaIndex:",i),this.generateSegmentInfo_(t,i,null,!0);if(null!==i){this.logger_("walkForward","mediaIndex:",i+1);var d=t.segments[i];return o=d&&d.end?d.end:s,this.generateSegmentInfo_(t,i+1,o,!1)} -if(this.fetchAtBuffer_){var f=l["default"].getMediaInfoForTime(t,s,a.segmentIndex,a.time);i=f.mediaIndex,o=f.startTime}else{var f=l["default"].getMediaInfoForTime(t,r,a.segmentIndex,a.time);i=f.mediaIndex,o=f.startTime}return this.logger_("getMediaIndexForTime","mediaIndex:",i,"startOfSegment:",o),this.generateSegmentInfo_(t,i,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_)return 0;var i=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,i,n){if(t<0||t>=e.segments.length)return null;var r=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:r.resolvedUri,mediaIndex:t,isSyncRequest:n,startOfSegment:i,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:r.timeline,duration:r.duration,segment:r}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=l["default"].estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=(0,w.timeUntilRebuffer)(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=a)return!1;var s=(0,k.minRebufferMaxBandwidthSelector)({master:this.hls_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a,u=o-s.rebufferingImpact,d=.5;return a<=w.TIME_FUDGE_FACTOR&&(d=1),!s.playlist||s.playlist.uri===this.playlist_.uri||u<d?!1:(this.bandwidth=s.playlist.attributes.BANDWIDTH*g["default"].BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("bandwidthupdate"),!0)}}},{key:"handleProgress_",value:function(e,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),e.abortRequests=(0,S.mediaSegmentRequest)(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.createSimplifiedSegmentObj_(e),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(e){var t=this.seekable_(),i=this.currentTime_(),n=0;(n=t.length&&t.start(0)>0&&t.start(0)<i?t.start(0):i-30)>0&&this.remove(0,n)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var n=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);i.key={resolvedUri:t.key.resolvedUri,iv:n}}return t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(e,t){if(this.mediaRequests+=1,t.stats&&(this.mediaBytesTransferred+=t.stats.bytesReceived,this.mediaTransferDuration+=t.stats.roundTripTime),!this.pendingSegment_)return void(this.mediaRequestsAborted+=1);if(t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===S.REQUEST_ERRORS.ABORTED?void(this.mediaRequestsAborted+=1):(this.pause(),e.code===S.REQUEST_ERRORS.TIMEOUT?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));this.bandwidth=t.stats.bandwidth,this.roundTrip=t.stats.roundTripTime,t.map&&(t.map=this.initSegment(t.map,!0)),this.processSegmentResponse_(t)}}},{key:"processSegmentResponse_",value:function(e){var t=this.pendingSegment_;t.bytes=e.bytes,e.map&&(t.segment.map.bytes=e.map.bytes),t.endOfAllRequests=e.endOfAllRequests,this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(!this.pendingSegment_)return void(this.state="READY");this.state="APPENDING";var t=this.pendingSegment_,i=t.segment;if(this.syncController_.probeSegmentInfo(t),t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==t.timestampOffset&&t.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(t.timestampOffset),this.trigger("timestampoffset")),i.map&&function(){var t=(0,T.initSegmentId)(i.map);if(!e.activeInitSegmentId_||e.activeInitSegmentId_!==t){var n=e.initSegment(i.map);e.sourceUpdater_.appendBuffer(n.bytes,function(){e.activeInitSegmentId_=t})}}(),t.byteLength=t.bytes.byteLength,"number"==typeof i.start&&"number"==typeof i.end?this.mediaSecondsLoaded+=i.end-i.start:this.mediaSecondsLoaded+=i.duration,this.sourceUpdater_.appendBuffer(t.bytes,this.handleUpdateEnd_.bind(this))}},{key:"handleUpdateEnd_",value:function(){if(this.logger_("handleUpdateEnd_","segmentInfo:",this.pendingSegment_),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_,t=e.segment,i=null!==this.mediaIndex;if(this.pendingSegment_=null,this.recordThroughput_(e),this.addSegmentMetadataCue_(e),this.state="READY",this.mediaIndex=e.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration)return void this.resetEverything();i&&this.trigger("bandwidthupdate"),this.trigger("progress"),O(e.playlist,this.mediaSource_,e.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_()}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},{key:"logger_",value:function(){}},{key:"addSegmentMetadataCue_",value:function(e){if(this.segmentMetadataTrack_){var t=e.segment,i=t.start,n=t.end;if(E(i)&&E(n)){(0,b["default"])(i,n,this.segmentMetadataTrack_);var r=_["default"].WebKitDataCue||_["default"].VTTCue,a={uri:e.uri,timeline:e.timeline,playlist:e.playlist.uri,start:i,end:n},s=JSON.stringify(a),o=new r(i,n,s);o.value=a,this.segmentMetadataTrack_.addCue(o)}}}}]),t}(c["default"].EventTarget);i["default"]=A,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],16:[function(e,t,i){(function(e){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,s=function(e){return e&&e.__esModule?e:{"default":e}}(a),o=function(){},u=function(){function e(t,i){var r=this;n(this,e);var a=function(){r.sourceBuffer_=t.addSourceBuffer(i),r.onUpdateendCallback_=function(){var e=r.pendingCallback_;r.pendingCallback_=null,e&&e(),r.runCallback_()},r.sourceBuffer_.addEventListener("updateend",r.onUpdateendCallback_),r.runCallback_()};this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,"closed"===t.readyState?t.addEventListener("sourceopen",a):a()}return r(e,[{key:"abort",value:function(e){var t=this;this.processedAppend_&&this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}},{key:"appendBuffer",value:function(e,t){var i=this;this.processedAppend_=!0,this.queueCallback_(function(){i.sourceBuffer_.appendBuffer(e)},t)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:s["default"].createTimeRanges()}},{key:"remove",value:function(e,t){var i=this;this.processedAppend_&&this.queueCallback_(function(){i.sourceBuffer_.remove(e,t)},o)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||this.pendingCallback_}},{key:"timestampOffset",value:function(e){var t=this;return void 0!==e&&(this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=e}),this.timestampOffset_=e),this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]),this.runCallback_()}},{key:"runCallback_",value:function(){var e=undefined;!this.updating()&&this.callbacks_.length&&(e=this.callbacks_.shift(),this.pendingCallback_=e[1],e[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_&&"open"===this.mediaSource.readyState&&this.sourceBuffer_.abort()}}]),e}();i["default"]=u,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(e,t,i){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},u=e(55),d=n(u),l=e(57),f=e(10),c="undefined"!=typeof window?window.videojs:void 0!==t?t.videojs:null,h=n(c),p=[{name:"VOD",run:function(e,t,i,n,r){if(i!==Infinity){return{time:0,segmentIndex:0}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(e.datetimeToDisplayTime&&t.dateTimeObject){return{time:t.dateTimeObject.getTime()/1e3+e.datetimeToDisplayTime,segmentIndex:0}}return null}},{name:"Segment",run:function(e,t,i,n,r){var a=t.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var d=a[u];if(d.timeline===n&&"undefined"!=typeof d.start){var l=Math.abs(r-d.start);if(null!==o&&o<l)break;(!s||null===o||o>=l)&&(o=l,s={time:d.start,segmentIndex:u})}}return s}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],d=t.discontinuitySequence+o+1,l=e.discontinuities[d];if(l){var f=Math.abs(r-l.time);if(null!==s&&s<f)break;(!a||null===s||s>=f)&&(s=f,a={time:l.time,segmentIndex:u})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){if(t.syncInfo){return{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}}return null}}];i.syncPointStrategies=p;var m=function(e){function t(){var e=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];r(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.inspectCache_=undefined,this.timelines=[],this.discontinuities=[],this.datetimeToDisplayTime=null,e.debug&&(this.logger_=h["default"].log.bind(h["default"],"sync-controller ->"))}return a(t,e),s(t,[{key:"getSyncPoint",value:function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+(0,f.sumDurations)(e,n.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,i,n){for(var r=[],a=0;a<p.length;a++){var s=p[a],o=s.run(this,e,t,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}),this.logger_("syncPoint found via <"+s.name+">:",o))}return r}},{key:"selectSyncPoint_",value:function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint with strategy <"+r+"> chosen: ",i),i}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var i=t.mediaSequence-e.mediaSequence,n=i-1;n>=0;n--){var r=e.segments[n];if(r&&"undefined"!=typeof r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist sync:",t.syncInfo),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(e){if(!this.datetimeToDisplayTime&&e.dateTimeObject){var t=e.dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=undefined}},{key:"probeSegmentInfo",value:function(e){var t=e.segment,i=undefined;(i=t.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,i)&&this.saveDiscontinuitySyncInfo_(e)}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,i=d["default"].timescale(t.map.bytes),n=d["default"].startTime(i,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=n),{start:n,end:n+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=(0,l.inspect)(e.bytes,this.inspectCache_),i=undefined,n=undefined;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,n=t.video[1].dtsTime):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,n=t.audio[1].dtsTime),{start:i,end:n}):null}},{key:"timestampOffsetForTimeline",value:function(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].time}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var i=e.segment,n=this.timelines[e.timeline];if(null!==e.timestampOffset)this.logger_("tsO:",e.timestampOffset),n={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=n,this.trigger("timestampoffset"),i.start=e.startOfSegment,i.end=t.end+n.mapping;else{if(!n)return!1;i.start=t.start+n.mapping,i.end=t.end+n.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=undefined;u=s<0?i.start-(0,f.sumDurations)(t,e.mediaIndex,r):i.end+(0,f.sumDurations)(t,e.mediaIndex+1,r),this.discontinuities[a]={time:u,accuracy:o}}}}},{key:"logger_",value:function(){}}]),t}(h["default"].EventTarget);i["default"]=m}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],18:[function(e,t,i){(function(n){"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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},d=e(15),l=r(d),f="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,c=r(f),h=e(30),p=r(h),m=e(71),g=r(m),y=e(2),_=new Uint8Array("\n\n".split("").map(function(e){return e.charCodeAt(0)})),v=function(e){return String.fromCharCode.apply(null,e)},b=function(e){function t(e){var i=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,i),this.mediaSource_=null,this.subtitlesTrack_=null}return s(t,e),o(t,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return c["default"].createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return c["default"].createTimeRanges([[t,i]])}},{key:"initSegment",value:function(e){var t=!(arguments.length<=1||arguments[1]===undefined)&&arguments[1];if(!e)return null;var i=(0,y.initSegmentId)(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=_.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(_,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(e){this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()}},{key:"remove",value:function(e,t){(0,g["default"])(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t=this.skipEmptySegments_(t)){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){var i=function(){e.state="READY",e.paused()||e.monitorBuffer_()};return this.syncController_.one("timestampoffset",i),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}}},{key:"skipEmptySegments_",value:function(e){for(;e&&e.segment.empty;)e=this.generateSegmentInfo_(e.playlist,e.mediaIndex+1,e.startOfSegment+e.duration,e.isSyncRequest);return e}},{key:"handleSegment_",value:function(){var e=this;if(!this.pendingSegment_)return void(this.state="READY");this.state="APPENDING";var t=this.pendingSegment_,i=t.segment;if("function"!=typeof p["default"].WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var n=function(){var t=function(){e.handleSegment_()};return e.state="WAITING_ON_VTTJS",e.subtitlesTrack_.tech_.one("vttjsloaded",t),e.subtitlesTrack_.tech_.one("vttjserror",function(){e.subtitlesTrack_.tech_.off("vttjsloaded",t),e.error({message:"Error loading vtt.js"}),e.state="READY",e.pause(),e.trigger("error")}),{v:undefined}}();if("object"==typeof n)return n.v}i.requested=!0;try{this.parseVTTCues_(t)}catch(r){return this.error({message:r.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(t,this.syncController_.timelines[t.timeline],this.playlist_),t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");t.byteLength=t.bytes.byteLength,this.mediaSecondsLoaded+=i.duration,t.cues.forEach(function(t){e.subtitlesTrack_.addCue(t)}),this.handleUpdateEnd_()}},{key:"parseVTTCues_",value:function(e){var t=undefined,i=!1;"function"==typeof p["default"].TextDecoder?t=new p["default"].TextDecoder("utf8"):(t=p["default"].WebVTT.StringDecoder(),i=!0);var n=new p["default"].WebVTT.Parser(p["default"],p["default"].vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){return e.timestampmap=t},n.onparsingerror=function(e){c["default"].log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=v(r)),n.parse(r)}var a=e.bytes;i&&(a=v(a)),n.parse(a),n.flush()}},{key:"updateTimeMapping_",value:function(e,t,i){var n=e.segment;if(t){if(!e.cues.length)return void(n.empty=!0);var r=e.timestampmap,a=r.MPEGTS/9e4-r.LOCAL+t.mapping;if(e.cues.forEach(function(e){e.startTime+=a,e.endTime+=a}),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}}}]),t}(l["default"]);i["default"]=b,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,r=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=function(){return function e(t,i){t=(0,n.mergeOptions)({timeout:45e3},t);var a=e.beforeRequest||r["default"].Hls.xhr.beforeRequest;if(a&&"function"==typeof a){var s=a(t);s&&(t=s)}var o=(0,n.xhr)(t,function(e,t){var n=o.response;!e&&n&&(o.responseTime=Date.now(),o.roundTripTime=o.responseTime-o.requestTime,o.bytesReceived=n.byteLength||n.length,o.bandwidth||(o.bandwidth=Math.floor(o.bytesReceived/o.roundTripTime*8*1e3))),e&&"ETIMEDOUT"===e.code&&(o.timedout=!0),e||o.aborted||200===t.statusCode||206===t.statusCode||0===t.statusCode||(e=new Error("XHR Failed with a response of: "+(o&&(n||o.responseText)))),i(e,o)}),u=o.abort;return o.abort=function(){return o.aborted=!0,u.apply(o,arguments)},o.uri=t.uri,o.requestTime=Date.now(),o}};i["default"]=a,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],a=undefined,s=undefined,o=undefined,u=[],d=[],l=undefined,f=undefined,c=undefined,h=undefined,p=undefined,m=undefined;for(a=0;a<256;a++)d[(u[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!n[s];s^=l||1,o=d[o]||1)for(h=o^o<<1^o<<2^o<<3^o<<4,h=h>>8^255&h^99,n[s]=h,r[h]=s,c=u[f=u[l=u[s]]],m=16843009*c^65537*f^257*l^16843008*s,p=257*u[h]^16843008*h,a=0;a<4;a++)t[a][s]=p=p<<24^p>>>8,i[a][h]=m=m<<24^m>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e},s=null,o=function(){function e(t){n(this,e),s||(s=a()),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];var i=undefined,r=undefined,o=undefined,u=undefined,d=undefined,l=this._tables[0][4],f=this._tables[1],c=t.length,h=1;if(4!==c&&6!==c&&8!==c)throw new Error("Invalid aes key size");for(u=t.slice(0),d=[],this._key=[u,d],i=c;i<4*c+28;i++)o=u[i-1],(i%c==0||8===c&&i%c==4)&&(o=l[o>>>24]<<24^l[o>>16&255]<<16^l[o>>8&255]<<8^l[255&o],i%c==0&&(o=o<<8^o>>>24^h<<24,h=h<<1^283*(h>>7))),u[i]=u[i-c]^o;for(r=0;i;r++,i--)o=u[3&r?i:i-4],d[r]=i<=4||r<4?o:f[0][l[o>>>24]]^f[1][l[o>>16&255]]^f[2][l[o>>8&255]]^f[3][l[255&o]]}return r(e,[{key:"decrypt",value:function(e,t,i,n,r,a){var s=this._key[1],o=e^s[0],u=n^s[1],d=i^s[2],l=t^s[3],f=undefined,c=undefined,h=undefined,p=s.length/4-2,m=undefined,g=4,y=this._tables[1],_=y[0],v=y[1],b=y[2],T=y[3],S=y[4];for(m=0;m<p;m++)f=_[o>>>24]^v[u>>16&255]^b[d>>8&255]^T[255&l]^s[g],c=_[u>>>24]^v[d>>16&255]^b[l>>8&255]^T[255&o]^s[g+1],h=_[d>>>24]^v[l>>16&255]^b[o>>8&255]^T[255&u]^s[g+2],l=_[l>>>24]^v[o>>16&255]^b[u>>8&255]^T[255&d]^s[g+3],g+=4,o=f,u=c,d=h;for(m=0;m<4;m++)r[(3&-m)+a]=S[o>>>24]<<24^S[u>>16&255]<<16^S[d>>8&255]<<8^S[255&l]^s[g++],f=o,o=u,u=d,d=l,l=f}}]),e}();i["default"]=o,t.exports=i["default"]},{}],21:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),s=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},o=e(24),u=function(e){return e&&e.__esModule?e:{"default":e}}(o),d=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,u["default"]),this.jobs=[],this.delay=1,this.timeout_=null}return r(t,e),a(t,[{key:"processJob_",value:function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}},{key:"push",value:function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}]),t}(u["default"]);i["default"]=d,t.exports=i["default"]},{}],22:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),s=e(20),o=n(s),u=e(21),d=n(u),l=e(26),f=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new o["default"](Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),s=new Int32Array(a.buffer),u=undefined,d=undefined,l=undefined,c=undefined,h=undefined,p=undefined,m=undefined,g=undefined,y=undefined;for(u=i[0],d=i[1],l=i[2],c=i[3],y=0;y<n.length;y+=4)h=f(n[y]),p=f(n[y+1]),m=f(n[y+2]),g=f(n[y+3]),r.decrypt(h,p,m,g,s,y),s[y]=f(s[y]^u),s[y+1]=f(s[y+1]^d),s[y+2]=f(s[y+2]^l),s[y+3]=f(s[y+3]^c),u=h,d=p,l=m,c=g;return a};i.decrypt=c;var h=function(){function e(t,i,n,a){r(this,e);var s=e.STEP,o=new Int32Array(t.buffer),u=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new d["default"],this.asyncStream_.push(this.decryptChunk_(o.subarray(c,c+s),i,n,u)),c=s;c<o.length;c+=s)n=new Uint32Array([f(o[c-4]),f(o[c-3]),f(o[c-2]),f(o[c-1])]),this.asyncStream_.push(this.decryptChunk_(o.subarray(c,c+s),i,n,u));this.asyncStream_.push(function(){a(null,(0,l.unpad)(u))})}return a(e,[{key:"decryptChunk_",value:function(e,t,i,n){return function(){var r=c(e,t,i);n.set(r,e.byteOffset)}}}],[{key:"STEP",get:function(){return 32e3}}]),e}();i.Decrypter=h,i["default"]={Decrypter:h,decrypt:c}},{}],23:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e(22),r=e(21),a=function(e){return e&&e.__esModule?e:{"default":e}}(r);i["default"]={decrypt:n.decrypt,Decrypter:n.Decrypter,AsyncStream:a["default"]},t.exports=i["default"]},{}],24:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=function(){function e(){n(this,e),this.listeners={}}return r(e,[{key:"on",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"off",value:function(e,t){var i=undefined;return!!this.listeners[e]&&(i=this.listeners[e].indexOf(t),this.listeners[e].splice(i,1),i>-1)}},{key:"trigger",value:function(e){var t=undefined,i=undefined,n=undefined,r=undefined;if(t=this.listeners[e])if(2===arguments.length)for(n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(r=Array.prototype.slice.call(arguments,1),n=t.length,i=0;i<n;++i)t[i].apply(this,r)}},{key:"dispose",value:function(){this.listeners={}}},{key:"pipe",value:function(e){this.on("data",function(t){e.push(t)})}}]),e}();i["default"]=a,t.exports=i["default"]},{}],25:[function(e,t,i){"use strict";var n;t.exports=function(e){var t=n[e.byteLength%16||0],i=new Uint8Array(e.byteLength+t.length);return i.set(e),i.set(t,e.byteLength),i},n=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]]},{}],26:[function(e,t,i){"use strict";i.pad=e(25),i.unpad=e(27)},{}],27:[function(e,t,i){"use strict";t.exports=function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}},{}],28:[function(e,t,i){},{}],29:[function(e,t,i){(function(i){var n,r=void 0!==i?i:"undefined"!=typeof window?window:{},a=e(28);"undefined"!=typeof document?n=document:(n=r["__GLOBAL_DOCUMENT_CACHE@4"])||(n=r["__GLOBAL_DOCUMENT_CACHE@4"]=a),t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],30:[function(e,t,i){(function(e){var i;i="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],31:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var r=e(32),a=n(r),s=e(33),o=n(s),u=e(34),d=n(u);t.exports={LineStream:a["default"],ParseStream:o["default"],Parser:d["default"]}},{}],32:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t} -}(),o=e(35),u=function(e){return e&&e.__esModule?e:{"default":e}}(o),d=function(e){function t(){n(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.buffer="",e}return a(t,e),s(t,[{key:"push",value:function(e){var t=void 0;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}]),t}(u["default"]);i["default"]=d},{}],33:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){var i=[],n=!0,r=!1,a=undefined;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(u){r=!0,a=u}finally{try{!n&&o["return"]&&o["return"]()}finally{if(r)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=e(35),d=function(e){return e&&e.__esModule?e:{"default":e}}(u),l=function(){return new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')},f=function(e){for(var t=e.split(l()),i={},n=t.length,r=void 0;n--;)""!==t[n]&&(r=/([^=]*)=(.*)/.exec(t[n]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),i[r[0]]=r[1]);return i},c=function(e){function t(){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return a(t,e),o(t,[{key:"push",value:function(e){var t=void 0,i=void 0;if(e=e.replace(/^[\u0000\s]+|[\u0000\s]+$/g,""),0!==e.length){if("#"!==e[0])return void this.trigger("data",{type:"uri",uri:e});if(0!==e.indexOf("#EXT"))return void this.trigger("data",{type:"comment",text:e.slice(1)});if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))return void this.trigger("data",{type:"tag",tagType:"m3u"});if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void this.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void this.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void this.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var n=f(t[1]);if(n.URI&&(i.uri=n.URI),n.BYTERANGE){var r=n.BYTERANGE.split("@"),a=s(r,2),o=a[0],u=a[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),u&&(i.byterange.offset=parseInt(u,10))}}return void this.trigger("data",i)}if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=f(t[1]),i.attributes.RESOLUTION){var d=i.attributes.RESOLUTION.split("x"),l={};d[0]&&(l.width=parseInt(d[0],10)),d[1]&&(l.height=parseInt(d[1],10)),i.attributes.RESOLUTION=l}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}return void this.trigger("data",i)}if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=f(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))return void this.trigger("data",{type:"tag",tagType:"endlist"});if(t=/^#EXT-X-DISCONTINUITY/.exec(e))return void this.trigger("data",{type:"tag",tagType:"discontinuity"});if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=f(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void this.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);this.trigger("data",{type:"tag",data:e.slice(4)})}}}]),t}(d["default"]);i["default"]=c},{}],34:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},u=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),d=e(35),l=n(d),f=e(32),c=n(f),h=e(33),p=n(h),m=function(e){function t(){r(this,t);var e=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));e.lineStream=new c["default"],e.parseStream=new p["default"],e.lineStream.pipe(e.parseStream);var i=e,n=[],s={},u=void 0,d=void 0,l=function(){},f={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},h=0;return e.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},e.parseStream.on("data",function(e){var t=void 0,r=void 0;({tag:function(){(({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(s.byterange=t,t.length=e.length,"offset"in e||(this.trigger("info",{message:"defaulting offset to zero"}),e.offset=0)),"offset"in e&&(s.byterange=t,t.offset=e.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=n},key:function(){return e.attributes?"NONE"===e.attributes.METHOD?void(d=null):e.attributes.URI?(e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),d={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void("undefined"!=typeof e.attributes.IV&&(d.iv=e.attributes.IV))):void this.trigger("warn",{message:"ignoring key declaration without URI"}):void this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){if(!isFinite(e.number))return void this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number});this.manifest.mediaSequence=e.number},"discontinuity-sequence":function(){if(!isFinite(e.number))return void this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number});this.manifest.discontinuitySequence=e.number,h=e.number},"playlist-type":function(){if(!/VOD|EVENT/.test(e.playlistType))return void this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist});this.manifest.playlistType=e.playlistType},map:function(){u={},e.uri&&(u.uri=e.uri),e.byterange&&(u.byterange=e.byterange)},"stream-inf":function(){if(this.manifest.playlists=n,this.manifest.mediaGroups=this.manifest.mediaGroups||f,!e.attributes)return void this.trigger("warn",{message:"ignoring empty stream-inf attributes"});s.attributes||(s.attributes={}),o(s.attributes,e.attributes)},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||f,!(e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],r={"default":/yes/i.test(e.attributes.DEFAULT)},r["default"]?r.autoselect=!0:r.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(r.language=e.attributes.LANGUAGE),e.attributes.URI&&(r.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(r.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(r.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(r.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=r},discontinuity:function(){h+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(n.length)},"program-date-time":function(){this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject},targetduration:function(){if(!isFinite(e.duration)||e.duration<0)return void this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration});this.manifest.targetDuration=e.duration},totalduration:function(){if(!isFinite(e.duration)||e.duration<0)return void this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration});this.manifest.totalDuration=e.duration},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data}})[e.tagType]||l).call(i)},uri:function(){s.uri=e.uri,n.push(s),!this.manifest.targetDuration||"duration"in s||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),d&&(s.key=d),s.timeline=h,u&&(s.map=u),s={}},comment:function(){}})[e.type].call(i)}),e}return s(t,e),u(t,[{key:"push",value:function(e){this.lineStream.push(e)}},{key:"end",value:function(){this.lineStream.push("\n")}}]),t}(l["default"]);i["default"]=m},{}],35:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=function(){function e(){n(this,e),this.listeners={}}return r(e,[{key:"on",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"off",value:function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1}},{key:"trigger",value:function(e){var t=this.listeners[e],i=void 0,n=void 0,r=void 0;if(t)if(2===arguments.length)for(n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(r=Array.prototype.slice.call(arguments,1),n=t.length,i=0;i<n;++i)t[i].apply(this,r)}},{key:"dispose",value:function(){this.listeners={}}},{key:"pipe",value:function(e){this.on("data",function(t){e.push(t)})}}]),e}();i["default"]=a},{}],36:[function(e,t,i){"use strict";var n,r=e(60);n=function(){var e=new Uint8Array,t=0;n.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.parseId3TagSize=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},this.parseAdtsSize=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},this.push=function(i){var n,r,a,s,o=0,u=0;for(e.length?(s=e.length,e=new Uint8Array(i.byteLength+s),e.set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(!0&e[u]&&240==(240&e[u+1])){if(e.length-u<7)break;if((o=this.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else u++;else{if(e.length-u<10)break;if((o=this.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array}},n.prototype=new r,t.exports=n},{}],37:[function(e,t,i){"use strict";var n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},a=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},s=function(e,t,i){return unescape(a(e,t,i))},o=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},u=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},d=function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},l=function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return n[(60&e[t+2])>>>2];t++}return null},f=function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=r(e.subarray(10,14)));do{if((i=r(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var a=0;a<n.byteLength;a++)if(0===n[a]){var o=s(n,0,a);if("com.apple.streaming.transportStreamTimestamp"===o){var u=n.subarray(a+1),d=(1&u[3])<<30|u[4]<<22|u[5]<<14|u[6]<<6|u[7]>>>2;return d*=4,d+=3&u[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null};t.exports={parseId3TagSize:o,parseAdtsSize:u,parseType:d,parseSampleRate:l,parseAacTimestamp:f}},{}],38:[function(e,t,i){"use strict";var n,r=e(60),a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];n=function(){var e;n.prototype.init.call(this),this.push=function(t){var i,n,r,s,o,u,d=0,l=0;if("audio"===t.type)for(e?(s=e,e=new Uint8Array(s.byteLength+t.data.byteLength),e.set(s),e.set(t.data,s.byteLength)):e=t.data;d+5<e.length;)if(255===e[d]&&240==(246&e[d+1])){if(n=2*(1&~e[d+1]),i=(3&e[d+3])<<11|e[d+4]<<3|(224&e[d+5])>>5,o=1024*(1+(3&e[d+6])),u=9e4*o/a[(60&e[d+2])>>>2],r=d+i,e.byteLength<r)return;if(this.trigger("data",{pts:t.pts+l*u,dts:t.dts+l*u,sampleCount:o,audioobjecttype:1+(e[d+2]>>>6&3),channelcount:(1&e[d+2])<<2|(192&e[d+3])>>>6,samplerate:a[(60&e[d+2])>>>2],samplingfrequencyindex:(60&e[d+2])>>>2,samplesize:16,data:e.subarray(d+7+n,r)}),e.byteLength===r)return void(e=undefined);l++,e=e.subarray(r)}else d++},this.flush=function(){this.trigger("done")}},n.prototype=new r,t.exports=n},{}],39:[function(e,t,i){"use strict";var n,r,a,s=e(60),o=e(59);r=function(){var e,t,i=0;r.prototype.init.call(this),this.push=function(n){var r;for(t?(r=new Uint8Array(t.byteLength+n.data.byteLength),r.set(t),r.set(n.data,t.byteLength),t=r):t=n.data;i<t.byteLength-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<t.byteLength;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<t.length);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")}},r.prototype=new s,a={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},n=function(){var e,t,i,s,u,d,l,f=new r;n.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,s=e.dts,f.push(e))},f.on("data",function(n){var r={trackId:t,pts:i,dts:s,data:n};switch(31&n[0]){case 5:r.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:r.nalUnitType="sei_rbsp",r.escapedRBSP=u(n.subarray(1));break;case 7:r.nalUnitType="seq_parameter_set_rbsp",r.escapedRBSP=u(n.subarray(1)),r.config=d(r.escapedRBSP);break;case 8:r.nalUnitType="pic_parameter_set_rbsp";break;case 9:r.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",r)}),f.on("done",function(){e.trigger("done")}),this.flush=function(){f.flush()},l=function(e,t){var i,n,r=8,a=8;for(i=0;i<e;i++)0!==a&&(n=t.readExpGolomb(),a=(r+n+256)%256),r=0===a?r:a},u=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},d=function(e){var t,i,n,r,s,u,d,f,c,h,p,m,g,y=0,_=0,v=0,b=0,T=1;if(t=new o(e),i=t.readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),a[i]&&(s=t.readUnsignedExpGolomb(),3===s&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(p=3!==s?8:12,g=0;g<p;g++)t.readBoolean()&&(g<6?l(16,t):l(64,t));if(t.skipUnsignedExpGolomb(),0===(u=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===u)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),d=t.readUnsignedExpGolomb(),g=0;g<d;g++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),f=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),h=t.readBits(1),0===h&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(y=t.readUnsignedExpGolomb(),_=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),b=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}m&&(T=m[0]/m[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(f+1)-2*y-2*_)*T),height:(2-h)*(c+1)*16-2*v-2*b}}},n.prototype=new s,t.exports={H264Stream:n,NalByteStream:r}},{}],40:[function(e,t,i){var n=[33,16,5,32,164,27],r=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],a=function(e){for(var t=[];e--;)t.push(0);return t},s={96e3:[n,[227,64],a(154),[56]],88200:[n,[231],a(170),[56]],64e3:[n,[248,192],a(240),[56]],48e3:[n,[255,192],a(268),[55,148,128],a(54),[112]],44100:[n,[255,192],a(268),[55,163,128],a(84),[112]],32e3:[n,[255,192],a(268),[55,234],a(226),[112]],24e3:[n,[255,192],a(268),[55,255,128],a(268),[111,112],a(126),[224]],16e3:[n,[255,192],a(268),[55,255,128],a(268),[111,255],a(269),[223,108],a(195),[1,192]],12e3:[r,a(268),[3,127,248],a(268),[6,255,240],a(268),[13,255,224],a(268),[27,253,128],a(259),[56]],11025:[r,a(268),[3,127,248],a(268),[6,255,240],a(268),[13,255,224],a(268),[27,255,192],a(268),[55,175,128],a(108),[112]],8e3:[r,a(268),[3,121,16],a(47),[7]]};t.exports=function(e){return Object.keys(e).reduce(function(t,i){return t[i]=new Uint8Array(e[i].reduce(function(e,t){return e.concat(t)},[])),t},{})}(s)},{}],41:[function(e,t,i){"use strict";var n=e(60),r=function(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,r.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):("video"===e.track.type&&(this.videoTrack=e.track,this.videoTags=e.tags,this.pendingTracks++),void("audio"===e.track.type&&(this.audioTrack=e.track,this.audioTags=e.tags,this.pendingTracks++)))}};r.prototype=new n,r.prototype.flush=function(e){var t,i,n,r,a={tags:{},captions:[],metadata:[]};if(this.pendingTracks<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(0===this.pendingTracks&&++this.processedTracks<this.numberOfTracks)return}if(this.processedTracks+=this.pendingTracks,this.pendingTracks=0,!(this.processedTracks<this.numberOfTracks)){for(this.videoTrack?r=this.videoTrack.timelineStartInfo.pts:this.audioTrack&&(r=this.audioTrack.timelineStartInfo.pts),a.tags.videoTags=this.videoTags,a.tags.audioTags=this.audioTags,n=0;n<this.pendingCaptions.length;n++)i=this.pendingCaptions[n],i.startTime=i.startPts-r,i.startTime/=9e4,i.endTime=i.endPts-r,i.endTime/=9e4,a.captions.push(i);for(n=0;n<this.pendingMetadata.length;n++)t=this.pendingMetadata[n],t.cueTime=t.pts-r,t.cueTime/=9e4,a.metadata.push(t);a.metadata.dispatchType=this.metadataStream.dispatchType,this.videoTrack=null,this.audioTrack=null,this.videoTags=[],this.audioTags=[],this.pendingCaptions.length=0,this.pendingMetadata.length=0,this.pendingTracks=0,this.processedTracks=0,this.trigger("data",a),this.trigger("done")}},t.exports=r},{}],42:[function(e,t,i){"use strict";var n=e(43),r=function(e,t,i){var r,a,s,o=new Uint8Array(9),u=new DataView(o.buffer);return e=e||0,t=t===undefined||t,i=i===undefined||i,u.setUint8(0,70),u.setUint8(1,76),u.setUint8(2,86),u.setUint8(3,1),u.setUint8(4,(t?4:0)|(i?1:0)),u.setUint32(5,o.byteLength),e<=0?(a=new Uint8Array(o.byteLength+4),a.set(o),a.set([0,0,0,0],o.byteLength),a):(r=new n(n.METADATA_TAG),r.pts=r.dts=0,r.writeMetaDataDouble("duration",e),s=r.finalize().length,a=new Uint8Array(o.byteLength+s),a.set(o),a.set(u.byteLength,s),a)};t.exports=r},{}],43:[function(e,t,i){"use strict";var n;n=function(e,t){var i,r=0,a=16384,s=function(e,t){var i,n=e.position+t;n<e.bytes.byteLength||(i=new Uint8Array(2*n),i.set(e.bytes.subarray(0,e.position),0),e.bytes=i,e.view=new DataView(e.bytes.buffer))},o=n.widthBytes||new Uint8Array("width".length),u=n.heightBytes||new Uint8Array("height".length),d=n.videocodecidBytes||new Uint8Array("videocodecid".length);if(!n.widthBytes){for(i=0;i<"width".length;i++)o[i]="width".charCodeAt(i);for(i=0;i<"height".length;i++)u[i]="height".charCodeAt(i);for(i=0;i<"videocodecid".length;i++)d[i]="videocodecid".charCodeAt(i);n.widthBytes=o,n.heightBytes=u,n.videocodecidBytes=d}switch(this.keyFrame=!1,e){case n.VIDEO_TAG:this.length=16,a*=6;break;case n.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case n.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(a),this.view=new DataView(this.bytes.buffer),this.bytes[0]=e,this.position=this.length,this.keyFrame=t,this.pts=0,this.dts=0,this.writeBytes=function(e,t,i){var n,r=t||0;i=i||e.byteLength,n=r+i,s(this,i),this.bytes.set(e.subarray(r,n),this.position),this.position+=i,this.length=Math.max(this.length,this.position)},this.writeByte=function(e){s(this,1),this.bytes[this.position]=e,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(e){s(this,2),this.view.setUint16(this.position,e),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(e){return this.bytes[this.length-e]},this.nalUnitSize=function(){return 0===r?0:this.length-(r+4)},this.startNalUnit=function(){if(r>0)throw new Error("Attempted to create new NAL wihout closing the old one");r=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(e){var t,i;this.length===r+4?this.length-=4:r>0&&(t=r+4,i=this.length-t,this.position=r,this.view.setUint32(this.position,i),this.position=this.length,e&&e.push(this.bytes.subarray(t,t+i))),r=0},this.writeMetaDataDouble=function(e,t){var i;if(s(this,2+e.length+9),this.view.setUint16(this.position,e.length),this.position+=2,"width"===e)this.bytes.set(o,this.position),this.position+=5;else if("height"===e)this.bytes.set(u,this.position),this.position+=6;else if("videocodecid"===e)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i<e.length;i++)this.bytes[this.position]=e.charCodeAt(i),this.position++;this.position++,this.view.setFloat64(this.position,t),this.position+=8,this.length=Math.max(this.length,this.position),++r},this.writeMetaDataBoolean=function(e,t){var i;for(s(this,2),this.view.setUint16(this.position,e.length),this.position+=2,i=0;i<e.length;i++)s(this,1),this.bytes[this.position]=e.charCodeAt(i),this.position++;s(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,t?1:0),this.position++,this.length=Math.max(this.length,this.position),++r},this.finalize=function(){var e,i;switch(this.bytes[0]){case n.VIDEO_TAG:this.bytes[11]=7|(this.keyFrame||t?16:32),this.bytes[12]=t?0:1,e=this.pts-this.dts,this.bytes[13]=(16711680&e)>>>16,this.bytes[14]=(65280&e)>>>8,this.bytes[15]=(255&e)>>>0;break;case n.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=t?0:1;break;case n.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,r),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,s(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=n.frameTime(this.bytes),this}},n.AUDIO_TAG=8,n.VIDEO_TAG=9,n.METADATA_TAG=18,n.isAudioFrame=function(e){return n.AUDIO_TAG===e[0]},n.isVideoFrame=function(e){return n.VIDEO_TAG===e[0]},n.isMetaData=function(e){return n.METADATA_TAG===e[0]},n.isKeyFrame=function(e){return n.isVideoFrame(e)?23===e[11]:!!n.isAudioFrame(e)||!!n.isMetaData(e)},n.frameTime=function(e){var t=e[4]<<16;return t|=e[5]<<8,t|=e[6]<<0,t|=e[7]<<24},t.exports=n},{}],44:[function(e,t,i){t.exports={tag:e(43),Transmuxer:e(46),getFlvHeader:e(42)}},{}],45:[function(e,t,i){"use strict";var n=function(){var e=this;this.list=[],this.push=function(e){this.list.push({bytes:e.bytes,dts:e.dts,pts:e.pts,keyFrame:e.keyFrame,metaDataTag:e.metaDataTag})},Object.defineProperty(this,"length",{get:function(){return e.list.length}})};t.exports=n},{}],46:[function(e,t,i){"use strict";var n,r,a,s,o,u,d=e(60),l=e(43),f=e(48),c=e(38),h=e(39).H264Stream,p=e(41),m=e(45);s=function(e,t){"number"==typeof t.pts&&(e.timelineStartInfo.pts===undefined?e.timelineStartInfo.pts=t.pts:e.timelineStartInfo.pts=Math.min(e.timelineStartInfo.pts,t.pts)),"number"==typeof t.dts&&(e.timelineStartInfo.dts===undefined?e.timelineStartInfo.dts=t.dts:e.timelineStartInfo.dts=Math.min(e.timelineStartInfo.dts,t.dts))},o=function(e,t){var i=new l(l.METADATA_TAG);return i.dts=t,i.pts=t,i.writeMetaDataDouble("videocodecid",7),i.writeMetaDataDouble("width",e.width),i.writeMetaDataDouble("height",e.height),i},u=function(e,t){var i,n=new l(l.VIDEO_TAG,!0);for(n.dts=t,n.pts=t,n.writeByte(1),n.writeByte(e.profileIdc),n.writeByte(e.profileCompatibility),n.writeByte(e.levelIdc),n.writeByte(255),n.writeByte(225),n.writeShort(e.sps[0].length),n.writeBytes(e.sps[0]),n.writeByte(e.pps.length),i=0;i<e.pps.length;++i)n.writeShort(e.pps[i].length),n.writeBytes(e.pps[i]);return n},a=function(e){var t,i=[];a.prototype.init.call(this),this.push=function(t){s(e,t),e&&e.channelcount===undefined&&(e.audioobjecttype=t.audioobjecttype,e.channelcount=t.channelcount,e.samplerate=t.samplerate,e.samplingfrequencyindex=t.samplingfrequencyindex,e.samplesize=t.samplesize,e.extraData=e.audioobjecttype<<11|e.samplingfrequencyindex<<7|e.channelcount<<3),t.pts=Math.round(t.pts/90),t.dts=Math.round(t.dts/90),i.push(t)},this.flush=function(){var n,r,a,s=new m;if(0===i.length)return void this.trigger("done","AudioSegmentStream");for(a=-Infinity;i.length;)n=i.shift(),(e.extraData!==t||n.pts-a>=1e3)&&(r=new l(l.METADATA_TAG),r.pts=n.pts,r.dts=n.dts,r.writeMetaDataDouble("audiocodecid",10),r.writeMetaDataBoolean("stereo",2===e.channelcount),r.writeMetaDataDouble("audiosamplerate",e.samplerate),r.writeMetaDataDouble("audiosamplesize",16),s.push(r.finalize()),t=e.extraData,r=new l(l.AUDIO_TAG,!0),r.pts=n.pts,r.dts=n.dts,r.view.setUint16(r.position,e.extraData),r.position+=2,r.length=Math.max(r.length,r.position),s.push(r.finalize()),a=n.pts),r=new l(l.AUDIO_TAG),r.pts=n.pts,r.dts=n.dts,r.writeBytes(n.data),s.push(r.finalize());t=null,this.trigger("data",{track:e,tags:s.list}),this.trigger("done","AudioSegmentStream")}},a.prototype=new d,r=function(e){var t,i,n=[];r.prototype.init.call(this),this.finishFrame=function(n,r){if(r){if(t&&e&&e.newMetadata&&(r.keyFrame||0===n.length)){var a=o(t,r.dts).finalize(),s=u(e,r.dts).finalize();a.metaDataTag=s.metaDataTag=!0,n.push(a),n.push(s),e.newMetadata=!1}r.endNalUnit(),n.push(r.finalize()),i=null}},this.push=function(t){s(e,t),t.pts=Math.round(t.pts/90),t.dts=Math.round(t.dts/90),n.push(t)},this.flush=function(){for(var r,a=new m;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length)return void this.trigger("done","VideoSegmentStream");for(;n.length;)r=n.shift(),"seq_parameter_set_rbsp"===r.nalUnitType?(e.newMetadata=!0,t=r.config,e.width=t.width,e.height=t.height,e.sps=[r.data],e.profileIdc=t.profileIdc,e.levelIdc=t.levelIdc,e.profileCompatibility=t.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===r.nalUnitType?(e.newMetadata=!0,e.pps=[r.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===r.nalUnitType?(i&&this.finishFrame(a,i),i=new l(l.VIDEO_TAG),i.pts=r.pts, -i.dts=r.dts):("slice_layer_without_partitioning_rbsp_idr"===r.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(r.data);i&&this.finishFrame(a,i),this.trigger("data",{track:e,tags:a.list}),this.trigger("done","VideoSegmentStream")}},r.prototype=new d,n=function(e){var t,i,s,o,u,d,l,m,g,y,_,v,b=this;n.prototype.init.call(this),e=e||{},this.metadataStream=new f.MetadataStream,e.metadataStream=this.metadataStream,t=new f.TransportPacketStream,i=new f.TransportParseStream,s=new f.ElementaryStream,o=new f.TimestampRolloverStream("video"),u=new f.TimestampRolloverStream("audio"),d=new f.TimestampRolloverStream("timed-metadata"),l=new c,m=new h,v=new p(e),t.pipe(i).pipe(s),s.pipe(o).pipe(m),s.pipe(u).pipe(l),s.pipe(d).pipe(this.metadataStream).pipe(v),_=new f.CaptionStream,m.pipe(_).pipe(v),s.on("data",function(e){var t,i,n;if("metadata"===e.type){for(t=e.tracks.length;t--;)"video"===e.tracks[t].type?i=e.tracks[t]:"audio"===e.tracks[t].type&&(n=e.tracks[t]);i&&!g&&(v.numberOfTracks++,g=new r(i),m.pipe(g).pipe(v)),n&&!y&&(v.numberOfTracks++,y=new a(n),l.pipe(y).pipe(v))}}),this.push=function(e){t.push(e)},this.flush=function(){t.flush()},v.on("data",function(e){b.trigger("data",e)}),v.on("done",function(){b.trigger("done")})},n.prototype=new d,t.exports=n},{}],47:[function(e,t,i){"use strict";var n=e(60),r=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i},a=function(e){return 181!==e.payload[0]?null:49!=(e.payload[1]<<8|e.payload[2])?null:"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])?null:3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},s=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)r=3*i,a={type:3&t[r+2],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},o=function(){o.prototype.init.call(this),this.captionPackets_=[],this.field1_=new f,this.field1_.on("data",this.trigger.bind(this,"data")),this.field1_.on("done",this.trigger.bind(this,"done"))};o.prototype=new n,o.prototype.push=function(e){var t,i;"sei_rbsp"===e.nalUnitType&&(t=r(e.escapedRBSP),4===t.payloadType&&(i=a(t))&&(this.captionPackets_=this.captionPackets_.concat(s(e.pts,i))))},o.prototype.flush=function(){if(!this.captionPackets_.length)return void this.field1_.flush();this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(this.field1_.push,this.field1_),this.captionPackets_.length=0,this.field1_.flush()};var u={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608},d=function(e){return null===e?"":(e=u[e]||e,String.fromCharCode(e))},l=function(){for(var e=[],t=15;t--;)e.push("");return e},f=function(){f.prototype.init.call(this),this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=l(),this.nonDisplayed_=l(),this.lastControlCode_=null,this.push=function(e){if(0===e.type){var t,i,n,r;if((t=32639&e.ccData)===this.lastControlCode_)return void(this.lastControlCode_=null);switch(this.lastControlCode_=4096==(61440&t)?t:null,t){case 0:break;case 5152:this.mode_="popOn";break;case 5167:this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;break;case 5157:this.topRow_=13,this.mode_="rollUp";break;case 5158:this.topRow_=12,this.mode_="rollUp";break;case 5159:this.topRow_=11,this.mode_="rollUp";break;case 5165:this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;break;case 5153:"popOn"===this.mode_?this.nonDisplayed_[14]=this.nonDisplayed_[14].slice(0,-1):this.displayed_[14]=this.displayed_[14].slice(0,-1);break;case 5164:this.flushDisplayed(e.pts),this.displayed_=l();break;case 5166:this.nonDisplayed_=l();break;default:if(n=t>>>8,r=255&t,n>=16&&n<=23&&r>=64&&r<=127&&(16!==n||r<96)&&(n=32,r=null),(17===n||25===n)&&r>=48&&r<=63&&(n=9834,r=""),16==(240&n))return;0===n&&(n=null),0===r&&(r=null),this[this.mode_](e.pts,n,r)}}}};f.prototype=new n,f.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){return e.trim()}).filter(function(e){return e.length}).join("\n");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t})},f.prototype.popOn=function(e,t,i){var n=this.nonDisplayed_[14];n+=d(t),n+=d(i),this.nonDisplayed_[14]=n},f.prototype.rollUp=function(e,t,i){var n=this.displayed_[14];""===n&&(this.flushDisplayed(e),this.startPts_=e),n+=d(t),n+=d(i),this.displayed_[14]=n},f.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.topRow_;e<14;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[14]=""},t.exports={CaptionStream:o,Cea608Stream:f}},{}],48:[function(e,t,i){"use strict";var n,r,a,s=e(60),o=e(47),u=e(51),d=e(52).TimestampRolloverStream,l=e(51);n=function(){var e=new Uint8Array(188),t=0;n.prototype.init.call(this),this.push=function(i){var n,r=0,a=188;for(t?(n=new Uint8Array(i.byteLength+t),n.set(e.subarray(0,t)),n.set(i,t),t=0):n=i;a<n.byteLength;)71!==n[r]||71!==n[a]?(r++,a++):(this.trigger("data",n.subarray(r,a)),r+=188,a+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")}},n.prototype=new s,r=function(){var e,t,i,n;r.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=undefined,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r,a,s;if(1&e[5]){for(n.programMapTable={},i=(15&e[1])<<8|e[2],r=3+i-4,a=(15&e[10])<<8|e[11],s=12+a;s<r;)n.programMapTable[(31&e[s+1])<<8|e[s+2]]=e[s],s+=5+((15&e[s+3])<<8|e[s+4]);for(t.programMapTable=n.programMapTable;n.packetsWaitingForPmt.length;)n.processPes_.apply(n,n.packetsWaitingForPmt.shift())}},this.push=function(t){var i={},n=4;i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid?(i.type="pat",e(t.subarray(n),i),this.trigger("data",i)):i.pid===this.pmtPid?(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i)):this.programMapTable===undefined?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.streamType=this.programMapTable[i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},r.prototype=new s,r.STREAM_TYPES={h264:27,adts:15},a=function(){var e=this,t={data:[],size:0},i={data:[],size:0},n={data:[],size:0},r=function(e,t){var i;t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),i=e[7],192&i&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8])},s=function(t,i,n){var a,s=new Uint8Array(t.size),o={type:i},u=0,d=0,l=!1;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,u=0;u<t.data.length;u++)a=t.data[u],s.set(a.data,d),d+=a.data.byteLength;r(s,o),l="video"===i||o.packetLength===t.size,(n||l)&&(t.size=0,t.data.length=0),l&&e.trigger("data",o)}};a.prototype.init.call(this),this.push=function(r){({pat:function(){},pes:function(){var e,a;switch(r.streamType){case u.H264_STREAM_TYPE:case l.H264_STREAM_TYPE:e=t,a="video";break;case u.ADTS_STREAM_TYPE:e=i,a="audio";break;case u.METADATA_STREAM_TYPE:e=n,a="timed-metadata";break;default:return}r.payloadUnitStartIndicator&&s(e,a,!0),e.data.push(r),e.size+=r.data.byteLength},pmt:function(){var t,i,n={type:"metadata",tracks:[]},a=r.programMapTable;for(t in a)a.hasOwnProperty(t)&&(i={timelineStartInfo:{baseMediaDecodeTime:0}},i.id=+t,a[t]===l.H264_STREAM_TYPE?(i.codec="avc",i.type="video"):a[t]===l.ADTS_STREAM_TYPE&&(i.codec="adts",i.type="audio"),n.tracks.push(i));e.trigger("data",n)}})[r.type]()},this.flush=function(){s(t,"video"),s(i,"audio"),s(n,"timed-metadata"),this.trigger("done")}},a.prototype=new s;var f={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:n,TransportParseStream:r,ElementaryStream:a,TimestampRolloverStream:d,CaptionStream:o.CaptionStream,Cea608Stream:o.Cea608Stream,MetadataStream:e(49)};for(var c in u)u.hasOwnProperty(c)&&(f[c]=u[c]);t.exports=f},{}],49:[function(e,t,i){"use strict";var n,r=e(60),a=e(51),s=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},o=function(e,t,i){return decodeURIComponent(s(e,t,i))},u=function(e,t,i){return unescape(s(e,t,i))},d=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},l={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=o(e.data,1,t),e.value=o(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=o(e.data,1,t),e.url=o(e.data,t+1,e.data.length);break}},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=u(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};n=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},r=0,s=[],o=0;if(n.prototype.init.call(this),this.dispatchType=a.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,n,a,u,f,c;if("timed-metadata"===e.type){if(e.dataAlignmentIndicator&&(o=0,s.length=0),0===s.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))return void(i.debug&&console.log("Skipping unrecognized metadata packet"));if(s.push(e),o+=e.data.byteLength,1===s.length&&(r=d(e.data.subarray(6,10)),r+=10),!(o<r)){for(t={data:new Uint8Array(r),frames:[],pts:s[0].pts,dts:s[0].dts},f=0;f<r;)t.data.set(s[0].data.subarray(0,r-f),f),f+=s[0].data.byteLength,o-=s[0].data.byteLength,s.shift();n=10,64&t.data[5]&&(n+=4,n+=d(t.data.subarray(10,14)),r-=d(t.data.subarray(16,20)));do{if((a=d(t.data.subarray(n+4,n+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if(c=String.fromCharCode(t.data[n],t.data[n+1],t.data[n+2],t.data[n+3]),u={id:c,data:t.data.subarray(n+10,n+a+10)},u.key=u.id,l[u.id]&&(l[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var h=u.data,p=(1&h[3])<<30|h[4]<<22|h[5]<<14|h[6]<<6|h[7]>>>2;p*=4,p+=3&h[7],u.timeStamp=p,t.pts===undefined&&t.dts===undefined&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),n+=10,n+=a}while(n<r);this.trigger("data",t)}}}},n.prototype=new r,t.exports=n},{}],50:[function(e,t,i){"use strict";var n=e(51),r=function(e){var t=31&e[1];return t<<=8,t|=e[2]},a=function(e){return!!(64&e[1])},s=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},o=function(e,t){var i=r(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},u=function(e){var t=a(e),i=4+s(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},d=function(e){var t={},i=a(e),n=4+s(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r,o,u;r=(15&e[n+1])<<8|e[n+2],o=3+r-4,u=(15&e[n+10])<<8|e[n+11];for(var d=12+u;d<o;){var l=n+d;t[(31&e[l+1])<<8|e[l+2]]=e[l],d+=5+((15&e[l+3])<<8|e[l+4])}return t}},l=function(e,t){switch(t[r(e)]){case n.H264_STREAM_TYPE:return"video";case n.ADTS_STREAM_TYPE:return"audio";case n.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},f=function(e){if(!a(e))return null;var t=4+s(e);if(t>=e.byteLength)return null;var i,n=null;return i=e[t+7],192&i&&(n={},n.pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},c=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},h=function(e){for(var t,i=4+s(e),n=e.subarray(i),r=0,a=0,o=!1;a<n.byteLength-3;a++)if(1===n[a+2]){r=a+5;break}for(;r<n.byteLength;)switch(n[r]){case 0:if(0!==n[r-1]){r+=2;break}if(0!==n[r-2]){r++;break}a+3!==r-2&&"slice_layer_without_partitioning_rbsp_idr"===(t=c(31&n[a+3]))&&(o=!0);do{r++}while(1!==n[r]&&r<n.length);a=r-2,r+=3;break;case 1:if(0!==n[r-1]||0!==n[r-2]){r+=3;break}t=c(31&n[a+3]),"slice_layer_without_partitioning_rbsp_idr"===t&&(o=!0),a=r-2,r+=3;break;default:r+=3}return n=n.subarray(a),r-=a,a=0,n&&n.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===(t=c(31&n[a+3]))&&(o=!0),o};t.exports={parseType:o,parsePat:u,parsePmt:d,parsePayloadUnitStartIndicator:a,parsePesType:l,parsePesTime:f,videoPacketContainsKeyFrame:h}},{}],51:[function(e,t,i){"use strict";t.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},{}],52:[function(e,t,i){"use strict";var n=e(60),r=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},a=function(e){var t,i;a.prototype.init.call(this),this.type_=e,this.push=function(e){e.type===this.type_&&(i===undefined&&(i=e.dts),e.dts=r(e.dts,i),e.pts=r(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.discontinuity=function(){i=void 0,t=void 0}};a.prototype=new n,t.exports={TimestampRolloverStream:a,handleRollover:r}},{}],53:[function(e,t,i){t.exports={generator:e(54),Transmuxer:e(56).Transmuxer,AudioSegmentStream:e(56).AudioSegmentStream,VideoSegmentStream:e(56).VideoSegmentStream}},{}],54:[function(e,t,i){"use strict";var n,r,a,s,o,u,d,l,f,c,h,p,m,g,y,_,v,b,T,S,w,k,O,E,A,L,P,I,C,U,x,M,D,R,B,j,N=Math.pow(2,32)-1;!function(){var e;if(O={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in O)O.hasOwnProperty(e)&&(O[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);E=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),L=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),A=new Uint8Array([0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),I=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),C={video:P,audio:I},M=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]),D=new Uint8Array([0,0,0,0,0,0,0,0]),R=D,B=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),j=D,U=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),n=function(e){var t,i,n,r=[],a=0;for(t=1;t<arguments.length;t++)r.push(arguments[t]);for(t=r.length;t--;)a+=r[t].byteLength;for(i=new Uint8Array(a+8),n=new DataView(i.buffer,i.byteOffset,i.byteLength),n.setUint32(0,i.byteLength),i.set(e,4),t=0,a=8;t<r.length;t++)i.set(r[t],a),a+=r[t].byteLength;return i},r=function(){return n(O.dinf,n(O.dref,M))},a=function(e){return n(O.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},s=function(){return n(O.ftyp,E,A,E,L)},_=function(e){return n(O.hdlr,C[e])},o=function(e){return n(O.mdat,e)},y=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),n(O.mdhd,t)},g=function(e){return n(O.mdia,y(e),_(e.type),d(e))},u=function(e){return n(O.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},d=function(e){return n(O.minf,"video"===e.type?n(O.vmhd,U):n(O.smhd,x),r(),b(e))},l=function(e,t){for(var i=[],r=t.length;r--;)i[r]=S(t[r]);return n.apply(null,[O.moof,u(e)].concat(i))},f=function(e){for(var t=e.length,i=[];t--;)i[t]=p(e[t]);return n.apply(null,[O.moov,h(4294967295)].concat(i).concat(c(e)))},c=function(e){for(var t=e.length,i=[];t--;)i[t]=w(e[t]);return n.apply(null,[O.mvex].concat(i))},h=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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 n(O.mvhd,t)},v=function(e){var t,i,r=e.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)t=r[i].flags,a[i+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return n(O.sdtp,a)},b=function(e){return n(O.stbl,T(e),n(O.stts,j),n(O.stsc,R),n(O.stsz,B),n(O.stco,D))},function(){var e,t;T=function(i){return n(O.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===i.type?e(i):t(i))},e=function(e){var t,i=e.sps||[],r=e.pps||[],a=[],s=[];for(t=0;t<i.length;t++)a.push((65280&i[t].byteLength)>>>8),a.push(255&i[t].byteLength),a=a.concat(Array.prototype.slice.call(i[t]));for(t=0;t<r.length;t++)s.push((65280&r[t].byteLength)>>>8),s.push(255&r[t].byteLength),s=s.concat(Array.prototype.slice.call(r[t]));return n(O.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n(O.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([i.length]).concat(a).concat([r.length]).concat(s))),n(O.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},t=function(e){return n(O.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),a(e))}}(),m=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return n(O.tkhd,t)},S=function(e){var t,i,r,a,s,o,u;return t=n(O.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),o=Math.floor(e.baseMediaDecodeTime/(N+1)),u=Math.floor(e.baseMediaDecodeTime%(N+1)),i=n(O.tfdt,new Uint8Array([1,0,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,u>>>24&255,u>>>16&255,u>>>8&255,255&u])),s=92,"audio"===e.type?(r=k(e,s),n(O.traf,t,i,r)):(a=v(e),r=k(e,a.length+s),n(O.traf,t,i,r,a))},p=function(e){return e.duration=e.duration||4294967295,n(O.trak,m(e),g(e))},w=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),n(O.trex,t)},function(){var e,t,i;i=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(e[0].duration!==undefined&&(i=1),e[0].size!==undefined&&(n=2),e[0].flags!==undefined&&(r=4),e[0].compositionTimeOffset!==undefined&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},t=function(e,t){var r,a,s,o;for(a=e.samples||[],t+=20+16*a.length,r=i(a,t),o=0;o<a.length;o++)s=a[o],r=r.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,61440&s.flags.degradationPriority,15&s.flags.degradationPriority,(4278190080&s.compositionTimeOffset)>>>24,(16711680&s.compositionTimeOffset)>>>16,(65280&s.compositionTimeOffset)>>>8,255&s.compositionTimeOffset]);return n(O.trun,new Uint8Array(r))},e=function(e,t){var r,a,s,o;for(a=e.samples||[],t+=20+8*a.length,r=i(a,t),o=0;o<a.length;o++)s=a[o],r=r.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size]);return n(O.trun,new Uint8Array(r))},k=function(i,n){return"audio"===i.type?e(i,n):t(i,n)}}(),t.exports={ftyp:s,mdat:o,moof:l,moov:f,initSegment:function(e){var t,i=s(),n=f(e);return t=new Uint8Array(i.byteLength+n.byteLength),t.set(i),t.set(n,i.byteLength),t}}},{}],55:[function(e,t,i){"use strict";var n,r,a,s;n=function(e,t){var i,a,s,o,u,d=[];if(!t.length)return null;for(i=0;i<e.byteLength;)a=e[i]<<24,a|=e[i+1]<<16,a|=e[i+2]<<8,a|=e[i+3],s=r(e.subarray(i+4,i+8)),o=a>1?i+a:e.byteLength,s===t[0]&&(1===t.length?d.push(e.subarray(i+8,o)):(u=n(e.subarray(i+8,o),t.slice(1)),u.length&&(d=d.concat(u)))),i=o;return d},r=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},a=function(e){var t={};return n(e,["moov","trak"]).reduce(function(e,t){var i,r,a,s,o;return(i=n(t,["tkhd"])[0])?(r=i[0],a=0===r?12:20,s=i[a]<<24|i[a+1]<<16|i[a+2]<<8|i[a+3],(o=n(t,["mdia","mdhd"])[0])?(r=o[0],a=0===r?12:20,e[s]=o[a]<<24|o[a+1]<<16|o[a+2]<<8|o[a+3],e):null):null},t)},s=function(e,t){var i,r,a;return i=n(t,["moof","traf"]),r=[].concat.apply([],i.map(function(t){return n(t,["tfhd"]).map(function(i){var r,a,s;return r=i[4]<<24|i[5]<<16|i[6]<<8|i[7],a=e[r]||9e4,s=n(t,["tfdt"]).map(function(e){var t,i;return t=e[0],i=e[4]<<24|e[5]<<16|e[6]<<8|e[7],1===t&&(i*=Math.pow(2,32),i+=e[8]<<24|e[9]<<16|e[10]<<8|e[11]),i})[0],(s=s||Infinity)/a})})),a=Math.min.apply(null,r),isFinite(a)?a:0},t.exports={parseType:r,timescale:a,startTime:s}},{}],56:[function(e,t,i){"use strict";var n,r,a,s,o,u,d,l,f,c,h,p=e(60),m=e(54),g=e(48),y=e(38),_=e(39).H264Stream,v=e(36),b=e(40),T=e(58),S=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],w=["width","height","profileIdc","levelIdc","profileCompatibility"];o=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0}}},u=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},c=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},h=function(e){var t,i,n=0;for(t=0;t<e.length;t++)i=e[t],n+=i.data.byteLength;return n},r=function(e){var t=[],i=0,n=0,a=0,s=Infinity;r.prototype.init.call(this),this.push=function(i){d(e,i),e&&S.forEach(function(t){e[t]=i[t]}),t.push(i)},this.setEarliestDts=function(t){n=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var n,r,a,s;if(0===t.length)return void this.trigger("done","AudioSegmentStream");n=this.trimAdtsFramesByEarliestDts_(t),e.baseMediaDecodeTime=f(e),this.prefixWithSilence_(e,n),e.samples=this.generateSampleTable_(n),a=m.mdat(this.concatenateFrameData_(n)),t=[],r=m.moof(i,[e]),s=new Uint8Array(r.byteLength+a.byteLength),i++,s.set(r),s.set(a,r.byteLength),l(e),this.trigger("data",{track:e,boxes:s}),this.trigger("done","AudioSegmentStream")},this.prefixWithSilence_=function(e,t){var i,n,r,o=0,u=0,d=0,l=0;if(t.length&&(i=T.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o=Math.ceil(9e4/(e.samplerate/1024)),a&&s&&(u=i-Math.max(a,s),d=Math.floor(u/o),l=d*o),!(d<1||l>45e3))){for(n=b[e.samplerate],n||(n=t[0].data),r=0;r<d;r++)t.splice(r,0,{data:n});e.baseMediaDecodeTime-=Math.floor(T.videoTsToAudioTs(l,e.samplerate))}},this.trimAdtsFramesByEarliestDts_=function(t){return e.minSegmentDts>=n?t:(e.minSegmentDts=Infinity,t.filter(function(t){return t.dts>=n&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)}))},this.generateSampleTable_=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},this.concatenateFrameData_=function(e){var t,i,n=0,r=new Uint8Array(h(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r}},r.prototype=new p,n=function(e){var t,i,r=0,a=[];n.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(n){d(e,n),"seq_parameter_set_rbsp"!==n.nalUnitType||t||(t=n.config,e.sps=[n.data],w.forEach(function(i){e[i]=t[i]},this)),"pic_parameter_set_rbsp"!==n.nalUnitType||i||(i=n.data,e.pps=[n.data]),a.push(n)},this.flush=function(){for(var t,i,n,s,o,u;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");t=this.groupNalsIntoFrames_(a),n=this.groupFramesIntoGops_(t),n[0][0].keyFrame||(i=this.getGopForFusion_(a[0],e),i?(n.unshift(i),n.byteLength+=i.byteLength,n.nalCount+=i.nalCount,n.pts=i.pts,n.dts=i.dts,n.duration+=i.duration):n=this.extendFirstKeyFrame_(n)),d(e,n),e.samples=this.generateSampleTable_(n),o=m.mdat(this.concatenateNalData_(n)),this.gopCache_.unshift({gop:n.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],e.baseMediaDecodeTime=f(e),this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),s=m.moof(r,[e]),u=new Uint8Array(s.byteLength+o.byteLength),r++,u.set(s),u.set(o,s.byteLength),this.trigger("data",{track:e,boxes:u}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){l(e),t=undefined,i=undefined},this.getGopForFusion_=function(t){var i,n,r,a,s,o=Infinity;for(s=0;s<this.gopCache_.length;s++)a=this.gopCache_[s],r=a.gop,e.pps&&c(e.pps[0],a.pps[0])&&e.sps&&c(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.extendFirstKeyFrame_=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},this.groupNalsIntoFrames_=function(e){var t,i,n=[],r=[];for(n.byteLength=0,t=0;t<e.length;t++)i=e[t],"access_unit_delimiter_rbsp"===i.nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.push(n)),n=[i],n.byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.push(n),r},this.groupFramesIntoGops_=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)i=e[t],i.keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),n=[i],n.nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},this.generateSampleTable_=function(e,t){var i,n,r,a,s,u=t||0,d=[];for(i=0;i<e.length;i++)for(a=e[i],n=0;n<a.length;n++)s=a[n],r=o(),r.dataOffset=u,r.compositionTimeOffset=s.pts-s.dts,r.duration=s.duration,r.size=4*s.length,r.size+=s.byteLength,s.keyFrame&&(r.flags.dependsOn=2),u+=r.size,d.push(r);return d},this.concatenateNalData_=function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,d=e.nalCount,l=u+4*d,f=new Uint8Array(l),c=new DataView(f.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],c.setUint32(o,s.data.byteLength),o+=4,f.set(s.data,o),o+=s.data.byteLength;return f}},n.prototype=new p,d=function(e,t){"number"==typeof t.pts&&(e.timelineStartInfo.pts===undefined&&(e.timelineStartInfo.pts=t.pts),e.minSegmentPts===undefined?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),e.maxSegmentPts===undefined?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(e.timelineStartInfo.dts===undefined&&(e.timelineStartInfo.dts=t.dts),e.minSegmentDts===undefined?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.maxSegmentDts===undefined?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},l=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},f=function(e){var t,i,n=e.minSegmentDts-e.timelineStartInfo.dts;return t=e.timelineStartInfo.baseMediaDecodeTime,t+=n,t=Math.max(0,t),"audio"===e.type&&(i=e.samplerate/9e4,t*=i,t=Math.floor(t)),t},s=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof e.remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,s.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBoxes.push(e.boxes),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track),void("audio"===e.track.type&&(this.audioTrack=e.track)))}},s.prototype=new p,s.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return void(++this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,w.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,S.forEach(function(e){s.info[e]=this.audioTrack[e]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=m.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)t=this.pendingCaptions[r],t.startTime=t.startPts-o,t.startTime/=9e4,t.endTime=t.endPts-o,t.endTime/=9e4,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)i=this.pendingMetadata[r],i.cueTime=i.pts-o,i.cueTime/=9e4,s.metadata.push(i);s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},a=function(e){var t,i,o=this,d=!0;a.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={} -;this.transmuxPipeline_=t,t.type="aac",t.metadataStream=new g.MetadataStream,t.aacStream=new v,t.audioTimestampRolloverStream=new g.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new g.TimestampRolloverStream("timed-metadata"),t.adtsStream=new y,t.coalesceStream=new s(e,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type||t.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:o.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new r(i),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new g.MetadataStream,a.packetStream=new g.TransportPacketStream,a.parseStream=new g.TransportParseStream,a.elementaryStream=new g.ElementaryStream,a.videoTimestampRolloverStream=new g.TimestampRolloverStream("video"),a.audioTimestampRolloverStream=new g.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new g.TimestampRolloverStream("timed-metadata"),a.adtsStream=new y,a.h264Stream=new _,a.captionStream=new g.CaptionStream,a.coalesceStream=new s(e,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream),a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a.h264Stream),a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",function(e){var s;if("metadata"===e.type){for(s=e.tracks.length;s--;)t||"video"!==e.tracks[s].type?i||"audio"!==e.tracks[s].type||(i=e.tracks[s],i.timelineStartInfo.baseMediaDecodeTime=o.baseMediaDecodeTime):(t=e.tracks[s],t.timelineStartInfo.baseMediaDecodeTime=o.baseMediaDecodeTime);t&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new n(t),a.videoSegmentStream.on("timelineStartInfo",function(e){i&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts))}),a.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new r(i),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream))}}),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(e){var n=this.transmuxPipeline_;this.baseMediaDecodeTime=e,i&&(i.timelineStartInfo.dts=undefined,i.timelineStartInfo.pts=undefined,l(i),i.timelineStartInfo.baseMediaDecodeTime=e,n.audioTimestampRolloverStream&&n.audioTimestampRolloverStream.discontinuity()),t&&(n.videoSegmentStream&&(n.videoSegmentStream.gopCache_=[],n.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=undefined,t.timelineStartInfo.pts=undefined,l(t),t.timelineStartInfo.baseMediaDecodeTime=e),n.timedMetadataTimestampRolloverStream&&n.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.push=function(e){if(d){var t=u(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){d=!0,this.transmuxPipeline_.headOfPipeline.flush()}},a.prototype=new p,t.exports={Transmuxer:a,VideoSegmentStream:n,AudioSegmentStream:r,AUDIO_PROPERTIES:S,VIDEO_PROPERTIES:w}},{}],57:[function(e,t,i){"use strict";var n=e(51),r=e(52).handleRollover,a={};a.ts=e(50),a.aac=e(37);var s=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},o=function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),a.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=a.ts.parsePat(i));break;case"pmt":t.table||(t.table=a.ts.parsePmt(i))}if(t.pid&&t.table)return;n+=188,r+=188}},u=function(e,t,i){for(var n,r,s,o,u=0,d=188,l=!1;d<e.byteLength;)if(71!==e[u]||71!==e[d])u++,d++;else{switch(n=e.subarray(u,d),a.ts.parseType(n,t.pid)){case"pes":r=a.ts.parsePesType(n,t.table),s=a.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(o=a.ts.parsePesTime(n))&&(o.type="audio",i.audio.push(o),l=!0)}if(l)break;u+=188,d+=188}for(d=e.byteLength,u=d-188,l=!1;u>=0;)if(71!==e[u]||71!==e[d])u--,d--;else{switch(n=e.subarray(u,d),a.ts.parseType(n,t.pid)){case"pes":r=a.ts.parsePesType(n,t.table),s=a.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(o=a.ts.parsePesTime(n))&&(o.type="audio",i.audio.push(o),l=!0)}if(l)break;u-=188,d-=188}},d=function(e,t,i){for(var n,r,s,o,u,d,l,f=0,c=188,h=!1,p={data:[],size:0};c<e.byteLength;)if(71!==e[f]||71!==e[c])f++,c++;else{switch(n=e.subarray(f,c),a.ts.parseType(n,t.pid)){case"pes":if(r=a.ts.parsePesType(n,t.table),s=a.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(s&&!h&&(o=a.ts.parsePesTime(n))&&(o.type="video",i.video.push(o),h=!0),!i.firstKeyFrame)){if(s&&0!==p.size){for(u=new Uint8Array(p.size),d=0;p.data.length;)l=p.data.shift(),u.set(l,d),d+=l.byteLength;a.ts.videoPacketContainsKeyFrame(u)&&(i.firstKeyFrame=a.ts.parsePesTime(u),i.firstKeyFrame.type="video"),p.size=0}p.data.push(n),p.size+=n.byteLength}}if(h&&i.firstKeyFrame)break;f+=188,c+=188}for(c=e.byteLength,f=c-188,h=!1;f>=0;)if(71!==e[f]||71!==e[c])f--,c--;else{switch(n=e.subarray(f,c),a.ts.parseType(n,t.pid)){case"pes":r=a.ts.parsePesType(n,t.table),s=a.ts.parsePayloadUnitStartIndicator(n),"video"===r&&s&&(o=a.ts.parsePesTime(n))&&(o.type="video",i.video.push(o),h=!0)}if(h)break;f-=188,c-=188}},l=function(e,t){if(e.audio&&e.audio.length){var i=t;void 0===i&&(i=e.audio[0].dts),e.audio.forEach(function(e){e.dts=r(e.dts,i),e.pts=r(e.pts,i),e.dtsTime=e.dts/9e4,e.ptsTime=e.pts/9e4})}if(e.video&&e.video.length){var n=t;if(void 0===n&&(n=e.video[0].dts),e.video.forEach(function(e){e.dts=r(e.dts,n),e.pts=r(e.pts,n),e.dtsTime=e.dts/9e4,e.ptsTime=e.pts/9e4}),e.firstKeyFrame){var a=e.firstKeyFrame;a.dts=r(a.dts,n),a.pts=r(a.pts,n),a.dtsTime=a.dts/9e4,a.ptsTime=a.dts/9e4}}},f=function(e){for(var t,i=!1,n=0,r=null,s=null,o=0,u=0;e.length-u>=3;){switch(a.aac.parseType(e,u)){case"timed-metadata":if(e.length-u<10){i=!0;break}if((o=a.aac.parseId3TagSize(e,u))>e.length){i=!0;break}null===s&&(t=e.subarray(u,u+o),s=a.aac.parseAacTimestamp(t)),u+=o;break;case"audio":if(e.length-u<7){i=!0;break}if((o=a.aac.parseAdtsSize(e,u))>e.length){i=!0;break}null===r&&(t=e.subarray(u,u+o),r=a.aac.parseSampleRate(t)),n++,u+=o;break;default:u++}if(i)return null}if(null===r||null===s)return null;var d=9e4/r;return{audio:[{type:"audio",dts:s,pts:s},{type:"audio",dts:s+1024*n*d,pts:s+1024*n*d}]}},c=function(e){var t={pid:null,table:null},i={};o(e,t);for(var r in t.table)if(t.table.hasOwnProperty(r)){var a=t.table[r];switch(a){case n.H264_STREAM_TYPE:i.video=[],d(e,t,i),0===i.video.length&&delete i.video;break;case n.ADTS_STREAM_TYPE:i.audio=[],u(e,t,i),0===i.audio.length&&delete i.audio}}return i},h=function(e,t){var i,n=s(e);return(i=n?f(e):c(e))&&(i.audio||i.video)?(l(i,t),i):null};t.exports={inspect:h}},{}],58:[function(e,t,i){var n,r,a,s,o,u;n=function(e){return 9e4*e},r=function(e,t){return e*t},a=function(e){return e/9e4},s=function(e,t){return e/t},o=function(e,t){return n(s(e,t))},u=function(e,t){return r(a(e),t)},t.exports={secondsToVideoTs:n,secondsToAudioTs:r,videoTsToSeconds:a,audioTsToSeconds:s,audioTsToVideoTs:o,videoTsToAudioTs:u}},{}],59:[function(e,t,i){"use strict";var n;n=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,r=Math.floor(e/8),e-=8*r,t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return n-=r,n>0?i<<=r:t>0&&this.loadWord(),r=e-r,r>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},t.exports=n},{}],60:[function(e,t,i){"use strict";var n=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}};n.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},n.prototype.push=function(e){this.trigger("data",e)},n.prototype.flush=function(e){this.trigger("done",e)},t.exports=n},{}],61:[function(e,t,i){!function(e){var n={buildAbsoluteURL:function(e,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var i=null,r=null,a=/^([^#]*)(.*)$/.exec(t);a&&(r=a[2],t=a[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(i=s[2],t=s[1]);var o=/^([^#]*)(.*)$/.exec(e);o&&(e=o[1]);var u=/^([^\?]*)(.*)$/.exec(e);u&&(e=u[1]);var d=/^(([a-z]+:)?\/\/[^:\/]+(:[0-9]+)?)?(\/?.*)$/i.exec(e);if(!d)throw new Error("Error trying to parse base URL.");var l=d[2]||"",f=d[1]||"",c=d[4];0!==c.indexOf("/")&&""!==f&&(c="/"+c);var h=null;return h=/^\/\//.test(t)?l+"//"+n.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?f+"/"+n.buildAbsolutePath("",t.substring(1)):n.buildAbsolutePath(f+c,t),i&&(h+=i),r&&(h+=r),h},buildAbsolutePath:function(e,t){for(var i,n,r=t,a="",s=e.replace(/[^\/]*$/,r.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),o=0;(n=s.indexOf("/../",o))>-1;o=n+i)i=/^\/(?:\.\.\/)*/.exec(s.slice(n))[0].length,a=(a+s.substring(o,n)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return a+s.substr(o)}};"object"==typeof i&&"object"==typeof t?t.exports=n:"function"==typeof define&&define.amd?define([],function(){return n}):"object"==typeof i?i.URLToolkit=n:e.URLToolkit=n}(this)},{}],62:[function(e,t,i){(function(n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(i,"__esModule",{value:!0});var a=e(30),s=r(a),o="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,u=r(o),d=function(e){Object.defineProperties(e.frame,{id:{get:function(){return u["default"].log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return u["default"].log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return u["default"].log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})},l=function(e){undefined;return isNaN(e)||Math.abs(e)===Infinity?Number.MAX_VALUE:e},f=function(e,t,i){var n=s["default"].WebKitDataCue||s["default"].VTTCue;t&&t.forEach(function(e){this.inbandTextTrack_.addCue(new n(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},e),i&&function(){var t=l(e.mediaSource_.duration);i.forEach(function(e){var t=e.cueTime+this.timestampOffset;e.frames.forEach(function(e){var i=new n(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,d(i),this.metadataTrack_.addCue(i)},this)},e),e.metadataTrack_&&e.metadataTrack_.cues&&e.metadataTrack_.cues.length&&function(){for(var i=e.metadataTrack_.cues,n=[],r=0;r<i.length;r++)i[r]&&n.push(i[r]);var a=n.reduce(function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),s=Object.keys(a).sort(function(e,t){return Number(e)-Number(t)});s.forEach(function(e,i){var n=a[e],r=Number(s[i+1])||t;n.forEach(function(e){e.endTime=r})})}()}()};i["default"]={addTextTrackData:f,durationOfVideo:l},t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(e,t,i){for(var n=e.remoteTextTracks()||[],r=0;r<n.length;r++){var a=n[r];a.kind===t&&a.label===i&&e.removeRemoteTextTrack(a)}};i.removeExistingTrack=n;var r=function(e){n(e,"captions","cc1"),n(e,"metadata","Timed Metadata")};i.cleanupTextTracks=r},{}],64:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(e){return/mp4a\.\d+.\d+/i.test(e)},r=function(e){return/avc1\.[\da-f]+/i.test(e)},a=function(e){var t={type:"",parameters:{}},i=e.trim().split(";");return t.type=i.shift().trim(),i.forEach(function(e){var i=e.trim().split("=");if(i.length>1){var n=i[0].replace(/"/g,"").trim(),r=i[1].replace(/"/g,"").trim();t.parameters[n]=r}}),t},s=function(e){return e.map(function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})})};i["default"]={isAudioCodec:n,parseContentType:a,isVideoCodec:r,translateLegacyCodecs:s},t.exports=i["default"]},{}],65:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e(63),r=function(e,t,i){var r=t.player_;i.captions&&i.captions.length&&!e.inbandTextTrack_&&((0,n.removeExistingTrack)(r,"captions","cc1"),e.inbandTextTrack_=r.addRemoteTextTrack({kind:"captions",label:"cc1"},!1).track,r.tech_.trigger({type:"usage",name:"hls-608"})),i.metadata&&i.metadata.length&&!e.metadataTrack_&&((0,n.removeExistingTrack)(r,"metadata","Timed Metadata",!0),e.metadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)};i["default"]=r,t.exports=i["default"]},{}],66:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n={TIME_BETWEEN_CHUNKS:1,BYTES_PER_CHUNK:32768};i["default"]=n,t.exports=i["default"]},{}],67:[function(e,t,i){(function(n){"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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},d=e(29),l=r(d),f="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,c=r(f),h=e(68),p=r(h),m=e(66),g=r(m),y=e(64),_=e(63),v=function(e){function t(){var e=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.sourceBuffers=[],this.readyState="closed",this.on(["sourceopen","webkitsourceopen"],function(t){e.swfObj=l["default"].getElementById(t.swfId),e.player_=(0,c["default"])(e.swfObj.parentNode),e.tech_=e.swfObj.tech,e.readyState="open",e.tech_.on("seeking",function(){for(var t=e.sourceBuffers.length;t--;)e.sourceBuffers[t].abort()}),e.tech_.hls&&e.tech_.hls.on("dispose",function(){(0,_.cleanupTextTracks)(e.player_)}),e.swfObj&&e.swfObj.vjs_load()})}return s(t,e),o(t,[{key:"addSeekableRange_",value:function(){}},{key:"addSourceBuffer",value:function(e){var t=(0,y.parseContentType)(e),i=undefined;if("video/mp2t"!==t.type)throw new Error("NotSupportedError (Video.js)");return i=new p["default"](this),this.sourceBuffers.push(i),i}},{key:"endOfStream",value:function(e){"network"===e?this.tech_.error(2):"decode"===e&&this.tech_.error(3),"ended"!==this.readyState&&(this.readyState="ended",this.swfObj.vjs_endOfStream())}}]),t}(c["default"].EventTarget);i["default"]=v;try{Object.defineProperty(v.prototype,"duration",{get:function(){return this.swfObj?this.swfObj.vjs_getProperty("duration"):NaN},set:function(e){var t=undefined,i=this.swfObj.vjs_getProperty("duration");if(this.swfObj.vjs_setProperty("duration",e),e<i)for(t=0;t<this.sourceBuffers.length;t++)this.sourceBuffers[t].remove(e,i);return e}})}catch(T){v.prototype.duration=NaN}for(var b in g["default"])v[b]=g["default"][b];t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],68:[function(e,t,i){(function(n){"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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},d=e(30),l=r(d),f="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,c=r(f),h=e(44),p=r(h),m=e(71),g=r(m),y=e(65),_=r(y),v=e(62),b=e(69),T=r(b),S=e(75),w=r(S),k=e(66),O=r(k),E=function(e){l["default"].setTimeout(e,O["default"].TIME_BETWEEN_CHUNKS)},A=function(){return Math.random().toString(36).slice(2,8)},L=function(e,t){("number"!=typeof t||t<0)&&(t=0);var i=Math.pow(10,t);return Math.round(e*i)/i},P=function(e){function t(e){var i=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var n=undefined;this.chunkSize_=O["default"].BYTES_PER_CHUNK,this.buffer_=[],this.bufferSize_=0,this.basePtsOffset_=NaN,this.mediaSource_=e,this.audioBufferEnd_=NaN,this.videoBufferEnd_=NaN,this.updating=!1,this.timestampOffset_=0,n=l["default"].btoa(String.fromCharCode.apply(null,Array.prototype.slice.call(p["default"].getFlvHeader())));var r=this.mediaSource_.player_.id().replace(/[^a-zA-Z0-9]/g,"_");this.flashEncodedHeaderName_="vjs_flashEncodedHeader_"+r+A(),this.flashEncodedDataName_="vjs_flashEncodedData_"+r+A(),l["default"][this.flashEncodedHeaderName_]=function(){return delete l["default"][i.flashEncodedHeaderName_],n},this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedHeaderName_),this.transmuxer_=(0,w["default"])(T["default"]),this.transmuxer_.postMessage({action:"init",options:{}}),this.transmuxer_.onmessage=function(e){"data"===e.data.action&&i.receiveBuffer_(e.data.segment)},this.one("updateend",function(){i.mediaSource_.tech_.trigger("loadedmetadata")}),Object.defineProperty(this,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.mediaSource_.swfObj.vjs_discontinuity(),this.basePtsOffset_=NaN,this.audioBufferEnd_=NaN,this.videoBufferEnd_=NaN,this.transmuxer_.postMessage({action:"reset"}))}}),Object.defineProperty(this,"buffered",{get:function(){if(!(this.mediaSource_&&this.mediaSource_.swfObj&&"vjs_getProperty"in this.mediaSource_.swfObj))return c["default"].createTimeRange();var e=this.mediaSource_.swfObj.vjs_getProperty("buffered");return e&&e.length&&(e[0][0]=L(e[0][0],3),e[0][1]=L(e[0][1],3)),c["default"].createTimeRanges(e)}}),this.mediaSource_.player_.on("seeked",function(){(0,g["default"])(0,Infinity,i.metadataTrack_),(0,g["default"])(0,Infinity,i.inbandTextTrack_)}),this.mediaSource_.player_.tech_.hls.on("dispose",function(){i.transmuxer_.terminate()})}return s(t,e),o(t,[{key:"appendBuffer",value:function(e){var t=undefined;if(this.updating)throw t=new Error("SourceBuffer.append() cannot be called while an update is in progress"),t.name="InvalidStateError",t.code=11,t;this.updating=!0,this.mediaSource_.readyState="open",this.trigger({type:"update"}),this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"abort",value:function(){this.buffer_=[],this.bufferSize_=0,this.mediaSource_.swfObj.vjs_abort(),this.updating&&(this.updating=!1,this.trigger({type:"updateend"}))}},{key:"remove",value:function(e,t){(0,g["default"])(e,t,this.metadataTrack_),(0,g["default"])(e,t,this.inbandTextTrack_),this.trigger({type:"update"}),this.trigger({type:"updateend"})}},{key:"receiveBuffer_",value:function(e){var t=this;(0,_["default"])(this,this.mediaSource_,e),(0,v.addTextTrackData)(this,e.captions,e.metadata),E(function(){var i=t.convertTagsToData_(e);0===t.buffer_.length&&E(t.processBuffer_.bind(t)),i&&(t.buffer_.push(i),t.bufferSize_+=i.byteLength)})}},{key:"processBuffer_",value:function(){var e=this,t=O["default"].BYTES_PER_CHUNK;if(!this.buffer_.length)return void(!1!==this.updating&&(this.updating=!1,this.trigger({type:"updateend"})));var i=this.buffer_[0].subarray(0,t);i.byteLength<t||this.buffer_[0].byteLength===t?this.buffer_.shift():this.buffer_[0]=this.buffer_[0].subarray(t),this.bufferSize_-=i.byteLength;for(var n=[],r=i.byteLength,a=0;a<r;a++)n.push(String.fromCharCode(i[a]));var s=l["default"].btoa(n.join(""));l["default"][this.flashEncodedDataName_]=function(){return E(e.processBuffer_.bind(e)),delete l["default"][e.flashEncodedDataName_],s},this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedDataName_)}},{key:"convertTagsToData_",value:function(e){var t=0,i=this.mediaSource_.tech_,n=0,r=undefined,a=e.tags.videoTags,s=e.tags.audioTags;if(isNaN(this.basePtsOffset_)&&(a.length||s.length)){var o=a[0]||{pts:Infinity},u=s[0]||{pts:Infinity};this.basePtsOffset_=Math.min(u.pts,o.pts)}i.seeking()&&(this.videoBufferEnd_=NaN,this.audioBufferEnd_=NaN),isNaN(this.videoBufferEnd_)?(i.buffered().length&&(n=i.buffered().end(0)-this.timestampOffset),i.seeking()&&(n=Math.max(n,i.currentTime()-this.timestampOffset)),n*=1e3,n+=this.basePtsOffset_):n=this.videoBufferEnd_+.1;var d=a.length;if(d&&a[d-1].pts>=n){for(;--d;){var l=a[d];if(!(l.pts>n)&&(l.keyFrame||l.metaDataTag))break}for(;d;){if(!a[d-1].metaDataTag)break;d--}}var f=a.slice(d),c=undefined;for(c=isNaN(this.audioBufferEnd_)?n:this.audioBufferEnd_+.1,f.length&&(c=Math.min(c,f[0].pts)),d=0;d<s.length&&!(s[d].pts>=c);)d++;var h=s.slice(d);h.length&&(this.audioBufferEnd_=h[h.length-1].pts),f.length&&(this.videoBufferEnd_=f[f.length-1].pts);var p=this.getOrderedTags_(f,h);if(0!==p.length){if(p[0].pts<n&&i.seeking()){var m=i.currentTime(),g=(n-p[0].pts)/1e3,y=m-g;y<1/30&&(y=0);try{this.mediaSource_.swfObj.vjs_adjustCurrentTime(y)}catch(b){}}for(var _=0;_<p.length;_++)t+=p[_].bytes.byteLength;r=new Uint8Array(t);for(var _=0,v=0;_<p.length;_++)r.set(p[_].bytes,v),v+=p[_].bytes.byteLength;return r}}},{key:"getOrderedTags_",value:function(e,t){for(var i=undefined,n=[];e.length||t.length;)i=e.length?t.length&&t[0].dts<e[0].dts?t.shift():e.shift():t.shift(),n.push(i);return n}}]),t}(c["default"].EventTarget);i["default"]=P,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],69:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),s=e(30),o=n(s),u=e(44),d=n(u),l=function(e){e.on("data",function(e){o["default"].postMessage({action:"data",segment:e})}),e.on("done",function(e){o["default"].postMessage({action:"done"})})},f=function(){function e(t){r(this,e),this.options=t||{},this.init()}return a(e,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new d["default"].Transmuxer(this.options),l(this.transmuxer)}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"flush",value:function(){this.transmuxer.flush()}}]),e}(),c=function(e){e.onmessage=function(e){if("init"===e.data.action&&e.data.options)return void(this.messageHandlers=new f(e.data.options));this.messageHandlers||(this.messageHandlers=new f),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data)}};i["default"]=function(e){return new c(e)},t.exports=i["default"]},{}],70:[function(e,t,i){(function(n){"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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},d=e(30),l=r(d),f=e(29),c=r(f),h="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,p=r(h),m=e(74),g=r(m),y=e(62),_=e(64),v=e(63),b=function(e){function t(){var e=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var i=undefined;this.nativeMediaSource_=new l["default"].MediaSource;for(i in this.nativeMediaSource_)i in t.prototype||"function"!=typeof this.nativeMediaSource_[i]||(this[i]=this.nativeMediaSource_[i].bind(this.nativeMediaSource_));this.duration_=NaN,Object.defineProperty(this,"duration",{get:function(){return this.duration_===Infinity?this.duration_:this.nativeMediaSource_.duration},set:function(e){if(this.duration_=e,e!==Infinity)return void(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(this,"seekable",{get:function(){return this.duration_===Infinity?p["default"].createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(this,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(this,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),this.sourceBuffers=[],this.activeSourceBuffers_=[],this.updateActiveSourceBuffers_=function(){e.activeSourceBuffers_.length=0;for(var t=!1,i=!0,n=0;n<e.player_.audioTracks().length;n++){var r=e.player_.audioTracks()[n];if(r.enabled&&"main"!==r.kind){t=!0,i=!1;break}}e.sourceBuffers.forEach(function(n){if(n.appendAudioInitSegment_=!0,n.videoCodec_&&n.audioCodec_)n.audioDisabled_=t;else if(n.videoCodec_&&!n.audioCodec_)n.audioDisabled_=!0,i=!1;else if(!n.videoCodec_&&n.audioCodec_&&(n.audioDisabled_=i,i))return;e.activeSourceBuffers_.push(n)})},this.onPlayerMediachange_=function(){e.sourceBuffers.forEach(function(e){e.appendAudioInitSegment_=!0})},["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},this),this.on("sourceopen",function(t){var i=c["default"].querySelector('[src="'+e.url_+'"]');i&&(e.player_=(0,p["default"])(i.parentNode),e.player_.audioTracks&&e.player_.audioTracks()&&(e.player_.audioTracks().on("change",e.updateActiveSourceBuffers_),e.player_.audioTracks().on("addtrack",e.updateActiveSourceBuffers_),e.player_.audioTracks().on("removetrack",e.updateActiveSourceBuffers_)),e.player_.on("mediachange",e.onPlayerMediachange_))}),this.on("sourceended",function(t){for(var i=(0,y.durationOfVideo)(e.duration),n=0;n<e.sourceBuffers.length;n++){var r=e.sourceBuffers[n],a=r.metadataTrack_&&r.metadataTrack_.cues;a&&a.length&&(a[a.length-1].endTime=i)}}),this.on("sourceclose",function(e){this.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_&&((0,v.cleanupTextTracks)(this.player_),this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&this.player_.off("mediachange",this.onPlayerMediachange_))})}return s(t,e),o(t,[{key:"addSeekableRange_",value:function(e,t){var i=undefined;if(this.duration!==Infinity)throw i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity"),i.name="InvalidStateError",i.code=11,i;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t=undefined,i=(0,_.parseContentType)(e);if(/^(video|audio)\/mp2t$/i.test(i.type)){var n=[];i.parameters&&i.parameters.codecs&&(n=i.parameters.codecs.split(","),n=(0,_.translateLegacyCodecs)(n),n=n.filter(function(e){return(0,_.isAudioCodec)(e)||(0,_.isVideoCodec)(e)})),0===n.length&&(n=["avc1.4d400d","mp4a.40.2"]),t=new g["default"](this,n),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),t.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else t=this.nativeMediaSource_.addSourceBuffer(e);return this.sourceBuffers.push(t),t}}]),t}(p["default"].EventTarget);i["default"]=b,t.exports=i["default"] -}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],71:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(e,t,i){var n=undefined,r=undefined;if(i&&i.cues)for(n=i.cues.length;n--;)r=i.cues[n],r.startTime<=t&&r.endTime>=e&&i.removeCue(r)};i["default"]=n,t.exports=i["default"]},{}],72:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),s=e(30),o=n(s),u=e(53),d=n(u),l=function(e){e.on("data",function(e){var t=e.initSegment;e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength};var i=e.data;e.data=i.buffer,o["default"].postMessage({action:"data",segment:e,byteOffset:i.byteOffset,byteLength:i.byteLength},[e.data])}),e.captionStream&&e.captionStream.on("data",function(e){o["default"].postMessage({action:"caption",data:e})}),e.on("done",function(e){o["default"].postMessage({action:"done"})})},f=function(){function e(t){r(this,e),this.options=t||{},this.init()}return a(e,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new d["default"].Transmuxer(this.options),l(this.transmuxer)}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*e.appendStart))}},{key:"flush",value:function(e){this.transmuxer.flush()}}]),e}(),c=function(e){e.onmessage=function(e){if("init"===e.data.action&&e.data.options)return void(this.messageHandlers=new f(e.data.options));this.messageHandlers||(this.messageHandlers=new f),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data)}};i["default"]=function(e){return new c(e)},t.exports=i["default"]},{}],73:[function(e,t,i){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(i,"__esModule",{value:!0});var r=e(30),a=n(r),s=e(67),o=n(s),u=e(70),d=n(u),l="undefined"!=typeof window?window.videojs:void 0!==t?t.videojs:null,f=n(l),c=0,h={mode:"auto"};f["default"].mediaSources={};var p=function(e,t){var i=f["default"].mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})},m=function(){return!!a["default"].MediaSource&&!!a["default"].MediaSource.isTypeSupported&&a["default"].MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},g=function(e){var t=f["default"].mergeOptions(h,e);if(this.MediaSource={open:p,supportsNativeMediaSources:m},"html5"===t.mode||"auto"===t.mode&&m())return new d["default"];if(f["default"].getTech("Flash"))return new o["default"];throw new Error("Cannot use Flash or Html5 to create a MediaSource for this video")};i.MediaSource=g,g.open=p,g.supportsNativeMediaSources=m;var y={createObjectURL:function(e){var t=undefined;return e instanceof d["default"]?(t=a["default"].URL.createObjectURL(e.nativeMediaSource_),e.url_=t,t):e instanceof o["default"]?(t="blob:vjs-media-source/"+c,c++,f["default"].mediaSources[t]=e,t):(t=a["default"].URL.createObjectURL(e),e.url_=t,t)}};i.URL=y,f["default"].MediaSource=g,f["default"].URL=y}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],74:[function(e,t,i){(function(n){"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 s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},d="undefined"!=typeof window?window.videojs:void 0!==n?n.videojs:null,l=r(d),f=e(65),c=r(f),h=e(71),p=r(h),m=e(62),g=e(75),y=r(g),_=e(72),v=r(_),b=e(64),T=function(e,t){var i=e.addSourceBuffer(t),n=Object.create(null);n.updating=!1,n.realBuffer_=i;for(var r in i)!function(e){"function"==typeof i[e]?n[e]=function(){return i[e].apply(i,arguments)}:"undefined"==typeof n[e]&&Object.defineProperty(n,e,{get:function(){return i[e]},set:function(t){return i[e]=t}})}(r);return n},S=function(e){function t(e,i){var n=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,l["default"].EventTarget),this.timestampOffset_=0,this.pendingBuffers_=[],this.bufferUpdating_=!1,this.mediaSource_=e,this.codecs_=i,this.audioCodec_=null,this.videoCodec_=null,this.audioDisabled_=!1,this.appendAudioInitSegment_=!0;var r={remux:!1};this.codecs_.forEach(function(e){(0,b.isAudioCodec)(e)?n.audioCodec_=e:(0,b.isVideoCodec)(e)&&(n.videoCodec_=e)}),this.transmuxer_=(0,y["default"])(v["default"]),this.transmuxer_.postMessage({action:"init",options:r}),this.transmuxer_.onmessage=function(e){return"data"===e.data.action?n.data_(e):"done"===e.data.action?n.done_(e):void 0},Object.defineProperty(this,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.appendAudioInitSegment_=!0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(this,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=e),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=e)}}),Object.defineProperty(this,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(this,"buffered",{get:function(){var e=null,t=null,i=0,n=[],r=[];if(!this.videoBuffer_&&!this.audioBuffer_)return l["default"].createTimeRange();if(!this.videoBuffer_)return this.audioBuffer_.buffered;if(!this.audioBuffer_)return this.videoBuffer_.buffered;if(this.audioDisabled_)return this.videoBuffer_.buffered;if(0===this.videoBuffer_.buffered.length&&0===this.audioBuffer_.buffered.length)return l["default"].createTimeRange();for(var a=this.videoBuffer_.buffered,s=this.audioBuffer_.buffered,o=a.length;o--;)n.push({time:a.start(o),type:"start"}),n.push({time:a.end(o),type:"end"});for(o=s.length;o--;)n.push({time:s.start(o),type:"start"}),n.push({time:s.end(o),type:"end"});for(n.sort(function(e,t){return e.time-t.time}),o=0;o<n.length;o++)"start"===n[o].type?2===++i&&(e=n[o].time):"end"===n[o].type&&1===--i&&(t=n[o].time),null!==e&&null!==t&&(r.push([e,t]),e=null,t=null);return l["default"].createTimeRanges(r)}})}return s(t,e),o(t,[{key:"data_",value:function(e){var t=e.data.segment;t.data=new Uint8Array(t.data,e.data.byteOffset,e.data.byteLength),t.initSegment=new Uint8Array(t.initSegment.data,t.initSegment.byteOffset,t.initSegment.byteLength),(0,c["default"])(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){this.processPendingSegments_()}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach(function(i){if(e[i+"Codec_"]&&!e[i+"Buffer_"]){var n=null;if(e.mediaSource_[i+"Buffer_"])n=e.mediaSource_[i+"Buffer_"],n.updating=!1;else{var r=i+"Codec_",a=i+'/mp4;codecs="'+e[r]+'"';n=T(e.mediaSource_.nativeMediaSource_,a),e.mediaSource_[i+"Buffer_"]=n}e[i+"Buffer_"]=n,["update","updatestart","updateend"].forEach(function(r){n.addEventListener(r,function(){if("audio"!==i||!e.audioDisabled_){"updateend"===r&&(e[i+"Buffer_"].updating=!1);return t.every(function(t){return!("audio"!==t||!e.audioDisabled_)||(i===t||!e[t+"Buffer_"]||!e[t+"Buffer_"].updating)})?e.trigger(r):void 0}})})}})}},{key:"appendBuffer",value:function(e){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"remove",value:function(e,t){this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(e,t)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(e,t)),(0,p["default"])(e,t,this.metadataTrack_),(0,p["default"])(e,t,this.inbandTextTrack_)}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};e=this.pendingBuffers_.reduce(function(e,t){var i=t.type,n=t.data,r=t.initSegment;return e[i].segments.push(n),e[i].bytes+=n.byteLength,e[i].initSegment=r,t.captions&&(e.captions=e.captions.concat(t.captions)),t.info&&(e[i].info=t.info),t.metadata&&(e.metadata=e.metadata.concat(t.metadata)),e},e),this.videoBuffer_||this.audioBuffer_||(0===e.video.bytes&&(this.videoCodec_=null),0===e.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),e.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:e.audio.info}),e.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:e.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(e.audio.segments.unshift(e.audio.initSegment),e.audio.bytes+=e.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1),this.videoBuffer_&&(e.video.segments.unshift(e.video.initSegment),e.video.bytes+=e.video.initSegment.byteLength,this.concatAndAppendSegments_(e.video,this.videoBuffer_),(0,m.addTextTrackData)(this,e.captions,e.metadata)),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(e.audio,this.audioBuffer_),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var i=0,n=undefined;if(e.bytes){n=new Uint8Array(e.bytes),e.segments.forEach(function(e){n.set(e,i),i+=e.byteLength});try{t.updating=!0,t.appendBuffer(n)}catch(r){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:r.message,originalError:r})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),t}(l["default"].EventTarget);i["default"]=S,t.exports=i["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],75:[function(e,t,i){var n=arguments[3],r=arguments[4],a=arguments[5],s=JSON.stringify;t.exports=function(e){for(var t,i=Object.keys(a),o=0,u=i.length;o<u;o++){var d=i[o];if(a[d].exports===e){t=d;break}}if(!t){t=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var l={},o=0,u=i.length;o<u;o++){var d=i[o];l[d]=d}r[t]=[Function(["require","module","exports"],"("+e+")(self)"),l]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[t]=t,r[f]=[Function(["require"],"require("+s(t)+")(self)"),c];var h="("+n+")({"+Object.keys(r).map(function(e){return s(e)+":["+r[e][0]+","+s(r[e][1])+"]"}).join(",")+"},{},["+s(f)+"])",p=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(p.createObjectURL(new Blob([h],{type:"text/javascript"})))}},{}],76:[function(e,t,i){(function(i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=function(e,t,i){for(var n=!0;n;){var r=e,a=t,s=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,a);if(o!==undefined){if("value"in o)return o.value;var u=o.get;return u===undefined?undefined:u.call(s)}var d=Object.getPrototypeOf(r);if(null===d)return undefined;e=d,t=a,i=s,n=!0,o=d=undefined}},u=e(29),d=n(u),l=e(8),f=n(l),c=e(10),h=n(c),p=e(19),m=n(p),g=e(23),y=e(2),_=n(y),v=e(73),b=e(31),T=n(b),S="undefined"!=typeof window?window.videojs:void 0!==i?i.videojs:null,w=n(S),k=e(5),O=e(3),E=n(O),A=e(13),L=n(A),P=e(30),I=n(P),C=e(7),U=n(C),x=e(12),M=n(x),D=e(9),R={PlaylistLoader:f["default"],Playlist:h["default"],Decrypter:g.Decrypter,AsyncStream:g.AsyncStream,decrypt:g.decrypt,utils:_["default"],STANDARD_PLAYLIST_SELECTOR:D.lastBandwidthSelector,comparePlaylistBandwidth:D.comparePlaylistBandwidth,comparePlaylistResolution:D.comparePlaylistResolution,xhr:(0,m["default"])()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach(function(e){Object.defineProperty(R,e,{get:function(){return w["default"].log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),E["default"][e]},set:function(t){if(w["default"].log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0)return void w["default"].log.warn("value of Hls."+e+" must be greater than or equal to 0");E["default"][e]=t}})});var B=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.uri){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})},j=function(e,t){t.representations().forEach(function(t){e.addQualityLevel(t)}),B(e,t.playlists)};R.canPlaySource=function(){return w["default"].log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},R.supportsNativeHls=function(){var e=d["default"].createElement("video");return!!w["default"].getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),R.isSupported=function(){return w["default"].log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var N=I["default"].navigator&&I["default"].navigator.userAgent||"";R.supportsAudioInfoChange_=function(){if(w["default"].browser.IS_FIREFOX){var e=/Firefox\/([\d.]+)/i.exec(N);return parseInt(e[1],10)>=49}return!0};var F=w["default"].getComponent("Component"),G=function(e){function t(e,i,n){var a=this;if(r(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,i,n.hls),i.options_&&i.options_.playerId){var s=(0,w["default"])(i.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return w["default"].log.warn("player.hls is deprecated. Use player.tech_.hls instead."),i.trigger({type:"usage",name:"hls-player-access"}),a}})}if(this.tech_=i,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");this.on(d["default"],["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var t=d["default"].fullscreenElement||d["default"].webkitFullscreenElement||d["default"].mozFullScreenElement||d["default"].msFullscreenElement;t&&t.contains(a.tech_.el())&&a.masterPlaylistController_.fastQualityChange_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_)return void(this.ignoreNextSeekingEvent_=!1);this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),this.audioTrackChange_=function(){a.masterPlaylistController_.setupAudio(),a.tech_.trigger({type:"usage",name:"hls-audio-change"})},this.textTrackChange_=function(){a.masterPlaylistController_.setupSubtitles()},this.on(this.tech_,"play",this.play)}return a(t,e),s(t,[{key:"setOptions_",value:function(){var e=this;this.options_.withCredentials=this.options_.withCredentials||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=w["default"].browser.IS_ANDROID?5e5:4194304),["withCredentials","bandwidth"].forEach(function(t){"undefined"!=typeof e.source_[t]&&(e.options_[t]=e.source_[t])}),this.bandwidth=this.options_.bandwidth}},{key:"src",value:function(e){var t=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=R,this.masterPlaylistController_=new k.MasterPlaylistController(this.options_),this.playbackWatcher_=new U["default"](w["default"].mergeOptions(this.options_,{seekable:function(){return t.seekable()}})),this.masterPlaylistController_.on("error",function(){w["default"].players[t.tech_.options_.playerId].error(t.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):R.STANDARD_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e=1/(this.bandwidth||1),t=undefined;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set:function(){w["default"].log.error('The "systemBandwidth" property is read-only')}}}),Object.defineProperties(this.stats,{bandwidth:{get:function(){return t.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return t.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return t.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return t.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return t.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return t.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return t.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return t.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.masterPlaylistController_.on("sourceopen",function(){t.tech_.audioTracks().addEventListener("change",t.audioTrackChange_),t.tech_.remoteTextTracks().addEventListener("change",t.textTrackChange_)}),this.masterPlaylistController_.on("selectedinitialmedia",function(){(0,L["default"])(t)}),this.masterPlaylistController_.on("audioupdate",function(){t.tech_.clearTracks("audio"),t.masterPlaylistController_.activeAudioGroup().forEach(function(e){t.tech_.audioTracks().addTrack(e)})}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.tech_.ready(function(){return t.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(w["default"].URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=w["default"].players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){j(e.qualityLevels_,e)}),this.playlists.on("mediachange",function(){B(e.qualityLevels_,e.playlists)}))}},{key:"activeAudioGroup_",value:function(){return this.masterPlaylistController_.activeAudioGroup()}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(e){this.masterPlaylistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_.audioTracks().removeEventListener("change",this.audioTrackChange_),this.tech_.remoteTextTracks().removeEventListener("change",this.textTrackChange_),o(Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}}]),t}(F),q=function V(e){return{canHandleSource:function(t){var i=arguments.length<=1||arguments[1]===undefined?{}:arguments[1],n=w["default"].mergeOptions(w["default"].options,i);return(!n.hls||!n.hls.mode||n.hls.mode===e)&&V.canPlayType(t.type,n)},handleSource:function(t,i){var n=arguments.length<=2||arguments[2]===undefined?{}:arguments[2],r=w["default"].mergeOptions(w["default"].options,n,{hls:{mode:e}});return"flash"===e&&i.setTimeout(function(){i.trigger("loadstart")},1),i.hls=new G(t,i,r),i.hls.xhr=(0,m["default"])(),i.hls.src(t.src),i.hls},canPlayType:function(e){var t=arguments.length<=1||arguments[1]===undefined?{}:arguments[1],i=w["default"].mergeOptions(w["default"].options,t);return V.canPlayType(e,i)?"maybe":""}}};q.canPlayType=function(e,t){if(w["default"].browser.IE_VERSION&&w["default"].browser.IE_VERSION<=10)return!1;var i=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;return!(!t.hls.overrideNative&&R.supportsNativeHls)&&i.test(e)},"undefined"!=typeof w["default"].MediaSource&&"undefined"!=typeof w["default"].URL||(w["default"].MediaSource=v.MediaSource,w["default"].URL=v.URL);var H=w["default"].getTech("Flash");v.MediaSource.supportsNativeMediaSources()&&w["default"].getTech("Html5").registerSourceHandler(q("html5"),0),I["default"].Uint8Array&&H&&H.registerSourceHandler(q("flash")),w["default"].HlsHandler=G,w["default"].HlsSourceHandler=q,w["default"].Hls=R,w["default"].use||w["default"].registerComponent("Hls",R),w["default"].m3u8=T["default"],w["default"].options.hls=w["default"].options.hls||{},w["default"].registerPlugin?w["default"].registerPlugin("reloadSourceOnError",M["default"]):w["default"].plugin("reloadSourceOnError",M["default"]),t.exports={Hls:R,HlsHandler:G,HlsSourceHandler:q}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[76]); \ No newline at end of file diff --git a/embed/players/webrtc.js b/embed/players/webrtc.js new file mode 100644 index 00000000..7a07bfc1 --- /dev/null +++ b/embed/players/webrtc.js @@ -0,0 +1 @@ +var WebRTCBrowserEqualizerLoaded=true;(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.adapter=e()}})(function(){var e,t,r;return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var c=typeof require=="function"&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var p=r[o]={exports:{}};t[o][0].call(p.exports,function(e){var r=t[o][1][e];return i(r?r:e)},p,p.exports,e,t,r,n)}return r[o].exports}var a=typeof require=="function"&&require;for(var o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";var n=e("sdp");function i(e){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type}function a(e,t,r,i,a){var o=n.writeRtpDescription(e.kind,t);o+=n.writeIceParameters(e.iceGatherer.getLocalParameters());o+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),r==="offer"?"actpass":a||"active");o+="a=mid:"+e.mid+"\r\n";if(e.rtpSender&&e.rtpReceiver){o+="a=sendrecv\r\n"}else if(e.rtpSender){o+="a=sendonly\r\n"}else if(e.rtpReceiver){o+="a=recvonly\r\n"}else{o+="a=inactive\r\n"}if(e.rtpSender){var s=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=s;var c="msid:"+(i?i.id:"-")+" "+s+"\r\n";o+="a="+c;o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+c;if(e.sendEncodingParameters[0].rtx){o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+c;o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n"}}o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n";if(e.rtpSender&&e.sendEncodingParameters[0].rtx){o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"}return o}function o(e,t){var r=false;e=JSON.parse(JSON.stringify(e));return e.filter(function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;if(e.url&&!e.urls){console.warn("RTCIceServer.url is deprecated! Use urls instead.")}var i=typeof n==="string";if(i){n=[n]}n=n.filter(function(e){var n=e.indexOf("turn:")===0&&e.indexOf("transport=udp")!==-1&&e.indexOf("turn:[")===-1&&!r;if(n){r=true;return true}return e.indexOf("stun:")===0&&t>=14393&&e.indexOf("?transport=udp")===-1});delete e.url;e.urls=i?n[0]:n;return!!n.length}})}function s(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]};var n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++){if(t[r].payloadType===e||t[r].preferredPayloadType===e){return t[r]}}};var i=function(e,t,r,i){var a=n(e.parameters.apt,r);var o=n(t.parameters.apt,i);return a&&o&&a.name.toLowerCase()===o.name.toLowerCase()};e.codecs.forEach(function(n){for(var a=0;a<t.codecs.length;a++){var o=t.codecs[a];if(n.name.toLowerCase()===o.name.toLowerCase()&&n.clockRate===o.clockRate){if(n.name.toLowerCase()==="rtx"&&n.parameters&&o.parameters.apt){if(!i(n,o,e.codecs,t.codecs)){continue}}o=JSON.parse(JSON.stringify(o));o.numChannels=Math.min(n.numChannels,o.numChannels);r.codecs.push(o);o.rtcpFeedback=o.rtcpFeedback.filter(function(e){for(var t=0;t<n.rtcpFeedback.length;t++){if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter){return true}}return false});break}}});e.headerExtensions.forEach(function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}});return r}function c(e,t,r){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)!==-1}function d(e,t){var r=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});if(!r){e.addRemoteCandidate(t)}return!r}function p(e,t){var r=new Error(t);r.name=e;r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:undefined,OperationError:undefined}[e];return r}t.exports=function(e,t){function r(t,r){r.addTrack(t);r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function f(t,r){r.removeTrack(t);r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}function u(t,r,n,i){var a=new Event("track");a.track=r;a.receiver=n;a.transceiver={receiver:n};a.streams=i;e.setTimeout(function(){t._dispatchEvent("track",a)})}var l=function(r){var i=this;var a=document.createDocumentFragment();["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){i[e]=a[e].bind(a)});this.canTrickleIceCandidates=null;this.needNegotiation=false;this.localStreams=[];this.remoteStreams=[];this._localDescription=null;this._remoteDescription=null;this.signalingState="stable";this.iceConnectionState="new";this.connectionState="new";this.iceGatheringState="new";r=JSON.parse(JSON.stringify(r||{}));this.usingBundle=r.bundlePolicy==="max-bundle";if(r.rtcpMuxPolicy==="negotiate"){throw p("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported")}else if(!r.rtcpMuxPolicy){r.rtcpMuxPolicy="require"}switch(r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all";break}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced";break}r.iceServers=o(r.iceServers||[],t);this._iceGatherers=[];if(r.iceCandidatePoolSize){for(var s=r.iceCandidatePoolSize;s>0;s--){this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}))}}else{r.iceCandidatePoolSize=0}this._config=r;this.transceivers=[];this._sdpSessionId=n.generateSessionId();this._sdpSessionVersion=0;this._dtlsRole=undefined;this._isClosed=false};Object.defineProperty(l.prototype,"localDescription",{configurable:true,get:function(){return this._localDescription}});Object.defineProperty(l.prototype,"remoteDescription",{configurable:true,get:function(){return this._remoteDescription}});l.prototype.onicecandidate=null;l.prototype.onaddstream=null;l.prototype.ontrack=null;l.prototype.onremovestream=null;l.prototype.onsignalingstatechange=null;l.prototype.oniceconnectionstatechange=null;l.prototype.onconnectionstatechange=null;l.prototype.onicegatheringstatechange=null;l.prototype.onnegotiationneeded=null;l.prototype.ondatachannel=null;l.prototype._dispatchEvent=function(e,t){if(this._isClosed){return}this.dispatchEvent(t);if(typeof this["on"+e]==="function"){this["on"+e](t)}};l.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)};l.prototype.getConfiguration=function(){return this._config};l.prototype.getLocalStreams=function(){return this.localStreams};l.prototype.getRemoteStreams=function(){return this.remoteStreams};l.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0;var n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:true};if(this.usingBundle&&r){n.iceTransport=this.transceivers[0].iceTransport;n.dtlsTransport=this.transceivers[0].dtlsTransport}else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport;n.dtlsTransport=i.dtlsTransport}if(!t){this.transceivers.push(n)}return n};l.prototype.addTrack=function(t,r){if(this._isClosed){throw p("InvalidStateError","Attempted to call addTrack on a closed peerconnection.")}var n=this.transceivers.find(function(e){return e.track===t});if(n){throw p("InvalidAccessError","Track already exists.")}var i;for(var a=0;a<this.transceivers.length;a++){if(!this.transceivers[a].track&&this.transceivers[a].kind===t.kind){i=this.transceivers[a]}}if(!i){i=this._createTransceiver(t.kind)}this._maybeFireNegotiationNeeded();if(this.localStreams.indexOf(r)===-1){this.localStreams.push(r)}i.track=t;i.stream=r;i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport);return i.rtpSender};l.prototype.addStream=function(e){var r=this;if(t>=15025){e.getTracks().forEach(function(t){r.addTrack(t,e)})}else{var n=e.clone();e.getTracks().forEach(function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",function(e){r.enabled=e.enabled})});n.getTracks().forEach(function(e){r.addTrack(e,n)})}};l.prototype.removeTrack=function(t){if(this._isClosed){throw p("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.")}if(!(t instanceof e.RTCRtpSender)){throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack "+"does not implement interface RTCRtpSender.")}var r=this.transceivers.find(function(e){return e.rtpSender===t});if(!r){throw p("InvalidAccessError","Sender was not created by this connection.")}var n=r.stream;r.rtpSender.stop();r.rtpSender=null;r.track=null;r.stream=null;var i=this.transceivers.map(function(e){return e.stream});if(i.indexOf(n)===-1&&this.localStreams.indexOf(n)>-1){this.localStreams.splice(this.localStreams.indexOf(n),1)}this._maybeFireNegotiationNeeded()};l.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var r=t.getSenders().find(function(t){return t.track===e});if(r){t.removeTrack(r)}})};l.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})};l.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})};l.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0){return this.transceivers[0].iceGatherer}else if(this._iceGatherers.length){return this._iceGatherers.shift()}var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});Object.defineProperty(i,"state",{value:"new",writable:true});this.transceivers[t].bufferedCandidateEvents=[];this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||Object.keys(e.candidate).length===0;i.state=r?"completed":"gathering";if(n.transceivers[t].bufferedCandidateEvents!==null){n.transceivers[t].bufferedCandidateEvents.push(e)}};i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates);return i};l.prototype._gather=function(t,r){var i=this;var a=this.transceivers[r].iceGatherer;if(a.onlocalcandidate){return}var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null;a.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates);a.onlocalcandidate=function(e){if(i.usingBundle&&r>0){return}var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var s=e.candidate;var c=!s||Object.keys(s).length===0;if(c){if(a.state==="new"||a.state==="gathering"){a.state="completed"}}else{if(a.state==="new"){a.state="gathering"}s.component=1;s.ufrag=a.getLocalParameters().usernameFragment;var d=n.writeCandidate(s);o.candidate=Object.assign(o.candidate,n.parseCandidate(d));o.candidate.candidate=d;o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var p=n.getMediaSections(i._localDescription.sdp);if(!c){p[o.candidate.sdpMLineIndex]+="a="+o.candidate.candidate+"\r\n"}else{p[o.candidate.sdpMLineIndex]+="a=end-of-candidates\r\n"}i._localDescription.sdp=n.getDescription(i._localDescription.sdp)+p.join("");var f=i.transceivers.every(function(e){return e.iceGatherer&&e.iceGatherer.state==="completed"});if(i.iceGatheringState!=="gathering"){i.iceGatheringState="gathering";i._emitGatheringStateChange()}if(!c){i._dispatchEvent("icecandidate",o)}if(f){i._dispatchEvent("icecandidate",new Event("icecandidate"));i.iceGatheringState="complete";i._emitGatheringStateChange()}};e.setTimeout(function(){o.forEach(function(e){a.onlocalcandidate(e)})},0)};l.prototype._createIceAndDtlsTransports=function(){var t=this;var r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState();t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);n.ondtlsstatechange=function(){t._updateConnectionState()};n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:true});t._updateConnectionState()};return{iceTransport:r,dtlsTransport:n}};l.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;if(t){delete t.onlocalcandidate;delete this.transceivers[e].iceGatherer}var r=this.transceivers[e].iceTransport;if(r){delete r.onicestatechange;delete this.transceivers[e].iceTransport}var n=this.transceivers[e].dtlsTransport;if(n){delete n.ondtlsstatechange;delete n.onerror;delete this.transceivers[e].dtlsTransport}};l.prototype._transceive=function(e,r,i){var a=s(e.localCapabilities,e.remoteCapabilities);if(r&&e.rtpSender){a.encodings=e.sendEncodingParameters;a.rtcp={cname:n.localCName,compound:e.rtcpParameters.compound};if(e.recvEncodingParameters.length){a.rtcp.ssrc=e.recvEncodingParameters[0].ssrc}e.rtpSender.send(a)}if(i&&e.rtpReceiver&&a.codecs.length>0){if(e.kind==="video"&&e.recvEncodingParameters&&t<15019){e.recvEncodingParameters.forEach(function(e){delete e.rtx})}if(e.recvEncodingParameters.length){a.encodings=e.recvEncodingParameters}else{a.encodings=[{}]}a.rtcp={compound:e.rtcpParameters.compound};if(e.rtcpParameters.cname){a.rtcp.cname=e.rtcpParameters.cname}if(e.sendEncodingParameters.length){a.rtcp.ssrc=e.sendEncodingParameters[0].ssrc}e.rtpReceiver.receive(a)}};l.prototype.setLocalDescription=function(e){var t=this;if(["offer","answer"].indexOf(e.type)===-1){return Promise.reject(p("TypeError",'Unsupported type "'+e.type+'"'))}if(!c("setLocalDescription",e.type,t.signalingState)||t._isClosed){return Promise.reject(p("InvalidStateError","Can not set local "+e.type+" in state "+t.signalingState))}var r;var i;if(e.type==="offer"){r=n.splitSections(e.sdp);i=r.shift();r.forEach(function(e,r){var i=n.parseRtpParameters(e);t.transceivers[r].localCapabilities=i});t.transceivers.forEach(function(e,r){t._gather(e.mid,r)})}else if(e.type==="answer"){r=n.splitSections(t._remoteDescription.sdp);i=r.shift();var a=n.matchPrefix(i,"a=ice-lite").length>0;r.forEach(function(e,r){var o=t.transceivers[r];var c=o.iceGatherer;var d=o.iceTransport;var p=o.dtlsTransport;var f=o.localCapabilities;var u=o.remoteCapabilities;var l=n.isRejected(e)&&n.matchPrefix(e,"a=bundle-only").length===0;if(!l&&!o.rejected){var v=n.getIceParameters(e,i);var m=n.getDtlsParameters(e,i);if(a){m.role="server"}if(!t.usingBundle||r===0){t._gather(o.mid,r);if(d.state==="new"){d.start(c,v,a?"controlling":"controlled")}if(p.state==="new"){p.start(m)}}var h=s(f,u);t._transceive(o,h.codecs.length>0,false)}})}t._localDescription={type:e.type,sdp:e.sdp};if(e.type==="offer"){t._updateSignalingState("have-local-offer")}else{t._updateSignalingState("stable")}return Promise.resolve()};l.prototype.setRemoteDescription=function(i){var a=this;if(["offer","answer"].indexOf(i.type)===-1){return Promise.reject(p("TypeError",'Unsupported type "'+i.type+'"'))}if(!c("setRemoteDescription",i.type,a.signalingState)||a._isClosed){return Promise.reject(p("InvalidStateError","Can not set remote "+i.type+" in state "+a.signalingState))}var o={};a.remoteStreams.forEach(function(e){o[e.id]=e});var s=[];var l=n.splitSections(i.sdp);var v=l.shift();var m=n.matchPrefix(v,"a=ice-lite").length>0;var h=n.matchPrefix(v,"a=group:BUNDLE ").length>0;a.usingBundle=h;var g=n.matchPrefix(v,"a=ice-options:")[0];if(g){a.canTrickleIceCandidates=g.substr(14).split(" ").indexOf("trickle")>=0}else{a.canTrickleIceCandidates=false}l.forEach(function(c,p){var u=n.splitLines(c);var l=n.getKind(c);var g=n.isRejected(c)&&n.matchPrefix(c,"a=bundle-only").length===0;var y=u[0].substr(2).split(" ")[2];var C=n.getDirection(c,v);var T=n.parseMsid(c);var S=n.getMid(c)||n.generateIdentifier();if(g||l==="application"&&(y==="DTLS/SCTP"||y==="UDP/DTLS/SCTP")){a.transceivers[p]={mid:S,kind:l,protocol:y,rejected:true};return}if(!g&&a.transceivers[p]&&a.transceivers[p].rejected){a.transceivers[p]=a._createTransceiver(l,true)}var R;var P;var E;var b;var k;var w;var _;var x;var O;var D=n.parseRtpParameters(c);var M;var I;if(!g){M=n.getIceParameters(c,v);I=n.getDtlsParameters(c,v);I.role="client"}_=n.parseRtpEncodingParameters(c);var L=n.parseRtcpParameters(c);var j=n.matchPrefix(c,"a=end-of-candidates",v).length>0;var N=n.matchPrefix(c,"a=candidate:").map(function(e){return n.parseCandidate(e)}).filter(function(e){return e.component===1});if((i.type==="offer"||i.type==="answer")&&!g&&h&&p>0&&a.transceivers[p]){a._disposeIceAndDtlsTransports(p);a.transceivers[p].iceGatherer=a.transceivers[0].iceGatherer;a.transceivers[p].iceTransport=a.transceivers[0].iceTransport;a.transceivers[p].dtlsTransport=a.transceivers[0].dtlsTransport;if(a.transceivers[p].rtpSender){a.transceivers[p].rtpSender.setTransport(a.transceivers[0].dtlsTransport)}if(a.transceivers[p].rtpReceiver){a.transceivers[p].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)}}if(i.type==="offer"&&!g){R=a.transceivers[p]||a._createTransceiver(l);R.mid=S;if(!R.iceGatherer){R.iceGatherer=a._createIceGatherer(p,h)}if(N.length&&R.iceTransport.state==="new"){if(j&&(!h||p===0)){R.iceTransport.setRemoteCandidates(N)}else{N.forEach(function(e){d(R.iceTransport,e)})}}x=e.RTCRtpReceiver.getCapabilities(l);if(t<15019){x.codecs=x.codecs.filter(function(e){return e.name!=="rtx"})}w=R.sendEncodingParameters||[{ssrc:(2*p+2)*1001}];var A=false;if(C==="sendrecv"||C==="sendonly"){A=!R.rtpReceiver;k=R.rtpReceiver||new e.RTCRtpReceiver(R.dtlsTransport,l);if(A){var U;O=k.track;if(T&&T.stream==="-"){}else if(T){if(!o[T.stream]){o[T.stream]=new e.MediaStream;Object.defineProperty(o[T.stream],"id",{get:function(){return T.stream}})}Object.defineProperty(O,"id",{get:function(){return T.track}});U=o[T.stream]}else{if(!o.default){o.default=new e.MediaStream}U=o.default}if(U){r(O,U);R.associatedRemoteMediaStreams.push(U)}s.push([O,k,U])}}else if(R.rtpReceiver&&R.rtpReceiver.track){R.associatedRemoteMediaStreams.forEach(function(e){var t=e.getTracks().find(function(e){return e.id===R.rtpReceiver.track.id});if(t){f(t,e)}});R.associatedRemoteMediaStreams=[]}R.localCapabilities=x;R.remoteCapabilities=D;R.rtpReceiver=k;R.rtcpParameters=L;R.sendEncodingParameters=w;R.recvEncodingParameters=_;a._transceive(a.transceivers[p],false,A)}else if(i.type==="answer"&&!g){R=a.transceivers[p];P=R.iceGatherer;E=R.iceTransport;b=R.dtlsTransport;k=R.rtpReceiver;w=R.sendEncodingParameters;x=R.localCapabilities;a.transceivers[p].recvEncodingParameters=_;a.transceivers[p].remoteCapabilities=D;a.transceivers[p].rtcpParameters=L;if(N.length&&E.state==="new"){if((m||j)&&(!h||p===0)){E.setRemoteCandidates(N)}else{N.forEach(function(e){d(R.iceTransport,e)})}}if(!h||p===0){if(E.state==="new"){E.start(P,M,"controlling")}if(b.state==="new"){b.start(I)}}a._transceive(R,C==="sendrecv"||C==="recvonly",C==="sendrecv"||C==="sendonly");if(k&&(C==="sendrecv"||C==="sendonly")){O=k.track;if(T){if(!o[T.stream]){o[T.stream]=new e.MediaStream}r(O,o[T.stream]);s.push([O,k,o[T.stream]])}else{if(!o.default){o.default=new e.MediaStream}r(O,o.default);s.push([O,k,o.default])}}else{delete R.rtpReceiver}}});if(a._dtlsRole===undefined){a._dtlsRole=i.type==="offer"?"active":"passive"}a._remoteDescription={type:i.type,sdp:i.sdp};if(i.type==="offer"){a._updateSignalingState("have-remote-offer")}else{a._updateSignalingState("stable")}Object.keys(o).forEach(function(t){var r=o[t];if(r.getTracks().length){if(a.remoteStreams.indexOf(r)===-1){a.remoteStreams.push(r);var n=new Event("addstream");n.stream=r;e.setTimeout(function(){a._dispatchEvent("addstream",n)})}s.forEach(function(e){var t=e[0];var n=e[1];if(r.id!==e[2].id){return}u(a,t,n,[r])})}});s.forEach(function(e){if(e[2]){return}u(a,e[0],e[1],[])});e.setTimeout(function(){if(!(a&&a.transceivers)){return}a.transceivers.forEach(function(e){if(e.iceTransport&&e.iceTransport.state==="new"&&e.iceTransport.getRemoteCandidates().length>0){console.warn("Timeout for addRemoteCandidate. Consider sending "+"an end-of-candidates notification");e.iceTransport.addRemoteCandidate({})}})},4e3);return Promise.resolve()};l.prototype.close=function(){this.transceivers.forEach(function(e){if(e.iceTransport){e.iceTransport.stop()}if(e.dtlsTransport){e.dtlsTransport.stop()}if(e.rtpSender){e.rtpSender.stop()}if(e.rtpReceiver){e.rtpReceiver.stop()}});this._isClosed=true;this._updateSignalingState("closed")};l.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)};l.prototype._maybeFireNegotiationNeeded=function(){var t=this;if(this.signalingState!=="stable"||this.needNegotiation===true){return}this.needNegotiation=true;e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=false;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0)};l.prototype._updateIceConnectionState=function(){var e;var t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(e){t[e.iceTransport.state]++});e="new";if(t.failed>0){e="failed"}else if(t.checking>0){e="checking"}else if(t.disconnected>0){e="disconnected"}else if(t.new>0){e="new"}else if(t.connected>0){e="connected"}else if(t.completed>0){e="completed"}if(e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}};l.prototype._updateConnectionState=function(){var e;var t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(e){t[e.iceTransport.state]++;t[e.dtlsTransport.state]++});t.connected+=t.completed;e="new";if(t.failed>0){e="failed"}else if(t.connecting>0){e="connecting"}else if(t.disconnected>0){e="disconnected"}else if(t.new>0){e="new"}else if(t.connected>0){e="connected"}if(e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}};l.prototype.createOffer=function(){var r=this;if(r._isClosed){return Promise.reject(p("InvalidStateError","Can not call createOffer after close"))}var i=r.transceivers.filter(function(e){return e.kind==="audio"}).length;var o=r.transceivers.filter(function(e){return e.kind==="video"}).length;var s=arguments[0];if(s){if(s.mandatory||s.optional){throw new TypeError("Legacy mandatory/optional constraints not supported.")}if(s.offerToReceiveAudio!==undefined){if(s.offerToReceiveAudio===true){i=1}else if(s.offerToReceiveAudio===false){i=0}else{i=s.offerToReceiveAudio}}if(s.offerToReceiveVideo!==undefined){if(s.offerToReceiveVideo===true){o=1}else if(s.offerToReceiveVideo===false){o=0}else{o=s.offerToReceiveVideo}}}r.transceivers.forEach(function(e){if(e.kind==="audio"){i--;if(i<0){e.wantReceive=false}}else if(e.kind==="video"){o--;if(o<0){e.wantReceive=false}}});while(i>0||o>0){if(i>0){r._createTransceiver("audio");i--}if(o>0){r._createTransceiver("video");o--}}var c=n.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach(function(i,a){var o=i.track;var s=i.kind;var c=i.mid||n.generateIdentifier();i.mid=c;if(!i.iceGatherer){i.iceGatherer=r._createIceGatherer(a,r.usingBundle)}var d=e.RTCRtpSender.getCapabilities(s);if(t<15019){d.codecs=d.codecs.filter(function(e){return e.name!=="rtx"})}d.codecs.forEach(function(e){if(e.name==="H264"&&e.parameters["level-asymmetry-allowed"]===undefined){e.parameters["level-asymmetry-allowed"]="1"}if(i.remoteCapabilities&&i.remoteCapabilities.codecs){i.remoteCapabilities.codecs.forEach(function(t){if(e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate){e.preferredPayloadType=t.payloadType}})}});d.headerExtensions.forEach(function(e){var t=i.remoteCapabilities&&i.remoteCapabilities.headerExtensions||[];t.forEach(function(t){if(e.uri===t.uri){e.id=t.id}})});var p=i.sendEncodingParameters||[{ssrc:(2*a+1)*1001}];if(o){if(t>=15019&&s==="video"&&!p[0].rtx){p[0].rtx={ssrc:p[0].ssrc+1}}}if(i.wantReceive){i.rtpReceiver=new e.RTCRtpReceiver(i.dtlsTransport,s)}i.localCapabilities=d;i.sendEncodingParameters=p});if(r._config.bundlePolicy!=="max-compat"){c+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"}c+="a=ice-options:trickle\r\n";r.transceivers.forEach(function(e,t){c+=a(e,e.localCapabilities,"offer",e.stream,r._dtlsRole);c+="a=rtcp-rsize\r\n";if(e.iceGatherer&&r.iceGatheringState!=="new"&&(t===0||!r.usingBundle)){e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1;c+="a="+n.writeCandidate(e)+"\r\n"});if(e.iceGatherer.state==="completed"){c+="a=end-of-candidates\r\n"}}});var d=new e.RTCSessionDescription({type:"offer",sdp:c});return Promise.resolve(d)};l.prototype.createAnswer=function(){var r=this;if(r._isClosed){return Promise.reject(p("InvalidStateError","Can not call createAnswer after close"))}if(!(r.signalingState==="have-remote-offer"||r.signalingState==="have-local-pranswer")){return Promise.reject(p("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState))}var i=n.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);if(r.usingBundle){i+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"}var o=n.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach(function(e,n){if(n+1>o){return}if(e.rejected){if(e.kind==="application"){if(e.protocol==="DTLS/SCTP"){i+="m=application 0 DTLS/SCTP 5000\r\n"}else{i+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n"}}else if(e.kind==="audio"){i+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\n"+"a=rtpmap:0 PCMU/8000\r\n"}else if(e.kind==="video"){i+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\n"+"a=rtpmap:120 VP8/90000\r\n"}i+="c=IN IP4 0.0.0.0\r\n"+"a=inactive\r\n"+"a=mid:"+e.mid+"\r\n";return}if(e.stream){var c;if(e.kind==="audio"){c=e.stream.getAudioTracks()[0]}else if(e.kind==="video"){c=e.stream.getVideoTracks()[0]}if(c){if(t>=15019&&e.kind==="video"&&!e.sendEncodingParameters[0].rtx){e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}}}}var d=s(e.localCapabilities,e.remoteCapabilities);var p=d.codecs.filter(function(e){return e.name.toLowerCase()==="rtx"}).length;if(!p&&e.sendEncodingParameters[0].rtx){delete e.sendEncodingParameters[0].rtx}i+=a(e,d,"answer",e.stream,r._dtlsRole);if(e.rtcpParameters&&e.rtcpParameters.reducedSize){i+="a=rtcp-rsize\r\n"}});var c=new e.RTCSessionDescription({type:"answer",sdp:i});return Promise.resolve(c)};l.prototype.addIceCandidate=function(e){var t=this;var r;if(e&&!(e.sdpMLineIndex!==undefined||e.sdpMid)){return Promise.reject(new TypeError("sdpMLineIndex or sdpMid required"))}return new Promise(function(i,a){if(!t._remoteDescription){return a(p("InvalidStateError","Can not add ICE candidate without a remote description"))}else if(!e||e.candidate===""){for(var o=0;o<t.transceivers.length;o++){if(t.transceivers[o].rejected){continue}t.transceivers[o].iceTransport.addRemoteCandidate({});r=n.getMediaSections(t._remoteDescription.sdp);r[o]+="a=end-of-candidates\r\n";t._remoteDescription.sdp=n.getDescription(t._remoteDescription.sdp)+r.join("");if(t.usingBundle){break}}}else{var s=e.sdpMLineIndex;if(e.sdpMid){for(var c=0;c<t.transceivers.length;c++){if(t.transceivers[c].mid===e.sdpMid){s=c;break}}}var f=t.transceivers[s];if(f){if(f.rejected){return i()}var u=Object.keys(e.candidate).length>0?n.parseCandidate(e.candidate):{};if(u.protocol==="tcp"&&(u.port===0||u.port===9)){return i()}if(u.component&&u.component!==1){return i()}if(s===0||s>0&&f.iceTransport!==t.transceivers[0].iceTransport){if(!d(f.iceTransport,u)){return a(p("OperationError","Can not add ICE candidate"))}}var l=e.candidate.trim();if(l.indexOf("a=")===0){l=l.substr(2)}r=n.getMediaSections(t._remoteDescription.sdp);r[s]+="a="+(u.type?l:"end-of-candidates")+"\r\n";t._remoteDescription.sdp=n.getDescription(t._remoteDescription.sdp)+r.join("")}else{return a(p("OperationError","Can not add ICE candidate"))}}i()})};l.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;this.transceivers.forEach(function(e){if(e.rtpSender&&e.rtpSender.track===t){r=e.rtpSender}else if(e.rtpReceiver&&e.rtpReceiver.track===t){r=e.rtpReceiver}});if(!r){throw p("InvalidAccessError","Invalid selector.")}return r.getStats()}var n=[];this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){if(e[t]){n.push(e[t].getStats())}})});return Promise.all(n).then(function(e){var t=new Map;e.forEach(function(e){e.forEach(function(e){t.set(e.id,e)})});return t})};var v=["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"];v.forEach(function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then(function(e){var t=new Map;Object.keys(e).forEach(function(r){e[r].type=i(e[r]);t.set(r,e[r])});return t})}}});var m=["createOffer","createAnswer"];m.forEach(function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;if(typeof e[0]==="function"||typeof e[1]==="function"){return t.apply(this,[arguments[2]]).then(function(t){if(typeof e[0]==="function"){e[0].apply(null,[t])}},function(t){if(typeof e[1]==="function"){e[1].apply(null,[t])}})}return t.apply(this,arguments)}});m=["setLocalDescription","setRemoteDescription","addIceCandidate"];m.forEach(function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;if(typeof e[1]==="function"||typeof e[2]==="function"){return t.apply(this,arguments).then(function(){if(typeof e[1]==="function"){e[1].apply(null)}},function(t){if(typeof e[2]==="function"){e[2].apply(null,[t])}})}return t.apply(this,arguments)}});["getStats"].forEach(function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;if(typeof e[1]==="function"){return t.apply(this,arguments).then(function(){if(typeof e[1]==="function"){e[1].apply(null)}})}return t.apply(this,arguments)}});return l}},{sdp:2}],2:[function(e,t,r){"use strict";var n={};n.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)};n.localCName=n.generateIdentifier();n.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})};n.splitSections=function(e){var t=e.split("\nm=");return t.map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})};n.getDescription=function(e){var t=n.splitSections(e);return t&&t[0]};n.getMediaSections=function(e){var t=n.splitSections(e);t.shift();return t};n.matchPrefix=function(e,t){return n.splitLines(e).filter(function(e){return e.indexOf(t)===0})};n.parseCandidate=function(e){var t;if(e.indexOf("a=candidate:")===0){t=e.substring(12).split(" ")}else{t=e.substring(10).split(" ")}var r={foundation:t[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],port:parseInt(t[5],10),type:t[7]};for(var n=8;n<t.length;n+=2){switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1];r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1];break}}return r};n.writeCandidate=function(e){var t=[];t.push(e.foundation);t.push(e.component);t.push(e.protocol.toUpperCase());t.push(e.priority);t.push(e.ip);t.push(e.port);var r=e.type;t.push("typ");t.push(r);if(r!=="host"&&e.relatedAddress&&e.relatedPort){t.push("raddr");t.push(e.relatedAddress);t.push("rport");t.push(e.relatedPort)}if(e.tcpType&&e.protocol.toLowerCase()==="tcp"){t.push("tcptype");t.push(e.tcpType)}if(e.usernameFragment||e.ufrag){t.push("ufrag");t.push(e.usernameFragment||e.ufrag)}return"candidate:"+t.join(" ")};n.parseIceOptions=function(e){return e.substr(14).split(" ")};n.parseRtpMap=function(e){var t=e.substr(9).split(" ");var r={payloadType:parseInt(t.shift(),10)};t=t[0].split("/");r.name=t[0];r.clockRate=parseInt(t[1],10);r.channels=t.length===3?parseInt(t[2],10):1;r.numChannels=r.channels;return r};n.writeRtpMap=function(e){var t=e.payloadType;if(e.preferredPayloadType!==undefined){t=e.preferredPayloadType}var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(r!==1?"/"+r:"")+"\r\n"};n.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}};n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&e.direction!=="sendrecv"?"/"+e.direction:"")+" "+e.uri+"\r\n"};n.parseFmtp=function(e){var t={};var r;var n=e.substr(e.indexOf(" ")+1).split(";");for(var i=0;i<n.length;i++){r=n[i].trim().split("=");t[r[0].trim()]=r[1]}return t};n.writeFmtp=function(e){var t="";var r=e.payloadType;if(e.preferredPayloadType!==undefined){r=e.preferredPayloadType}if(e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach(function(t){if(e.parameters[t]){n.push(t+"="+e.parameters[t])}else{n.push(t)}});t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t};n.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}};n.writeRtcpFb=function(e){var t="";var r=e.payloadType;if(e.preferredPayloadType!==undefined){r=e.preferredPayloadType}if(e.rtcpFeedback&&e.rtcpFeedback.length){e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})}return t};n.parseSsrcMedia=function(e){var t=e.indexOf(" ");var r={ssrc:parseInt(e.substr(7,t-7),10)};var n=e.indexOf(":",t);if(n>-1){r.attribute=e.substr(t+1,n-t-1);r.value=e.substr(n+1)}else{r.attribute=e.substr(t+1)}return r};n.getMid=function(e){var t=n.matchPrefix(e,"a=mid:")[0];if(t){return t.substr(6)}};n.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}};n.getDtlsParameters=function(e,t){var r=n.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:r.map(n.parseFingerprint)}};n.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";e.fingerprints.forEach(function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"});return r};n.getIceParameters=function(e,t){var r=n.splitLines(e);r=r.concat(n.splitLines(t));var i={usernameFragment:r.filter(function(e){return e.indexOf("a=ice-ufrag:")===0})[0].substr(12),password:r.filter(function(e){return e.indexOf("a=ice-pwd:")===0})[0].substr(10)};return i};n.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\n"+"a=ice-pwd:"+e.password+"\r\n"};n.parseRtpParameters=function(e){var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]};var r=n.splitLines(e);var i=r[0].split(" ");for(var a=3;a<i.length;a++){var o=i[a];var s=n.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){var c=n.parseRtpMap(s);var d=n.matchPrefix(e,"a=fmtp:"+o+" ");c.parameters=d.length?n.parseFmtp(d[0]):{};c.rtcpFeedback=n.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(n.parseRtcpFb);t.codecs.push(c);switch(c.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(c.name.toUpperCase());break;default:break}}}n.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(n.parseExtmap(e))});return t};n.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ";r+=t.codecs.length>0?"9":"0";r+=" UDP/TLS/RTP/SAVPF ";r+=t.codecs.map(function(e){if(e.preferredPayloadType!==undefined){return e.preferredPayloadType}return e.payloadType}).join(" ")+"\r\n";r+="c=IN IP4 0.0.0.0\r\n";r+="a=rtcp:9 IN IP4 0.0.0.0\r\n";t.codecs.forEach(function(e){r+=n.writeRtpMap(e);r+=n.writeFmtp(e);r+=n.writeRtcpFb(e)});var i=0;t.codecs.forEach(function(e){if(e.maxptime>i){i=e.maxptime}});if(i>0){r+="a=maxptime:"+i+"\r\n"}r+="a=rtcp-mux\r\n";if(t.headerExtensions){t.headerExtensions.forEach(function(e){r+=n.writeExtmap(e)})}return r};n.parseRtpEncodingParameters=function(e){var t=[];var r=n.parseRtpParameters(e);var i=r.fecMechanisms.indexOf("RED")!==-1;var a=r.fecMechanisms.indexOf("ULPFEC")!==-1;var o=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return e.attribute==="cname"});var s=o.length>0&&o[0].ssrc;var c;var d=n.matchPrefix(e,"a=ssrc-group:FID").map(function(e){var t=e.substr(17).split(" ");return t.map(function(e){return parseInt(e,10)})});if(d.length>0&&d[0].length>1&&d[0][0]===s){c=d[0][1]}r.codecs.forEach(function(e){if(e.name.toUpperCase()==="RTX"&&e.parameters.apt){var r={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};if(s&&c){r.rtx={ssrc:c}}t.push(r);if(i){r=JSON.parse(JSON.stringify(r));r.fec={ssrc:c,mechanism:a?"red+ulpfec":"red"};t.push(r)}}});if(t.length===0&&s){t.push({ssrc:s})}var p=n.matchPrefix(e,"b=");if(p.length){if(p[0].indexOf("b=TIAS:")===0){p=parseInt(p[0].substr(7),10)}else if(p[0].indexOf("b=AS:")===0){p=parseInt(p[0].substr(5),10)*1e3*.95-50*40*8}else{p=undefined}t.forEach(function(e){e.maxBitrate=p})}return t};n.parseRtcpParameters=function(e){var t={};var r;var i=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return e.attribute==="cname"})[0];if(i){t.cname=i.value;t.ssrc=i.ssrc}var a=n.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=a.length>0;t.compound=a.length===0;var o=n.matchPrefix(e,"a=rtcp-mux");t.mux=o.length>0;return t};n.parseMsid=function(e){var t;var r=n.matchPrefix(e,"a=msid:");if(r.length===1){t=r[0].substr(7).split(" ");return{stream:t[0],track:t[1]}}var i=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return e.attribute==="msid"});if(i.length>0){t=i[0].value.split(" ");return{stream:t[0],track:t[1]}}};n.generateSessionId=function(){return Math.random().toString().substr(2,21)};n.writeSessionBoilerplate=function(e,t){var r;var i=t!==undefined?t:2;if(e){r=e}else{r=n.generateSessionId()}return"v=0\r\n"+"o=thisisadapterortc "+r+" "+i+" IN IP4 127.0.0.1\r\n"+"s=-\r\n"+"t=0 0\r\n"};n.writeMediaSection=function(e,t,r,i){var a=n.writeRtpDescription(e.kind,t);a+=n.writeIceParameters(e.iceGatherer.getLocalParameters());a+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),r==="offer"?"actpass":"active");a+="a=mid:"+e.mid+"\r\n";if(e.direction){a+="a="+e.direction+"\r\n"}else if(e.rtpSender&&e.rtpReceiver){a+="a=sendrecv\r\n"}else if(e.rtpSender){a+="a=sendonly\r\n"}else if(e.rtpReceiver){a+="a=recvonly\r\n"}else{a+="a=inactive\r\n"}if(e.rtpSender){var o="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+o;a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o;if(e.sendEncodingParameters[0].rtx){a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o;a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n"}}a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n";if(e.rtpSender&&e.sendEncodingParameters[0].rtx){a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"}return a};n.getDirection=function(e,t){var r=n.splitLines(e);for(var i=0;i<r.length;i++){switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2);default:}}if(t){return n.getDirection(t)}return"sendrecv"};n.getKind=function(e){var t=n.splitLines(e);var r=t[0].split(" ");return r[0].substr(2)};n.isRejected=function(e){return e.split(" ",2)[1]==="0"};n.parseMLine=function(e){var t=n.splitLines(e);var r=t[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}};n.parseOLine=function(e){var t=n.matchPrefix(e,"o=")[0];var r=t.substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}};if(typeof t==="object"){t.exports=n}},{}],3:[function(e,t,r){(function(r){"use strict";var n=e("./adapter_factory.js");t.exports=n({window:r.window})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./adapter_factory.js":4}],4:[function(e,t,r){"use strict";var n=e("./utils");t.exports=function(t,r){var i=t&&t.window;var a={shimChrome:true,shimFirefox:true,shimEdge:true,shimSafari:true};for(var o in r){if(hasOwnProperty.call(r,o)){a[o]=r[o]}}var s=n.log;var c=n.detectBrowser(i);var d=e("./chrome/chrome_shim")||null;var p=e("./edge/edge_shim")||null;var f=e("./firefox/firefox_shim")||null;var u=e("./safari/safari_shim")||null;var l=e("./common_shim")||null;var v={browserDetails:c,commonShim:l,extractVersion:n.extractVersion,disableLog:n.disableLog,disableWarnings:n.disableWarnings};switch(c.browser){case"chrome":if(!d||!d.shimPeerConnection||!a.shimChrome){s("Chrome shim is not included in this adapter release.");return v}s("adapter.js shimming chrome.");v.browserShim=d;l.shimCreateObjectURL(i);d.shimGetUserMedia(i);d.shimMediaStream(i);d.shimSourceObject(i);d.shimPeerConnection(i);d.shimOnTrack(i);d.shimAddTrackRemoveTrack(i);d.shimGetSendersWithDtmf(i);d.shimSenderReceiverGetStats(i);d.fixNegotiationNeeded(i);l.shimRTCIceCandidate(i);l.shimMaxMessageSize(i);l.shimSendThrowTypeError(i);break;case"firefox":if(!f||!f.shimPeerConnection||!a.shimFirefox){s("Firefox shim is not included in this adapter release.");return v}s("adapter.js shimming firefox.");v.browserShim=f;l.shimCreateObjectURL(i);f.shimGetUserMedia(i);f.shimSourceObject(i);f.shimPeerConnection(i);f.shimOnTrack(i);f.shimRemoveStream(i);f.shimSenderGetStats(i);f.shimReceiverGetStats(i);f.shimRTCDataChannel(i);l.shimRTCIceCandidate(i);l.shimMaxMessageSize(i);l.shimSendThrowTypeError(i);break;case"edge":if(!p||!p.shimPeerConnection||!a.shimEdge){s("MS edge shim is not included in this adapter release.");return v}s("adapter.js shimming edge.");v.browserShim=p;l.shimCreateObjectURL(i);p.shimGetUserMedia(i);p.shimPeerConnection(i);p.shimReplaceTrack(i);l.shimMaxMessageSize(i);l.shimSendThrowTypeError(i);break;case"safari":if(!u||!a.shimSafari){s("Safari shim is not included in this adapter release.");return v}s("adapter.js shimming safari.");v.browserShim=u;l.shimCreateObjectURL(i);u.shimRTCIceServerUrls(i);u.shimCallbacksAPI(i);u.shimLocalStreamsAPI(i);u.shimRemoteStreamsAPI(i);u.shimTrackEventTransceiver(i);u.shimGetUserMedia(i);u.shimCreateOfferLegacy(i);l.shimRTCIceCandidate(i);l.shimMaxMessageSize(i);l.shimSendThrowTypeError(i);break;default:s("Unsupported browser!");break}return v}},{"./chrome/chrome_shim":5,"./common_shim":7,"./edge/edge_shim":8,"./firefox/firefox_shim":11,"./safari/safari_shim":13,"./utils":14}],5:[function(e,t,r){"use strict";var n=e("../utils.js");var i=n.log;function a(e,t,r){if(!t||r.has(t.id)){return}r.set(t.id,t);Object.keys(t).forEach(function(n){if(n.endsWith("Id")){a(e,e.get(t[n]),r)}else if(n.endsWith("Ids")){t[n].forEach(function(t){a(e,e.get(t),r)})}})}function o(e,t,r){var n=r?"outbound-rtp":"inbound-rtp";var i=new Map;if(t===null){return i}var o=[];e.forEach(function(e){if(e.type==="track"&&e.trackIdentifier===t.id){o.push(e)}});o.forEach(function(t){e.forEach(function(r){if(r.type===n&&r.trackId===t.id){a(e,r,i)}})});return i}t.exports={shimGetUserMedia:e("./getusermedia"),shimMediaStream:function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},shimOnTrack:function(e){if(typeof e==="object"&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){if(this._ontrack){this.removeEventListener("track",this._ontrack)}this.addEventListener("track",this._ontrack=e)},enumerable:true,configurable:true});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;if(!r._ontrackpoly){r._ontrackpoly=function(t){t.stream.addEventListener("addtrack",function(n){var i;if(e.RTCPeerConnection.prototype.getReceivers){i=r.getReceivers().find(function(e){return e.track&&e.track.id===n.track.id})}else{i={track:n.track}}var a=new Event("track");a.track=n.track;a.receiver=i;a.transceiver={receiver:i};a.streams=[t.stream];r.dispatchEvent(a)});t.stream.getTracks().forEach(function(n){var i;if(e.RTCPeerConnection.prototype.getReceivers){i=r.getReceivers().find(function(e){return e.track&&e.track.id===n.id})}else{i={track:n}}var a=new Event("track");a.track=n;a.receiver=i;a.transceiver={receiver:i};a.streams=[t.stream];r.dispatchEvent(a)})};r.addEventListener("addstream",r._ontrackpoly)}return t.apply(r,arguments)}}else if(!("RTCRtpTransceiver"in e)){n.wrapPeerConnectionEvent(e,"track",function(e){if(!e.transceiver){e.transceiver={receiver:e.receiver}}return e})}},shimGetSendersWithDtmf:function(e){if(typeof e==="object"&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){if(this._dtmf===undefined){if(t.kind==="audio"){this._dtmf=e.createDTMFSender(t)}else{this._dtmf=null}}return this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){this._senders=this._senders||[];return this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=this;var a=r.apply(i,arguments);if(!a){a=t(i,e);i._senders.push(a)}return a};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;n.apply(t,arguments);var r=t._senders.indexOf(e);if(r!==-1){t._senders.splice(r,1)}}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;r._senders=r._senders||[];i.apply(r,[e]);e.getTracks().forEach(function(e){r._senders.push(t(r,e))})};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._senders=t._senders||[];a.apply(t,[e]);e.getTracks().forEach(function(e){var r=t._senders.find(function(t){return t.track===e});if(r){t._senders.splice(t._senders.indexOf(r),1)}})}}else if(typeof e==="object"&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var o=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this;var t=o.apply(e,[]);t.forEach(function(t){t._pc=e});return t};Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){if(this._dtmf===undefined){if(this.track.kind==="audio"){this._dtmf=this._pc.createDTMFSender(this.track)}else{this._dtmf=null}}return this._dtmf}})}},shimSenderReceiverGetStats:function(e){if(!(typeof e==="object"&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver)){return}if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;if(t){e.RTCPeerConnection.prototype.getSenders=function(){var e=this;var r=t.apply(e,[]);r.forEach(function(t){t._pc=e});return r}}var r=e.RTCPeerConnection.prototype.addTrack;if(r){e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);e._pc=this;return e}}e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(t){return o(t,e.track,true)})}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var i=e.RTCPeerConnection.prototype.getReceivers;if(i){e.RTCPeerConnection.prototype.getReceivers=function(){var e=this;var t=i.apply(e,[]);t.forEach(function(t){t._pc=e});return t}}n.wrapPeerConnectionEvent(e,"track",function(e){e.receiver._pc=e.srcElement;return e});e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(t){return o(t,e.track,false)})}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype)){return}var a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var t=this;if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var r=arguments[0];var n;var i;var o;t.getSenders().forEach(function(e){if(e.track===r){if(n){o=true}else{n=e}}});t.getReceivers().forEach(function(e){if(e.track===r){if(i){o=true}else{i=e}}return e.track===r});if(o||n&&i){return Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError"))}else if(n){return n.getStats()}else if(i){return i.getStats()}return Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(t,arguments)}},shimSourceObject:function(e){var t=e&&e.URL;if(typeof e==="object"){if(e.HTMLMediaElement&&!("srcObject"in e.HTMLMediaElement.prototype)){Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var r=this;this._srcObject=e;if(this.src){t.revokeObjectURL(this.src)}if(!e){this.src="";return undefined}this.src=t.createObjectURL(e);e.addEventListener("addtrack",function(){if(r.src){t.revokeObjectURL(r.src)}r.src=t.createObjectURL(e)});e.addEventListener("removetrack",function(){if(r.src){t.revokeObjectURL(r.src)}r.src=t.createObjectURL(e)})}})}}},shimAddTrackRemoveTrackWithNative:function(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{};return Object.keys(this._shimmedLocalStreams).map(function(t){return e._shimmedLocalStreams[t][0]})};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r){return t.apply(this,arguments)}this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);if(!this._shimmedLocalStreams[r.id]){this._shimmedLocalStreams[r.id]=[r,n]}else if(this._shimmedLocalStreams[r.id].indexOf(n)===-1){this._shimmedLocalStreams[r.id].push(n)}return n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{};e.getTracks().forEach(function(e){var r=t.getSenders().find(function(t){return t.track===e});if(r){throw new DOMException("Track already exists.","InvalidAccessError")}});var n=t.getSenders();r.apply(this,arguments);var i=t.getSenders().filter(function(e){return n.indexOf(e)===-1});this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{};delete this._shimmedLocalStreams[e.id];return n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{};if(e){Object.keys(this._shimmedLocalStreams).forEach(function(r){var n=t._shimmedLocalStreams[r].indexOf(e);if(n!==-1){t._shimmedLocalStreams[r].splice(n,1)}if(t._shimmedLocalStreams[r].length===1){delete t._shimmedLocalStreams[r]}})}return i.apply(this,arguments)}},shimAddTrackRemoveTrack:function(e){var t=n.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65){return this.shimAddTrackRemoveTrackWithNative(e)}var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;var t=r.apply(this);e._reverseStreams=e._reverseStreams||{};return t.map(function(t){return e._reverseStreams[t.id]})};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;r._streams=r._streams||{};r._reverseStreams=r._reverseStreams||{};t.getTracks().forEach(function(e){var t=r.getSenders().find(function(t){return t.track===e});if(t){throw new DOMException("Track already exists.","InvalidAccessError")}});if(!r._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());r._streams[t.id]=n;r._reverseStreams[n.id]=t;t=n}i.apply(r,[t])};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._streams=t._streams||{};t._reverseStreams=t._reverseStreams||{};a.apply(t,[t._streams[e.id]||e]);delete t._reverseStreams[t._streams[e.id]?t._streams[e.id].id:e.id];delete t._streams[e.id]};e.RTCPeerConnection.prototype.addTrack=function(t,r){var n=this;if(n.signalingState==="closed"){throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError")}var i=[].slice.call(arguments,1);if(i.length!==1||!i[0].getTracks().find(function(e){return e===t})){throw new DOMException("The adapter.js addTrack polyfill only supports a single "+" stream which is associated with the specified track.","NotSupportedError")}var a=n.getSenders().find(function(e){return e.track===t});if(a){throw new DOMException("Track already exists.","InvalidAccessError")}n._streams=n._streams||{};n._reverseStreams=n._reverseStreams||{};var o=n._streams[r.id];if(o){o.addTrack(t);Promise.resolve().then(function(){n.dispatchEvent(new Event("negotiationneeded"))})}else{var s=new e.MediaStream([t]);n._streams[r.id]=s;n._reverseStreams[s.id]=r;n.addStream(s)}return n.getSenders().find(function(e){return e.track===t})};function o(e,t){var r=t.sdp;Object.keys(e._reverseStreams||[]).forEach(function(t){var n=e._reverseStreams[t];var i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)});return new RTCSessionDescription({type:t.type,sdp:r})}function s(e,t){var r=t.sdp;Object.keys(e._reverseStreams||[]).forEach(function(t){var n=e._reverseStreams[t];var i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)});return new RTCSessionDescription({type:t.type,sdp:r})}["createOffer","createAnswer"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this;var t=arguments;var n=arguments.length&&typeof arguments[0]==="function";if(n){return r.apply(e,[function(r){var n=o(e,r);t[0].apply(null,[n])},function(e){if(t[1]){t[1].apply(null,e)}},arguments[2]])}return r.apply(e,arguments).then(function(t){return o(e,t)})}});var c=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this;if(!arguments.length||!arguments[0].type){return c.apply(e,arguments)}arguments[0]=s(e,arguments[0]);return c.apply(e,arguments)};var d=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=this;var t=d.get.apply(this);if(t.type===""){return t}return o(e,t)}});e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;if(t.signalingState==="closed"){throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError")}if(!e._pc){throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack "+"does not implement interface RTCRtpSender.","TypeError")}var r=e._pc===t;if(!r){throw new DOMException("Sender was not created by this connection.","InvalidAccessError")}t._streams=t._streams||{};var n;Object.keys(t._streams).forEach(function(r){var i=t._streams[r].getTracks().find(function(t){return e.track===t});if(i){n=t._streams[r]}});if(n){if(n.getTracks().length===1){t.removeStream(t._reverseStreams[n.id])}else{n.removeTrack(e.track)}t.dispatchEvent(new Event("negotiationneeded"))}}},shimPeerConnection:function(e){var t=n.detectBrowser(e);if(!e.RTCPeerConnection&&e.webkitRTCPeerConnection){e.RTCPeerConnection=function(t,r){i("PeerConnection");if(t&&t.iceTransportPolicy){t.iceTransports=t.iceTransportPolicy}return new e.webkitRTCPeerConnection(t,r)};e.RTCPeerConnection.prototype=e.webkitRTCPeerConnection.prototype;if(e.webkitRTCPeerConnection.generateCertificate){Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.webkitRTCPeerConnection.generateCertificate}})}}else{var r=e.RTCPeerConnection;e.RTCPeerConnection=function(e,t){if(e&&e.iceServers){var i=[];for(var a=0;a<e.iceServers.length;a++){var o=e.iceServers[a];if(!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")){n.deprecated("RTCIceServer.url","RTCIceServer.urls");o=JSON.parse(JSON.stringify(o));o.urls=o.url;i.push(o)}else{i.push(e.iceServers[a])}}e.iceServers=i}return new r(e,t)};e.RTCPeerConnection.prototype=r.prototype;Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return r.generateCertificate}})}var a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,t,r){var n=this;var i=arguments;if(arguments.length>0&&typeof e==="function"){return a.apply(this,arguments)}if(a.length===0&&(arguments.length===0||typeof arguments[0]!=="function")){return a.apply(this,[])}var o=function(e){var t={};var r=e.result();r.forEach(function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){r[t]=e.stat(t)});t[r.id]=r});return t};var s=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};if(arguments.length>=2){var c=function(e){i[1](s(o(e)))};return a.apply(this,[c,arguments[0]])}return new Promise(function(e,t){a.apply(n,[function(t){e(s(o(t)))},t])}).then(t,r)};if(t.version<51){["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=arguments;var t=this;var n=new Promise(function(n,i){r.apply(t,[e[0],n,i])});if(e.length<2){return n}return n.then(function(){e[1].apply(null,[])},function(t){if(e.length>=3){e[2].apply(null,[t])}})}})}if(t.version<52){["createOffer","createAnswer"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this;if(arguments.length<1||arguments.length===1&&typeof arguments[0]==="object"){var t=arguments.length===1?arguments[0]:undefined;return new Promise(function(n,i){r.apply(e,[n,i,t])})}return r.apply(this,arguments)}})}["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){arguments[0]=new(t==="addIceCandidate"?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]);return r.apply(this,arguments)}});var o=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){if(!arguments[0]){if(arguments[1]){arguments[1].apply(null)}return Promise.resolve()}return o.apply(this,arguments)}},fixNegotiationNeeded:function(e){n.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){var t=e.target;if(t.signalingState!=="stable"){return}return e})},shimGetDisplayMedia:function(e,t){if("getDisplayMedia"in e.navigator){return}if(typeof t!=="function"){console.error("shimGetDisplayMedia: getSourceId argument is not "+"a function");return}navigator.getDisplayMedia=function(e){return t(e).then(function(t){e.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:e.video.frameRate||3}};return navigator.mediaDevices.getUserMedia(e)})}}}},{"../utils.js":14,"./getusermedia":6}],6:[function(e,t,r){"use strict";var n=e("../utils.js");var i=n.log;t.exports=function(e){var t=n.detectBrowser(e);var r=e&&e.navigator;var a=function(e){if(typeof e!=="object"||e.mandatory||e.optional){return e}var t={};Object.keys(e).forEach(function(r){if(r==="require"||r==="advanced"||r==="mediaSource"){return}var n=typeof e[r]==="object"?e[r]:{ideal:e[r]};if(n.exact!==undefined&&typeof n.exact==="number"){n.min=n.max=n.exact}var i=function(e,t){if(e){return e+t.charAt(0).toUpperCase()+t.slice(1)}return t==="deviceId"?"sourceId":t};if(n.ideal!==undefined){t.optional=t.optional||[];var a={};if(typeof n.ideal==="number"){a[i("min",r)]=n.ideal;t.optional.push(a);a={};a[i("max",r)]=n.ideal;t.optional.push(a)}else{a[i("",r)]=n.ideal;t.optional.push(a)}}if(n.exact!==undefined&&typeof n.exact!=="number"){t.mandatory=t.mandatory||{};t.mandatory[i("",r)]=n.exact}else{["min","max"].forEach(function(e){if(n[e]!==undefined){t.mandatory=t.mandatory||{};t.mandatory[i(e,r)]=n[e]}})}});if(e.advanced){t.optional=(t.optional||[]).concat(e.advanced)}return t};var o=function(e,n){if(t.version>=61){return n(e)}e=JSON.parse(JSON.stringify(e));if(e&&typeof e.audio==="object"){var o=function(e,t,r){if(t in e&&!(r in e)){e[r]=e[t];delete e[t]}};e=JSON.parse(JSON.stringify(e));o(e.audio,"autoGainControl","googAutoGainControl");o(e.audio,"noiseSuppression","googNoiseSuppression");e.audio=a(e.audio)}if(e&&typeof e.video==="object"){var s=e.video.facingMode;s=s&&(typeof s==="object"?s:{ideal:s});var c=t.version<66;if(s&&(s.exact==="user"||s.exact==="environment"||s.ideal==="user"||s.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!c)){delete e.video.facingMode;var d;if(s.exact==="environment"||s.ideal==="environment"){d=["back","rear"]}else if(s.exact==="user"||s.ideal==="user"){d=["front"]}if(d){return r.mediaDevices.enumerateDevices().then(function(t){t=t.filter(function(e){return e.kind==="videoinput"});var r=t.find(function(e){return d.some(function(t){return e.label.toLowerCase().indexOf(t)!==-1})});if(!r&&t.length&&d.indexOf("back")!==-1){r=t[t.length-1]}if(r){e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}}e.video=a(e.video);i("chrome: "+JSON.stringify(e));return n(e)})}}e.video=a(e.video)}i("chrome: "+JSON.stringify(e));return n(e)};var s=function(e){return{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};var c=function(e,t,n){o(e,function(e){r.webkitGetUserMedia(e,t,function(e){if(n){n(s(e))}})})};r.getUserMedia=c;var d=function(e){return new Promise(function(t,n){r.getUserMedia(e,t,n)})};if(!r.mediaDevices){r.mediaDevices={getUserMedia:d,enumerateDevices:function(){return new Promise(function(t){var r={audio:"audioinput",video:"videoinput"};return e.MediaStreamTrack.getSources(function(e){t(e.map(function(e){return{label:e.label,kind:r[e.kind],deviceId:e.id,groupId:""}}))})})},getSupportedConstraints:function(){return{deviceId:true,echoCancellation:true,facingMode:true,frameRate:true,height:true,width:true}}}}if(!r.mediaDevices.getUserMedia){r.mediaDevices.getUserMedia=function(e){return d(e)}}else{var p=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return o(e,function(e){return p(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length){t.getTracks().forEach(function(e){e.stop()});throw new DOMException("","NotFoundError")}return t},function(e){return Promise.reject(s(e))})})}}if(typeof r.mediaDevices.addEventListener==="undefined"){r.mediaDevices.addEventListener=function(){i("Dummy mediaDevices.addEventListener called.")}}if(typeof r.mediaDevices.removeEventListener==="undefined"){r.mediaDevices.removeEventListener=function(){i("Dummy mediaDevices.removeEventListener called.")}}}},{"../utils.js":14}],7:[function(e,t,r){"use strict";var n=e("sdp");var i=e("./utils");t.exports={shimRTCIceCandidate:function(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype){return}var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if(typeof e==="object"&&e.candidate&&e.candidate.indexOf("a=")===0){e=JSON.parse(JSON.stringify(e));e.candidate=e.candidate.substr(2)}if(e.candidate&&e.candidate.length){var r=new t(e);var i=n.parseCandidate(e.candidate);var a=Object.assign(r,i);a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}};return a}return new t(e)};e.RTCIceCandidate.prototype=t.prototype;i.wrapPeerConnectionEvent(e,"icecandidate",function(t){if(t.candidate){Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"})}return t})},shimCreateObjectURL:function(e){var t=e&&e.URL;if(!(typeof e==="object"&&e.HTMLMediaElement&&"srcObject"in e.HTMLMediaElement.prototype&&t.createObjectURL&&t.revokeObjectURL)){return undefined}var r=t.createObjectURL.bind(t);var n=t.revokeObjectURL.bind(t);var a=new Map,o=0;t.createObjectURL=function(e){if("getTracks"in e){var t="polyblob:"+ ++o;a.set(t,e);i.deprecated("URL.createObjectURL(stream)","elem.srcObject = stream");return t}return r(e)};t.revokeObjectURL=function(e){n(e);a.delete(e)};var s=Object.getOwnPropertyDescriptor(e.HTMLMediaElement.prototype,"src");Object.defineProperty(e.HTMLMediaElement.prototype,"src",{get:function(){return s.get.apply(this)},set:function(e){this.srcObject=a.get(e)||null;return s.set.apply(this,[e])}});var c=e.HTMLMediaElement.prototype.setAttribute;e.HTMLMediaElement.prototype.setAttribute=function(){if(arguments.length===2&&(""+arguments[0]).toLowerCase()==="src"){this.srcObject=a.get(arguments[1])||null}return c.apply(this,arguments)}},shimMaxMessageSize:function(e){if(e.RTCSctpTransport||!e.RTCPeerConnection){return}var t=i.detectBrowser(e);if(!("sctp"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return typeof this._sctp==="undefined"?null:this._sctp}})}var r=function(e){var t=n.splitSections(e.sdp);t.shift();return t.some(function(e){var t=n.parseMLine(e);return t&&t.kind==="application"&&t.protocol.indexOf("SCTP")!==-1})};var a=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(t===null||t.length<2){return-1}var r=parseInt(t[1],10);return r!==r?-1:r};var o=function(e){var r=65536;if(t.browser==="firefox"){if(t.version<57){if(e===-1){r=16384}else{r=2147483637}}else if(t.version<60){r=t.version===57?65535:65536}else{r=2147483637}}return r};var s=function(e,r){var i=65536;if(t.browser==="firefox"&&t.version===57){i=65535}var a=n.matchPrefix(e.sdp,"a=max-message-size:");if(a.length>0){i=parseInt(a[0].substr(19),10)}else if(t.browser==="firefox"&&r!==-1){i=2147483637}return i};var c=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;e._sctp=null;if(r(arguments[0])){var t=a(arguments[0]);var n=o(t);var i=s(arguments[0],t);var d;if(n===0&&i===0){d=Number.POSITIVE_INFINITY}else if(n===0||i===0){d=Math.max(n,i)}else{d=Math.min(n,i)}var p={};Object.defineProperty(p,"maxMessageSize",{get:function(){return d}});e._sctp=p}return c.apply(e,arguments)}},shimSendThrowTypeError:function(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype)){return}function t(e,t){var r=e.send;e.send=function(){var n=arguments[0];var i=n.length||n.size||n.byteLength;if(e.readyState==="open"&&t.sctp&&i>t.sctp.maxMessageSize){throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)")}return r.apply(e,arguments)}}var r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=this;var n=r.apply(e,arguments);t(n,e);return n};i.wrapPeerConnectionEvent(e,"datachannel",function(e){t(e.channel,e.target);return e})}}},{"./utils":14,sdp:2}],8:[function(e,t,r){"use strict";var n=e("../utils");var i=e("./filtericeservers");var a=e("rtcpeerconnection-shim");t.exports={shimGetUserMedia:e("./getusermedia"),shimPeerConnection:function(e){var t=n.detectBrowser(e);if(e.RTCIceGatherer){if(!e.RTCIceCandidate){e.RTCIceCandidate=function(e){return e}}if(!e.RTCSessionDescription){e.RTCSessionDescription=function(e){return e}}if(t.version<15025){var r=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){r.set.call(this,e);var t=new Event("enabled");t.enabled=e;this.dispatchEvent(t)}})}}if(e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){if(this._dtmf===undefined){if(this.track.kind==="audio"){this._dtmf=new e.RTCDtmfSender(this)}else if(this.track.kind==="video"){this._dtmf=null}}return this._dtmf}})}if(e.RTCDtmfSender&&!e.RTCDTMFSender){e.RTCDTMFSender=e.RTCDtmfSender}var o=a(e,t.version);e.RTCPeerConnection=function(e){if(e&&e.iceServers){e.iceServers=i(e.iceServers)}return new o(e)};e.RTCPeerConnection.prototype=o.prototype},shimReplaceTrack:function(e){if(e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)){e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack}}}},{"../utils":14,"./filtericeservers":9,"./getusermedia":10,"rtcpeerconnection-shim":1}],9:[function(e,t,r){"use strict";var n=e("../utils");t.exports=function(e,t){var r=false;e=JSON.parse(JSON.stringify(e));return e.filter(function(e){if(e&&(e.urls||e.url)){var i=e.urls||e.url;if(e.url&&!e.urls){n.deprecated("RTCIceServer.url","RTCIceServer.urls")}var a=typeof i==="string";if(a){i=[i]}i=i.filter(function(e){var n=e.indexOf("turn:")===0&&e.indexOf("transport=udp")!==-1&&e.indexOf("turn:[")===-1&&!r;if(n){r=true;return true}return e.indexOf("stun:")===0&&t>=14393&&e.indexOf("?transport=udp")===-1});delete e.url;e.urls=a?i[0]:i;return!!i.length}})}},{"../utils":14}],10:[function(e,t,r){"use strict";t.exports=function(e){var t=e&&e.navigator;var r=function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}};var n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(function(e){return Promise.reject(r(e))})}}},{}],11:[function(e,t,r){"use strict";var n=e("../utils");t.exports={shimGetUserMedia:e("./getusermedia"),shimOnTrack:function(e){if(typeof e==="object"&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){if(this._ontrack){this.removeEventListener("track",this._ontrack);this.removeEventListener("addstream",this._ontrackpoly)}this.addEventListener("track",this._ontrack=e);this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var r=new Event("track");r.track=t;r.receiver={track:t};r.transceiver={receiver:r.receiver};r.streams=[e.stream];this.dispatchEvent(r)}.bind(this))}.bind(this))}})}if(typeof e==="object"&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)){Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}},shimSourceObject:function(e){if(typeof e==="object"){if(e.HTMLMediaElement&&!("srcObject"in e.HTMLMediaElement.prototype)){Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}})}}},shimPeerConnection:function(e){var t=n.detectBrowser(e);if(typeof e!=="object"||!(e.RTCPeerConnection||e.mozRTCPeerConnection)){return}if(!e.RTCPeerConnection){e.RTCPeerConnection=function(r,n){if(t.version<38){if(r&&r.iceServers){var i=[];for(var a=0;a<r.iceServers.length;a++){var o=r.iceServers[a];if(o.hasOwnProperty("urls")){for(var s=0;s<o.urls.length;s++){var c={url:o.urls[s]};if(o.urls[s].indexOf("turn")===0){c.username=o.username;c.credential=o.credential}i.push(c)}}else{i.push(r.iceServers[a])}}r.iceServers=i}}return new e.mozRTCPeerConnection(r,n)};e.RTCPeerConnection.prototype=e.mozRTCPeerConnection.prototype;if(e.mozRTCPeerConnection.generateCertificate){Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.mozRTCPeerConnection.generateCertificate}})}e.RTCSessionDescription=e.mozRTCSessionDescription;e.RTCIceCandidate=e.mozRTCIceCandidate}["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){arguments[0]=new(t==="addIceCandidate"?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]);return r.apply(this,arguments)}});var r=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){if(!arguments[0]){if(arguments[1]){arguments[1].apply(null)}return Promise.resolve()}return r.apply(this,arguments)};var i=function(e){var t=new Map;Object.keys(e).forEach(function(r){t.set(r,e[r]);t[r]=e[r]});return t};var a={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"};var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,r,n){return o.apply(this,[e||null]).then(function(e){if(t.version<48){e=i(e)}if(t.version<53&&!r){try{e.forEach(function(e){e.type=a[e.type]||e.type})}catch(t){if(t.name!=="TypeError"){throw t}e.forEach(function(t,r){e.set(r,Object.assign({},t,{type:a[t.type]||t.type}))})}}return e}).then(r,n)}},shimSenderGetStats:function(e){if(!(typeof e==="object"&&e.RTCPeerConnection&&e.RTCRtpSender)){return}if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype){return}var t=e.RTCPeerConnection.prototype.getSenders;if(t){e.RTCPeerConnection.prototype.getSenders=function(){var e=this;var r=t.apply(e,[]);r.forEach(function(t){t._pc=e});return r}}var r=e.RTCPeerConnection.prototype.addTrack;if(r){e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);e._pc=this;return e}}e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},shimReceiverGetStats:function(e){if(!(typeof e==="object"&&e.RTCPeerConnection&&e.RTCRtpSender)){return}if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype){return}var t=e.RTCPeerConnection.prototype.getReceivers;if(t){e.RTCPeerConnection.prototype.getReceivers=function(){var e=this;var r=t.apply(e,[]);r.forEach(function(t){t._pc=e});return r}}n.wrapPeerConnectionEvent(e,"track",function(e){e.receiver._pc=e.srcElement;return e});e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},shimRemoveStream:function(e){if(!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype){return}e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;n.deprecated("removeStream","removeTrack");this.getSenders().forEach(function(r){if(r.track&&e.getTracks().indexOf(r.track)!==-1){t.removeTrack(r)}})}},shimRTCDataChannel:function(e){if(e.DataChannel&&!e.RTCDataChannel){e.RTCDataChannel=e.DataChannel}},shimGetDisplayMedia:function(e,t){if("getDisplayMedia"in e.navigator){return}navigator.getDisplayMedia=function(e){if(!(e&&e.video)){var r=new DOMException("getDisplayMedia without video "+"constraints is undefined");r.name="NotFoundError";r.code=8;return Promise.reject(r)}if(e.video===true){e.video={mediaSource:t}}else{e.video.mediaSource=t}return navigator.mediaDevices.getUserMedia(e)}}}},{"../utils":14,"./getusermedia":12}],12:[function(e,t,r){"use strict";var n=e("../utils");var i=n.log;t.exports=function(e){var t=n.detectBrowser(e);var r=e&&e.navigator;var a=e&&e.MediaStreamTrack;var o=function(e){return{name:{InternalError:"NotReadableError",NotSupportedError:"TypeError",PermissionDeniedError:"NotAllowedError",SecurityError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the "+"user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}};var s=function(e,n,a){var s=function(e){if(typeof e!=="object"||e.require){return e}var t=[];Object.keys(e).forEach(function(r){if(r==="require"||r==="advanced"||r==="mediaSource"){return}var n=e[r]=typeof e[r]==="object"?e[r]:{ideal:e[r]};if(n.min!==undefined||n.max!==undefined||n.exact!==undefined){t.push(r)}if(n.exact!==undefined){if(typeof n.exact==="number"){n.min=n.max=n.exact}else{e[r]=n.exact}delete n.exact}if(n.ideal!==undefined){e.advanced=e.advanced||[];var i={};if(typeof n.ideal==="number"){i[r]={min:n.ideal,max:n.ideal}}else{i[r]=n.ideal}e.advanced.push(i);delete n.ideal;if(!Object.keys(n).length){delete e[r]}}});if(t.length){e.require=t}return e};e=JSON.parse(JSON.stringify(e));if(t.version<38){i("spec: "+JSON.stringify(e));if(e.audio){e.audio=s(e.audio)}if(e.video){e.video=s(e.video)}i("ff37: "+JSON.stringify(e))}return r.mozGetUserMedia(e,n,function(e){a(o(e))})};var c=function(e){return new Promise(function(t,r){s(e,t,r)})};if(!r.mediaDevices){r.mediaDevices={getUserMedia:c,addEventListener:function(){},removeEventListener:function(){}}}r.mediaDevices.enumerateDevices=r.mediaDevices.enumerateDevices||function(){return new Promise(function(e){var t=[{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}];e(t)})};if(t.version<41){var d=r.mediaDevices.enumerateDevices.bind(r.mediaDevices);r.mediaDevices.enumerateDevices=function(){return d().then(undefined,function(e){if(e.name==="NotFoundError"){return[]}throw e})}}if(t.version<49){var p=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return p(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length){t.getTracks().forEach(function(e){e.stop()});throw new DOMException("The object can not be found here.","NotFoundError")}return t},function(e){return Promise.reject(o(e))})}}if(!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var f=function(e,t,r){if(t in e&&!(r in e)){e[r]=e[t];delete e[t]}};var u=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){if(typeof e==="object"&&typeof e.audio==="object"){e=JSON.parse(JSON.stringify(e));f(e.audio,"autoGainControl","mozAutoGainControl");f(e.audio,"noiseSuppression","mozNoiseSuppression")}return u(e)};if(a&&a.prototype.getSettings){var l=a.prototype.getSettings;a.prototype.getSettings=function(){var e=l.apply(this,arguments);f(e,"mozAutoGainControl","autoGainControl");f(e,"mozNoiseSuppression","noiseSuppression");return e}}if(a&&a.prototype.applyConstraints){var v=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){if(this.kind==="audio"&&typeof e==="object"){e=JSON.parse(JSON.stringify(e));f(e,"autoGainControl","mozAutoGainControl");f(e,"noiseSuppression","mozNoiseSuppression")}return v.apply(this,[e])}}}r.getUserMedia=function(e,i,a){if(t.version<44){return s(e,i,a)}n.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia");r.mediaDevices.getUserMedia(e).then(i,a)}}},{"../utils":14}],13:[function(e,t,r){"use strict";var n=e("../utils");t.exports={shimLocalStreamsAPI:function(e){if(typeof e!=="object"||!e.RTCPeerConnection){return}if(!("getLocalStreams"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.getLocalStreams=function(){if(!this._localStreams){this._localStreams=[]}return this._localStreams}}if(!("getStreamById"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.getStreamById=function(e){var t=null;if(this._localStreams){this._localStreams.forEach(function(r){if(r.id===e){t=r}})}if(this._remoteStreams){this._remoteStreams.forEach(function(r){if(r.id===e){t=r}})}return t}}if(!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){if(!this._localStreams){this._localStreams=[]}if(this._localStreams.indexOf(e)===-1){this._localStreams.push(e)}var r=this;e.getTracks().forEach(function(n){t.call(r,n,e)})};e.RTCPeerConnection.prototype.addTrack=function(e,r){if(r){if(!this._localStreams){this._localStreams=[r]}else if(this._localStreams.indexOf(r)===-1){this._localStreams.push(r)}}return t.call(this,e,r)}}if(!("removeStream"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.removeStream=function(e){if(!this._localStreams){this._localStreams=[]}var t=this._localStreams.indexOf(e);if(t===-1){return}this._localStreams.splice(t,1);var r=this;var n=e.getTracks();this.getSenders().forEach(function(e){if(n.indexOf(e.track)!==-1){r.removeTrack(e)}})}}},shimRemoteStreamsAPI:function(e){if(typeof e!=="object"||!e.RTCPeerConnection){return}if(!("getRemoteStreams"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}}if(!("onaddstream"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;if(this._onaddstream){this.removeEventListener("addstream",this._onaddstream);this.removeEventListener("track",this._onaddstreampoly)}this.addEventListener("addstream",this._onaddstream=e);this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach(function(e){if(!t._remoteStreams){t._remoteStreams=[]}if(t._remoteStreams.indexOf(e)>=0){return}t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e;t.dispatchEvent(r)})})}})}},shimCallbacksAPI:function(e){if(typeof e!=="object"||!e.RTCPeerConnection){return}var t=e.RTCPeerConnection.prototype;var r=t.createOffer;var n=t.createAnswer;var i=t.setLocalDescription;var a=t.setRemoteDescription;var o=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0];var i=r.apply(this,[n]);if(!t){return i}i.then(e,t);return Promise.resolve()};t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0];var i=n.apply(this,[r]);if(!t){return i}i.then(e,t);return Promise.resolve()};var s=function(e,t,r){var n=i.apply(this,[e]);if(!r){return n}n.then(t,r);return Promise.resolve()};t.setLocalDescription=s;s=function(e,t,r){var n=a.apply(this,[e]);if(!r){return n}n.then(t,r);return Promise.resolve()};t.setRemoteDescription=s;s=function(e,t,r){var n=o.apply(this,[e]);if(!r){return n}n.then(t,r);return Promise.resolve()};t.addIceCandidate=s},shimGetUserMedia:function(e){var t=e&&e.navigator;if(!t.getUserMedia){if(t.webkitGetUserMedia){t.getUserMedia=t.webkitGetUserMedia.bind(t)}else if(t.mediaDevices&&t.mediaDevices.getUserMedia){t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t)}}},shimRTCIceServerUrls:function(e){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){var i=[];for(var a=0;a<e.iceServers.length;a++){var o=e.iceServers[a];if(!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")){n.deprecated("RTCIceServer.url","RTCIceServer.urls");o=JSON.parse(JSON.stringify(o));o.urls=o.url;delete o.url;i.push(o)}else{i.push(e.iceServers[a])}}e.iceServers=i}return new t(e,r)};e.RTCPeerConnection.prototype=t.prototype;if("generateCertificate"in e.RTCPeerConnection){Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}},shimTrackEventTransceiver:function(e){if(typeof e==="object"&&e.RTCPeerConnection&&"receiver"in e.RTCTrackEvent.prototype&&!e.RTCTransceiver){Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}},shimCreateOfferLegacy:function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){var r=this;if(e){if(typeof e.offerToReceiveAudio!=="undefined"){e.offerToReceiveAudio=!!e.offerToReceiveAudio}var n=r.getTransceivers().find(function(e){return e.sender.track&&e.sender.track.kind==="audio"});if(e.offerToReceiveAudio===false&&n){if(n.direction==="sendrecv"){if(n.setDirection){n.setDirection("sendonly")}else{n.direction="sendonly"}}else if(n.direction==="recvonly"){if(n.setDirection){n.setDirection("inactive")}else{n.direction="inactive"}}}else if(e.offerToReceiveAudio===true&&!n){r.addTransceiver("audio")}if(typeof e.offerToReceiveAudio!=="undefined"){e.offerToReceiveVideo=!!e.offerToReceiveVideo}var i=r.getTransceivers().find(function(e){return e.sender.track&&e.sender.track.kind==="video"});if(e.offerToReceiveVideo===false&&i){if(i.direction==="sendrecv"){i.setDirection("sendonly")}else if(i.direction==="recvonly"){i.setDirection("inactive")}}else if(e.offerToReceiveVideo===true&&!i){r.addTransceiver("video")}}return t.apply(r,arguments)}}}},{"../utils":14}],14:[function(e,t,r){"use strict";var n=true;var i=true;function a(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function o(e,t,r){if(!e.RTCPeerConnection){return}var n=e.RTCPeerConnection.prototype;var i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t){return i.apply(this,arguments)}var a=function(e){var t=r(e);if(t){n(t)}};this._eventMap=this._eventMap||{};this._eventMap[n]=a;return i.apply(this,[e,a])};var a=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[r]){return a.apply(this,arguments)}var n=this._eventMap[r];delete this._eventMap[r];return a.apply(this,[e,n])};Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){if(this["_on"+t]){this.removeEventListener(t,this["_on"+t]);delete this["_on"+t]}if(e){this.addEventListener(t,this["_on"+t]=e)}},enumerable:true,configurable:true})}t.exports={extractVersion:a,wrapPeerConnectionEvent:o,disableLog:function(e){if(typeof e!=="boolean"){return new Error("Argument type: "+typeof e+". Please use a boolean.")}n=e;return e?"adapter.js logging disabled":"adapter.js logging enabled"},disableWarnings:function(e){if(typeof e!=="boolean"){return new Error("Argument type: "+typeof e+". Please use a boolean.")}i=!e;return"adapter.js deprecation warnings "+(e?"disabled":"enabled")},log:function(){if(typeof window==="object"){if(n){return}if(typeof console!=="undefined"&&typeof console.log==="function"){console.log.apply(console,arguments)}}},deprecated:function(e,t){if(!i){return}console.warn(e+" is deprecated, please use "+t+" instead.")},detectBrowser:function(e){var t=e&&e.navigator;var r={};r.browser=null;r.version=null;if(typeof e==="undefined"||!e.navigator){r.browser="Not a browser.";return r}if(t.mozGetUserMedia){r.browser="firefox";r.version=a(t.userAgent,/Firefox\/(\d+)\./,1)}else if(t.webkitGetUserMedia){r.browser="chrome";r.version=a(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2)}else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/)){r.browser="edge";r.version=a(t.userAgent,/Edge\/(\d+).(\d+)$/,2)}else if(e.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./)){r.browser="safari";r.version=a(t.userAgent,/AppleWebKit\/(\d+)\./,1)}else{r.browser="Not a supported browser.";return r}return r}}},{}]},{},[3])(3)}); \ No newline at end of file diff --git a/embed/skins.js b/embed/skins.js new file mode 100644 index 00000000..bcf490e5 --- /dev/null +++ b/embed/skins.js @@ -0,0 +1,2559 @@ +if (typeof MistSkins == "undefined") { var MistSkins = {}; } +if ((typeof mistoptions != "undefined") && ("host" in mistoptions)) { var misthost = MistUtil.http.url.sanitizeHost(mistoptions.host); } else { var misthost = ".."; } + +MistSkins["default"] = { + structure: { + main: { + if: function(){ + return (!!this.info.hasVideo && (this.source.type.split("/")[1] != "audio")); + }, + then: { //use this substructure when there is video + type: "placeholder", + classes: ["mistvideo"], + children: [{ + type: "hoverWindow", + mode: "pos", + style: {position: "relative"}, + transition: { + hide: "left: 0; right: 0; bottom: -43px;", + show: "bottom: 0;", + viewport: "left:0; right: 0; top: -1000px; bottom: 0;" + }, + button: {type: "videocontainer"}, + children: [{type: "loading"},{type: "error"}], + window: {type: "controls"} + }] + }, + else: { //use this subsctructure for audio only + type: "container", + classes: ["mistvideo"], + style: {overflow: "visible"}, + children: [ + { + type: "controls", + classes: ["mistvideo-novideo"], + style: {width: "480px"} + }, + {type: "loading"}, + {type: "error"}, + { + if: function(){ + return (this.options.controls == "stock"); + }, + then: { //show the video element if its controls will be used + type: "video", + style: { position: "absolute" } + }, + else: { //hide the video element + type: "video", + style: { + position: "absolute", + display: "none" + } + } + } + ], + } + }, + videocontainer: {type: "video"}, + controls: { + if: function(){ + return !!(this.player && this.player.api && this.player.api.play) + }, + then: { //use this subsctructure for players that have an api with at least a play function available + type: "container", + classes: ["mistvideo-column"], + children: [ + { + type: "progress", + classes: ["mistvideo-pointer"] + }, + { + type: "container", + classes: ["mistvideo-main","mistvideo-padding","mistvideo-row","mistvideo-background"], + children: [ + { + type: "play", + classes: ["mistvideo-pointer"] + }, + {type: "currentTime"}, + {type: "totalTime"}, + { + type: "container", + classes: ["mistvideo-align-right"], + children: [ + { + type: "container", + children: [ + { + type: "container", + classes: ["mistvideo-volume_container"], + children: [{ + type: "volume", + mode: "horizontal", + size: {height: 22} + }] + }, + { + type: "speaker", + classse: ["mistvideo-pointer"], + style: {"margin-left": "-2px"} + } + ] + }, + { + if: function(){ + //show the fullscreen and loop buttons here if the player size is larger than 200px + if (("size" in this) && (this.size.width > 200) || ((!this.info.hasVideo || (this.source.type.split("/")[1] == "audio")))) { + return true; + } + return false; + }, + then: { + type: "container", + children: [{ + type: "loop", + classes: ["mistvideo-pointer"] + }, + { + type: "fullscreen", + classes: ["mistvideo-pointer"] + }] + } + }, + { + type: "hoverWindow", + mode: "pos", + transition: { + hide: "right: -1000px; bottom: 44px;", + show: "right: 5px;", + viewport: "right: 0; left: 0; bottom: 0; top: -1000px" + }, + button: {type: "settings"}, + window: {type: "submenu"} + } + ]} + ] + } + ] + }, + else: { //use this subsctructure for players that don't have an api with at least a play function available + if: function() { return !!(this.player && this.player.api); }, + then: { //use this subsctructure if some sort of api does exist + type: "hoverWindow", + mode: "pos", + transition: { + hide: "right: -1000px; bottom: 44px;", + show: "right: 2.5px;", + viewport: "right: 0; left: -1000px; bottom: 0; top: -1000px" + }, + style: { right: "5px", left: "auto" }, + button: { + type: "settings", + classes: ["mistvideo-background","mistvideo-padding"], + }, + window: { type: "submenu" } + } + } + }, + submenu: { + type: "container", + style: { + "width": "80%", + "maxWidth": "25em", + "zIndex": 2 + }, + classes: ["mistvideo-padding","mistvideo-column","mistvideo-background"], + children: [ + {type: "tracks"}, + { + if: function(){ + //only show the fullscreen and loop buttons here if the player size is less than 200px + if (("size" in this) && (this.size.width <= 200)) { + return true; + } + return false; + }, + then: { + type: "container", + classes: ["mistvideo-center"], + children: [{ + type: "loop", + classes: ["mistvideo-pointer"] + }, + { + type: "fullscreen", + classes: ["mistvideo-pointer"] + }] + } + } + ] + }, + placeholder: { + type: "container", + classes: ["mistvideo","mistvideo-delay-display"], + children: [ + {type: "placeholder"}, + {type: "loading"}, + {type: "error"} + ] + }, + secondaryVideo: function(switchThese){ + return { + type: "hoverWindow", + classes: ["mistvideo"], + mode: "pos", + transition: { + hide: "left: 10px; bottom: -40px;", + show: "bottom: 10px;" + }, + button: { + type: "container", + children: [{type: "video"}] + }, + window: { + type: "switchVideo", + classes: ["mistvideo-controls","mistvideo-padding","mistvideo-background"], + containers: switchThese + } + }; + } + }, + css: { + skin: misthost+"/skins/default.css" + }, + icons: { + blueprints: { + play: { + size: 45, + svg: '<path d="M6.26004984594 3.0550109625C5.27445051914 3.68940862462 4.67905105702 4.78142391497 4.67968264562 5.95354422781C4.67968264562 5.95354422781 4.70004942312 39.0717540916 4.70004942312 39.0717540916C4.70302341604 40.3033886636 5.36331656075 41.439734231 6.43188211452 42.0521884912C7.50044766829 42.6646427515 8.81469531629 42.6600161659 9.87892235656 42.0400537716C9.87892235656 42.0400537716 38.5612768409 25.4802882606 38.5612768409 25.4802882606C39.6181165777 24.8606067582 40.2663250096 23.7262617523 40.2636734301 22.5011460995C40.2610218505 21.2760304467 39.6079092743 20.1445019555 38.5483970356 19.5294009803C38.5483970356 19.5294009803 9.84567577375 2.9709566275 9.84567577375 2.9709566275C8.72898008118 2.32550764609 7.34527425735 2.35794451351 6.26004984594 3.0550109625C6.26004984594 3.0550109625 6.26004984594 3.0550109625 6.26004984594 3.0550109625" class="fill" />' + }, + largeplay: { + size: 45, + svg: '<path d="M6.26004984594 3.0550109625C5.27445051914 3.68940862462 4.67905105702 4.78142391497 4.67968264562 5.95354422781C4.67968264562 5.95354422781 4.70004942312 39.0717540916 4.70004942312 39.0717540916C4.70302341604 40.3033886636 5.36331656075 41.439734231 6.43188211452 42.0521884912C7.50044766829 42.6646427515 8.81469531629 42.6600161659 9.87892235656 42.0400537716C9.87892235656 42.0400537716 38.5612768409 25.4802882606 38.5612768409 25.4802882606C39.6181165777 24.8606067582 40.2663250096 23.7262617523 40.2636734301 22.5011460995C40.2610218505 21.2760304467 39.6079092743 20.1445019555 38.5483970356 19.5294009803C38.5483970356 19.5294009803 9.84567577375 2.9709566275 9.84567577375 2.9709566275C8.72898008118 2.32550764609 7.34527425735 2.35794451351 6.26004984594 3.0550109625C6.26004984594 3.0550109625 6.26004984594 3.0550109625 6.26004984594 3.0550109625" class="stroke" />' + }, + pause: { + size: 45, + svg: '<g><path d="m 7.5,38.531275 a 4.0011916,4.0011916 0 0 0 3.749999,3.96873 l 2.2812501,0 a 4.0011916,4.0011916 0 0 0 3.96875,-3.75003 l 0,-32.28123 a 4.0011916,4.0011916 0 0 0 -3.75,-3.96875 l -2.2812501,0 a 4.0011916,4.0011916 0 0 0 -3.968749,3.75 l 0,32.28128 z" class="fill" /><path d="m 27.5,38.531275 a 4.0011916,4.0011916 0 0 0 3.75,3.9687 l 2.28125,0 a 4.0011916,4.0011916 0 0 0 3.96875,-3.75 l 0,-32.28126 a 4.0011916,4.0011916 0 0 0 -3.75,-3.96875 l -2.28125,0 a 4.0011916,4.0011916 0 0 0 -3.96875,3.75 l 0,32.28131 z" class="fill" /></g>' + }, + speaker: { + size: 45, + svg: '<path d="m 32.737813,5.2037363 c -1.832447,-1.10124 -4.200687,-0.8622 -5.771871,0.77112 0,0 -7.738819,8.0443797 -7.738819,8.0443797 0,0 -3.417976,0 -3.417976,0 -1.953668,0 -3.54696,1.65618 -3.54696,3.68694 0,0 0,9.58644 0,9.58644 0,2.03094 1.593292,3.68712 3.54696,3.68712 0,0 3.417976,0 3.417976,0 0,0 7.738819,8.04474 7.738819,8.04474 1.572104,1.63404 3.938942,1.8747 5.771871,0.77076 0,0 0,-34.5914997 0,-34.5914997 z" class="stroke semiFill toggle" />' + }, + volume: { + size: {width:100, height:45}, + svg: function(){ + var uid = MistUtil.createUnique(); + return '<defs><mask id="'+uid+'"><path d="m6.202 33.254 86.029-28.394c2.6348-0.86966 4.7433 0.77359 4.7433 3.3092v28.617c0 1.9819-1.6122 3.5773-3.6147 3.5773h-86.75c-4.3249 0-5.0634-5.5287-0.40598-7.1098" fill="#fff" /></mask></defs><rect mask="url(#'+uid+')" class="slider horizontal semiFill" width="100%" height="100%" /><path d="m6.202 33.254 86.029-28.394c2.6348-0.86966 4.7433 0.77359 4.7433 3.3092v28.617c0 1.9819-1.6122 3.5773-3.6147 3.5773h-86.75c-4.3249 0-5.0634-5.5287-0.40598-7.1098" class="stroke" /><rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.001)"/>'; //rectangle added because Edge won't trigger mouse events above transparent areas + } + }, + muted: { + size: 45, + svg: '<g class="stroke" stroke-linecap="round" vector-effect="none" stroke-width="2"><path d="m25.587 5.2036c-1.8324-1.1012-4.2007-0.8622-5.7719 0.77112 0 0-7.7388 8.0444-7.7388 8.0444h-3.418c-1.9537 0-3.547 1.6562-3.547 3.6869v9.5864c0 2.0309 1.5933 3.6871 3.547 3.6871h3.418s7.7388 8.0447 7.7388 8.0447c1.5721 1.634 3.9389 1.8747 5.7719 0.77076v-34.591 z" /><path d="m30.032 27.86 9.8517-9.8517"/><path d="m30.032 18.008 9.8517 9.8517"/></g>' + }, + fullscreen: { + size: 45, + svg: '<path d="m2.5 10.928v8.5898l4.9023-2.8008 9.6172 5.7832-9.6172 5.7832-4.9023-2.8008v8.5898h15.031l-4.9004-2.8008 9.8691-5.6387 9.8691 5.6387-4.9004 2.8008h15.031v-8.5898l-4.9023 2.8008-9.6172-5.7832 9.6172-5.7832 4.9023 2.8008v-8.5898h-15.033l4.9023 2.8008-9.8691 5.6387-9.8691-5.6387 4.9023-2.8008z" class="fill">' + }, + loop: { + size: 45, + svg: '<path d="M 21.279283,3.749797 A 18.750203,18.750203 0 0 0 8.0304417,9.2511582 L 12.740779,13.961496 A 12.083464,12.083464 0 0 1 21.279283,10.416536 12.083464,12.083464 0 0 1 33.362748,22.5 12.083464,12.083464 0 0 1 21.279283,34.583464 12.083464,12.083464 0 0 1 12.740779,31.038504 l 3.063185,-3.063185 H 4.9705135 V 38.80877 L 8.0304417,35.748842 A 18.750203,18.750203 0 0 0 21.279283,41.250203 18.750203,18.750203 0 0 0 40.029486,22.5 18.750203,18.750203 0 0 0 21.279283,3.749797 Z" class="stroke semiFill toggle" />' + }, + settings: { + size: 45, + svg: '<path d="m24.139 3.834-1.4785 4.3223c-1.1018 0.0088-2.2727 0.13204-3.2031 0.33594l-2.3281-3.9473c-1.4974 0.45304-2.9327 1.091-4.2715 1.9004l1.3457 4.3672c-0.87808 0.62225-1.685 1.3403-2.4023 2.1426l-4.1953-1.8223c-0.9476 1.2456-1.7358 2.6055-2.3457 4.0469l3.6523 2.7383c-0.34895 1.0215-0.58154 2.0787-0.69336 3.1523l-4.4531 0.98828c-0.00716 0.14696-0.011931 0.29432-0.015625 0.44141 0.00628 1.4179 0.17336 2.8307 0.49805 4.2109l4.5703 0.070312c0.32171 1.0271 0.75826 2.0138 1.3008 2.9434l-3.0391 3.4355c0.89502 1.2828 1.9464 2.4492 3.1309 3.4707l3.7363-2.6289c0.86307 0.64582 1.7958 1.192 2.7812 1.6289l-0.43555 4.541c1.4754 0.52082 3.0099 0.85458 4.5684 0.99414l1.4766-4.3223c0.05369 3e-3 0.10838 0.005313 0.16211 0.007812 1.024-0.0061 2.0436-0.12048 3.043-0.34375l2.3281 3.9473c1.4974-0.45304 2.9327-1.091 4.2715-1.9004l-1.3457-4.3672c0.87808-0.62225 1.685-1.3403 2.4023-2.1426l4.1953 1.8223c0.9476-1.2456 1.7358-2.6055 2.3457-4.0469l-3.6523-2.7383c0.34895-1.0215 0.58154-2.0787 0.69336-3.1523l4.4531-0.98828c0.0072-0.14698 0.011925-0.29432 0.015625-0.44141-0.0062-1.4179-0.17336-2.8307-0.49805-4.2109l-4.5703-0.070312c-0.32171-1.0271-0.75826-2.0138-1.3008-2.9434l3.0391-3.4355c-0.89502-1.2828-1.9464-2.4492-3.1309-3.4707l-3.7363 2.6289c-0.86307-0.64582-1.7958-1.192-2.7812-1.6289l0.43555-4.541c-1.4754-0.52082-3.0099-0.85457-4.5684-0.99414zm-1.6387 7.8789a10.786 10.786 0 0 1 10.787 10.787 10.786 10.786 0 0 1-10.787 10.787 10.786 10.786 0 0 1-10.787-10.787 10.786 10.786 0 0 1 10.787-10.787z" class="fill"/>' + }, + loading: { + size: 100, + svg: '<path d="m49.998 8.7797e-4c-0.060547 0.0018431-0.12109 0.0037961-0.18164 0.0058593-0.1251 0.0015881-0.25012 0.0061465-0.375 0.013672h-0.001954c-27.388 0.30599-49.432 22.59-49.439 49.98 0.020074 2.6488 0.25061 5.292 0.68945 7.904 3.8792-24.231 24.77-42.065 49.311-42.096v-0.0058582h0.001954c4.3638 3.0803e-4 7.9013-3.5366 7.9021-7.9002 1.474e-4 -2.0958-0.83235-4.106-2.3144-5.5879-1.482-1.482-3.492-2.3145-5.5879-2.3144-6.5007e-4 -7.9369e-8 -0.0013001-7.9369e-8 -0.001954 0" class="semiFill spin"></path>' + }, + timeout: { + size: 25, + svg: function(options){ + if ((!options) || (!options.delay)) { + options = {delay: 10}; + } + var delay = options.delay; + var uid = MistUtil.createUnique(); + return '<defs><mask id="'+uid+'"><rect x="0" y="0" width="25" height="25" fill="#fff"/><rect x="-5" y="-5" width="17.5" height="35" fill="#000" transform="rotate(180,12.5,12.5)"><animateTransform attributeName="transform" type="rotate" from="0,12.5,12.5" to="180,12.5,12.5" begin="DOMNodeInsertedIntoDocument" dur="'+(delay/2)+'s" repeatCount="1"/></rect><rect x="0" y="0" width="12.5" height="25" fill="#fff"/><rect x="-5" y="-5" width="17.5" height="35" fill="#000" transform="rotate(360,12.5,12.5)"><animate attributeType="CSS" attributeName="opacity" from="0" to="1" begin="DOMNodeInsertedIntoDocument" dur="'+(delay)+'s" calcMode="discrete" repeatCount="1" /><animateTransform attributeName="transform" type="rotate" from="180,12.5,12.5" to="360,12.5,12.5" begin="DOMNodeInsertedIntoDocument+'+(delay/2)+'s" dur="'+(delay/2)+'s" repeatCount="1"/></rect><circle cx="12.5" cy="12.5" r="8" fill="#000"/></mask></defs><circle cx="12.5" cy="12.5" r="12.5" class="fill" mask="url(#'+uid+')"/>'; + } + }, + popout: { + size: 45, + svg: '<path d="m24.721 11.075c-12.96 0.049575-32.113 15.432-10.336 28.834-7.6763-7.9825-2.4795-21.824 10.336-22.19v5.5368l15.276-8.862-15.276-8.86v5.5419z" class="stroke fill"/>' + }, + switchvideo: { + size: 45, + svg: '<path d="m8.4925 18.786c-3.9578 1.504-6.4432 3.632-6.4434 5.9982 2.183e-4 4.1354 7.5562 7.5509 17.399 8.1467v4.7777l10.718-6.2573-10.718-6.2529v4.5717c-6.9764-0.4712-12.229-2.5226-12.227-4.9859 6.693e-4 -0.72127 0.45868-1.4051 1.2714-2.0267zm28.015 0v3.9715c0.81164 0.62126 1.2685 1.3059 1.2692 2.0267-0.0014 1.4217-1.791 2.75-4.8021 3.6968-2.0515 0.82484-0.93693 3.7696 1.2249 2.9659 5.3088-1.8593 8.7426-3.8616 8.7514-6.6627-1.26e-4 -2.3662-2.4856-4.4942-6.4434-5.9982z" class="fill"/><rect rect x="10.166" y="7.7911" width="24.668" height="15.432" class="stroke"/>' + } + } + }, + blueprints: { + container: function(){ + var container = document.createElement("div"); + + return container; + }, + video: function(){ + var MistVideo = this; + + //disable right click + MistUtil.event.addListener(MistVideo.video,"contextmenu",function(e){ + e.preventDefault(); + + //also do something useful + //show submenu + MistVideo.container.setAttribute("data-show-submenu",""); + MistVideo.container.removeAttribute("data-hidecursor"); + //onmouseout, hide submenu + var f = function(){ + MistVideo.container.removeAttribute("data-show-submenu"); + MistVideo.container.removeEventListener("mouseout",f); + } + MistUtil.event.addListener(MistVideo.container,"mouseout",f); + }); + + //hide the cursor after some time + MistVideo.video.hideTimer = false; + MistVideo.video.hideCursor = function(){ + if (this.hideTimer) { clearTimeout(this.hideTimer); } + this.hideTimer = MistVideo.timers.start(function(){ + MistVideo.container.setAttribute("data-hidecursor",""); + var controlsContainer = MistVideo.container.querySelector(".mistvideo-controls"); + if (controlsContainer) { controlsContainer.parentNode.setAttribute("data-hidecursor",""); } + },3e3); + }; + MistUtil.event.addListener(MistVideo.video,"mousemove",function(){ + MistVideo.container.removeAttribute("data-hidecursor"); + var controlsContainer = MistVideo.container.querySelector(".mistvideo-controls"); + if (controlsContainer) { controlsContainer.parentNode.removeAttribute("data-hidecursor"); } + MistVideo.video.hideCursor(); + }); + MistUtil.event.addListener(MistVideo.video,"mouseout",function(){ + //stop the timer if no longer over the video element + if (MistVideo.video.hideTimer) { MistVideo.timers.stop(MistVideo.video.hideTimer); } + }); + + //improve autoplay behaviour + if (MistVideo.options.autoplay) { + //because Mist doesn't send data instantly (but real time), it can take a little while before canplaythrough is fired. Rather than wait, we can just start playing at the canplay event + MistUtil.event.addListener(MistVideo.video,"canplay",function(){ + if (MistVideo.player.api.paused) { + var promise = MistVideo.player.api.play(); + if (promise) { + promise.catch(function(e){ + if (MistVideo.destroyed) { return; } + MistVideo.log("Autoplay failed. Retrying with muted audio.."); + //play has failed + + if (MistVideo.info.hasVideo) { + //try again with sound muted + MistVideo.player.api.muted = true; + //safari doesn't send this event themselves.. + MistUtil.event.send("volumechange",null,MistVideo.video); + + var promise = MistVideo.player.api.play(); + if (promise) { + promise.catch(function(){ + if (MistVideo.destroyed) { return; } + MistVideo.log("Autoplay failed even with muted video. Unmuting and showing play button."); + MistVideo.player.api.muted = false; + + //play has failed + + //show large centered play button + var largePlayButton = MistVideo.skin.icons.build("largeplay",150); + MistUtil.class.add(largePlayButton,"mistvideo-pointer"); + MistVideo.container.appendChild(largePlayButton); + + //start playing on click + MistUtil.event.addListener(largePlayButton,"click",function(){ + if (MistVideo.player.api.paused) { + MistVideo.player.api.play(); + } + }); + + //remove large button on play + var f = function (){ + MistVideo.container.removeChild(largePlayButton); + MistVideo.video.removeEventListener("play",f); + }; + MistUtil.event.addListener(MistVideo.video,"play",f); + + }).then(function(){ + if (MistVideo.destroyed) { return; } + + MistVideo.log("Autoplay worked! Video will be unmuted on mouseover if the page has been interacted with."); + + //show large "muted" icon + var largeMutedButton = MistVideo.skin.icons.build("muted",100); + MistUtil.class.add(largeMutedButton,"mistvideo-pointer"); + MistVideo.container.appendChild(largeMutedButton); + MistUtil.event.addListener(largeMutedButton,"click",function(){ + MistVideo.player.api.muted = false; + MistVideo.container.removeChild(largeMutedButton); + }); + + //listen for page interactions + var interacted = false; + var i = function(){ + interacted = true; + document.body.removeEventListener("click",i); + }; + MistUtil.event.addListener(document.body,"click",i,MistVideo.video); + + + //turn sound back on on mouseover + var f = function(){ + if (interacted) { + MistVideo.player.api.muted = false; + MistVideo.video.removeEventListener("mouseenter",f); + MistVideo.log("Re-enabled sound"); + } + }; + MistUtil.event.addListener(MistVideo.video,"mouseenter",f); + + //remove all the things when unmuted + var fu = function(){ + if (!MistVideo.video.muted) { + MistVideo.container.removeChild(largeMutedButton); + MistVideo.video.removeEventListener("volumechange",fu); + document.body.removeEventListener("click",i); + MistVideo.video.removeEventListener("mouseenter",f); + } + } + MistUtil.event.addListener(MistVideo.video,"volumechange",fu); + + }); + } + } + }); + } + } + }); + } + + return this.video; + }, + videocontainer: function(){ + return this.UI.buildStructure(this.skin.structure.videocontainer); + }, + secondaryVideo: function(o){ + if (!o) { o = {}; } + if (!o.options) { o.options = {}; } + + var MistVideo = this; + + if (!("secondary" in MistVideo)) { + MistVideo.secondary = []; + } + + var options = MistUtil.object.extend(o.options,MistVideo.options,true); + MistVideo.secondary.push(options); + + var pointer = { + primary: MistVideo, + secondary: false + }; + + options.target = document.createElement("div"); + options.callback = function(mv){ + options.MistVideo = mv; //tell the main video we exist + pointer.secondary = mv; + + mv.player.api.muted = true; //disable sound + mv.player.api.loop = false; //disable looping, master will do that for us + + //as all event listeners are tied to the video element (not the container), events don't bubble up and disturb higher players + + //prevent clicks on the control container from bubbling down to underlying elements + var controlContainers = options.target.querySelectorAll(".controls"); + for (var i = 0; i < controlContainers.length; i++) { + MistUtil.event.addListener(controlContainers[i],"click",function(e){ + e.stopPropagation(); + }); + } + + //ensure the state of the main player is copied + MistUtil.event.addListener(MistVideo.video,"play",function(){ + if (mv.player.api.paused) { mv.player.api.play(); } + },options.target); + MistUtil.event.addListener(MistVideo.video,"pause",function(e){ + if (!mv.player.api.paused) { mv.player.api.pause(); } + },options.target); + MistUtil.event.addListener(MistVideo.video,"seeking",function(){ + mv.player.api.currentTime = this.currentTime; + },options.target); + MistUtil.event.addListener(MistVideo.video,"timeupdate",function(){ + if (mv.player.api.pausedesync) { return; } + + //sync + var desync = this.currentTime - mv.player.api.currentTime; + var adesync = Math.abs(desync); + if (adesync > 30) { + mv.player.api.pausedesync = true; + mv.player.api.currentTime = this.currentTime; + mv.log("Re-syncing with main video by seeking (desync: "+desync+"s)"); + } + else if (adesync > 0.01) { + var rate = 0.1; + if (adesync < 1) { + rate = 0.05; + } + rate = 1 + rate * Math.sign(desync); + if (rate != mv.player.api.playbackRate) { + mv.log("Re-syncing by changing the playback rate (desync: "+Math.round(desync*1e3)+"ms, rate: "+rate+")"); + } + mv.player.api.playbackRate = rate; + } + else if (mv.player.api.playbackRate != 1) { + mv.player.api.playbackRate = 1; + mv.log("Sync with main video achieved (desync: "+Math.round(desync*1e3)+"ms)"); + } + },options.target); + MistUtil.event.addListener(mv.video,"seeked",function(){ + //don't attempt to correct sync if we're already seeking + mv.player.api.pausedesync = false; + }); + + }; + options.skin = MistUtil.object.extend({},MistVideo.skin,true); + options.skin.structure.main = MistUtil.object.extend({},MistVideo.skin.structure.secondaryVideo(pointer)); + + mistPlay(MistVideo.stream,options); + + return options.target; + }, + switchVideo: function(options){ + var container = document.createElement("div"); + + container.appendChild(this.skin.icons.build("switchvideo")); + + MistUtil.event.addListener(container,"click",function(){ + var primary = options.containers.primary; + var secondary = options.containers.secondary; + + function findVideo(startAt,matchTarget) { + if (startAt.video.currentTarget == matchTarget) { + return startAt.video; + } + if (startAt.secondary) { + for (var i = 0; i < startAt.secondary.length; i++) { + var result = findVideo(startAt.secondary[i].MistVideo,matchTarget); + if (result) { return result; } + } + } + return false; + } + + //find video element in primary/secondary containers + var pv = findVideo(primary,primary.options.target); + var sv = findVideo(primary,secondary.options.target); + //prevent pausing the primary + var playit = !pv.paused; + //switch them + var place = document.createElement("div"); + sv.parentElement.insertBefore(place,sv); + pv.parentElement.insertBefore(sv,pv); + place.parentElement.insertBefore(pv,place); + place.parentElement.removeChild(place); + if (playit) { + try { + pv.play(); + sv.play(); + } catch(e) {} + } + + var tmp = { + width: pv.style.width, + height: pv.style.height, + currentTarget: pv.currentTarget + };/* + pv.style.width = sv.style.width; + pv.style.height = sv.style.height; + sv.style.width = tmp.width; + sv.style.height = tmp.height;*/ + pv.currentTarget = sv.currentTarget; + sv.currentTarget = tmp.currentTarget; + primary.player.resizeAll(); + }); + + return container; + }, + controls: function(){ + if ((this.options.controls) && (this.options.controls != "stock")) { + var container = this.UI.buildStructure(this.skin.structure.controls); + if (MistUtil.isTouchDevice()) { + container.style.zoom = 1.5; + } + return container; + } + }, + submenu: function(){ + return this.UI.buildStructure(this.skin.structure.submenu); + }, + hoverWindow: function(options){ + + //rewrite to a container with specific classes and continue the buildStructure call + + var structure = { + type: "container", + classes: ("classes" in options ? options.classes : []), + children: ("children" in options ? options.children : []) + }; + + + structure.classes.push("hover_window_container"); + if (!("classes" in options.window)) { options.window.classes = []; } + options.window.classes.push("inner_window"); + options.window.classes.push("mistvideo-container"); + options.window = { + type: "container", + classes: ["outer_window"], + children: [options.window] + }; + + if (!("classes" in options.button)) { options.button.classes = []; } + options.button.classes.push("pointer"); + + switch (options.mode) { + case "left": + structure.classes.push("horizontal"); + structure.children = [options.window,options.button]; + break; + case "right": + structure.classes.push("horizontal"); + structure.children = [options.button,options.window]; + break; + case "top": + structure.classes.push("vertical"); + structure.children = [options.button,options.window]; + break; + case "bottom": + structure.classes.push("vertical"); + structure.children = [options.window,options.button]; + break; + case "pos": + structure.children = [options.button,options.window]; + if (!("classes" in options.window)) { options.window.classes = []; } + break; + default: + throw "Unsupported mode for structure type hoverWindow"; + break; + } + + if ("transition" in options) { + + if (!("css" in structure)) { structure.css = []; } + structure.css.push( + ".hover_window_container:hover > .outer_window:not([data-hidecursor]) > .inner_window { "+options.transition.show+" }\n"+ + ".hover_window_container > .outer_window { "+options.transition.viewport+" }\n"+ + ".hover_window_container > .outer_window > .inner_window { "+options.transition.hide+" }" + ); + + } + + structure.classes.push(options.mode); + + return this.UI.buildStructure(structure); + }, + draggable: function(options){ + var container = this.skin.blueprints.container(options); + var MistVideo = this; + + var button = this.skin.icons.build("fullscreen",16); + container.appendChild(button); + button.style.alignSelf = "flex-end"; + button.style.position = "absolute"; + button.style.cursor = "move"; + + var offset = {}; + var move = function(e){ + container.style.left = (e.clientX - offset.x)+"px"; + container.style.top = (e.clientY - offset.y)+"px"; + }; + var stop = function(e){ + window.removeEventListener("mousemove",move); + window.removeEventListener("click",stop); + + MistUtil.event.addListener(button,"click",start); + }; + var start = function(e){ + e.stopPropagation(); + + button.removeEventListener("click",start); + + offset.x = MistVideo.container.getBoundingClientRect().left - (container.getBoundingClientRect().left - e.clientX); + offset.y = MistVideo.container.getBoundingClientRect().top - (container.getBoundingClientRect().top - e.clientY); + + container.style.position = "absolute"; + container.style.right = "auto"; + container.style.bottom = "auto"; + MistVideo.container.appendChild(container); + move(e); + + //container.style.resize = "both"; + + MistUtil.event.addListener(window,"mousemove",move,container); + MistUtil.event.addListener(window,"click",stop,container); + }; + + MistUtil.event.addListener(button,"click",start); + + return container; + }, + progress: function(){ + + //the outer container is div.progress, which contains div.bar and multiple div.buffer-s + var margincontainer = document.createElement("div"); + + var container = document.createElement("div"); + margincontainer.appendChild(container); + + container.kids = {}; + + container.kids.bar = document.createElement("div"); + container.kids.bar.className = "bar"; + container.appendChild(container.kids.bar); + + var video = this.video; + var api = this.player.api; + var MistVideo = this; + + //these functions update the states + container.updateBar = function(currentTime){ + if (this.kids.bar) { + if (!isFinite(api.duration)) { this.kids.bar.style.display = "none"; return; } + else { this.kids.bar.style.display = ""; } + + w = Math.min(1,Math.max(0,this.time2perc(currentTime))); + this.kids.bar.style.width = w*100+"%"; + } + }; + container.time2perc = function(time) { + if (!isFinite(api.duration)) { return 0; } + var result = 0; + if (MistVideo.info.type == "live") { + var buffer_window = MistVideo.info.meta.buffer_window * 1e-3; + result = (time - api.duration + buffer_window) / buffer_window; + } + else { + result = time / api.duration; + } + return Math.min(1,Math.max(0,result)); + } + container.buildBuffer = function(start,end){ + var buffer = document.createElement("div"); + buffer.className = "buffer"; + buffer.style.left = (this.time2perc(start)*100)+"%"; + buffer.style.width = ((this.time2perc(end) - this.time2perc(start))*100)+"%"; + return buffer; + }; + container.updateBuffers = function(buffers){ + //clear old buffer-divs + var old = this.querySelectorAll(".buffer"); + for (var i = 0; i < old.length; i++) { + this.removeChild(old[i]); + } + + //add new buffer-divs + if (buffers) { + for (var i = 0; i < buffers.length; i++) { + this.appendChild(this.buildBuffer( + buffers.start(i), + buffers.end(i) + )); + } + } + }; + + //obey video states + MistUtil.event.addListener(video,"progress",function(){ + container.updateBuffers(api.buffered); + },container); + MistUtil.event.addListener(video,"timeupdate",function(){ + if (!dragging) { container.updateBar(api.currentTime); } + },container); + MistUtil.event.addListener(video,"seeking",function(){ + container.updateBar(api.currentTime); + },container); + + //control video states + container.getPos = function(e){ + var perc = MistUtil.getPos(this,e); + if (MistVideo.info.type == "live") { + //live mode: seek in DVR window + var bufferWindow = MistVideo.info.meta.buffer_window * 1e-3; //buffer window in seconds + //assuming the "right" part or the progressbar is at true live + return (perc-1) * bufferWindow + MistVideo.player.api.duration; + } + else { + //VOD mode + if (!isFinite(api.duration)) { return false; } + return perc * api.duration; + } + }; + //seeking + container.seek = function(e){ + var pos = this.getPos(e); + api.currentTime = pos; + }; + MistUtil.event.addListener(margincontainer,"mouseup",function(e){ + if (e.which != 1) { return;} //only respond to left mouse clicks + container.seek(e); + }); + + //hovering + var tooltip = MistVideo.UI.buildStructure({type:"tooltip"}); + tooltip.style.opacity = 0; + container.appendChild(tooltip); + MistUtil.event.addListener(margincontainer,"mouseout",function(){ + if (!dragging) { tooltip.style.opacity = 0; } + }); + container.moveTooltip = function(e){ + var secs = this.getPos(e); + if (secs === false) { + //the tooltip isn't going to make sense + tooltip.style.opacity = 0; + return; + } + tooltip.setText(MistUtil.format.time(secs)); + tooltip.style.opacity = 1; + + var perc = MistUtil.getPos(this,e);// e.clientX - this.getBoundingClientRect().left; + var pos = {bottom:20}; + //if the cursor is on the left side of the progress bar, show tooltip on the right of the cursor, otherwise, show it on the left side + if (perc > 0.5) { + pos.right = (1-perc)*100+"%"; + tooltip.triangle.setMode("bottom","right"); + } + else { + pos.left = perc*100+"%"; + tooltip.triangle.setMode("bottom","left"); + } + tooltip.setPos(pos); + }; + MistUtil.event.addListener(margincontainer,"mousemove",function(e){ + container.moveTooltip(e); + }); + //TODO for live seeking, maybe show a tooltip at start and end with the apprioprate times as well? + + //dragging + var dragging = false; + MistUtil.event.addListener(margincontainer,"mousedown",function(e){ + if (e.which != 1) { return;} //only respond to left mouse clicks + + dragging = true; + + container.updateBar(container.getPos(e)); + + var moveListener = MistUtil.event.addListener(document,"mousemove",function(e){ + container.updateBar(container.getPos(e)); + container.moveTooltip(e); + },container); + + + var upListener = MistUtil.event.addListener(document,"mouseup",function(e){ + if (e.which != 1) { return;} //only respond to left mouse clicks + dragging = false; + + //remove mousemove and up + MistUtil.event.removeListener(moveListener); + MistUtil.event.removeListener(upListener); + + tooltip.style.opacity = 0; + + //trigger seek + if ((!e.path) || (MistUtil.array.indexOf(e.path,margincontainer) < 0)) { //it's not already triggered by onmouseup + container.seek(e); + } + },container); + }); + + return margincontainer; + }, + play: function(){ + var MistVideo = this; + var button = document.createElement("div"); + + button.appendChild(this.skin.icons.build("play")); + button.appendChild(this.skin.icons.build("pause")); + + button.setState = function(state){ + this.setAttribute("data-state",state); + }; + button.setState("paused"); + + var video = this.video; + //obey video states + MistUtil.event.addListener(video,"playing",function(){ + button.setState("playing"); + },button); + MistUtil.event.addListener(video,"pause",function(){ + button.setState("paused"); + },button); + MistUtil.event.addListener(video,"paused",function(){ + button.setState("paused"); + },button); + MistUtil.event.addListener(video,"ended",function(){ + button.setState("paused"); + },button); + + //control video states + MistUtil.event.addListener(button,"click",function(){ + if (MistVideo.player.api.error) { MistVideo.player.api.load(); } + if (MistVideo.player.api.paused) { + MistVideo.player.api.play(); + } + else { + MistVideo.player.api.pause(); + } + }); + + //toggle play/pause on click on video container + if (MistVideo.player.api) { + MistUtil.event.addListener(MistVideo.video,"click",function(){ + if (MistVideo.player.api.paused) { MistVideo.player.api.play(); } + else if (!MistUtil.isTouchDevice()) { MistVideo.player.api.pause(); } + },button); + } + + return button; + }, + speaker: function(){ + + var hasaudio = false; + var tracks = this.info.meta.tracks; + for (var i in tracks) { + if (tracks[i].type == "audio") { hasaudio = true; break; } + } + if (!hasaudio) { return false; } + + var button = this.skin.icons.build("speaker"); + var MistVideo = this; + + var video = this.video; + //obey video states + MistUtil.event.addListener(video,"volumechange",function(){ + if ((MistVideo.player.api.volume) && (!MistVideo.player.api.muted)) { + MistUtil.class.remove(button,"off"); + } + else { + MistUtil.class.add(button,"off"); + } + },button); + + //control video states + MistUtil.event.addListener(button,"click",function(e){ + MistVideo.player.api.muted = !MistVideo.player.api.muted; + }); + + return button; + }, + volume: function(options){ + + var hasaudio = false; + var tracks = this.info.meta.tracks; + for (var i in tracks) { + if (tracks[i].type == "audio") { hasaudio = true; break; } + } + if (!hasaudio) { return false; } + + var container = document.createElement("div"); + var button = this.skin.icons.build("volume",("size" in options ? options.size : false)); + container.appendChild(button); + var MistVideo = this; + + button.mode = ("mode" in options ? options.mode : "vertical"); + if (button.mode == "vertical") { button.style.transform = "rotate(90deg)"; } //TODO do this properly + + //pad values with this amount (to allow for line thickness) + button.margin = { + start: 0.15, + end: 0.1 + }; + + var video = this.video; + //obey video states + button.set = function(perc){ + + perc = 100 - 100 * Math.pow(1 - perc/100,2); //transform back from quadratic + + //add padding + if ((perc != 100) && (perc != 0)) { + perc = this.addPadding(perc/100) * 100; + } + + var sliders = button.querySelectorAll(".slider"); + for (var i = 0; i < sliders.length; i++) { + sliders[i].setAttribute(button.mode == "vertical" ? "height" : "width",perc+"%"); + } + } + MistUtil.event.addListener(video,"volumechange",function(){ + button.set(MistVideo.player.api.muted ? 0 : (MistVideo.player.api.volume*100)); + },button); + + //apply initial video state + if (('localStorage' in window) && (localStorage != null) && ('mistVolume' in localStorage)) { + MistVideo.player.api.volume = localStorage['mistVolume']; + } + + button.addPadding = function(actual){ + return actual * (1 - (this.margin.start + this.margin.end)) + this.margin.start; + } + + button.removePadding = function(padded){ + var val = (padded - this.margin.start) / (1 - (this.margin.start + this.margin.end)); + val = Math.max(val,0); + val = Math.min(val,1); + return val; + } + + //control video states + button.getPos = function(e){ + return this.addPadding(MistUtil.getPos(this,e)); + }; + //set volume + button.setVolume = function(e){ + MistVideo.player.api.muted = false; + + var val = this.removePadding(MistUtil.getPos(this,e)); + + val = 1 - Math.pow((1-val),0.5); //transform to quadratic range between 0 and 1 + MistVideo.player.api.volume = val; + try { + localStorage["mistVolume"] = MistVideo.player.api.volume; + } + catch (e) {} + }; + MistUtil.event.addListener(button,"mouseup",function(e){ + if (e.which != 1) { return;} //only respond to left mouse clicks + button.setVolume(e); + }); + + //hovering + var tooltip = MistVideo.UI.buildStructure({type:"tooltip"}); + tooltip.style.opacity = 0; + tooltip.triangle.setMode("bottom","right"); + container.style.position = "relative"; + container.appendChild(tooltip); + + MistUtil.event.addListener(button,"mouseover",function(){ + tooltip.style.opacity = 1; + }); + MistUtil.event.addListener(button,"mouseout",function(){ + if (!dragging) { tooltip.style.opacity = 0; } + }); + button.moveTooltip = function(e){ + tooltip.style.opacity = 1; + var pos = MistUtil.getPos(this,e); + tooltip.setText(Math.round(this.removePadding(pos)*100)+"%"); + tooltip.setPos({ + bottom: 46, + right: 100*(1-pos)+"%" + }); + }; + MistUtil.event.addListener(button,"mousemove",function(e){ + button.moveTooltip(e); + }); + + //dragging + var dragging = false; + MistUtil.event.addListener(button,"mousedown",function(e){ + if (e.which != 1) { return;} //only respond to left mouse clicks + dragging = true; + //button.set(button.getPos(e)*100); + button.setVolume(e); + tooltip.style.opacity = 1; + + var moveListener = MistUtil.event.addListener(document,"mousemove",function(e){ + //button.set(button.getPos(e)*100); + button.setVolume(e); + button.moveTooltip(e); + },button); + + var upListener = MistUtil.event.addListener(document,"mouseup",function(e){ + if (e.which != 1) { return;} //only respond to left mouse clicks + dragging = false; + + //remove mousemove and up + MistUtil.event.removeListener(moveListener); + MistUtil.event.removeListener(upListener); + + tooltip.style.opacity = 0; + + //trigger volumechange + if ((!e.path) || (MistUtil.array.indexOf(e.path,button) < 0)) { //it's not already triggered by onmouseup + button.setVolume(e); + } + },button); + }); + + + return container; + }, + currentTime: function(){ + var MistVideo = this; + + var container = document.createElement("div"); + var text = document.createTextNode(""); + container.appendChild(text); + + var video = MistVideo.player.api; + var formatTime = MistUtil.format.time; + container.set = function(){ + var v = MistVideo.player.api.currentTime; + text.nodeValue = formatTime(v); + }; + container.set(); + + MistUtil.event.addListener(MistVideo.video,"timeupdate",function(){ + container.set(); + },container); + MistUtil.event.addListener(MistVideo.video,"seeking",function(){ + container.set(); + },container); + + return container; + }, + totalTime: function(){ + var MistVideo = this; + + var container = document.createElement("div"); + var text = document.createTextNode(""); + container.appendChild(text); + + var video = this.player.api; + if (MistVideo.info.type == "live") { + text.nodeValue = "live"; + container.className = "live"; + } + else { + container.set = function(duration){ + if (isNaN(duration) || !isFinite(duration)) { + this.style.display = "none"; + return; + } + this.style.display = ""; + text.nodeValue = MistUtil.format.time(duration); + }; + + MistUtil.event.addListener(MistVideo.video,"durationchange",function(){ + var v = MistVideo.player.api.duration; + container.set(v); + },container); + } + + return container; + }, + playername: function(){ + if (!this.playerName || !(this.playerName in mistplayers)) { return; } + + var container = document.createElement("span"); + + container.appendChild(document.createTextNode(mistplayers[this.playerName].name)); + + return container; + }, + mimetype: function(){ + if (!this.source) { return; } + + var a = document.createElement("a"); + a.href = this.source.url; + a.target = "_blank"; + a.title = a.href+" ("+this.source.type+")"; + + a.appendChild(document.createTextNode(MistUtil.format.mime2human(this.source.type))); + + return a; + }, + logo: function(options){ + if ("element" in options) { + return options.element; + } + if ("src" in options) { + var img = document.createElement("img"); + img.src = options.src; + return img; + } + }, + settings: function(){ + var button = this.skin.icons.build("settings"); + + return button; + }, + loop: function(){ + if ((!("loop" in this.player.api)) || (this.info.type == "live")) { return; } + + var MistVideo = this; + var button = this.skin.icons.build("loop"); + + var video = this.video; + var api = this.player.api; + button.set = function(){ + if (api.loop) { + MistUtil.class.remove(this,"off"); + } + else { + MistUtil.class.add(this,"off"); + } + }; + + MistUtil.event.addListener(button,"click",function(e){ + api.loop = !api.loop; + this.set(); + }); + button.set(); + + return button; + }, + fullscreen: function(){ + if ((!("setSize" in this.player)) || (!this.info.hasVideo) || (this.source.type.split("/")[1] == "audio")) { return; } + + //determine which functions to use.. + var requestfuncs = ["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"]; + var funcs = false; + for (var i in requestfuncs) { + if (requestfuncs[i] in document.body) { + funcs = {}; + funcs.request = requestfuncs[i]; + + var cancelfuncs = ["exitFullscreen","webkitCancelFullScreen","mozCancelFullScreen","msExitFullscreen"]; + var elementfuncs = ["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"]; + var eventname = ["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"]; + funcs.cancel = cancelfuncs[i]; + funcs.element = elementfuncs[i]; + funcs.event = eventname[i]; + break; + } + } + if (!funcs) { return;} + + var button = this.skin.icons.build("fullscreen"); + var MistVideo = this; + + function onclick(){ + if (document[funcs.element]) { + document[funcs.cancel](); + } + else { + MistVideo.container[funcs.request](); + } + } + MistUtil.event.addListener(button,"click",onclick); + MistUtil.event.addListener(MistVideo.video,"dblclick",onclick); + MistUtil.event.addListener(document,funcs.event, function() { + if (document[funcs.element] == MistVideo.container) { + MistVideo.container.setAttribute("data-fullscreen",""); + } + else if (MistVideo.container.hasAttribute("data-fullscreen")) { + MistVideo.container.removeAttribute("data-fullscreen"); + } + MistVideo.player.resizeAll(); + },button); + + return button; + }, + tracks: function(){ + + if ((!this.info) || (!this.video)) { return; } + + var MistVideo = this; + var table = document.createElement("table"); + + function build(tracks) { + + //empty table + MistUtil.empty(table); + + tracks = MistUtil.tracks.parse(tracks); + + var selections = {}; + var checkboxes = {}; + + function changeToTracks(type,value){ + MistVideo.log("User selected "+type+" track with id "+value); + + if ("setTrack" in MistVideo.player.api) { + MistVideo.player.api.setTrack(type,value); + return; + } + + //gather what tracks we should use + var usetracks = {}; + for (var i in selections) { + if (i == "subtitle") { continue; } //subtitle tracks are handled seperately + usetracks[i] = selections[i].value; + } + usetracks[type] = value; + //use setTracks + if ("setTracks" in MistVideo.player.api) { + MistVideo.player.api.setTracks(usetracks); + } + //use setSource + if ("setSource" in MistVideo.player.api) { + MistVideo.player.api.setSource( + MistUtil.http.url.addParam(MistVideo.source.url,usetracks) + ); + } + } + + //sort the tracks to ["audio","video",..,"subtitle",..etc] + var tracktypes = MistUtil.object.keys(tracks,function(keya,keyb){ + function order(value) { + switch (value) { + case "audio": return "aaaaaaa"; + case "video": return "aaaaaab"; + default: return value; + } + } + if (order(keya) > order(keyb)) { return 1; } + if (order(keya) < order(keyb)) { return -1; } + return 0; + }); + for (var j in tracktypes) { + var type = tracktypes[j]; + var t = tracks[type]; + + if (type == "subtitle") { + if ((!("player" in MistVideo)) || (!("api" in MistVideo.player)) || (!("setSubtitle" in MistVideo.player.api))) { + //this player does not support adding subtitles, don't show track selection in the interface + MistVideo.log("Subtitle selection was disabled as this player does not support it."); + continue; + } + + //check if the VTT output is available + var subtitleSource = false; + for (var i in MistVideo.info.source) { + var source = MistVideo.info.source[i]; + //this is a subtitle source, and it's the same protocol (HTTP/HTTPS) as the video source + if ((source.type == "html5/text/vtt") && (MistUtil.http.url.split(source.url).protocol == MistUtil.http.url.split(MistVideo.source.url).protocol)) { + subtitleSource = source.url.replace(/.srt$/,".vtt"); + break; + } + } + + if (!subtitleSource) { + //if we can't find a subtitle output, don't show track selection in the interface + MistVideo.log("Subtitle selection was disabled as an SRT source could not be found."); + continue; + } + + //also add the option to disable subtitles + t[""] = { trackid: "", different: { none:"None" } }; + + } + + var tr = document.createElement("tr"); + tr.title = "The current "+type+" track"; + table.appendChild(tr); + + if ("decodingIssues" in MistVideo.skin.blueprints) { //this is dev mode + var cell = document.createElement("td"); + tr.appendChild(cell); + if (type != "subtitle") { + var checkbox = document.createElement("input"); + checkbox.setAttribute("type","checkbox"); + checkbox.setAttribute("checked",""); + checkbox.setAttribute("title","Whether or not to play "+type); + checkbox.trackType = type; + cell.appendChild(checkbox); + checkboxes[type] = checkbox; + + MistUtil.event.addListener(checkbox,"change",function(){ + //make sure at least one checkbox is checked + var n = 0; + for (var i in checkboxes) { + if (checkboxes[i].checked) { + n++; + } + } + if (n == 0) { + for (var i in checkboxes) { + if (i == this.trackType) { continue; } + if (!checkboxes[i].checked) { + checkboxes[i].checked = true; + break; + } + } + } + + var value = 0; + if (this.checked) { + if (this.trackType in selections) { + value = selections[this.trackType].value; + } + else { + value = "auto"; + } + } + else { + value = 0; + } + changeToTracks(this.trackType,(this.checked ? value : 0)); + }); + } + } + + var header = document.createElement("td"); + tr.appendChild(header); + header.appendChild(document.createTextNode(MistUtil.format.ucFirst(type)+":")); + var cell = document.createElement("td"); + tr.appendChild(cell); + var trackkeys = MistUtil.object.keys(t); + + //var determine the display info for the tracks + function orderValues(trackinfoobj) { + var order = { + width: 1, + bps: 2, + fpks: 4, + channels: 5, + rate: 7, + language: 0, + codec: 6 + }; + return MistUtil.object.values(trackinfoobj,function(keya,keyb,valuea,valueb){ + if (order[keya] > order[keyb]) { return 1; } + if (order[keya] < order[keyb]) { return -1; } + return 0; + }); + } + + //there is more than one track of this type, and the player supports switching tracks + if ((trackkeys.length > 1) && ("player" in MistVideo) && ("api" in MistVideo.player) && (("setTrack" in MistVideo.player.api) || ("setTracks" in MistVideo.player.api) || ("setSource" in MistVideo.player.api))) { + //show a select box + var select = document.createElement("select"); + select.title = "Select another "+type+" track"; + selections[type] = select; + select.trackType = type; + cell.appendChild(select); + + //display properties that are the same for all tracks + var same = orderValues(t[MistUtil.object.keys(t)[0]].same); + if (same.length) { + var span = document.createElement("span"); + span.className = "mistvideo-description"; + cell.appendChild(span); + cell.appendChild(document.createTextNode(same.join(" "))); + } + + + //add options to the select + var options = MistUtil.object.keys(t,true); //sort them + for (var i in options) { + var track = t[options[i]]; + var option = document.createElement("option"); + select.appendChild(option); + option.value = track.trackid; + if (MistUtil.object.keys(track.different).length) { + option.appendChild(document.createTextNode(orderValues(track.different).join(" "))); + } + else { + //all the tracks are the same as far as the metadata is concerned, just show a track number + option.appendChild(document.createTextNode("Track "+(Number(i)+1))); + } + } + if (type == "subtitle") { + MistUtil.event.addListener(select,"change",function(){ + try { + localStorage["mistSubtitleLanguage"] = t[this.value].lang; + } + catch (e) {} + + if (this.value != "") { + //gather metadata for this subtitle track here + var trackinfo = MistUtil.object.extend({},t[this.value]); + trackinfo.label = orderValues(trackinfo.describe).join(" "); + + trackinfo.src = MistUtil.http.url.addParam(subtitleSource,{track:this.value}); + MistVideo.player.api.setSubtitle(trackinfo); + } + else { + MistVideo.player.api.setSubtitle(); + } + }); + + //load last used language if available + if (("localStorage" in window) && (localStorage != null) && ("mistSubtitleLanguage" in localStorage)) { + for (var i in t) { + if (t[i].lang == localStorage["mistSubtitleLanguage"]) { + select.value = i; + + //trigger onchange + var e = document.createEvent("Event"); + e.initEvent("change"); + select.dispatchEvent(e); + break; + } + } + } + } + else { + MistUtil.event.addListener(select,"change",function(){ + if (this.trackType in checkboxes) { //this is dev mode + checkboxes[this.trackType].checked = true; + } + + changeToTracks(this.trackType,this.value); + + }); + + //set to the track that plays by default + if (MistVideo.info.type == "live") { + //for live, the default track is the highest index + select.value = MistUtil.object.keys(t).pop(); + } + else { + //for vod, the default track is the lowest index + select.value = MistUtil.object.keys(t).shift(); + } + + MistUtil.event.addListener(MistVideo.video,"playerUpdate_trackChanged",function(e){ + + if (e.message.type != type) { return; } + select.value = e.message.trackid; + MistVideo.log("Player selected "+type+" track with id "+e.message.trackid); + + },select); + } + } + else { + //show as text + var span = document.createElement("span"); + span.className = "mistvideo-description"; + cell.appendChild(span); + span.appendChild(document.createTextNode(orderValues(t[trackkeys[0]].same).join(" "))); + } + } + + } + build(this.info.meta.tracks); + MistUtil.event.addListener(MistVideo.video,"metaUpdate_tracks",function(e){ + + //reconstruct track selection interface + build(e.message.meta.tracks); + + },table); + + return table; + }, + text: function(options){ + var container = document.createElement("span"); + + container.appendChild(document.createTextNode(options.text)); + + return container; + }, + placeholder: function(){ + var placeholder = document.createElement("div"); + var size = this.calcSize(); + placeholder.style.width = size.width+"px"; + placeholder.style.height = size.height+"px"; + if (this.options.poster) placeholder.style.background = "url('"+this.options.poster+"') no-repeat 50%/contain"; + + return placeholder; + }, + timeout: function(options){ + if (!"function" in options) { return; } + var delay = ("delay" in options ? options.delay : 5); + + var icon = this.skin.icons.build("timeout",false,{delay:delay}); + + icon.timeout = this.timers.start(function(){ + options.function(); + },delay*1e3); + + return icon; + }, + polling: function(){ + var div = document.createElement("div"); + var icon = this.skin.icons.build("loading"); + div.appendChild(icon); + return div; + }, + loading: function(){ + var MistVideo = this; + var icon = this.skin.icons.build("loading",50); + + if (("player" in MistVideo) && (MistVideo.player.api)) { + var timer = false; + function addIcon(e){ + MistVideo.container.setAttribute("data-loading",e.type); + checkIfOk(); + } + function removeIcon(){ + MistVideo.container.removeAttribute("data-loading"); + if (timer) { MistVideo.timers.stop(timer); } + timer = false; + } + function checkIfOk(){ + if (!timer) { + //if everything is playing fine, remove the icon + timer = MistVideo.timers.start(function(){ + timer = false; + if ((MistVideo.monitor.vars) && (MistVideo.monitor.vars.score >= 0.999)) { //it's playing just fine + removeIcon(); + } + else { + checkIfOk(); + } + },1e3); + } + } + + //add loading icon + var events = ["waiting","seeking","stalled"]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(e){ + if ((!this.paused) && ("container" in MistVideo)) { + addIcon(e); + } + },icon); + } + //remove loading icon + var events = ["seeked","playing","canplay","paused"]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(e){ + if ("container" in MistVideo) { + removeIcon(); + } + },icon); + MistUtil.event.addListener(MistVideo.video,"progress",function(e){ + if (("container" in MistVideo) && ("monitor" in MistVideo) && ("vars" in MistVideo.monitor) && ("score" in MistVideo.monitor.vars) && (MistVideo.monitor.vars.score > 0.99)) { + removeIcon(); + } + },icon); + } + + } + + return icon; + }, + error: function(){ + var MistVideo = this; + var container = document.createElement("div"); + container.message = function(message,details,options){ + MistUtil.empty(this); + var message_container = document.createElement("div"); + message_container.className = "message"; + this.appendChild(message_container); + + if (!options.polling && !options.passive) { + var header = document.createElement("h3"); + message_container.appendChild(header); + header.appendChild(document.createTextNode("The player has encountered a problem")); + } + + var p = document.createElement("p"); + message_container.appendChild(p); + message_container.update = function(message){ + MistUtil.empty(p); + p.appendChild(document.createTextNode(message)); + }; + if (message) { + if (MistVideo.info.on_error) { + message = MistVideo.info.on_error.replace(/\<error>/,message); + } + + message_container.update(message); + + var d = document.createElement("p"); + d.className = "details mistvideo-description"; + message_container.appendChild(d); + + if (details) { + d.appendChild(document.createTextNode(details)); + } + else if ("decodingIssues" in MistVideo.skin.blueprints) { //dev mode + if (("player" in MistVideo) && ("api" in MistVideo.player)) { + details = []; + if (typeof MistVideo.player.api.currentTime != "undefined") { + details.push(["Current video time:",MistUtil.format.time(MistVideo.player.api.currentTime)]); + } + if (("video" in MistVideo) && ("getVideoPlaybackQuality" in MistVideo.video)) { + var data = MistVideo.video.getVideoPlaybackQuality(); + if (("droppedVideoFrames" in data) && ("totalVideoFrames" in data) && (data.totalVideoFrames)) { + details.push(["Frames dropped/total:",MistUtil.format.number(data.droppedVideoFrames)+"/"+MistUtil.format.number(data.totalVideoFrames)]); + } + if (("corruptedVideoFrames" in data) && (data.corruptedVideoFrames)) { + details.push(["Corrupted frames:",MistUtil.format.number(data.corruptedVideoFrames)]); + } + } + var networkstates = { + 0: ["NETWORK EMPTY:","not yet initialized"], + 1: ["NETWORK IDLE:","resource selected, but not in use"], + 2: ["NETWORK LOADING:","data is being downloaded"], + 3: ["NETWORK NO SOURCE:","could not locate source"] + }; + details.push(networkstates[MistVideo.video.networkState]); + var readystates = { + 0: ["HAVE NOTHING:","no information about ready state"], + 1: ["HAVE METADATA:","metadata has been loaded"], + 2: ["HAVE CURRENT DATA:","data for the current playback position is available, but not for the next frame"], + 3: ["HAVE FUTURE DATA:","data for current and next frame is available"], + 4: ["HAVE ENOUGH DATA:","can start playing"] + }; + details.push(readystates[MistVideo.video.readyState]); + + if (!options.passive) { + var table = document.createElement("table") + for (var i in details) { + var tr = document.createElement("tr"); + table.appendChild(tr); + for (var j in details[i]) { + var td = document.createElement("td"); + tr.appendChild(td); + td.appendChild(document.createTextNode(details[i][j])); + } + } + d.appendChild(table); + } + } + var c = document.createElement("div"); + c.className = "mistvideo-container mistvideo-column"; + c.style.textAlign = "left"; + c.style.marginBottom = "1em"; + message_container.appendChild(c); + var s = MistVideo.UI.buildStructure({type:"forcePlayer"}); + if (s) { c.appendChild(s); } + var s = MistVideo.UI.buildStructure({type:"forceType"}); + if (s) { c.appendChild(s); } + } + + } + + return message_container; + }; + + var countdown = false; + var showingError = false; + var since = false; + var message_global; + var ignoreThese = {}; + + //add control functions to overall MistVideo object + this.showError = function(message,options){ + if (!options) { + options = { + softReload: true, + reload: true,//(MistVideo.options.reloadDelay ? MistVideo.options.reloadDelay : 10), + nextCombo: !!MistVideo.info, + polling: false, + passive: false + }; + } + + + var identifyer = (options.type ? options.type : message); + if (identifyer in ignoreThese) { return; } + + if (options.reload === true) { + if ((MistVideo.options.reloadDelay) && (!isNaN(Number(MistVideo.options.reloadDelay)))) { + options.reload = Number(MistVideo.options.reloadDelay); + } + else { + options.reload = 10; + } + } + if (options.passive) { + if (showingError === true) { return; } + if (showingError) { + //only update the text, not the buttons or their countdowns + message_global.update(message); + since = (new Date()).getTime(); + return; + } + container.setAttribute("data-passive",""); + } + else { + container.removeAttribute("data-passive"); + } + + showingError = (options.passive ? "passive" : true); + since = (new Date()).getTime(); + + + this.log(message,"error"); + var message_container = container.message(message,false,options); + message_global = message_container; + + var button_container = document.createElement("div"); + button_container.className = "mistvideo-buttoncontainer"; + message_container.appendChild(button_container); + + MistUtil.empty(button_container); + if (options.softReload) { + var obj = { + type: "button", + label: "Reload video", + onclick: function(){ + MistVideo.player.api.load(); + } + }; + if (!isNaN(options.softReload+"")) { obj.delay = options.softReload; } + button_container.appendChild(MistVideo.UI.buildStructure(obj)); + } + if (options.reload) { + var obj = { + type: "button", + label: "Reload player", + onclick: function(){ + MistVideo.reload(); + } + }; + if (!isNaN(options.reload+"")) { obj.delay = options.reload; } + button_container.appendChild(MistVideo.UI.buildStructure(obj)); + } + if (options.nextCombo) { + var obj = { + type: "button", + label: "Next source", + onclick: function(){ + MistVideo.nextCombo(); + } + }; + if (!isNaN(options.nextCombo+"")) { obj.delay = options.nextCombo; } + button_container.appendChild(MistVideo.UI.buildStructure(obj)); + } + if (options.ignore) { + var obj = { + type: "button", + label: "Ignore", + onclick: function(){ + this.clearError(); + ignoreThese[identifyer] = true; + //stop showing this error + } + }; + if (!isNaN(options.ignore+"")) { obj.delay = options.ignore; } + button_container.appendChild(MistVideo.UI.buildStructure(obj)); + } + if (options.polling) { + button_container.appendChild(MistVideo.UI.buildStructure({type:"polling"})); + } + + MistUtil.class.add(container,"show"); + if ("container" in MistVideo) { + MistVideo.container.removeAttribute("data-loading"); + } + }; + container.clear = function(message){ + var countdowns = container.querySelectorAll("svg.icon.timeout"); + for (var i = 0; i < countdowns.length; i++) { + MistVideo.timers.stop(countdowns[i].timeout); + } + + MistUtil.empty(container); + MistUtil.class.remove(container,"show"); + + showingError = false; + }; + this.clearError = container.clear; + + //listener to clear error window + if ("video" in MistVideo) { + var events = ["timeupdate","playing","canplay"];//,"progress"]; + for (var i in events) { + MistUtil.event.addListener(MistVideo.video,events[i],function(e){ + if (!showingError) { return; } + if (e.type == "timeupdate") { + if (MistVideo.player.api.currentTime == 0) { return; } + if (((new Date()).getTime() - since) < 2e3) { return; } + } + MistVideo.log("Removing error window because of "+e.type+" event"); + container.clear(); + },container); + } + } + + return container; + }, + tooltip: function(){ + var container = document.createElement("div"); + + var textNode = document.createTextNode(""); + container.appendChild(textNode); + container.setText = function(text){ + textNode.nodeValue = text; + }; + + var triangle = document.createElement("div"); + container.triangle = triangle; + triangle.className = "triangle"; + container.appendChild(triangle); + triangle.setMode = function(primary,secondary){ + if (!primary) { primary = "bottom"; } + if (!secondary) { secondary = "left"; } + + //reset styles + var sides = ["bottom","top","right","left"]; + for (var i in sides) { + this.style[sides[i]] = ""; //bottom + var cap = MistUtil.format.ucFirst(sides[i]); + this.style["border"+cap] = ""; //borderBottom + this.style["border"+cap+"Color"] = ""; //borderBottomColor + } + + var opposite = { + top: "bottom", + bottom: "top", + left: "right", + right: "left" + }; + + //set styles + this.style[primary] = "-10px"; //bottom + this.style["border"+MistUtil.format.ucFirst(opposite[primary])] = "none"; //borderTop + this.style["border"+MistUtil.format.ucFirst(primary)+"Color"] = "transparent"; //borderBottomColor + this.style[secondary] = 0; //left + this.style["border"+MistUtil.format.ucFirst(opposite[secondary])] = "none"; //borderRight + }; + + container.setPos = function(pos){ + + //also apply the "other" values, to reset if direction mode is switched + var set = { + left: "auto", + right: "auto", + top: "auto", + bottom: "auto" + }; + MistUtil.object.extend(set,pos); + + for (var i in set) { + if (!isNaN(set[i])) { set[i] += "px"; } //add px if the value is a number + this.style[i] = set[i]; + } + }; + + return container; + }, + button: function(options){ //label,onclick,timeout){ + var button = document.createElement("button"); + var MistVideo = this; + + if (options.onclick) { + MistUtil.event.addListener(button,"click",function(){ + options.onclick.call(MistVideo,arguments); + }); + + if (options.delay) { + var countdown = this.UI.buildStructure({ + type: "timeout", + delay: options.delay, + function: options.onclick + }); + if (countdown) { + button.appendChild(countdown); + } + } + } + + button.appendChild(document.createTextNode(options.label)); + + return button; + } + + }, + colors: { + fill: "#fff", + semiFill: "rgba(255,255,255,0.5)", + stroke: "#fff", + strokeWidth: 1.5, + background: "rgba(0,0,0,0.8)", + progressBackground: "#333", + accent: "#0f0" + } +}; + +MistSkins.dev = { + structure: MistUtil.object.extend({},MistSkins["default"].structure,true), + blueprints: { + timeout: function(){ //don't use countdowns on buttons + return false; + }, + log: function(){ + var container = document.createElement("div"); + container.appendChild(document.createTextNode("Logs")); + var logsc = document.createElement("div");//scroll this + logsc.className = "logs"; + container.appendChild(logsc); + var logs = document.createElement("table"); + logsc.appendChild(logs); + + var MistVideo = this; + var lastmessage = {message: false}; + var count = false; + var scroll = true; + function addMessage(time,message,data) { + if (!data) { data = {}; } + + if (lastmessage.message == message) { + count++; + + lastmessage.counter.nodeValue = count; + if ((count == 2) && (lastmessage.counter.parentElement)) { + lastmessage.counter.parentElement.style.display = ""; + } + + return; + } + + count = 1; + + var entry = document.createElement("tr"); + entry.className = "entry"; + if ((data.type) && (data.type != "log")) { + MistUtil.class.add(entry,"type-"+data.type); + message = MistUtil.format.ucFirst(data.type)+": "+message; + } + logs.appendChild(entry); + + var timestamp = document.createElement("td"); + timestamp.className = "timestamp"; + entry.appendChild(timestamp); + var stamp = time.toLocaleTimeString(); //get current time in local format + //add miliseconds + var t = stamp.split(" "); + t[0] += "."+("00"+time.getMilliseconds()).slice(-3); + //t = t.join(" "); + timestamp.appendChild(document.createTextNode(t[0])); + if ("currentTime" in data) { + timestamp.title = "Video playback time: "+MistUtil.format.time(data.currentTime,{ms:true}); + } + + var td = document.createElement("td"); + entry.appendChild(td); + var msg = document.createElement("span"); + msg.className = "message"; + td.appendChild(msg); + msg.appendChild(document.createTextNode(message)); + + var counter = document.createElement("span"); + counter.style.display = "none"; + counter.className = "counter"; + td.appendChild(counter); + var countnode = document.createTextNode(count); + counter.appendChild(countnode); + + if (scroll) { logsc.scrollTop = logsc.scrollHeight; } + + lastmessage = {message: message, counter: countnode}; + } + + MistUtil.event.addListener(logsc,"scroll",function(){ + //console.log(logsc.scrollTop + logsc.clientHeight,logsc.scrollHeight); + if (logsc.scrollTop + logsc.clientHeight >= logsc.scrollHeight - 5) { + scroll = true; + } + else { + scroll = false; + } + //console.log(scroll); + }) + + //add previously generated log messages + for (var i in MistVideo.logs) { + addMessage(MistVideo.logs[i].time,MistVideo.logs[i].message,MistVideo.logs[i].data); + } + + MistUtil.event.addListener(MistVideo.options.target,"log",function(e){ + if (!e.message) { return; } + var data = {}; + if (MistVideo.player && MistVideo.player.api && ("currentTime" in MistVideo.player.api)) { + data.currentTime = MistVideo.player.api.currentTime; + } + addMessage(new Date(),e.message,data); + },container); + MistUtil.event.addListener(MistVideo.options.target,"error",function(e){ + if (!e.message) { return; } + var data = {type:"error"}; + if (MistVideo.player && MistVideo.player.api && ("currentTime" in MistVideo.player.api)) { + data.currentTime = MistVideo.player.api.currentTime; + } + addMessage(new Date(),e.message,data); + },container); + + return container; + }, + decodingIssues: function(){ + if (!this.player) { return; } + + var MistVideo = this; + var container = document.createElement("div"); + + function buildItem(options){ + var label = document.createElement("label"); + container.appendChild(label); + label.style.display = "none"; + + var text = document.createElement("span"); + label.appendChild(text); + text.appendChild(document.createTextNode(options.name+":")); + text.className = "mistvideo-description"; + + var valuec = document.createElement("span"); + label.appendChild(valuec); + var value = document.createTextNode((options.value ? options.value : "")); + valuec.appendChild(value); + var ele = document.createElement("span"); + valuec.appendChild(ele); + + label.set = function(val){ + if (val !== 0) { this.style.display = ""; } + if (typeof val == "object") { + if ("val" in val) { + value.nodeValue = val.val; + valuec.className = "value"; + } + //is there a graph already? + if (ele.children.length) { + var graph = ele.children[0]; + return graph.addData(val); + } + else { + //create a graph + var graph = MistUtil.createGraph({x:[val.x],y:[val.y]},val.options); + + //it's (probably) a DOM element, insert it + ele.style.display = ""; + MistUtil.empty(ele); + return ele.appendChild(graph); + } + } + return value.nodeValue = val; + }; + + container.appendChild(label); + updates.push(function(){ + var result = options.function(); + label.set(result); + }); + } + + if (MistVideo.player.api) { + var videovalues = { + "Playback score": function(){ + if ("monitor" in MistVideo) { + if (("vars" in MistVideo.monitor) && ("score" in MistVideo.monitor.vars)) { + if (MistVideo.monitor.vars.values.length) { + var last = MistVideo.monitor.vars.values[MistVideo.monitor.vars.values.length - 1]; + if ("score" in last) { + var score = Math.min(1,Math.max(0,last.score)); + return { + x: last.clock, + y: Math.min(1,Math.max(0,last.score)), + options: { + y: { + min: 0, + max: 1 + }, + x: { + count: 10 + } + }, + val: Math.round(Math.min(1,Math.max(0,MistVideo.monitor.vars.score))*100)+"%" + }; + } + } + } + return 0; + } + }, + "Corrupted frames": function(){ + if ((MistVideo.player.api) && ("getVideoPlaybackQuality" in MistVideo.player.api)) { + var r = MistVideo.player.api.getVideoPlaybackQuality(); + if (r) { + if (r.corruptedVideoFrames) { + return { + val: MistUtil.format.number(r.corruptedVideoFrames), + x: (new Date()).getTime()*1e-3, + y: r.corruptedVideoFrames, + options: { + x: { count: 10 } + } + }; + } + return 0; + } + } + }, + "Dropped frames": function(){ + if ((MistVideo.player.api) && ("getVideoPlaybackQuality" in MistVideo.player.api)) { + var r = MistVideo.player.api.getVideoPlaybackQuality(); + if (r) { + if (r.droppedVideoFrames) { + return MistUtil.format.number(r.droppedVideoFrames); + /* show a graph: return { + val: MistUtil.format.number(r.droppedVideoFrames), + x: (new Date()).getTime()*1e-3, + y: r.droppedVideoFrames, + options: { + x: { count: 10 }, + differentiate: true, + reverseGradient: true + } + };*/ + } + return 0; + } + } + }, + "Total frames": function(){ + if ((MistVideo.player.api) && ("getVideoPlaybackQuality" in MistVideo.player.api)) { + var r = MistVideo.player.api.getVideoPlaybackQuality(); + if (r) { return MistUtil.format.number(r.totalVideoFrames); } + } + }, + "Decoded audio": function(){ + if (MistVideo.player.api) { + return MistUtil.format.bytes(MistVideo.player.api.webkitAudioDecodedByteCount); + } + }, + "Decoded video": function(){ + if (MistVideo.player.api) { + return MistUtil.format.bytes(MistVideo.player.api.webkitVideoDecodedByteCount); + } + }, + "Negative acknowledgements": function(){ + if (MistVideo.player.api) { + return MistUtil.format.number(MistVideo.player.api.nackCount); + } + }, + "Picture losses": function(){ + return MistUtil.format.number(MistVideo.player.api.pliCount); + }, + "Packets lost": function(){ + return MistUtil.format.number(MistVideo.player.api.packetsLost); + }, + "Packets received": function(){ + return MistUtil.format.number(MistVideo.player.api.packetsReceived); + }, + "Bytes received": function(){ + if (MistVideo.player.api) { + return MistUtil.format.bytes(MistVideo.player.api.bytesReceived); + } + } + }; + var updates = []; + for (var i in videovalues) { + if (typeof videovalues[i]() == "undefined") { continue; } + buildItem({ + name: i, + function: videovalues[i] + }); + } + container.update = function(){ + for (var i in updates) { + updates[i](); + } + MistVideo.timers.start(function(){ + container.update(); + },1e3); + }; + container.update(); + } + + return container; + }, + forcePlayer: function(){ + var container = document.createElement("label"); + container.title = "Reload MistVideo and use the selected player"; + var MistVideo = this; + + var s = document.createElement("span"); + container.appendChild(s); + s.appendChild(document.createTextNode("Force player: ")); + + var select = document.createElement("select"); + container.appendChild(select); + var option = document.createElement("option"); + select.appendChild(option); + option.value = ""; + option.appendChild(document.createTextNode("Automatic")); + for (var i in mistplayers) { + var option = document.createElement("option"); + select.appendChild(option); + option.value = i; + option.appendChild(document.createTextNode(mistplayers[i].name)); + + } + + if (this.options.forcePlayer) { select.value = this.options.forcePlayer; } + + MistUtil.event.addListener(select,"change",function(){ + MistVideo.options.forcePlayer = (this.value == "" ? false : this.value); + if (MistVideo.options.forcePlayer != MistVideo.playerName) { //only reload if there is a change + MistVideo.reload(); + } + }); + + return container; + }, + forceType: function(){ + if (!this.info) { return; } + + var container = document.createElement("label"); + container.title = "Reload MistVideo and use the selected protocol"; + var MistVideo = this; + + var s = document.createElement("span"); + container.appendChild(s); + s.appendChild(document.createTextNode("Force protocol: ")); + + var select = document.createElement("select"); + container.appendChild(select); + var option = document.createElement("option"); + select.appendChild(option); + option.value = ""; + option.appendChild(document.createTextNode("Automatic")); + var sofar = {}; + for (var i in MistVideo.info.source) { + var source = MistVideo.info.source[i]; + + //skip doubles + if (source.type in sofar) { continue; } + sofar[source.type] = 1; + + var option = document.createElement("option"); + select.appendChild(option); + option.value = source.type; + option.appendChild(document.createTextNode(MistUtil.format.mime2human(source.type))); + } + + if (this.options.forceType) { select.value = this.options.forceType; } + + MistUtil.event.addListener(select,"change",function(){ + MistVideo.options.forceType = (this.value == "" ? false : this.value); + if ((!MistVideo.source) || (MistVideo.options.forceType != MistVideo.source.type)) { //only reload if there is a change + MistVideo.reload(); + } + }); + + return container; + }, + forceSource: function(){ + var container = document.createElement("label"); + container.title = "Reload MistVideo and use the selected source"; + var MistVideo = this; + + var s = document.createElement("span"); + container.appendChild(s); + s.appendChild(document.createTextNode("Force source: ")); + + var select = document.createElement("select"); + container.appendChild(select); + var option = document.createElement("option"); + select.appendChild(option); + option.value = ""; + option.appendChild(document.createTextNode("Automatic")); + for (var i in MistVideo.info.source) { + var source = MistVideo.info.source[i]; + var option = document.createElement("option"); + select.appendChild(option); + option.value = i; + option.appendChild(document.createTextNode(source.url+" ("+MistUtil.format.mime2human(source.type)+")")); + } + + if (this.options.forceSource) { select.value = this.options.forceSource; } + + MistUtil.event.addListener(select,"change",function(){ + MistVideo.options.forceSource = (this.value == "" ? false : this.value); + if (MistVideo.options.forceSource != MistVideo.source.index) { //only reload if there is a change + MistVideo.reload(); + } + }); + + return container; + } + } +}; + +//MistSkins.dev.css = MistUtil.object.extend(MistSkins["default"].css); +MistSkins.dev.css = {skin: misthost+"/skins/dev.css"}; +//prepend dev tools to settings window +MistSkins.dev.structure.submenu = MistUtil.object.extend({},MistSkins["default"].structure.submenu,true); +MistSkins.dev.structure.submenu.type = "draggable"; +MistSkins.dev.structure.submenu.style.width = "25em"; +MistSkins.dev.structure.submenu.children.unshift({ + type: "container", + style: { flexShrink: 1 }, + classes: ["mistvideo-column"], + children: [ + { + if: function(){ + return (this.playerName && this.source) + }, + then: { + type: "container", + classes: ["mistvideo-description"], + style: { display: "block" }, + children: [ + {type: "playername", style: { display: "inline" }}, + {type: "text", text: "is playing", style: {margin: "0 0.2em"}}, + {type: "mimetype"} + ] + } + }, + {type:"log"}, + {type:"decodingIssues"}, + { + type: "container", + classes: ["mistvideo-column","mistvideo-devcontrols"], + style: {"font-size":"0.9em"}, + children: [ + { + type: "text", + text: "Player control" + },{ + type: "container", + classes: ["mistvideo-devbuttons"], + style: {"flex-wrap": "wrap"}, + children: [ + { + if: function(){ return !!(this.player && this.player.api); }, + then: { + type: "button", + title: "Reload the video source", + label: "video.load();", + onclick: function(){ + this.player.api.load(); + } + } + },{ + type: "button", + title: "Build MistVideo again", + label: "MistVideo.reload();", + onclick: function(){ + this.reload(); + } + },{ + type: "button", + title: "Switch to the next available player and source combination", + label: "MistVideo.nextCombo();", + onclick: function(){ + this.nextCombo(); + } + } + ] + }, + {type:"forcePlayer"}, + {type:"forceType"}//, + //{type:"forceSource"} + ] + } + ] +}); + +// a skin has a structure +// a skin has formatting rules +// a skin has blueprints that build element types +function MistSkin(MistVideo) { + MistVideo.skin = this; + + this.applySkinOptions = function(skinOptions) { + if ((typeof skinOptions == "string") && (skinOptions in MistSkins)) { skinOptions = MistUtil.object.extend({},MistSkins[skinOptions],true); } + + var skinParent; + if (("inherit" in skinOptions) && (skinOptions.inherit)) { + skinParent = this.applySkinOptions(skinOptions.inherit); + } + else { + skinParent = MistSkins.default; + } + + //structure should be shallow extended + this.structure = MistUtil.object.extend({},skinParent.structure); + if (skinOptions && ("structure" in skinOptions)) { + MistUtil.object.extend(this.structure,skinOptions.structure); + } + + //blueprints should be shallow extended + this.blueprints = MistUtil.object.extend({},skinParent.blueprints); + if (skinOptions && ("blueprints" in skinOptions)) { + MistUtil.object.extend(this.blueprints,skinOptions.blueprints); + } + + //icons should be shallow extended + this.icons = MistUtil.object.extend({},skinParent.icons,true); + if (skinOptions && ("icons" in skinOptions)) { + MistUtil.object.extend(this.icons.blueprints,skinOptions.icons); + } + this.icons.build = function(type,size,options){ + if (!size) { size = 22; } + + //return an svg + + var d = this.blueprints[type]; + var svg; + if (typeof d.svg == "function") { + svg = d.svg.call(MistVideo,options); + } + else { + svg = d.svg; + } + + if (typeof size != "object") { + size = { + height: size, + width: size + }; + } + + if (typeof d.size != "object") { + d.size = { + height: d.size, + width: d.size + }; + } + if ((!("width" in size) && ("height" in size)) || (!("height" in size) && ("width" in size))) { + if ("width" in size) { + size.height = size.width * d.size.height / d.size.width; + } + if ("height" in size) { + size.width = size.height * d.size.width / d.size.height; + } + } + + var str = ""; + str += '<svg viewBox="0 0 '+d.size.width+' '+d.size.height+'"'+("width" in size ? ' width="'+size.width+'"' : "")+("height" in size ? ' height="'+size.height+'"' : "")+' class="mist icon '+type+'">'; + str += '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="100%" width="100%">'; + str += svg; + str += '</svg>'; + str += '</svg>'; + + var container = document.createElement("div"); + container.innerHTML = str; + + return container.firstChild; + } + + //colors should be deep extended + this.colors = MistUtil.object.extend({},skinParent.colors); + if (skinOptions && ("colors" in skinOptions)) { + MistUtil.object.extend(this.colors,skinOptions.colors,true); + } + + //apply "general" css and skin specific css to structure + this.css = MistUtil.object.extend({},skinParent.css); + if (skinOptions && ("css" in skinOptions)) { + MistUtil.object.extend(this.css,skinOptions.css); + } + + return this; + } + this.applySkinOptions("skin" in MistVideo.options ? MistVideo.options.skin : "default"); + + //load css + var styles = []; + var toload = 0; + for (var i in this.css) { + if (typeof this.css[i] == "string") { + styles.push(MistUtil.css.load(MistVideo.urlappend(this.css[i]),this.colors)); + } + } + this.css = styles; //overwrite + + return; +} diff --git a/embed/skins/default.css b/embed/skins/default.css new file mode 100644 index 00000000..2632b215 --- /dev/null +++ b/embed/skins/default.css @@ -0,0 +1,131 @@ +.mistvideo { + line-height: 1.2; + font-size: 14.5px; +} +.mistvideo svg { + margin: 2.5px; +} +.mistvideo-background { background-color: $background; } +.mistvideo-totalTime:before { + content: '/'; + margin: 0.2em; +} +.mistvideo-progress { + padding: 10px 0; + margin: -10px 0; + z-index: 2; /*keep above control bar*/ +} +.mistvideo-progress > * { + height: 2px; + background-color: $progressBackground; + opacity: 0.95; + position: relative; +} +.mistvideo-novideo .mistvideo-progress > *, +.mistvideo-progress:hover > * { + height: 10px; +} + +.mistvideo-progress:not(:hover) > * { + transition: height 0.25s ease-in 0.5s; +} +.mistvideo-progress .bar { + height: inherit; + width: 0; + position: absolute; + border-right: inherit; + background-color: $accent; + z-index: 2; /*keep above buffer bar(s)*/ +} +.mistvideo-progress .buffer { + height: inherit; + width: 0; + position: absolute; + background-color: $semiFill; +} +.mistvideo-progress .bar:after { + content: ''; + border: 5px solid $accent; + border-radius: 5px; + position: absolute; + right: -5px; + top: 50%; + transform: translateY(-50%); +} + +.mistvideo-play[data-state="playing"] svg.play { + display: none; +} +.mistvideo-play[data-state="paused"] svg.pause { + display: none; +} +.mistvideo-main { align-items: center; } + +svg.icon.timeout { + display: inline-block; + height: 1em; + width: 1em; + margin: 0; + margin-right: 0.25em; + vertical-align: top; +} + +.mist.largeplay, .mist.muted { + position: absolute; + opacity: 0.5; +} +.mist.largeplay { + top: 50%; + left: 0; + right: 0; + margin: auto; + transform: translateY(-50%); +} +.mist.muted { + top: 0; + right: 0; + margin: 1em; +} +.mistvideo-secondaryVideo { + z-index: 1; + width: 50%; + height: 50%; +} +.mistvideo-polling { + display: inline-block; + position: relative; + width: 25px; + height: 25px; +} +.mistvideo-polling svg.icon.loading { + z-index: 0; + opacity: 1; +} +.mistvideo[data-show-submenu] .mistvideo-submenu { + right: 5px; +} +.mistvideo[data-show-submenu] .mistvideo-controls { + bottom: 0; +} +.mistvideo-error[data-passive] { + bottom: auto; + left: auto; + margin: 0.5em; + padding: 0.5em; +} +.mistvideo-error[data-passive] .message { + max-width: none; +} +.mistvideo-error .mistvideo-buttoncontainer { + display: flex; + flex-flow: row nowrap; + justify-content: center; +} +.mistvideo-error .mistvideo-buttoncontainer .mistvideo-button { + white-space: nowrap; +} +.browser-ie .mist.icon.loading { + animation: spin 1.5s infinite linear; + transform-origin: 50% 50%; +} +.browser-ie .mist.icon.loading .spin { animation: none; } diff --git a/embed/skins/dev.css b/embed/skins/dev.css new file mode 100644 index 00000000..19197adb --- /dev/null +++ b/embed/skins/dev.css @@ -0,0 +1,105 @@ +.mistvideo-log { + margin: 0.5em 0; +} +.mistvideo-log .logs { + max-height: 10em; + min-height: 5em; + width: 100%; + padding: 0.2em 0; + padding-right: 1em; /*for scrollbar*/ + overflow-y: auto; + overflow-x: hidden; + font-size: 0.9em; +} +.mistvideo-log .logs table td { + vertical-align: top; + padding: 0; +} +.mistvideo-log .logs .entry .message { + margin: 0 0.2em; +} +.mistvideo-log .logs .entry.type-error { + color: $accent; +} +.mistvideo-log .logs .timestamp, +.mistvideo-log .logs .counter { + color: $semiFill; +} +.mistvideo-log .logs .timestamp:before { content: '['; } +.mistvideo-log .logs .timestamp:after { content: ']'; } +.mistvideo-log .logs .counter:before { content: '('; } +.mistvideo-log .logs .counter:after { content: '\00d7)'; } + +.mistvideo-devbuttons { font-size: 0.9em; } +.mistvideo-devbuttons button { + font-size: 0.8em; + margin: 0.1em; + padding: 0.2em 0.4em; +} +.mistvideo-forceSource > span, +.mistvideo-forceType > span, +.mistvideo-forcePlayer > span { display: inline-block; width: 7em; } +.mistvideo-forceSource > select, +.mistvideo-forceType > select, +.mistvideo-forcePlayer > select { + width: 15em; + min-width: auto; +} +.mistvideo-devcontrols { + margin: 0.5em 0; +} + +.mistvideo-decodingIssues > * { + display: flex; + width: 50%; + max-width: 20em; + flex-flow: row nowrap; + align-items: flex-end; + justify-content: space-between; +} +.mistvideo-decodingIssues > * > :last-child { + margin-right: 0.5em; +} +.mistvideo-decodingIssues { + display: flex; + flex-flow: row wrap; + justify-content: space-between; +} +.mistvideo-decodingIssues label { + position: relative; +} +.mistvideo-decodingIssues label .value { + font-size: 0.8em; +} +svg.icon.graph { + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 6em; +} +select { + border-radius: 0; +} +input[type="checkbox"] { + margin: 0; + margin-right: 0.2em; + border: 1px solid $semiFill; + border-radius: 0; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + width: 0.8em; + height: 0.8em; + color: inherit; + position: relative; + cursor: pointer; +} +input[type="checkbox"]:checked:after { + content: "\2713"; + position: absolute; + bottom: -0.2em; + left: 0; + font-size: 1.2em; +} diff --git a/embed/skins/general.css b/embed/skins/general.css new file mode 100644 index 00000000..0f968138 --- /dev/null +++ b/embed/skins/general.css @@ -0,0 +1,224 @@ +.mistvideo { + display: inline-block; + position: relative; + color: $stroke; + font-family: sans-serif; + background-color: #000; + justify-content: center; + align-items: center; +} +.mistvideo-controls { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.mistvideo.novideo { + overflow: visible; +} +.mistvideo-video { + overflow: hidden; +} +svg.icon.loading { + z-index: -1; /* don't use display: none because of transition for [data-loading=stalled] */ + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin: auto; + opacity: 0; +} +[data-loading] { + position: relative; +} + +/*wait before showing icon when stalled*/ +[data-loading="stalled"] svg.icon.loading { + transition: opacity 0s 3s; +} +[data-loading] svg.icon.loading { + z-index: 2; + opacity: 1; +} +[data-loading-css] .mistvideo-controls { + display: none; +} +[data-hidecursor], +[data-hidecursor] .mistvideo-pointer, +[data-hidecursor] * +{ cursor: none } +.mistvideo-error { + display: none; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: $background; + align-items: center; + justify-content: center; + text-align: center; + z-index: 2; /*above progress bar*/ + cursor: default; /*cursor won't show up if it was hidden because the mousemove event can no longer reach the video element*/ + min-height: fit-content; /*overflow if needed*/ + min-width: fit-content; +} +.mistvideo-error.show { display: flex; } +.mistvideo-error .message { max-width: 80%; } +.mistvideo-error .message .details table { text-align: left; } +.mistvideo-video:not(.video-js) button, +.mistvideo-error button, +.mistvideo-controls button +{ + color: $stroke; + border: 1px solid $semiFill; + background-color: $background; + margin: 0.25em; + padding: 0.5em 1em; + opacity: 0.5; + cursor: pointer; +} +button:hover { opacity: 1; } +select { + background-color: transparent; + color: $stroke; + border: none; + margin: 0 0.5em; + font-size: inherit; + cursor: pointer; + -ms-background-color: red; +} +select > option { + background-color: $background; +} + +.browser-edge select, .browser-safari select { + /*These browsers don't show an arrow for select boxes, causing them to be invisible when a border is not applied */ + border: 1px solid $semiFill; + border-top: none; + border-left: none; + margin-top: 2px; +} + +@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } +[data-fullscreen] { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: 100% !important; + height: 100% !important; +} +video { + display: block; + flex-shrink: 0; +} +table { color: inherit; font-size: inherit; font-style: inherit; } +audio:not([controls]) { display: block !important; } +.mistvideo-padding { padding: 5px 10px; } +.mistvideo-pointer { cursor: pointer; } +.description { + color: $semiFill; + font-size: 0.9em; +} +.mistvideo-container { + display: flex; + flex-wrap: nowrap; +} +.mistvideo-container.mistvideo { display: inline-flex; max-width: 100%; } +.mistvideo-container.mistvideo-row { flex-direction: row; } +.mistvideo-container.mistvideo-column { flex-direction: column; } +.mistvideo-container.mistvideo-center { justify-content: center; } + +.mistvideo-align-right { + margin-left: auto; + margin-right: 0; +} + +.hover_window_container.pos > .outer_window { + position: absolute; + pointer-events: none; + overflow: hidden; +} +.hover_window_container.pos > .outer_window > .inner_window { + position: absolute; + pointer-events: all; +} +.hover_window_container:not(:hover) > .outer_window > .inner_window, +.hover_window_container > .outer_window[data-hidecursor] > .inner_window +{ transition: all 0.5s ease-in 0.5s; } +.outer_window > .inner_window { flex-grow: 1; } +.hover_window_container > .outer_window > .inner_window > * { flex-shrink: 0; } + +.mistvideo-draggable { + overflow: hidden; +} + +.mistvideo-tooltip { + position: absolute; + background-color: $background; + padding: 0.5em 1em; + z-index: 2; +} +*:not(:hover) > .mistvideo-tooltip { transition: opacity 0.25s ease-in; } +.mistvideo-tooltip .triangle { + border: 10px solid $background; + position: absolute; +} +.mistvideo-tracks label { + display: block; +} +.mistvideo-tracks label > span { + margin-right: 1em; +} + +a { + color: $accent; +} +.mistvideo-log .logs { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} +.mistvideo-placeholder { + max-width: 100%; + max-height: 100%; +} + +.mistvideo-topright { + position: absolute; + top: 0; + right: 0; +} +.mistvideo-topleft { + position: absolute; + top: 0; + left: 0; +} +.mistvideo-delay-display { + animation: appear 1s; + animation-iteration-count: 1; + animation-timing-function: steps(1,end); +} +@keyframes appear { from { opacity: 0; } to { opacity: 1; } } + +svg.icon { + display: block; + stroke-width: $strokeWidth; + fill: none; + stroke: none; +} +svg.icon.fill, svg.icon .fill { fill: $fill; } +svg.icon.semiFill, svg.icon .semiFill { fill: $semiFill; } +svg.icon.stroke, svg.icon .stroke { stroke: $stroke; vector-effect: non-scaling-stroke; } +svg.icon.off .toggle.fill, +svg.icon.off .toggle.semiFill, +svg.icon.off .toggle .fill, +svg.icon.off .toggle .semiFill { fill: none; } +svg.icon.spin, svg.icon .spin { + animation: spin 1.5s infinite linear; + transform-origin: 50% 50%; +} diff --git a/embed/skins/video-js.css b/embed/skins/video-js.css new file mode 100644 index 00000000..14028297 --- /dev/null +++ b/embed/skins/video-js.css @@ -0,0 +1,1279 @@ +.video-js .vjs-big-play-button .vjs-icon-placeholder:before, .vjs-button > .vjs-icon-placeholder:before, .video-js .vjs-modal-dialog, .vjs-modal-dialog .vjs-modal-dialog-content { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } + +.video-js .vjs-big-play-button .vjs-icon-placeholder:before, .vjs-button > .vjs-icon-placeholder:before { + text-align: center; } + +@font-face { + font-family: VideoJS; + src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABBIAAsAAAAAGoQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV3RY21hcAAAAYQAAADQAAADIjn098ZnbHlmAAACVAAACv4AABEIAwnSw2hlYWQAAA1UAAAAKgAAADYUHzoRaGhlYQAADYAAAAAbAAAAJA4DByFobXR4AAANnAAAAA8AAACE4AAAAGxvY2EAAA2sAAAARAAAAEQ9NEHGbWF4cAAADfAAAAAfAAAAIAEyAIFuYW1lAAAOEAAAASUAAAIK1cf1oHBvc3QAAA84AAABDwAAAZ5AAl/0eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGQ7xTiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGBHcRdyA4RZgQRAC4HCwEAAHic7dFprsIgAEXhg8U61XmeWcBb1FuQP4w7ZQXK5boMm3yclFDSANAHmuKviBBeBPQ8ymyo8w3jOh/5r2ui5nN6v8sYNJb3WMdeWRvLji0DhozKdxM6psyYs2DJijUbtuzYc+DIiTMXrty4k8oGLb+n0xCe37ekM7Z66j1DbUy3l6PpHnLfdLO5NdSBoQ4NdWSoY9ON54mhdqa/y1NDnRnq3FAXhro01JWhrg11Y6hbQ90Z6t5QD4Z6NNSToZ4N9WKoV0O9GerdUJORPqkhTd54nJ1YDXBU1RV+576/JBs2bPYPkrDZt5vsJrv53V/I5mclhGDCTwgGBQQSTEji4hCkYIAGd4TGIWFAhV0RQTpWmQp1xv6hA4OTOlNr2zFANbHUYbq2OtNCpViRqsk+e+7bTQAhzti8vPfuPffcc88959zznbcMMPjHD/KDDGEY0ABpYX384NhlomIYlo4JISGEY9mMh2FSidYiqkEUphtNYDSY/dXg9023l4DdxlqUl0chuZRhncJKrsCQHIwcGuwfnhMIzBnuH4Sym+1D2zaGjheXlhYfD238z80mKYMmvJ5XeOTzd8z9eujbMxJNhu4C9xPE/bCMiDuSNIWgkTQwBE55hLSAE7ZwhrHLnAHZOGV/kmBGTiNjZxzI77Hb7Hqjz68TjT6vh+5JT/cCIkqS0D6CqPf5jX4Qjdx5j6vlDfZM4aZFdbVXIxtOlJaP/WottMnH6CJQ3bTiue3PrY23HjnChtuamxwvvzFjxkPrNj3z0tG9T561HDYf6OgmRWvlY3JQHoQb8ltV2Yet7YfWctEjR1AtxS/cSX6U4alf6NJEBQ7YKg9wrXQKd0IeZCb2ux75Uhh1Un+Nz+9LTOE7PK777nN5xqdTneTBhCbx446mZrhnUkrCz2YhA9dSMxaG0SYmT8hi9ZPu1E94PJYQSH6LRmhxec7Q7ZeXntgQuVpbh+a4qWNsckVyTdn0P7o7DpgPW84+uRcq0BITflBikGdUjAZ9wYBVI3mtrNvr9kpg1UsaK6t3690aoorC1lg0GpMH2HAMtkZjsSi5Ig9ESVosOh7GQfLjKNLvKpMKkLSKNFAka710GdgSi8oDMSoNhqjkKBXTgn3swtaxyzGkUzIzae9RtLdWkSlZ1KDX6EzgllzV4NV4SoDFSOGD4+HCeQUF8wrZ5Hs8zIb5EaVxy8DYFTbMCJPnLIWZxugZE2NlivC0gc1qEQUR8jEKgZcAXeH18BiCgl5nlHh0CrjB4Hb5fX4gb0J7c9PuHVsfgkx2n/vTY/JV8kn8PGxf7faOZ8qX8JVByuIf4whk9sqXli2hvPJV9hrp0hY7l8r2x37ydaVsb4xvXv/47v2NjfCl8m5oRDJclFMoE1yk0Uh1Te4/m8lFXe9qBZD0EkheicebXvzI2PLCuoKCukLuhPIeKwaHPEouxw3kMqaIUXDQ1p0mip+MyCORSCQaoUsnY1VZ38nUTrG21WvVo4f1OsEJFhvSfAFwGfT8VHRMeAVUpwLOoLzjT/REIj3O3FhuURE+nERF+0pTId5Fyxv5sfwGyg4O+my4vZv0sZm7oeQlFZORiB+tG0MweVNraeitl7yxiPIHTk4/diVxs94o5lEYishB2iAtkchEnsActoEpx44Fo8XnsQMaA22BlqC20RmhBKzYojZyYaxg+JggMc4HHY2m+L9EkWSYljirOisrO7d3VorxzyZ6Vc4lJqITAu1b2wOBdrLElAP+bFc2eGaZFVbkmJktv5uT6Jlz5D/MnBFor6ig/JPnRViBsV3LNKGGqB1ChJ0tgQywlVLFJIuQgTFttwkiKxhyQdAZMdMYtSaoAewqfvXVYPAbDT6/1mez85YS8FSDywQ6NfAnef6FNEGMilnppyvn5rB6tTyq1pOceRWnp2WJEZFXHeX5oyoem1nTTgdqc4heDY7bOeKz63vnz+/dRx+s31Ht2JGanQ5seirfWJL9tjozU/12TnEjn5oux9OzU3ckGbBzBwNOyk69JykKH0n/0LM9A72tuwM3zQpIRu4AxiToseEpgPOmbROyFe9/X2yeUvoUsCyEvjcgs7fpWP3/aKlFN0+6HFUe6D9HFz/XPwBlN9tTqNyZjFJ8UO2RUT5/h4CptCctEyeisnOyXjALEp7dXKaQKf6O7IMnGjNNACRMLxqdYJX8eMLvmmd68D+ayBLyKKYZwYxDt/GNhzETDJ05Qxlyi3pi3/Z93ndYVSumgj0V/KkIFlO6+1K3fF2+3g0q+YtuSIf0bvmLqV09nnobI6hwcjIP8aPCKayjsF5JBY3LaKAeRLSyYB1h81oTwe9SlPMkXB7G0mfL9q71gaqqwPqu67QRKS1+ObTx+sbQy9QV2OQHEScGkdFBeT7v7qisqqrs6N52i78/R+6S0qQONVj26agOVoswCyQWIV5D86vH53bxNUeXV0K+XZaHv/nm/KsHhOvylwsWnJX/HE8l/4WCv5x+l5n08z6UU8bUMa3MBpSmM7F63AxntdC9eBCKEZW9Hr+ABNqtxgAQrSbMtmrW7lKQuoSgBhSrTazWVU2QAKWY8wiiuhqFmQgWJBgoXiuWIm42N7hqZbBsgXz52O5P5uSvaNgFGnOuvsRw8I8Laha91wMvDuxqWFheN7/8GVtTltdS83DQsXRmqc5ZtcJXEVrlV2doTWk5+Yunm71dG5f55m/qY0MjI93vv9/NfpxXV9sUXrxy2fbNy1or65cOlDRnOoKFeeXcbw42H/bNDT5Qs3flgs31gWC1lD1nfUV/X7NdCnSUdHY2e8afzfKsqZ5ZljfDqjLOmk3UebNXB+aHArPYDRs+/HDDxeT5DiP+sFg7OpRaVQMGBV89PpeBdj22hCE0Uub0UqwLrNWsG0cuyadgLXTeR5rbO4+3c/vl15cur2nRq+TXCQDcS3SO+s6ak+e5/eMS+1dw3btu3YG2tvFL8XdIZvdjdW6TO/4B7IdrZWVPmctm5/59AgsPItTSbCiIBr2OqIGzmu20SMKAS7yqwGBUfGfgjDYlLLDeF0SfcLB2LSx8flT+08/kzz6yOj96rft4rpTjdPQcmLd47uKibbDq7ZSz/XtbH2nN717Nd62rU+c8Icevvv7I09wA6WvjVcafb+FsbNG+ZQ80Rn6ZZsvrP7teP2dzTdoETvNhjCmsr8FID2sJ69VYvdUcxk4AzYRlKcaE38eXNRlfW9H1as9i6acLHp1XpuNB5K7DIvkX08y1ZYvh3KfWaiCzH+ztrSDmD7LuX73x/mJelB8Yj39t8nhNQJJ2CAthpoFGLsGgtSOCJooCGoaJAMTjSWHVZ08YAa1Fg9lPI5U6DOsGVjDasJeZZ+YyhfCwfOzCxlBA69M9XLXtza7H/rav+9Tjq5xNi0wpKQIRNO4Lrzz7yp5QVYM6Jd/oc1Uvn/mQhhuWh6ENXoS2YTZ8QT42bF5d/559zp5r0Uff2VnR2tdf2/WCOd2cO0Mw6qpWPnvxpV0nrt5fZd2yItc199GWe8vlNfNDq+CH/7yAAnB9hn7T4QO4c1g9ScxsZgmzntnE/IDGndtHMw69lFwoCnYsMGx+rBp8JSBqdLzBr9QRPq/PbhWMWFtQZp1xguy/haw3TEHm3TWAnxFWQQWgt7M5OV0lCz1VRYucpWliy7z6Zd4urwPIyeZQqli2Lgg7szJV09PysATbOQtYIrB2YzbkJYkGgJ0m4AjPUap1pvYu1K9qr97z0Yl3p332b2LYB78ncYIlRkau/8GObSsOlZancACE5d5ily+c2+7h5Yj4lqhVmXXB+iXLfvdqSgqfKtQvfHDV0OnvQR1qhw42XS/vkvsh/hXcrDFP0a+SJNIomEfD1nsrYGO+1bgTOJhM8Hv6ek+7vVglxuSRwoKn17S937bm6YJCeSSG0Op1n+7tE37tcZ/p7dsTv4EUrGpDbWueKigsLHhqTVsoEj+JU0kaSjnj9tz8/gryQWwJ9BcJXBC/7smO+I/IFURJetFPrdt5WcoL6DbEJaygI8CTHfQTjf40ofD+DwalTqIAAHicY2BkYGAA4uByr8R4fpuvDNzsDCBw7f/3LmSanREszsHABKIAKi0J7gAAeJxjYGRgYGcAARD5/z87IwMjAypQBAAtgwI4AHicY2BgYGAfYAwAOkQA4QAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAcICGAJYArQC4AMwA7AD3gQwBJYE3AUkBWYFigYgBmYGtAbqB1gIEghYCG4IhHicY2BkYGBQZChlYGcAASYg5gJCBob/YD4DABfTAbQAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2PyXLCMBBE3YCNDWEL2ffk7o8S8oCnkCVHC5C/jzBQlUP6IHVPzYyekl5y0iL5X5/ooY8BUmQYIkeBEca4wgRTzDDHAtdY4ga3uMM9HvCIJzzjBa94wzs+8ImvZNAq8TM+HqVkKxWlrQiOxjujQkNlEzyNzl6Z/cU2XF06at7U83VQyklLpEvSnuzsb+HAPnPfQVgaupa1Jlu4sPLsFblcitaz0dHU0ZF1qatjZ1+aTXYCmp6u0gSvWNPyHLtFZ+ZeXWVSaEkqs3T8S74WklbGbNNNq4LL4+CWKtZDv2cfX8l8aFbKFhEnJnJ+IULFpqwoQnNHlHaVQtPBl+ypmbSWdmyC61KS/AKZC3Y+AA==) format("woff"); + font-weight: normal; + font-style: normal; } + +.vjs-icon-play, .video-js .vjs-big-play-button .vjs-icon-placeholder:before, .video-js .vjs-play-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-play:before, .video-js .vjs-big-play-button .vjs-icon-placeholder:before, .video-js .vjs-play-control .vjs-icon-placeholder:before { + content: "\f101"; } + +.vjs-icon-play-circle { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-play-circle:before { + content: "\f102"; } + +.vjs-icon-pause, .video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-pause:before, .video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before { + content: "\f103"; } + +.vjs-icon-volume-mute, .video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-volume-mute:before, .video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before { + content: "\f104"; } + +.vjs-icon-volume-low, .video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-volume-low:before, .video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before { + content: "\f105"; } + +.vjs-icon-volume-mid, .video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-volume-mid:before, .video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before { + content: "\f106"; } + +.vjs-icon-volume-high, .video-js .vjs-mute-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-volume-high:before, .video-js .vjs-mute-control .vjs-icon-placeholder:before { + content: "\f107"; } + +.vjs-icon-fullscreen-enter, .video-js .vjs-fullscreen-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-fullscreen-enter:before, .video-js .vjs-fullscreen-control .vjs-icon-placeholder:before { + content: "\f108"; } + +.vjs-icon-fullscreen-exit, .video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-fullscreen-exit:before, .video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before { + content: "\f109"; } + +.vjs-icon-square { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-square:before { + content: "\f10a"; } + +.vjs-icon-spinner { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-spinner:before { + content: "\f10b"; } + +.vjs-icon-subtitles, .video-js .vjs-subtitles-button .vjs-icon-placeholder, .video-js .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-subtitles:before, .video-js .vjs-subtitles-button .vjs-icon-placeholder:before, .video-js .vjs-subs-caps-button .vjs-icon-placeholder:before, + .video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before, + .video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before, + .video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before, + .video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before { + content: "\f10c"; } + +.vjs-icon-captions, .video-js .vjs-captions-button .vjs-icon-placeholder, .video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-captions:before, .video-js .vjs-captions-button .vjs-icon-placeholder:before, .video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before, + .video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before { + content: "\f10d"; } + +.vjs-icon-chapters, .video-js .vjs-chapters-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-chapters:before, .video-js .vjs-chapters-button .vjs-icon-placeholder:before { + content: "\f10e"; } + +.vjs-icon-share { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-share:before { + content: "\f10f"; } + +.vjs-icon-cog { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-cog:before { + content: "\f110"; } + +.vjs-icon-circle, .video-js .vjs-play-progress, .video-js .vjs-volume-level { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-circle:before, .video-js .vjs-play-progress:before, .video-js .vjs-volume-level:before { + content: "\f111"; } + +.vjs-icon-circle-outline { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-circle-outline:before { + content: "\f112"; } + +.vjs-icon-circle-inner-circle { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-circle-inner-circle:before { + content: "\f113"; } + +.vjs-icon-hd { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-hd:before { + content: "\f114"; } + +.vjs-icon-cancel, .video-js .vjs-control.vjs-close-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-cancel:before, .video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before { + content: "\f115"; } + +.vjs-icon-replay, .video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-replay:before, .video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before { + content: "\f116"; } + +.vjs-icon-facebook { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-facebook:before { + content: "\f117"; } + +.vjs-icon-gplus { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-gplus:before { + content: "\f118"; } + +.vjs-icon-linkedin { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-linkedin:before { + content: "\f119"; } + +.vjs-icon-twitter { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-twitter:before { + content: "\f11a"; } + +.vjs-icon-tumblr { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-tumblr:before { + content: "\f11b"; } + +.vjs-icon-pinterest { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-pinterest:before { + content: "\f11c"; } + +.vjs-icon-audio-description, .video-js .vjs-descriptions-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-audio-description:before, .video-js .vjs-descriptions-button .vjs-icon-placeholder:before { + content: "\f11d"; } + +.vjs-icon-audio, .video-js .vjs-audio-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-audio:before, .video-js .vjs-audio-button .vjs-icon-placeholder:before { + content: "\f11e"; } + +.vjs-icon-next-item { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-next-item:before { + content: "\f11f"; } + +.vjs-icon-previous-item { + font-family: VideoJS; + font-weight: normal; + font-style: normal; } + .vjs-icon-previous-item:before { + content: "\f120"; } + +.video-js { + display: block; + vertical-align: top; + box-sizing: border-box; + color: #fff; + background-color: #000; + position: relative; + padding: 0; + font-size: 10px; + line-height: 1; + font-weight: normal; + font-style: normal; + font-family: Arial, Helvetica, sans-serif; + word-break: initial; } + .video-js:-moz-full-screen { + position: absolute; } + .video-js:-webkit-full-screen { + width: 100% !important; + height: 100% !important; } + +.video-js[tabindex="-1"] { + outline: none; } + +.video-js *, +.video-js *:before, +.video-js *:after { + box-sizing: inherit; } + +.video-js ul { + font-family: inherit; + font-size: inherit; + line-height: inherit; + list-style-position: outside; + margin-left: 0; + margin-right: 0; + margin-top: 0; + margin-bottom: 0; } + +.video-js.vjs-fluid, +.video-js.vjs-16-9, +.video-js.vjs-4-3 { + width: 100%; + max-width: 100%; + height: 0; } + +.video-js.vjs-16-9 { + padding-top: 56.25%; } + +.video-js.vjs-4-3 { + padding-top: 75%; } + +.video-js.vjs-fill { + width: 100%; + height: 100%; } + +.video-js .vjs-tech { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } + +body.vjs-full-window { + padding: 0; + margin: 0; + height: 100%; } + +.vjs-full-window .video-js.vjs-fullscreen { + position: fixed; + overflow: hidden; + z-index: 1000; + left: 0; + top: 0; + bottom: 0; + right: 0; } + +.video-js.vjs-fullscreen { + width: 100% !important; + height: 100% !important; + padding-top: 0 !important; } + +.video-js.vjs-fullscreen.vjs-user-inactive { + cursor: none; } + +.vjs-hidden { + display: none !important; } + +.vjs-disabled { + opacity: 0.5; + cursor: default; } + +.video-js .vjs-offscreen { + height: 1px; + left: -9999px; + position: absolute; + top: 0; + width: 1px; } + +.vjs-lock-showing { + display: block !important; + opacity: 1; + visibility: visible; } + +.vjs-no-js { + padding: 20px; + color: #fff; + background-color: #000; + font-size: 18px; + font-family: Arial, Helvetica, sans-serif; + text-align: center; + width: 300px; + height: 150px; + margin: 0px auto; } + +.vjs-no-js a, +.vjs-no-js a:visited { + color: #66A8CC; } + +.video-js .vjs-big-play-button { + font-size: 3em; + line-height: 1.5em; + height: 1.5em; + width: 3em; + display: block; + position: absolute; + top: 10px; + left: 10px; + padding: 0; + cursor: pointer; + opacity: 1; + border: 0.06666em solid #fff; + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); + border-radius: 0.3em; + transition: all 0.4s; } + +.vjs-big-play-centered .vjs-big-play-button { + top: 50%; + left: 50%; + margin-top: -0.75em; + margin-left: -1.5em; } + +.video-js:hover .vjs-big-play-button, +.video-js .vjs-big-play-button:focus { + border-color: #fff; + background-color: #73859f; + background-color: rgba(115, 133, 159, 0.5); + transition: all 0s; } + +.vjs-controls-disabled .vjs-big-play-button, +.vjs-has-started .vjs-big-play-button, +.vjs-using-native-controls .vjs-big-play-button, +.vjs-error .vjs-big-play-button { + display: none; } + +.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button { + display: block; } + +.video-js button { + background: none; + border: none; + color: inherit; + display: inline-block; + font-size: inherit; + line-height: inherit; + text-transform: none; + text-decoration: none; + transition: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } + +.vjs-control .vjs-button { + width: 100%; + height: 100%; } + +.video-js .vjs-control.vjs-close-button { + cursor: pointer; + height: 3em; + position: absolute; + right: 0; + top: 0.5em; + z-index: 2; } + +.video-js .vjs-modal-dialog { + background: rgba(0, 0, 0, 0.8); + background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0)); + overflow: auto; } + +.video-js .vjs-modal-dialog > * { + box-sizing: border-box; } + +.vjs-modal-dialog .vjs-modal-dialog-content { + font-size: 1.2em; + line-height: 1.5; + padding: 20px 24px; + z-index: 1; } + +.vjs-menu-button { + cursor: pointer; } + +.vjs-menu-button.vjs-disabled { + cursor: default; } + +.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu { + display: none; } + +.vjs-menu .vjs-menu-content { + display: block; + padding: 0; + margin: 0; + font-family: Arial, Helvetica, sans-serif; + overflow: auto; } + +.vjs-menu .vjs-menu-content > * { + box-sizing: border-box; } + +.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu { + display: none; } + +.vjs-menu li { + list-style: none; + margin: 0; + padding: 0.2em 0; + line-height: 1.4em; + font-size: 1.2em; + text-align: center; + text-transform: lowercase; } + +.vjs-menu li.vjs-menu-item:focus, +.vjs-menu li.vjs-menu-item:hover { + background-color: #73859f; + background-color: rgba(115, 133, 159, 0.5); } + +.vjs-menu li.vjs-selected, +.vjs-menu li.vjs-selected:focus, +.vjs-menu li.vjs-selected:hover { + background-color: #fff; + color: #2B333F; } + +.vjs-menu li.vjs-menu-title { + text-align: center; + text-transform: uppercase; + font-size: 1em; + line-height: 2em; + padding: 0; + margin: 0 0 0.3em 0; + font-weight: bold; + cursor: default; } + +.vjs-menu-button-popup .vjs-menu { + display: none; + position: absolute; + bottom: 0; + width: 10em; + left: -3em; + height: 0em; + margin-bottom: 1.5em; + border-top-color: rgba(43, 51, 63, 0.7); } + +.vjs-menu-button-popup .vjs-menu .vjs-menu-content { + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); + position: absolute; + width: 100%; + bottom: 1.5em; + max-height: 15em; } + +.vjs-workinghover .vjs-menu-button-popup:hover .vjs-menu, +.vjs-menu-button-popup .vjs-menu.vjs-lock-showing { + display: block; } + +.video-js .vjs-menu-button-inline { + transition: all 0.4s; + overflow: hidden; } + +.video-js .vjs-menu-button-inline:before { + width: 2.222222222em; } + +.video-js .vjs-menu-button-inline:hover, +.video-js .vjs-menu-button-inline:focus, +.video-js .vjs-menu-button-inline.vjs-slider-active, +.video-js.vjs-no-flex .vjs-menu-button-inline { + width: 12em; } + +.vjs-menu-button-inline .vjs-menu { + opacity: 0; + height: 100%; + width: auto; + position: absolute; + left: 4em; + top: 0; + padding: 0; + margin: 0; + transition: all 0.4s; } + +.vjs-menu-button-inline:hover .vjs-menu, +.vjs-menu-button-inline:focus .vjs-menu, +.vjs-menu-button-inline.vjs-slider-active .vjs-menu { + display: block; + opacity: 1; } + +.vjs-no-flex .vjs-menu-button-inline .vjs-menu { + display: block; + opacity: 1; + position: relative; + width: auto; } + +.vjs-no-flex .vjs-menu-button-inline:hover .vjs-menu, +.vjs-no-flex .vjs-menu-button-inline:focus .vjs-menu, +.vjs-no-flex .vjs-menu-button-inline.vjs-slider-active .vjs-menu { + width: auto; } + +.vjs-menu-button-inline .vjs-menu-content { + width: auto; + height: 100%; + margin: 0; + overflow: hidden; } + +.video-js .vjs-control-bar { + display: none; + width: 100%; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 3.0em; + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); } + +.vjs-has-started .vjs-control-bar { + display: flex; + visibility: visible; + opacity: 1; + transition: visibility 0.1s, opacity 0.1s; } + +.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar { + visibility: visible; + opacity: 0; + transition: visibility 1s, opacity 1s; } + +.vjs-controls-disabled .vjs-control-bar, +.vjs-using-native-controls .vjs-control-bar, +.vjs-error .vjs-control-bar { + display: none !important; } + +.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar { + opacity: 1; + visibility: visible; } + +.vjs-has-started.vjs-no-flex .vjs-control-bar { + display: table; } + +.video-js .vjs-control { + position: relative; + text-align: center; + margin: 0; + padding: 0; + height: 100%; + width: 4em; + flex: none; } + +.vjs-button > .vjs-icon-placeholder:before { + font-size: 1.8em; + line-height: 1.67; } + +.video-js .vjs-control:focus:before, +.video-js .vjs-control:hover:before, +.video-js .vjs-control:focus { + text-shadow: 0em 0em 1em white; } + +.video-js .vjs-control-text { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; } + +.vjs-no-flex .vjs-control { + display: table-cell; + vertical-align: middle; } + +.video-js .vjs-custom-control-spacer { + display: none; } + +.video-js .vjs-progress-control { + cursor: pointer; + flex: auto; + display: flex; + align-items: center; + min-width: 4em; + touch-action: none; } + +.video-js .vjs-progress-control.disabled { + cursor: default; } + +.vjs-live .vjs-progress-control { + display: none; } + +.vjs-no-flex .vjs-progress-control { + width: auto; } + +.video-js .vjs-progress-holder { + flex: auto; + transition: all 0.2s; + height: 0.3em; } + +.video-js .vjs-progress-control .vjs-progress-holder { + margin: 0 10px; } + +.video-js .vjs-progress-control:hover .vjs-progress-holder { + font-size: 1.666666666666666666em; } + +.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled { + font-size: 1em; } + +.video-js .vjs-progress-holder .vjs-play-progress, +.video-js .vjs-progress-holder .vjs-load-progress, +.video-js .vjs-progress-holder .vjs-load-progress div { + position: absolute; + display: block; + height: 100%; + margin: 0; + padding: 0; + width: 0; } + +.video-js .vjs-play-progress { + background-color: #fff; } + .video-js .vjs-play-progress:before { + font-size: 0.9em; + position: absolute; + right: -0.5em; + top: -0.333333333333333em; + z-index: 1; } + +.video-js .vjs-load-progress { + background: rgba(115, 133, 159, 0.5); } + +.video-js .vjs-load-progress div { + background: rgba(115, 133, 159, 0.75); } + +.video-js .vjs-time-tooltip { + background-color: #fff; + background-color: rgba(255, 255, 255, 0.8); + border-radius: 0.3em; + color: #000; + float: right; + font-family: Arial, Helvetica, sans-serif; + font-size: 1em; + padding: 6px 8px 8px 8px; + pointer-events: none; + position: absolute; + top: -3.4em; + visibility: hidden; + z-index: 1; } + +.video-js .vjs-progress-holder:focus .vjs-time-tooltip { + display: none; } + +.video-js .vjs-progress-control:hover .vjs-time-tooltip, +.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip { + display: block; + font-size: 0.6em; + visibility: visible; } + +.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip { + font-size: 1em; } + +.video-js .vjs-progress-control .vjs-mouse-display { + display: none; + position: absolute; + width: 1px; + height: 100%; + background-color: #000; + z-index: 1; } + +.vjs-no-flex .vjs-progress-control .vjs-mouse-display { + z-index: 0; } + +.video-js .vjs-progress-control:hover .vjs-mouse-display { + display: block; } + +.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display { + visibility: hidden; + opacity: 0; + transition: visibility 1s, opacity 1s; } + +.video-js.vjs-user-inactive.vjs-no-flex .vjs-progress-control .vjs-mouse-display { + display: none; } + +.vjs-mouse-display .vjs-time-tooltip { + color: #fff; + background-color: #000; + background-color: rgba(0, 0, 0, 0.8); } + +.video-js .vjs-slider { + position: relative; + cursor: pointer; + padding: 0; + margin: 0 0.45em 0 0.45em; + /* iOS Safari */ + -webkit-touch-callout: none; + /* Safari */ + -webkit-user-select: none; + /* Konqueror HTML */ + /* Firefox */ + -moz-user-select: none; + /* Internet Explorer/Edge */ + -ms-user-select: none; + /* Non-prefixed version, currently supported by Chrome and Opera */ + user-select: none; + background-color: #73859f; + background-color: rgba(115, 133, 159, 0.5); } + +.video-js .vjs-slider.disabled { + cursor: default; } + +.video-js .vjs-slider:focus { + text-shadow: 0em 0em 1em white; + box-shadow: 0 0 1em #fff; } + +.video-js .vjs-mute-control { + cursor: pointer; + flex: none; } + +.video-js .vjs-volume-control { + cursor: pointer; + margin-right: 1em; + display: flex; } + +.video-js .vjs-volume-control.vjs-volume-horizontal { + width: 5em; } + +.video-js .vjs-volume-panel .vjs-volume-control { + visibility: visible; + opacity: 0; + width: 1px; + height: 1px; + margin-left: -1px; } + +.video-js .vjs-volume-panel { + transition: width 1s; } + .video-js .vjs-volume-panel:hover .vjs-volume-control, + .video-js .vjs-volume-panel:active .vjs-volume-control, + .video-js .vjs-volume-panel:focus .vjs-volume-control, + .video-js .vjs-volume-panel .vjs-volume-control:hover, + .video-js .vjs-volume-panel .vjs-volume-control:active, + .video-js .vjs-volume-panel .vjs-mute-control:hover ~ .vjs-volume-control, + .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active { + visibility: visible; + opacity: 1; + position: relative; + transition: visibility 0.1s, opacity 0.1s, height 0.1s, width 0.1s, left 0s, top 0s; } + .video-js .vjs-volume-panel:hover .vjs-volume-control.vjs-volume-horizontal, + .video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal, + .video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal, + .video-js .vjs-volume-panel .vjs-volume-control:hover.vjs-volume-horizontal, + .video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal, + .video-js .vjs-volume-panel .vjs-mute-control:hover ~ .vjs-volume-control.vjs-volume-horizontal, + .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal { + width: 5em; + height: 3em; } + .video-js .vjs-volume-panel.vjs-volume-panel-horizontal:hover, .video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active, .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active { + width: 9em; + transition: width 0.1s; } + .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only { + width: 4em; } + +.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical { + height: 8em; + width: 3em; + left: -3.5em; + transition: visibility 1s, opacity 1s, height 1s 1s, width 1s 1s, left 1s 1s, top 1s 1s; } + +.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal { + transition: visibility 1s, opacity 1s, height 1s 1s, width 1s, left 1s 1s, top 1s 1s; } + +.video-js.vjs-no-flex .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal { + width: 5em; + height: 3em; + visibility: visible; + opacity: 1; + position: relative; + transition: none; } + +.video-js.vjs-no-flex .vjs-volume-control.vjs-volume-vertical, +.video-js.vjs-no-flex .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical { + position: absolute; + bottom: 3em; + left: 0.5em; } + +.video-js .vjs-volume-panel { + display: flex; } + +.video-js .vjs-volume-bar { + margin: 1.35em 0.45em; } + +.vjs-volume-bar.vjs-slider-horizontal { + width: 5em; + height: 0.3em; } + +.vjs-volume-bar.vjs-slider-vertical { + width: 0.3em; + height: 5em; + margin: 1.35em auto; } + +.video-js .vjs-volume-level { + position: absolute; + bottom: 0; + left: 0; + background-color: #fff; } + .video-js .vjs-volume-level:before { + position: absolute; + font-size: 0.9em; } + +.vjs-slider-vertical .vjs-volume-level { + width: 0.3em; } + .vjs-slider-vertical .vjs-volume-level:before { + top: -0.5em; + left: -0.3em; } + +.vjs-slider-horizontal .vjs-volume-level { + height: 0.3em; } + .vjs-slider-horizontal .vjs-volume-level:before { + top: -0.3em; + right: -0.5em; } + +.video-js .vjs-volume-panel.vjs-volume-panel-vertical { + width: 4em; } + +.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level { + height: 100%; } + +.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level { + width: 100%; } + +.video-js .vjs-volume-vertical { + width: 3em; + height: 8em; + bottom: 8em; + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); } + +.video-js .vjs-volume-horizontal .vjs-menu { + left: -2em; } + +.vjs-poster { + display: inline-block; + vertical-align: middle; + background-repeat: no-repeat; + background-position: 50% 50%; + background-size: contain; + background-color: #000000; + cursor: pointer; + margin: 0; + padding: 0; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + height: 100%; } + +.vjs-has-started .vjs-poster { + display: none; } + +.vjs-audio.vjs-has-started .vjs-poster { + display: block; } + +.vjs-using-native-controls .vjs-poster { + display: none; } + +.video-js .vjs-live-control { + display: flex; + align-items: flex-start; + flex: auto; + font-size: 1em; + line-height: 3em; } + +.vjs-no-flex .vjs-live-control { + display: table-cell; + width: auto; + text-align: left; } + +.video-js .vjs-time-control { + flex: none; + font-size: 1em; + line-height: 3em; + min-width: 2em; + width: auto; + padding-left: 1em; + padding-right: 1em; } + +.vjs-live .vjs-time-control { + display: none; } + +.video-js .vjs-current-time, +.vjs-no-flex .vjs-current-time { + display: none; } + +.video-js .vjs-duration, +.vjs-no-flex .vjs-duration { + display: none; } + +.vjs-time-divider { + display: none; + line-height: 3em; } + +.vjs-live .vjs-time-divider { + display: none; } + +.video-js .vjs-play-control .vjs-icon-placeholder { + cursor: pointer; + flex: none; } + +.vjs-text-track-display { + position: absolute; + bottom: 3em; + left: 0; + right: 0; + top: 0; + pointer-events: none; } + +.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display { + bottom: 1em; } + +.video-js .vjs-text-track { + font-size: 1.4em; + text-align: center; + margin-bottom: 0.1em; } + +.vjs-subtitles { + color: #fff; } + +.vjs-captions { + color: #fc6; } + +.vjs-tt-cue { + display: block; } + +video::-webkit-media-text-track-display { + -webkit-transform: translateY(-3em); + transform: translateY(-3em); } + +.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display { + -webkit-transform: translateY(-1.5em); + transform: translateY(-1.5em); } + +.video-js .vjs-fullscreen-control { + cursor: pointer; + flex: none; } + +.vjs-playback-rate > .vjs-menu-button, +.vjs-playback-rate .vjs-playback-rate-value { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } + +.vjs-playback-rate .vjs-playback-rate-value { + pointer-events: none; + font-size: 1.5em; + line-height: 2; + text-align: center; } + +.vjs-playback-rate .vjs-menu { + width: 4em; + left: 0em; } + +.vjs-error .vjs-error-display .vjs-modal-dialog-content { + font-size: 1.4em; + text-align: center; } + +.vjs-error .vjs-error-display:before { + color: #fff; + content: 'X'; + font-family: Arial, Helvetica, sans-serif; + font-size: 4em; + left: 0; + line-height: 1; + margin-top: -0.5em; + position: absolute; + text-shadow: 0.05em 0.05em 0.1em #000; + text-align: center; + top: 50%; + vertical-align: middle; + width: 100%; } + +.vjs-loading-spinner { + display: none; + position: absolute; + top: 50%; + left: 50%; + margin: -25px 0 0 -25px; + opacity: 0.85; + text-align: left; + border: 6px solid rgba(43, 51, 63, 0.7); + box-sizing: border-box; + background-clip: padding-box; + width: 50px; + height: 50px; + border-radius: 25px; + visibility: hidden; } + +.vjs-seeking .vjs-loading-spinner, +.vjs-waiting .vjs-loading-spinner { + display: block; + -webkit-animation: 0s linear 0.3s forwards vjs-spinner-show; + animation: 0s linear 0.3s forwards vjs-spinner-show; } + +.vjs-loading-spinner:before, +.vjs-loading-spinner:after { + content: ""; + position: absolute; + margin: -6px; + box-sizing: inherit; + width: inherit; + height: inherit; + border-radius: inherit; + opacity: 1; + border: inherit; + border-color: transparent; + border-top-color: white; } + +.vjs-seeking .vjs-loading-spinner:before, +.vjs-seeking .vjs-loading-spinner:after, +.vjs-waiting .vjs-loading-spinner:before, +.vjs-waiting .vjs-loading-spinner:after { + -webkit-animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite; + animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite; } + +.vjs-seeking .vjs-loading-spinner:before, +.vjs-waiting .vjs-loading-spinner:before { + border-top-color: white; } + +.vjs-seeking .vjs-loading-spinner:after, +.vjs-waiting .vjs-loading-spinner:after { + border-top-color: white; + -webkit-animation-delay: 0.44s; + animation-delay: 0.44s; } + +@keyframes vjs-spinner-show { + to { + visibility: visible; } } + +@-webkit-keyframes vjs-spinner-show { + to { + visibility: visible; } } + +@keyframes vjs-spinner-spin { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); } } + +@-webkit-keyframes vjs-spinner-spin { + 100% { + -webkit-transform: rotate(360deg); } } + +@keyframes vjs-spinner-fade { + 0% { + border-top-color: #73859f; } + 20% { + border-top-color: #73859f; } + 35% { + border-top-color: white; } + 60% { + border-top-color: #73859f; } + 100% { + border-top-color: #73859f; } } + +@-webkit-keyframes vjs-spinner-fade { + 0% { + border-top-color: #73859f; } + 20% { + border-top-color: #73859f; } + 35% { + border-top-color: white; } + 60% { + border-top-color: #73859f; } + 100% { + border-top-color: #73859f; } } + +.vjs-chapters-button .vjs-menu ul { + width: 24em; } + +.video-js .vjs-subs-caps-button + .vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder { + vertical-align: middle; + display: inline-block; + margin-bottom: -0.1em; } + +.video-js .vjs-subs-caps-button + .vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before { + font-family: VideoJS; + content: "\f10d"; + font-size: 1.5em; + line-height: inherit; } + +.video-js .vjs-audio-button + .vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder { + vertical-align: middle; + display: inline-block; + margin-bottom: -0.1em; } + +.video-js .vjs-audio-button + .vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before { + font-family: VideoJS; + content: " \f11d"; + font-size: 1.5em; + line-height: inherit; } + +.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-custom-control-spacer { + flex: auto; } + +.video-js.vjs-layout-tiny:not(.vjs-fullscreen).vjs-no-flex .vjs-custom-control-spacer { + width: auto; } + +.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-current-time, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-time-divider, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-duration, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-remaining-time, +.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-playback-rate, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-progress-control, +.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-mute-control, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-volume-control, +.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-chapters-button, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-descriptions-button, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-captions-button, +.video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-subtitles-button, .video-js.vjs-layout-tiny:not(.vjs-fullscreen) .vjs-audio-button { + display: none; } + +.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-current-time, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-time-divider, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-duration, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-remaining-time, +.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-playback-rate, +.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-mute-control, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-volume-control, +.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-chapters-button, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-descriptions-button, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-captions-button, +.video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-subtitles-button, .video-js.vjs-layout-x-small:not(.vjs-fullscreen) .vjs-audio-button { + display: none; } + +.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-current-time, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-time-divider, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-duration, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-remaining-time, +.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-playback-rate, +.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-mute-control, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-volume-control, +.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-chapters-button, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-descriptions-button, .video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-captions-button, +.video-js.vjs-layout-small:not(.vjs-fullscreen) .vjs-subtitles-button .vjs-audio-button { + display: none; } + +.vjs-modal-dialog.vjs-text-track-settings { + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.75); + color: #fff; + height: 70%; } + +.vjs-text-track-settings .vjs-modal-dialog-content { + display: table; } + +.vjs-text-track-settings .vjs-track-settings-colors, +.vjs-text-track-settings .vjs-track-settings-font, +.vjs-text-track-settings .vjs-track-settings-controls { + display: table-cell; } + +.vjs-text-track-settings .vjs-track-settings-controls { + text-align: right; + vertical-align: bottom; } + +@supports (display: grid) { + .vjs-text-track-settings .vjs-modal-dialog-content { + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr auto; } + .vjs-text-track-settings .vjs-track-settings-colors { + display: block; + grid-column: 1; + grid-row: 1; } + .vjs-text-track-settings .vjs-track-settings-font { + grid-column: 2; + grid-row: 1; } + .vjs-text-track-settings .vjs-track-settings-controls { + grid-column: 2; + grid-row: 2; } } + +.vjs-track-setting > select { + margin-right: 5px; } + +.vjs-text-track-settings fieldset { + margin: 5px; + padding: 3px; + border: none; } + +.vjs-text-track-settings fieldset span { + display: inline-block; } + +.vjs-text-track-settings legend { + color: #fff; + margin: 0 0 5px 0; } + +.vjs-text-track-settings .vjs-label { + position: absolute; + clip: rect(1px 1px 1px 1px); + clip: rect(1px, 1px, 1px, 1px); + display: block; + margin: 0 0 5px 0; + padding: 0; + border: 0; + height: 1px; + width: 1px; + overflow: hidden; } + +.vjs-track-settings-controls button:focus, +.vjs-track-settings-controls button:active { + outline-style: solid; + outline-width: medium; + background-image: linear-gradient(0deg, #fff 88%, #73859f 100%); } + +.vjs-track-settings-controls button:hover { + color: rgba(43, 51, 63, 0.75); } + +.vjs-track-settings-controls button { + background-color: #fff; + background-image: linear-gradient(-180deg, #fff 88%, #73859f 100%); + color: #2B333F; + cursor: pointer; + border-radius: 2px; } + +.vjs-track-settings-controls .vjs-default-button { + margin-right: 1em; } + +@media print { + .video-js > *:not(.vjs-tech):not(.vjs-poster) { + visibility: hidden; } } + +.vjs-resize-manager { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: none; + visibility: hidden; } diff --git a/embed/util.js b/embed/util.js new file mode 100644 index 00000000..d7a3ceb0 --- /dev/null +++ b/embed/util.js @@ -0,0 +1,954 @@ +var MistUtil = { + format: { + time: function(secs,options){ + if (isNaN(secs) || !isFinite(secs)) { return secs; } + if (!options) { options = {}; } + + var ago = (secs < 0 ? " ago" : ""); + secs = Math.abs(secs); + + var days = Math.floor(secs / 86400) + secs = secs - days * 86400; + var hours = Math.floor(secs / 3600); + secs = secs - hours * 3600; + var mins = Math.floor(secs / 60); + var ms = Math.round((secs % 1)*1e3); + secs = Math.floor(secs - mins * 60); + var str = []; + if (days) { + days = days+" day"+(days > 1 ? "s" : "")+", "; + } + if ((hours) || (days)) { + str.push(hours); + str.push(("0"+mins).slice(-2)); + } + else { + str.push(mins); //don't use 0 padding if there are no hours in front + } + str.push(("0"+Math.floor(secs)).slice(-2)); + + if (options.ms) { + str[str.length-1] += "."+("000"+ms).slice(-3); + } + + return (days ? days : "")+str.join(":")+ago; + }, + ucFirst: function(string){ + return string.charAt(0).toUpperCase()+string.slice(1); + }, + number: function(num) { + if ((isNaN(Number(num))) || (num == 0)) { return num; } + + //rounding + //use a significance of three, but don't round "visible" digits + var sig = Math.max(3,Math.ceil(Math.log(num)/Math.LN10)); + var mult = Math.pow(10,sig - Math.floor(Math.log(num)/Math.LN10) - 1); + num = Math.round(num * mult) / mult; + + //thousand seperation + if (num >= 1e4) { + var seperator = " "; + number = num.toString().split("."); + var regex = /(\d+)(\d{3})/; + while (regex.test(number[0])) { + number[0] = number[0].replace(regex,"$1"+seperator+"$2"); + } + num = number.join("."); + } + + return num; + }, + bytes: function(val){ + if (isNaN(Number(val))) { return val; } + + var suffix = ["bytes","KB","MB","GB","TB","PB"]; + if (val == 0) { + unit = suffix[0]; + } + else { + var exponent = Math.floor(Math.log(Math.abs(val)) / Math.log(1024)); + if (exponent < 0) { + unit = suffix[0]; + } + else { + val = val / Math.pow(1024,exponent); + unit = suffix[exponent]; + } + } + return this.number(val)+unit; + }, + mime2human: function(mime){ + switch (mime) { + case "html5/video/webm": { + return "WebM"; + break; + } + case "html5/application/vnd.apple.mpegurl": { + return "HLS"; + break; + } + case "flash/10": { + return "Flash (RTMP)"; + break; + } + case "flash/11": { + return "Flash (HDS)"; + break; + } + case "flash/7": { + return "Flash (Progressive)"; + break; + } + case "html5/video/mpeg": { + return "TS"; + break; + } + case "html5/application/vnd.ms-ss": { + return "Smooth streaming"; + break; + } + case "dash/video/mp4": { + return "DASH"; + break; + } + case "webrtc": { + return "WebRTC"; + break; + } + case "silverlight": { + return "Smooth streaming (Silverlight)"; + break; + } + case "html5/text/vtt": { + return "VTT subtitles"; + break; + } + case "html5/text/plain": { + return "SRT subtitles"; + break; + } + default: { + return mime.replace("html5/","").replace("video/","").replace("audio/","").toLocaleUpperCase(); + } + } + } + }, + + class: { + //reroute classList functionalities if not supported; also avoid indexOf + add: function(DOMelement,item){ + if ("classList" in DOMelement) { + DOMelement.classList.add(item); + } + else { + var classes = this.get(DOMelement); + + classes.push(item); + this.set(DOMelement,classes); + } + }, + remove: function(DOMelement,item){ + if ("classList" in DOMelement) { + DOMelement.classList.remove(item); + } + else { + var classes = this.get(DOMelement); + + for (var i = classes.length-1; i >= 0; i--) { + if (classes[i] == item) { + classes.splice(i); + } + } + this.set(DOMelement,classes); + } + }, + get: function(DOMelement) { + var classes; + var className = DOMelement.getAttribute("class"); //DOMelement.className does not work on svg elements + + if ((!className) || (className == "")) { classes = []; } + else { classes = className.split(" "); } + + return classes; + }, + set: function(DOMelement,classes) { + DOMelement.setAttribute("class",classes.join(" ")); + }, + has: function(DOMelement,hasClass){ + return (DOMelement.className.split(" ").indexOf(hasClass) >= 0) + } + }, + + object: { + //extend object1 with object2 + extend: function(object1,object2,deep) { + for (var i in object2) { + if (deep && (typeof object2[i] == "object") && (!("nodeType" in object2[i]))) { + if (!(i in object1)) { + if (MistUtil.array.is(object2[i])) { + object1[i] = []; + } + else { + object1[i] = {}; + } + } + this.extend(object1[i],object2[i],true); + } + else { + object1[i] = object2[i]; + } + } + + return object1; + }, + //replace Object.keys + //if sorting: sort the keys alphabetically or use passed sorting function + //sorting gets these arguments: keya,keyb,valuea,valueb + keys: function(obj,sorting){ + + var keys = []; + for (var i in obj) { + keys.push(i); + } + + if (sorting) { + if (typeof sorting != "function") { + sorting = function(keya,keyb){ + if (keya > keyb) { return 1; } + if (keya < keyb) { return -1; } + return 0; + }; + } + + keys.sort(function(keya,keyb){ + return sorting(keya,keyb,obj[keya],obj[keyb]); + }); + } + + return keys; + }, + //replace Object.values + //if sorting: sort the keys alphabetically or use passed sorting function + //sorting gets these arguments: keya,keyb,valuea,valueb + values: function(obj,sorting){ + + var keys = this.keys(obj,sorting); + + values = []; + for (var i in keys) { + values.push(obj[keys[i]]); + } + + return values; + } + }, + array: { + //replace [].indexOf + indexOf: function(array,entry) { + if (!(array instanceof Array)) { throw "Tried to use indexOf on something that is not an array"; } + if ("indexOf" in array) { return array.indexOf(entry); } + + for (var i; i < array.length; i++) { + if (array[i] == entry) { + return i; + } + } + return -1; + }, + //replace isArray + is: function(array) { + if ("isArray" in Array) { + return Array.isArray(array); + } + return Object.prototype.toString.call(array) === '[object Array]'; + }, + multiSort: function (array,sortby) { + /* + MistUtil.array.multiSort([].concat(video.info.source),[ + {type: ["html5/video/webm","silverlight"]} or ["type",["html5/video/webm","silverlight"]] + ,{simul_tracks:-1} or ["simul_tracks",-1] + ,function(a){ return a.priority * -1; } + ,"url" + ]); + */ + + var sortfunc = function(a,b){ + if (isNaN(a) || isNaN(b)) { + return a.localeCompare(b); + } + return Math.sign(a-b); + }; + + if (!sortby.length) { return array.sort(sortfunc); } + + function getValue(key,a) { + + function parseIt(item,key,sortvalue){ + if (!(key in item)) { + throw "Invalid sorting rule: "+JSON.stringify([key,sortvalue])+". \""+key+"\" is not a key of "+JSON.stringify(item); + } + + if (typeof sortvalue == "number") { + //deals with something like {priority: -1} + if (key in item) { + return item[key] * sortvalue; + } + } + + //deals with something like {type:["webrtc"]} + var i = sortvalue.indexOf(item[key]) + return (i >= 0 ? i : sortvalue.length); + } + + //deals with something like function(a){ return a.foo + a.bar; } + if (typeof key == "function") { return key(a); } + + if (typeof key == "object") { + if (key instanceof Array) { + //it's an array + return parseIt(a,key[0],key[1]); + } + //it's an object + for (var j in key) { //only listen to a single key + return parseIt(a,j,key[j]); + } + } + + if (key in a) { + return a[key]; + } + + throw "Invalid sorting rule: "+key+". This should be a function, object or key of "+JSON.stringify(a)+"."; + } + + array.sort(function(a,b){ + var output = 0; + for (var i in sortby) { + var key = sortby[i]; + output = sortfunc(getValue(key,a),getValue(key,b)); + if (output != 0) { + break; + } + } + return output; + }); + + return array; + } + }, + + createUnique: function() { + var i = "uid"+Math.random().toString().replace("0.",""); + if (document.querySelector("."+i)) { + //if this is already used, try again + return createUnique(); + } + return i; + }, + + http: { + getpost: function(type,url,data,callback,errorCallback) { + var xhr = new XMLHttpRequest(); + xhr.open(type, url, true); + if (type == "POST") { xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); } + + if (errorCallback) { xhr.timeout = 8e3; } //go to timeout function after 8 seconds + + xhr.onload = function() { + var status = xhr.status; + if ((status >= 200) && (status < 300)) { + callback(xhr.response); + } + else if (errorCallback) { + xhr.onerror = function() { + errorCallback(xhr); + } + } + }; + if (errorCallback) { + xhr.onerror = function() { + errorCallback(xhr); + } + xhr.ontimeout = xhr.onerror; + } + if (type == "POST") { + var poststr; + var post = []; + for (var i in data) { + post.push(i+"="+encodeURIComponent(data[i])); + } + if (post.length) { poststr = post.join("&"); } + xhr.send(poststr); + } + else { + xhr.send(); + } + }, + get: function(url,callback,errorCallback){ + this.getpost("GET",url,null,callback,errorCallback); + }, + post: function(url,data,callback,errorCallback){ + this.getpost("POST",url,data,callback,errorCallback); + }, + url: { + addParam: function(url,params){ + var spliturl = url.split("?"); + var ret = [spliturl.shift()]; + var splitparams = []; + if (spliturl.length) { + splitparams = spliturl[0].split("&"); + } + for (var i in params) { + splitparams.push(i+"="+params[i]); + } + if (splitparams.length) { ret.push(splitparams.join("&")); } + return ret.join("?"); + }, + split: function(url){ + var a = document.createElement("a"); + a.href = url; + return { + protocol: a.protocol, + host: a.hostname, + hash: a.hash, + port: a.port, + path: a.pathname.replace(/\/*$/,"") + }; + }, + sanitizeHost: function(host){ + var split = MistUtil.http.url.split(host); + return split.protocol + "//" + split.host + (split.port && (split.port != "") ? ":"+split.port : "") + (split.hash && (split.hash != "") ? "#"+split.hash : "") + (split.path ? split.path : ""); + } + } + }, + + css: { + cache: {}, + load: function(url,colors,callback){ + var style = document.createElement("style"); + style.type = "text/css"; + style.setAttribute("data-source",url); + if (callback) { style.callback = callback; } + var cache = this.cache; + + function onCSSLoad(d) { + //parse rules and replace variables; expected syntax $abc[.abc] + var css = MistUtil.css.applyColors(d,colors); + + if ("callback" in style) { style.callback(css); } + else { style.textContent = css; } + } + + if (url in cache) { + if (cache[url] instanceof Array) { + cache[url].push(onCSSLoad); + } + else { + onCSSLoad(cache[url]); + } + } + else { + //retrieve file contents + cache[url] = [onCSSLoad]; + MistUtil.http.get(url,function(d){ + for (var i in cache[url]) { + cache[url][i](d); + } + cache[url] = d; + },function(){ + throw "Failed to load CSS from "+url; + }); + } + + return style; //its empty now, but will be filled on load + }, + applyColors: function(css,colors) { + return css.replace(/\$([^\s^;^}]*)/g,function(str,variable){ + var index = variable.split("."); + var val = colors; + for (var j in index) { + val = val[index[j]]; + } + return val; + }); + }, + createStyle: function(css,prepend,applyToChildren){ + var style = document.createElement("style"); + style.type = "text/css"; + + if (css) { + if (prepend) { + css = this.prependClass(css,prepend,applyToChildren); + } + style.textContent = css; + } + + return style; + }, + prependClass: function (css,prepend,applyToChildren) { + var style = false; + if (typeof css != "string") { + style = css; + if (!("unprepended" in style)) { + style.unprepended = style.textContent; + } + css = style.unprepended; + } + //remove all block comments + css = css.replace(/\/\*.*?\*\//g,""); + + //save all @{} blocks + var save = css.match(/@.*?{.*}/g); + for (var i in save) { + css = css.replace(save[i],"@@@@"); + } + + //find and replace selectors + css = css.replace(/[^@]*?{[^]*?}/g,function(match){ + var split = match.split("{") + var selectors = split[0].split(","); + var properties = "{"+split.slice(1).join("}"); + + for (var i in selectors) { + selectors[i] = selectors[i].trim(); + var str = "."+prepend+selectors[i]; + if (applyToChildren) { + str += ",\n."+prepend+" "+selectors[i]; + } + selectors[i] = str; + } + + + return "\n"+selectors+" "+properties; + }); + + //reinsert saved blocks + for (var i in save) { + css = css.replace(/@@@@/,save[i]); + } + + if (style) { + style.textContent = css; + return; + } + + return css; + } + }, + + empty: function(DOMelement) { + while (DOMelement.lastChild){ + if (DOMelement.lastChild.lastChild) { + //also empty this child + this.empty(DOMelement.lastChild); + } + if ("attachedListeners" in DOMelement.lastChild) { + //remove attached event listeners + for (var i in DOMelement.lastChild.attachedListeners) { + MistUtil.event.removeListener(DOMelement.lastChild.attachedListeners[i]); + } + } + DOMelement.removeChild(DOMelement.lastChild); + } + }, + + event: { + send: function(type,message,target){ + try { + var event = new Event(type,{ + bubbles: true, + cancelable: true + }); + event.message = message; + target.dispatchEvent(event); + } + catch (e) { + try { + var event = document.createEvent('Event'); + event.initEvent(type,true,true); + event.message = message; + target.dispatchEvent(event); + } + catch (e) { return false; } + } + return true; + }, + addListener: function(DOMelement,type,callback,storeOnElement) { + //add an event listener and store the handles, so they can be cleared + + DOMelement.addEventListener(type,callback); + + if (!storeOnElement) { storeOnElement = DOMelement; } + if (!("attachedListeners" in storeOnElement)) { + storeOnElement.attachedListeners = []; + } + var output = { + element: DOMelement, + type: type, + callback: callback + }; + + storeOnElement.attachedListeners.push(output); + return output; + }, + removeListener: function(data) { + data.element.removeEventListener(data.type, data.callback); + } + }, + + scripts: { + list: {}, + insert: function(src,onevent,MistVideo){ + var scripts = this; + + if (MistVideo) { + //register so we can remove it on unload + MistVideo.errorListeners.push({ + src: src, + onevent: onevent + }); + } + if (src in this.list) { + //already present + //register to error listening + this.list[src].subscribers.push(onevent.onerror); + //execute onload + if ("onload" in onevent) { + if (this.hasLoaded) { + onevent.onload(); + } + else { + MistUtil.event.addListener(this.list[src].tag,"load",onevent.onload); + } + } + return; + } + + var scripttag = document.createElement("script"); + scripttag.hasLoaded = false; + scripttag.setAttribute("src",src); + scripttag.setAttribute("crossorigin","anonymous"); //must be set to get info about errors thrown + document.head.appendChild(scripttag); + scripttag.onerror = function(e){ + onevent.onerror(e); + } + scripttag.onload = function(e){ + this.hasLoaded = true; + if (!MistVideo.destroyed) { onevent.onload(e); } + } + scripttag.addEventListener("error",function(e){ + onevent.onerror(e); + }); + + + //error catching + var oldonerror = false; + if (window.onerror) { + oldonerror = window.onerror; + } + window.onerror = function(message,source,line,column,error){ + if (oldonerror) { + oldonerror.apply(this,arguments); + } + if (source == src) { + onevent.onerror(error); + for (var i in scripts.list[src].subscribers) { + scripts.list[src].subscribers[i](error); + } + } + }; + + this.list[src] = { + subscribers: [onevent.onerror], + tag: scripttag + }; + + return scripttag; + } + }, + + tracks: { + parse: function(metaTracks){ + var output = {}; + for (var i in metaTracks) { + var track = MistUtil.object.extend({},metaTracks[i]); + if (track.type == "meta") { + track.type = track.codec; + track.codec = "meta"; + } + + if (!(track.type in output)) { output[track.type] = {}; } + output[track.type][track.trackid] = track; + + //make up something logical for the track displayname + var name = {}; + + for (var j in track) { + switch (j) { + case "width": + name[j] = track.width+"×"+track.height; + break; + case "bps": + if (track.codec == "meta") { continue; } + if (track.bps > 0) { + var val; + if (track.bps > 1024*1024/8) { + val = Math.round(track.bps/1024/1024*8)+"mbps"; + } + else { + val = Math.round(track.bps/1024*8)+"kbps"; + } + name[j] = val; + } + break; + case "fpks": + if (track.fpks > 0) { + name[j] = track.fpks/1e3+"fps"; + } + break; + case "channels": + if (track.channels > 0) { + name[j] = (track.channels == 1 ? "Mono" : (track.channels == 2 ? "Stereo" : "Surround ("+track.channels+"ch)")); + } + break; + case "rate": + name[j] = Math.round(track.rate)+"Khz"; + break; + case "language": + if (track[j] != "Undetermined") { name[j] = track[j]; } + break; + case "codec": + if (track.codec == "meta") { continue; } + name[j] = track[j]; + break; + } + } + + track.describe = name; + + } + + //filter what to display based on what is different + for (var type in output) { + var equal = false; + for (var i in output[type]) { + if (!equal) { + //fill equal with all the keys and values of the first track of this type + equal = MistUtil.object.extend({},output[type][i].describe); + continue; + } + if (MistUtil.object.keys(output[type]).length > 1) { + //if there is more than one track of this type + for (var j in output[type][i].describe) { + if (equal[j] != output[type][i].describe[j]) { + //remove key from equal if not equal + delete equal[j]; + } + } + } + } + //apply + for (var i in output[type]) { + var different = {}; + var same = {}; + for (var j in output[type][i].describe) { + if (!(j in equal)){ + different[j] = output[type][i].describe[j]; + } + else { + same[j] = output[type][i].describe[j]; + } + } + output[type][i].different = different; + output[type][i].same = same; + var d = MistUtil.object.values(different); + output[type][i].displayName = (d.length ? d.join(", ") : MistUtil.object.values(output[type][i].describe).join(" ")); + } + } + + return output; + } + }, + isTouchDevice: function(){ + return (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); + //return true; + }, + getPos: function(element,cursorLocation){ + var style = element.currentStyle || window.getComputedStyle(element, null); + + var zoom = 1; + var node = element; + while (node) { + if ((node.style.zoom) && (node.style.zoom != "")) { + zoom *= parseFloat(node.style.zoom,10); + } + node = node.parentElement; + } + + var pos0 = element.getBoundingClientRect().left - (parseInt(element.borderLeftWidth,10) || 0); + + var width = element.getBoundingClientRect().width;; + var perc = Math.max(0,((cursorLocation.clientX/zoom) - pos0) / width); + perc = Math.min(perc,1); + + return perc; + }, + + createGraph: function(data,options){ + var ns = "http://www.w3.org/2000/svg"; + + var svg = document.createElementNS(ns,"svg"); + svg.setAttributeNS(null,"height","100%"); + svg.setAttributeNS(null,"width","100%"); + svg.setAttributeNS(null,"class","mist icon graph"); + svg.setAttributeNS(null,"preserveAspectRatio","none"); + + var x_correction = data.x[0]; + var lasty = data.y[0]; + if (options.differentiate) { + for (var i = 1; i < data.y.length; i++) { + var diff = data.y[i] - lasty; + lasty = data.y[i]; + data.y[i] = diff; + } + } + + var path = []; + var area = { + x: { + min: data.x[0] - x_correction, + max: data.x[0] - x_correction + }, + y: { + min: data.y[0]*-1, + max: data.y[0]*-1 + } + }; + + function updateMinMax(x,y) { + if (arguments.length) { + area.x.min = Math.min(area.x.min,x); + area.x.max = Math.max(area.x.max,x); + area.y.min = Math.min(area.y.min,y*-1); + area.y.max = Math.max(area.y.max,y*-1); + } + else { + //reprocess the entire path + var d = path[0].split(","); + area = { + x: { + min: d[0], + max: d[0] + }, + y: { + min: d[1], + max: d[1] + } + }; + for (var i = 1; i < path.length; i++) { + var d = path[i].split(","); + updateMinMax(d[0],d[1]*-1); + } + } + } + + path.push([data.x[0] - x_correction,data.y[0]*-1].join(",")); + for (var i = 1; i < data.y.length; i++) { + updateMinMax(data.x[i] - x_correction,data.y[i]*-1); + path.push("L "+[data.x[i] - x_correction,data.y[i]*-1].join(",")); + } + + //define gradient + var defs = document.createElementNS(ns,"defs"); + svg.appendChild(defs); + var gradient = document.createElementNS(ns,"linearGradient"); + defs.appendChild(gradient); + gradient.setAttributeNS(null,"id",MistUtil.createUnique()); + gradient.setAttributeNS(null,"gradientUnits","userSpaceOnUse"); + gradient.innerHTML += '<stop offset="0" stop-color="green"/>'; + gradient.innerHTML += '<stop offset="0.33" stop-color="yellow"/>'; + gradient.innerHTML += '<stop offset="0.66" stop-color="orange"/>'; + gradient.innerHTML += '<stop offset="1" stop-color="red"/>'; + + function updateViewBox() { + if ("x" in options) { + if ("min" in options.x) { area.x.min = options.x.min; } + if ("max" in options.x) { area.x.max = options.x.max; } + if ("count" in options.x) { area.x.min = area.x.max - options.x.count; } + } + if ("y" in options) { + if ("min" in options.y) { area.y.min = options.y.max*-1; } + if ("max" in options.y) { area.y.max = options.y.min*-1; } + } + svg.setAttributeNS(null,"viewBox",[area.x.min,area.y.min,area.x.max - area.x.min,area.y.max - area.y.min].join(" ")); + + gradient.setAttributeNS(null,"x1",0); + gradient.setAttributeNS(null,"x2",0); + if (options.reverseGradient) { + gradient.setAttributeNS(null,"y1",area.y.max); + gradient.setAttributeNS(null,"y2",area.y.min); + } + else { + gradient.setAttributeNS(null,"y1",area.y.min); + gradient.setAttributeNS(null,"y2",area.y.max); + } + } + updateViewBox(); + + var line = document.createElementNS(ns,"path"); + svg.appendChild(line); + //line.setAttributeNS(null,"vector-effect","non-scaling-stroke"); + line.setAttributeNS(null,"stroke-width","0.1"); + line.setAttributeNS(null,"fill","none"); + line.setAttributeNS(null,"stroke","url(#"+gradient.getAttribute("id")+")"); + line.setAttributeNS(null,"d","M"+path.join(" L")); + + line.addData = function(newData) { + + if (options.differentiate) { + var diff = newData.y - lasty; + lasty = newData.y; + newData.y = diff; + } + + path.push([newData.x - x_correction,newData.y*-1].join(",")); + if (options.x && options.x.count) { + if (path.length > options.x.count) { + path.shift(); + updateMinMax(); + } + } + updateMinMax(newData.x - x_correction,newData.y*-1); + this.setAttributeNS(null,"d","M"+path.join(" L")); + updateViewBox(); + }; + svg.addData = function(newData){ + line.addData(newData); + }; + + return svg; + }, + getBrowser: function(){ + var ua = window.navigator.userAgent; + + if ((ua.indexOf("MSIE ") >= 0) || (ua.indexOf("Trident/") >= 0)) { + return "ie"; + } + if (ua.indexOf("Edge/") >= 0) { + return "edge"; + } + if ((ua.indexOf("Opera") >= 0) || (ua.indexOf('OPR') >= 0)) { + return "opera"; + } + if (ua.indexOf("Chrome") >= 0) { + return "chrome"; + } + if (ua.indexOf("Safari") >= 0) { + return "safari"; + } + if (ua.indexOf("Firefox") >= 0) { + return "firefox"; + } + return false; //unknown + } +}; diff --git a/embed/wrappers/dashjs.js b/embed/wrappers/dashjs.js index a50ecefd..f40be5b7 100644 --- a/embed/wrappers/dashjs.js +++ b/embed/wrappers/dashjs.js @@ -1,162 +1,216 @@ mistplayers.dashjs = { - name: 'Dash.js Player', - version: '1.2', - mimes: ['dash/video/mp4'], - priority: Object.keys(mistplayers).length + 1, + name: "Dash.js player", + mimes: ["dash/video/mp4"/*,"html5/application/vnd.ms-ss"*/], + priority: MistUtil.object.keys(mistplayers).length + 1, isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); + return (MistUtil.array.indexOf(this.mimes,mimetype) == -1 ? false : true); }, - isBrowserSupported: function (mimetype,source,options) { - if ((options.host.substr(0,7) == 'http://') && (source.url.substr(0,8) == 'https://')) { return false; } - return (('MediaSource' in window) && (location.protocol != 'file:')); + isBrowserSupported: function (mimetype,source,MistVideo) { + + //check for http/https mismatch + if (location.protocol != MistUtil.http.url.split(source.url).protocol) { + MistVideo.log("HTTP/HTTPS mismatch for this source"); + return false; + } + + //don't use dashjs if this location is loaded over file:// + if (location.protocol == "file:") { + MistVideo.log("This source ("+mimetype+") won't load if the page is run via file://"); + return false; + } + + return ("MediaSource" in window); }, - player: function(){this.onreadylist = [];} + player: function(){this.onreadylist = [];}, + scriptsrc: function(host) { return host+"/dashjs.js"; } }; var p = mistplayers.dashjs.player; p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - var cont = document.createElement('div'); - cont.className = 'mistplayer'; +p.prototype.build = function (MistVideo,callback) { var me = this; - function onplayerload () { - var ele = me.getElement('video'); - ele.className = ''; - cont.appendChild(ele); - ele.width = options.width; - ele.height = options.height; + this.onDashLoad = function() { + if (MistVideo.destroyed) { return; } - if (options.autoplay) { - ele.setAttribute('autoplay',''); - } - if (options.loop) { - ele.setAttribute('loop',''); - } - if (options.poster) { - ele.setAttribute('poster',options.poster); - } - if (options.controls) { - if (options.controls == 'stock') { - ele.setAttribute('controls',''); - } - else { - me.buildMistControls(); - } - } + MistVideo.log("Building DashJS player.."); - ele.addEventListener('error',function(e){ - var msg; - if ('message' in e) { - msg = e.message; - } - else { - msg = 'readyState: '; - switch (me.element.readyState) { - case 0: - msg += 'HAVE_NOTHING'; - break; - case 1: - msg += 'HAVE_METADATA'; - break; - case 2: - msg += 'HAVE_CURRENT_DATA'; - break; - case 3: - msg += 'HAVE_FUTURE_DATA'; - break; - case 4: - msg += 'HAVE_ENOUGH_DATA'; - break; + var ele = document.createElement("video"); + + if ("Proxy" in window) { + var overrides = { + get: {}, + set: {} + }; + + MistVideo.player.api = new Proxy(ele,{ + get: function(target, key, receiver){ + if (key in overrides.get) { + return overrides.get[key].apply(target, arguments); + } + var method = target[key]; + if (typeof method === "function"){ + return function () { + return method.apply(target, arguments); + } + } + return method; + }, + set: function(target, key, value) { + if (key in overrides.set) { + return overrides.set[key].call(target,value); + } + return target[key] = value; } - msg += ' networkState: '; - switch (me.element.networkState) { - case 0: - msg += 'NETWORK_EMPTY'; - break; - case 1: - msg += 'NETWORK_IDLE'; - break; - case 2: - msg += 'NETWORK_LOADING'; - break; - case 3: - msg += 'NETWORK_NO_SOURCE'; - break; - } - } - //prevent onerror loops - if (e.target == me.element) { - e.message = msg; - } - else { - me.adderror(msg); - } - }); - var events = ['abort','canplay','canplaythrough','durationchange','emptied','ended','interruptbegin','interruptend','loadeddata','loadedmetadata','loadstart','pause','play','playing','ratechange','seeked','seeking','stalled','volumechange','waiting']; - for (var i in events) { - ele.addEventListener(events[i],function(e){ - me.addlog('Player event fired: '+e.type); }); + + if (MistVideo.info.type == "live") { + overrides.get.duration = function(){ + //this should indicate the end of Mist's buffer + var buffer_end = 0; + if (this.buffered.length) { + buffer_end = this.buffered.end(this.buffered.length-1) + } + var time_since_buffer = (new Date().getTime() - MistVideo.player.api.lastProgress.getTime())*1e-3; + return buffer_end + time_since_buffer + -1*MistVideo.player.api.liveOffset + 45; + }; + overrides.set.currentTime = function(value){ + var offset = value - MistVideo.player.api.duration; + //MistVideo.player.api.liveOffset = offset; + + MistVideo.log("Seeking to "+MistUtil.format.time(value)+" ("+Math.round(offset*-10)/10+"s from live)"); + + MistVideo.video.currentTime = value; + //.player.api.setSource(MistUtil.http.url.addParam(MistVideo.source.url,{startunix:offset})); + } + MistUtil.event.addListener(ele,"progress",function(){ + MistVideo.player.api.lastProgress = new Date(); + }); + MistVideo.player.api.lastProgress = new Date(); + MistVideo.player.api.liveOffset = 0; + } + + } + else { + me.api = ele; + } + + if (MistVideo.options.autoplay) { + ele.setAttribute("autoplay",""); + } + if ((MistVideo.options.loop) && (MistVideo.info.type != "live")) { + ele.setAttribute("loop",""); + } + if (MistVideo.options.poster) { + ele.setAttribute("poster",MistVideo.options.poster); + } + if (MistVideo.options.controls == "stock") { + ele.setAttribute("controls",""); } var player = dashjs.MediaPlayer().create(); - player.getDebug().setLogToBrowserConsole(false); - player.initialize(ele,options.src,true); + //player.getDebug().setLogToBrowserConsole(false); + player.initialize(ele,MistVideo.source.url,MistVideo.options.autoplay); + + me.dash = player; - me.src = options.src; + //add listeners for events that we can log + var skipEvents = ["METRIC_ADDED","METRIC_CHANGED","METRICS_CHANGED","FRAGMENT_LOADING_STARTED","FRAGMENT_LOADING_COMPLETED","LOG","PLAYBACK_TIME_UPDATED","PLAYBACK_PROGRESS"]; + for (var i in dashjs.MediaPlayer.events) { + if (skipEvents.indexOf(i) < 0) { + me.dash.on(dashjs.MediaPlayer.events[i],function(e){ + MistVideo.log("Player event fired: "+e.type); + }); + } + } - me.addlog('Built html'); - callback(cont); + MistVideo.player.setSize = function(size){ + this.api.style.width = size.width+"px"; + this.api.style.height = size.height+"px"; + }; + MistVideo.player.api.setSource = function(url) { + MistVideo.player.dash.attachSource(url); + }; + + //trackswitching + MistVideo.player.api.setTrack = function(type,id){ + var meta = MistUtil.tracks.parse(MistVideo.info.meta.tracks); + if ((!(type in meta)) || ((!(id in meta[type]) && (id != 0)))) { + MistVideo.log("Skipping trackselection of "+type+" track "+id+" because it does not exist"); + return; + } + + //figure out what the track number is + //whyyyy did it have to be reverse order + var n = me.dash.getBitrateInfoListFor("video").length - 1; + for (var i in MistVideo.info.meta.tracks) { + var t = MistVideo.info.meta.tracks[i]; + if (t.type == type) { + if (t.trackid == id) { break; } + n--; + } + } + + me.dash.setAutoSwitchQualityFor(type,false); //turn off ABR rules //TODO do we want this by default? + me.dash.setFastSwitchEnabled(true); //show the new track asap + me.dash.setQualityFor(type,n); + //dash does change the track, but is appended to the buffer, so it seems to take a while.. + } + + //react to automatic trackswitching + me.dash.on("qualityChangeRendered",function(e){ + //the newQuality-th track of type mediaType is being selected + + //figure out the track id + //whyyyy did it have to be reverse order + var n = me.dash.getBitrateInfoListFor("video").length - 1; + var id; + for (var i in MistVideo.info.meta.tracks) { + var t = MistVideo.info.meta.tracks[i]; + if (t.type == e.mediaType) { + if (e.newQuality == n) { + id = t.trackid; + break; + } + n--; + } + } + + //create an event to pass this to the skin + MistUtil.event.send("playerUpdate_trackChanged",{ + type: e.mediaType, + trackid: id + },MistVideo.video); + + }); + + //dashjs keeps on spamming the stalled icon >_> + MistUtil.event.addListener(ele,"progress",function(e){ + if (MistVideo.container.getAttribute("data-loading") == "stalled") { + MistVideo.container.removeAttribute("data-loading"); + } + }); + + me.api.unload = function(){ + me.dash.reset(); + }; + + MistVideo.log("Built html"); + callback(ele); } - if ('dash' in window) { - onplayerload(); + if ("dashjs" in window) { + this.onDashLoad(); } else { - //load the dashjs player - var scripttag = document.createElement('script'); - scripttag.src = options.host+'/dashjs.js'; - me.addlog('Retrieving dashjs player code from '+scripttag.src); - document.head.appendChild(scripttag); - scripttag.onerror = function(){ - me.askNextCombo('Failed to load dashjs.js'); - } - scripttag.onload = function(){ - onplayerload(); - } + + var scripttag = MistUtil.scripts.insert(MistVideo.urlappend(mistplayers.dashjs.scriptsrc(MistVideo.options.host)),{ + onerror: function(e){ + var msg = "Failed to load dashjs.js"; + if (e.message) { msg += ": "+e.message; } + MistVideo.showError(msg); + }, + onload: me.onDashLoad + },MistVideo); } } -p.prototype.play = function(){ return this.element.play(); }; -p.prototype.pause = function(){ return this.element.pause(); }; -p.prototype.volume = function(level){ - if (typeof level == 'undefined' ) { return this.element.volume; } - return this.element.volume = level; -}; -p.prototype.play = function(){ return this.element.play(); }; -p.prototype.load = function(){ return this.element.load(); }; -if (document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) { - p.prototype.fullscreen = function(){ - if(this.element.requestFullscreen) { - return this.element.requestFullscreen(); - } else if(this.element.mozRequestFullScreen) { - return this.element.mozRequestFullScreen(); - } else if(this.element.webkitRequestFullscreen) { - return this.element.webkitRequestFullscreen(); - } else if(this.element.msRequestFullscreen) { - return this.element.msRequestFullscreen(); - } - }; -} -p.prototype.resize = function(size){ - this.element.width = size.width; - this.element.height = size.height; -}; -p.prototype.updateSrc = function(src){ - if (src == '') { - this.dash.reset(); - return; - } - this.dash.attachSource(src); - return true; -}; diff --git a/embed/wrappers/flash_strobe.js b/embed/wrappers/flash_strobe.js index 575ccc47..082f22c7 100644 --- a/embed/wrappers/flash_strobe.js +++ b/embed/wrappers/flash_strobe.js @@ -1,26 +1,37 @@ mistplayers.flash_strobe = { - name: 'Strobe Flash Media Playback', - version: '1.1', - mimes: ['flash/10','flash/11','flash/7'], - priority: Object.keys(mistplayers).length + 1, + name: "Strobe Flash media playback", + mimes: ["flash/10","flash/11","flash/7"], + priority: MistUtil.object.keys(mistplayers).length + 1, isMimeSupported: function (mimetype) { return (this.mimes.indexOf(mimetype) == -1 ? false : true); }, - isBrowserSupported: function (mimetype,source,options) { - //check for http / https crossovers - if ((options.host.substr(0,7) == 'http://') && (source.url.substr(0,8) == 'https://')) { return false; } + isBrowserSupported: function (mimetype,source,MistVideo) { + + //check for http/https mismatch + if ((MistUtil.http.url.split(source.url).protocol.slice(0,4) == "http") && (location.protocol != MistUtil.http.url.split(source.url).protocol)) { + MistVideo.log("HTTP/HTTPS mismatch for this source"); + return false; + } var version = 0; try { // check in the mimeTypes - version = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\.])/g, '').split('.')[0]; + var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin; + if (plugin.version) { version = plugin.version.split(".")[0]; } + else { version = plugin.description.replace(/([^0-9\.])/g, "").split(".")[0]; } } catch(e){} try { // for our special friend IE - version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable("$version").replace(/([^0-9\,])/g, '').split(',')[0]; + version = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/([^0-9\,])/g, "").split(",")[0]; } catch(e){} - var mimesplit = mimetype.split('/'); + if (!version) { + //flash is not enabled? Might need to ask permission first. + //TODO how? just let it build? + return false; + } + + var mimesplit = mimetype.split("/"); return Number(version) >= Number(mimesplit[mimesplit.length-1]); }, @@ -28,39 +39,53 @@ mistplayers.flash_strobe = { }; var p = mistplayers.flash_strobe.player; p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - function createParam(name,value) { - var p = document.createElement('param'); - p.setAttribute('name',name); - p.setAttribute('value',value); - return p; - } +p.prototype.build = function (MistVideo,callback) { - - var ele = this.getElement('object'); - - ele.setAttribute('width',options.width); - ele.setAttribute('height',options.height); - - ele.appendChild(createParam('movie',options.host+options.source.player_url)); - var flashvars = 'src='+encodeURIComponent(options.src)+'&controlBarMode='+(options.controls ? 'floating' : 'none')+'&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3'+(options.live ? '&streamType=live' : '')+(options.autoplay ? '&autoPlay=true' : '' ); - ele.appendChild(createParam('flashvars',flashvars)); - ele.appendChild(createParam('allowFullScreen','true')); - ele.appendChild(createParam('wmode','direct')); - if (options.autoplay) { - ele.appendChild(createParam('autoPlay','true')); - } - - var e = document.createElement('embed'); + var ele = document.createElement("object"); + var e = document.createElement("embed"); ele.appendChild(e); - e.setAttribute('src',options.source.player_url); - e.setAttribute('type','application/x-shockwave-flash'); - e.setAttribute('allowfullscreen','true'); - e.setAttribute('width',options.width); - e.setAttribute('height',options.height); - e.setAttribute('flashvars',flashvars); + function build(source) { + var options = MistVideo.options; + function createParam(name,value) { + var p = document.createElement("param"); + p.setAttribute("name",name); + p.setAttribute("value",value); + return p; + } + + MistUtil.empty(ele); + ele.appendChild(createParam("movie",MistVideo.urlappend(options.host+MistVideo.source.player_url))); + var flashvars = "src="+encodeURIComponent(source)+"&controlBarMode="+(options.controls ? "floating" : "none")+"&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3"+(options.live ? "&streamType=live" : "")+(options.autoplay ? "&autoPlay=true" : "" ); + ele.appendChild(createParam("flashvars",flashvars)); + ele.appendChild(createParam("allowFullScreen","true")); + ele.appendChild(createParam("wmode","direct")); + if (options.autoplay) { + ele.appendChild(createParam("autoPlay","true")); + } + + e.setAttribute("src",MistVideo.urlappend(MistVideo.source.player_url)); + e.setAttribute("type","application/x-shockwave-flash"); + e.setAttribute("allowfullscreen","true"); + e.setAttribute("flashvars",flashvars); + } + build(MistVideo.source.url); - this.addlog('Built html'); + this.api = {}; + this.setSize = function(size){ + ele.setAttribute("width",size.width); + ele.setAttribute("height",size.height); + e.setAttribute("width",size.width); + e.setAttribute("height",size.height); + }; + this.setSize(MistVideo.calcSize()); + this.onready(function(){ + if (MistVideo.container) { MistVideo.container.removeAttribute("data-loading"); } + }); + this.api.setSource = function(url){ + build(url); + } + + MistVideo.log("Built html"); callback(ele); } diff --git a/embed/wrappers/html5.js b/embed/wrappers/html5.js index 5198c1d9..f25a38c9 100644 --- a/embed/wrappers/html5.js +++ b/embed/wrappers/html5.js @@ -1,29 +1,87 @@ mistplayers.html5 = { - name: 'HTML5 video player', - version: '1.1', - mimes: ['html5/application/vnd.apple.mpegurl','html5/video/mp4','html5/video/ogg','html5/video/webm','html5/audio/mp3','html5/audio/webm','html5/audio/ogg','html5/audio/wav'], - priority: Object.keys(mistplayers).length + 1, + name: "HTML5 video player", + mimes: ["html5/application/vnd.apple.mpegurl","html5/video/mp4","html5/video/ogg","html5/video/webm","html5/audio/mp3","html5/audio/webm","html5/audio/ogg","html5/audio/wav"], + priority: MistUtil.object.keys(mistplayers).length + 1, isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); + return (MistUtil.array.indexOf(this.mimes,mimetype) == -1 ? false : true); }, - isBrowserSupported: function (mimetype,source,options,streaminfo) { - if ((['iPad','iPhone','iPod','MacIntel'].indexOf(navigator.platform) != -1) && (mimetype == 'html5/video/mp4')) { return false; } + isBrowserSupported: function (mimetype,source,MistVideo) { - var support = false; - var shortmime = mimetype.split('/'); - shortmime.shift(); - - if ((shortmime[0] == 'audio') && (streaminfo.height) && (!options.forceType) && (!options.forceSource)) { - //claim you don't support audio-only playback if there is video data, unless this mime is being forced - return false; + //check for http/https mismatch + if (location.protocol != MistUtil.http.url.split(source.url).protocol) { + if ((location.protocol == "file:") && (MistUtil.http.url.split(source.url).protocol == "http:")) { + MistVideo.log("This page was loaded over file://, the player might not behave as intended."); + } + else { + MistVideo.log("HTTP/HTTPS mismatch for this source"); + return false; + } } + + var support = false; + var shortmime = mimetype.split("/"); + shortmime.shift(); + try { - var v = document.createElement((shortmime[0] == 'audio' ? 'audio' : 'video')); - shortmime = shortmime.join('/') - if ((v) && (v.canPlayType(shortmime) != "")) { - support = v.canPlayType(shortmime); + shortmime = shortmime.join("/"); + + function test(mime) { + var v = document.createElement("video"); + if ((v) && (v.canPlayType(mime) != "")) { + support = v.canPlayType(mime); + } + return support; } + + if (shortmime == "video/mp4") { + function translateCodec(track) { + + function bin2hex(index) { + return ("0"+track.init.charCodeAt(index).toString(16)).slice(-2); + } + + switch (track.codec) { + case "AAC": + return "mp4a.40.2"; + case "MP3": + return "mp3"; + //return "mp4a.40.34"; + case "AC3": + return "ec-3"; + case "H264": + return "avc1."+bin2hex(1)+bin2hex(2)+bin2hex(3); + case "HEVC": + return "hev1."+bin2hex(1)+bin2hex(6)+bin2hex(7)+bin2hex(8)+bin2hex(9)+bin2hex(10)+bin2hex(11)+bin2hex(12); + default: + return track.codec.toLowerCase(); + } + + } + var codecs = {}; + for (var i in MistVideo.info.meta.tracks) { + if (MistVideo.info.meta.tracks[i].type != "meta") { + codecs[translateCodec(MistVideo.info.meta.tracks[i])] = 1; + } + } + codecs = MistUtil.object.keys(codecs); + if (codecs.length) { + if (codecs.length > source.simul_tracks) { + //not all of the tracks have to work + var working = 0; + for (var i in codecs) { + var s = test(shortmime+";codecs=\""+codecs[i]+"\""); + if (s) { + working++; + } + } + return (working >= source.simul_tracks); + } + shortmime += ";codecs=\""+codecs.join(",")+"\""; + } + } + + support = test(shortmime); } catch(e){} return support; }, @@ -34,206 +92,159 @@ mistplayers.html5 = { }; var p = mistplayers.html5.player; p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - var cont = document.createElement('div'); - cont.className = 'mistplayer'; - var me = this; //to allow nested functions to access the player class itself - - var shortmime = options.source.type.split('/'); +p.prototype.build = function (MistVideo,callback) { + var shortmime = MistVideo.source.type.split("/"); shortmime.shift(); + var video = document.createElement("video"); - var ele = this.getElement((shortmime[0] == 'audio' ? 'audio' : 'video')); - ele.className = ''; - cont.appendChild(ele); + //TODO verify: not required if player is loaded from same domain as it should always be when not in dev mode? + video.setAttribute("crossorigin","anonymous");//required for subs, breaks ogg? - if (options.source.type != "html5/video/ogg") { - ele.crossOrigin = 'anonymous'; //required for subtitles, but if ogg, the video won't load - } + var source = document.createElement("source"); + source.setAttribute("src",MistVideo.source.url); + video.source = source; + video.appendChild(source); + source.type = shortmime.join("/"); - if (shortmime[0] == 'audio') { - this.setTracks = function() { return false; } - this.fullscreen = false; - cont.className += ' audio'; - } - - this.addlog('Building HTML5 player..'); - - var source = document.createElement('source'); - source.setAttribute('src',options.src); - this.source = source; - ele.appendChild(source); - source.type = shortmime.join('/'); - this.addlog('Adding '+source.type+' source @ '+options.src); - - if ((this.tracks.subtitle.length) && (this.subtitle)) { - for (var i in this.tracks.subtitle) { - var t = document.createElement('track'); - ele.appendChild(t); - t.kind = 'subtitles'; - t.label = this.tracks.subtitle[i].desc; - t.srclang = this.tracks.subtitle[i].lang; - t.src = this.subtitle+'?track='+this.tracks.subtitle[i].trackid; + //apply options + var attrs = ["autoplay","loop","poster"]; + for (var i in attrs) { + var attr = attrs[i]; + if (MistVideo.options[attr]) { + video.setAttribute(attr,(MistVideo.options[attr] === true ? "" : MistVideo.options[attr])); } } - - ele.width = options.width; - ele.height = options.height; - ele.style.width = options.width+'px'; - ele.style.height = options.height+'px'; - - if (options.autoplay) { - ele.setAttribute('autoplay',''); + if (MistVideo.options.controls == "stock") { + video.setAttribute("controls",""); } - if (options.loop) { - ele.setAttribute('loop',''); - } - if (options.poster) { - ele.setAttribute('poster',options.poster); - } - if (options.controls) { - if ((options.controls == 'stock') || (!this.buildMistControls())) { - //MistControls have failed to build in the if condition - ele.setAttribute('controls',''); - } + if (MistVideo.info.type == "live") { + video.loop = false; } - cont.onclick = function(){ - if (ele.paused) { ele.play(); } - else { ele.pause(); } - }; - - this.addlog('Built html'); - - //forward events - ele.addEventListener('error',function(e){ - if (!e.isTrusted) { return; } //don't trigger on errors we have thrown ourselves + if (("Proxy" in window) && ("Reflect" in window)) { + var overrides = { + get: {}, + set: {} + }; - if (options.live) { - if ((ele.error) && (ele.error.code == 3)) { - e.stopPropagation(); //dont let this error continue to prevent the core from trying to handle the error - me.load(); - me.cancelAskNextCombo(); - e.message = 'Handled decoding error'; - me.addlog('Decoding error: reloading..'); - me.report({ - type: 'playback', - warn: 'A decoding error was encountered, but handled' - }); - return; + MistVideo.player.api = new Proxy(video,{ + get: function(target, key, receiver){ + if (key in overrides.get) { + return overrides.get[key].apply(target, arguments); + } + var method = target[key]; + if (typeof method === "function"){ + return function () { + return method.apply(target, arguments); + } + } + return method; + }, + set: function(target, key, value) { + if (key in overrides.set) { + return overrides.set[key].call(target,value); + } + return target[key] = value; } - } + }); - var msg; - if ('message' in e) { - msg = e.message; + if (MistVideo.source.type == "html5/audio/mp3") { + overrides.set.currentTime = function(){ + MistVideo.log("Seek attempted, but MistServer does not currently support seeking in MP3."); + return false; + } + } - else if ((e.target.tagName == 'SOURCE') && (e.target.getAttribute('src') == '')) { - e.stopPropagation(); - //this error is triggered because the unload function was fired - return; + if (MistVideo.info.type == "live") { + + overrides.get.duration = function(){ + //this should indicate the end of Mist's buffer + var buffer_end = 0; + if (this.buffered.length) { + buffer_end = this.buffered.end(this.buffered.length-1) + } + var time_since_buffer = (new Date().getTime() - MistVideo.player.api.lastProgress.getTime())*1e-3; + return buffer_end + time_since_buffer - MistVideo.player.api.liveOffset; + }; + overrides.set.currentTime = function(value){ + var offset = value - MistVideo.player.api.duration; + MistVideo.player.api.liveOffset = offset; + + MistVideo.log("Seeking to "+MistUtil.format.time(value)+" ("+Math.round(offset*-10)/10+"s from live)"); + + MistVideo.player.api.setSource(MistUtil.http.url.addParam(MistVideo.source.url,{startunix:offset})); + } + MistUtil.event.addListener(video,"progress",function(){ + MistVideo.player.api.lastProgress = new Date(); + }); + MistVideo.player.api.lastProgress = new Date(); + MistVideo.player.api.liveOffset = 0; + + + MistUtil.event.addListener(video,"pause",function(){ + MistVideo.player.api.pausedAt = new Date(); + }); + overrides.get.play = function(){ + return function(){ + if ((MistVideo.player.api.paused) && (MistVideo.player.api.pausedAt) && ((new Date()) - MistVideo.player.api.pausedAt > 5e3)) { + video.load(); + MistVideo.log("Reloading source.."); + } + + return video.play.apply(video, arguments); + } + }; + + if (MistVideo.source.type == "html5/video/mp4") { + overrides.get.currentTime = function(){ + return this.currentTime - MistVideo.player.api.liveOffset + MistVideo.info.lastms * 1e-3; + } + } } else { - msg = 'readyState: '; - switch (me.element.readyState) { - case 0: - msg += 'HAVE_NOTHING'; - break; - case 1: - msg += 'HAVE_METADATA'; - break; - case 2: - msg += 'HAVE_CURRENT_DATA'; - break; - case 3: - msg += 'HAVE_FUTURE_DATA'; - break; - case 4: - msg += 'HAVE_ENOUGH_DATA'; - break; - } - msg += ' networkState: '; - switch (me.element.networkState) { - case 0: - msg += 'NETWORK_EMPTY'; - break; - case 1: - msg += 'NETWORK_IDLE'; - break; - case 2: - msg += 'NETWORK_LOADING'; - break; - case 3: - msg += 'NETWORK_NO_SOURCE'; - break; + if (!isFinite(video.duration)) { + var duration = 0; + for (var i in MistVideo.info.meta.tracks) { + duration = Math.max(duration,MistVideo.info.meta.tracks[i].lastms); + } + overrides.get.duration = function(){ + if (isFinite(this.duration)) { return this.duration; } + return duration * 1e-3; + } } } - me.adderror(msg); - }); - var events = ['abort','canplay','canplaythrough','durationchange','emptied','ended','interruptbegin','interruptend','loadeddata','loadedmetadata','loadstart','pause','play','playing','ratechange','seeked','seeking','stalled','volumechange','waiting','progress']; - for (var i in events) { - ele.addEventListener(events[i],function(e){ - me.addlog('Player event fired: '+e.type); - }); - } - callback(cont); -} -p.prototype.play = function(){ return this.element.play(); }; -p.prototype.pause = function(){ return this.element.pause(); }; -p.prototype.volume = function(level){ - if (typeof level == 'undefined' ) { return this.element.volume; } - return this.element.volume = level; -}; -p.prototype.loop = function(bool){ - if (typeof bool == 'undefined') { - return this.element.loop; - } - return this.element.loop = bool; -}; -p.prototype.load = function(){ - var load; - if (this.element.paused) { - load = this.element.load(); } else { - //sometimes there is a play / pause interrupt: try again - //TODO figure out if this happens on paused or on playing - this.load(); - return; + MistVideo.player.api = video; } - - //this helps to prevent the player from just showing a black screen after a reload - if (this.element.paused) { - var me = this; - var unpause = function(){ - if (me.element.paused) { - me.element.play(); - } - me.element.removeEventListener('progress',unpause); - } - this.element.addEventListener('progress',unpause); - } - - return load; -}; -if (document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) { - p.prototype.fullscreen = function(){ - if(this.element.requestFullscreen) { - return this.element.requestFullscreen(); - } else if(this.element.mozRequestFullScreen) { - return this.element.mozRequestFullScreen(); - } else if(this.element.webkitRequestFullscreen) { - return this.element.webkitRequestFullscreen(); - } else if(this.element.msRequestFullscreen) { - return this.element.msRequestFullscreen(); + MistVideo.player.api.setSource = function(url) { + if (url != this.source.src) { + this.source.src = url; + this.load(); } }; + MistVideo.player.api.setSubtitle = function(trackmeta) { + //remove previous subtitles + var tracks = video.getElementsByTagName("track"); + for (var i = tracks.length - 1; i >= 0; i--) { + video.removeChild(tracks[i]); + } + if (trackmeta) { //if the chosen track exists + //add the new one + var track = document.createElement("track"); + video.appendChild(track); + track.kind = "subtitles"; + track.label = trackmeta.label; + track.srclang = trackmeta.lang; + track.src = trackmeta.src; + track.setAttribute("default",""); + } + }; + MistVideo.player.setSize = function(size){ + this.api.style.width = size.width+"px"; + this.api.style.height = size.height+"px"; + }; + + callback(video); } -p.prototype.updateSrc = function(src){ - this.source.setAttribute('src',src); - return true; -}; -p.prototype.resize = function(size){ - this.element.width = size.width; - this.element.height = size.height; -}; diff --git a/embed/wrappers/img.js b/embed/wrappers/img.js deleted file mode 100644 index 3dce1c2b..00000000 --- a/embed/wrappers/img.js +++ /dev/null @@ -1,23 +0,0 @@ -mistplayers.img = { - name: 'HTML img tag', - version: '1.1', - mimes: ['html5/image/jpeg'], - priority: Object.keys(mistplayers).length + 1, - isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); - }, - isBrowserSupported: function (mimetype,source,options,streaminfo) { - //only use this if we are sure we just want an image - if ((options.forceType) || (options.forceSource) || (options.forcePlayer)) { return true; } - return false; - }, - player: function(){this.onreadylist = [];} -}; -var p = mistplayers.img.player; -p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - var ele = this.getElement('img'); - ele.src = options.src; - ele.style.display = 'block'; - callback(ele); -} diff --git a/embed/wrappers/jwplayer.js b/embed/wrappers/jwplayer.js deleted file mode 100644 index 766bc34e..00000000 --- a/embed/wrappers/jwplayer.js +++ /dev/null @@ -1,40 +0,0 @@ -mistplayers.jwplayer = { - name: 'JWPlayer', - version: '0.2', - mimes: ['html5/video/mp4','html5/video/webm','dash/video/mp4','flash/10','flash/7','html5/application/vnd.apple.mpegurl','html5/audio/mp3','html5/audio/aac'], - priority: Object.keys(mistplayers).length + 1, - isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); - }, - isBrowserSupported: function (mimetype) { - //TODO like, actually check the browser or something? - if (typeof jwplayer == 'function') { - return true; - } - return false; - }, - player: function(){} -}; -var p = mistplayers.jwplayer.player; -p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - var ele = this.getElement('div'); - - this.jw = jwplayer(ele).setup({ - file: options.src, - width: options.width, - height: options.height, - autostart: options.autoplay, - image: options.poster, - controls: options.controls - }); - - this.addlog('Built html'); - callback(ele); -} -p.prototype.play = function(){ return this.jw.play(); }; -p.prototype.pause = function(){ return this.jw.pause(); }; -p.prototype.volume = function(level){ - if (typeof level == 'undefined' ) { return this.jw.getVolume/100; } - return this.jw.setVolume(level*100); -}; diff --git a/embed/wrappers/polytrope.js b/embed/wrappers/polytrope.js deleted file mode 100644 index 0c2dd483..00000000 --- a/embed/wrappers/polytrope.js +++ /dev/null @@ -1,101 +0,0 @@ -mistplayers.polytrope = { - name: 'Polytrope Flash Player', - version: '0.2', - mimes: ['flash/11','flash/10','flash/7'], - priority: Object.keys(mistplayers).length + 1, - isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); - }, - isBrowserSupported: function (mimetype) { - return false; - - var version = 0; - try { - // check in the mimeTypes - version = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\.])/g, '').split('.')[0]; - } catch(e){} - try { - // for our special friend IE - version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable("$version").replace(/([^0-9\,])/g, '').split(',')[0]; - } catch(e){} - - var mimesplit = mimetype.split('/'); - - return Number(version) >= Number(mimesplit[mimesplit.length-1]); - }, - player: function(){} -}; -var p = mistplayers.polytrope.player; -p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - function createParam(name,value) { - var p = document.createElement('param'); - p.setAttribute('name',name); - p.setAttribute('value',value); - return p; - } - - //TODO its not working. - - /* - this.swf = this.video_instance_el.flash({ - swf: "/shared/swf/videoplayer.swf?" + (new Date).getTime(), - width: "100%", - height: parseInt(this.options.element.height()), - wmode: "opaque", - menu: "false", - allowFullScreen: "true", - allowFullScreenInteractive: "true", - allowScriptAccess: "always", - id: "cucumbertv-swf-" + this.guid, - expressInstall: "/shared/swf/expressInstall.swf", - flashvars: { - rtmp_url: "rtmp://" + this.options.stream_host + "/play/", - stream_name: this.options.stream_name, - poster: this.options.poster, - autoplay: this.options.autoplay, - color_1: "0x1d1d1d", - color_2: "0xffffff", - buffer_time: .1, - is_streaming_url: "/api/user/is_streaming", - username: this.options.username, - mode: "v" == this.options.type ? "archive" : "live", - guid: this.guid - } - }) - - <div> - <object data="/shared/swf/videoplayer.swf?1468312898591" type="application/x-shockwave-flash" id="cucumbertv-swf-4dc64c18-59af-91a2-d0c5-ab8df4f45c65" width="100%" height="660"> - <param name="wmode" value="opaque"> - <param name="menu" value="false"> - <param name="allowFullScreen" value="true"> - <param name="allowFullScreenInteractive" value="true"> - <param name="allowScriptAccess" value="always"> - <param name="expressInstall" value="/shared/swf/expressInstall.swf"> - <param name="flashvars" value="rtmp_url=rtmp://www.stickystage.com/play/&stream_name=stickystage_archive+SrA-2016.07.08.23.54.08&poster=/stickystage/users/SrA/archive/SrA-2016.07.08.23.54.08.jpg&autoplay=true&color_1=0x1d1d1d&color_2=0xffffff&buffer_time=0.1&is_streaming_url=/api/user/is_streaming&username=SrA&mode=archive&guid=4dc64c18-59af-91a2-d0c5-ab8df4f45c65"> - <param name="movie" value="/shared/swf/videoplayer.swf?1468312898591"> - </object> - </div> - */ - - - - var ele = this.element('object'); - ele.data = 'players/polytrope.swf'; - ele.type = 'application/x-shockwave-flash'; - ele.width = options.width; - ele.height = options.height; - - /* - ele.appendChild(createParam('allowFullScreen','true')); - ele.appendChild(createParam('allowScriptAccess','always')); - var flashvars = 'rtmp_url=rtmp://www.stickystage.com/play/&stream_name=stickystage_archive+SrA-2016.07.08.23.54.08&poster=/stickystage/users/SrA/archive/SrA-2016.07.08.23.54.08.jpg&autoplay=true&color_1=0x1d1d1d&color_2=0xffffff&buffer_time=0.1&is_streaming_url=/api/user/is_streaming&username=SrA&mode=archive&guid=4dc64c18-59af-91a2-d0c5-ab8df4f45c65'; - ele.appendChild(createParam('flashvars',flashvars)); - ele.appendChild(createParam('movie','players/polytrope.swf')); - */ - - ele.innerHTML = '<param name="wmode" value="opaque"> <param name="menu" value="false"> <param name="allowFullScreen" value="true"> <param name="allowFullScreenInteractive" value="true"> <param name="allowScriptAccess" value="always"> <param name="expressInstall" value="/shared/swf/expressInstall.swf"> <param name="flashvars" value="rtmp_url=rtmp://www.stickystage.com/play/&stream_name=stickystage_archive+SrA-2016.07.08.23.54.08&poster=http://stickystage.com/stickystage/users/SrA/archive/SrA-2016.07.08.23.54.08.jpg&autoplay=true&color_1=0x1d1d1d&color_2=0xffffff&buffer_time=0.1&is_streaming_url=/api/user/is_streaming&username=SrA&mode=archive&guid=4dc64c18-59af-91a2-d0c5-ab8df4f45c65"> <param name="movie" value="players/polytrope.swf">'; - - this.addlog('Built html'); - callback(ele); -} diff --git a/embed/wrappers/silverlight.js b/embed/wrappers/silverlight.js deleted file mode 100644 index 2f099562..00000000 --- a/embed/wrappers/silverlight.js +++ /dev/null @@ -1,56 +0,0 @@ -mistplayers.silverlight = { - name: 'Silverlight', - version: '1.1', - mimes: ['silverlight'], - priority: Object.keys(mistplayers).length + 1, - isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); - }, - isBrowserSupported: function (mimetype) { - var plugin; - try { - // check in the mimeTypes - plugin = navigator.plugins["Silverlight Plug-In"]; - return !!plugin; - } catch(e){} - try { - // for our special friend IE - plugin = new ActiveXObject('AgControl.AgControl'); - return true; - } catch(e){} - - return false; - }, - player: function(){this.onreadylist = [];} -}; -var p = mistplayers.silverlight.player; -p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - function createParam(name,value) { - var p = document.createElement('param'); - p.setAttribute('name',name); - p.setAttribute('value',value); - return p; - } - - var ele = this.getElement('object'); - ele.setAttribute('data','data:application/x-silverlight,'); - ele.setAttribute('type','application/x-silverlight'); - ele.setAttribute('width',options.width); - ele.setAttribute('height',options.height); - ele.appendChild(createParam('source',encodeURI(options.src)+'/player.xap')); - ele.appendChild(createParam('initparams','autoload=false,'+(options.autoplay ? 'autoplay=true' : 'autoplay=false')+',displaytimecode=false,enablecaptions=true,joinLive=true,muted=false')); - - var a = document.createElement('a'); - ele.appendChild(a); - a.setAttribute('href','http://go.microsoft.com/fwlink/?LinkID=124807'); - a.setAttribute('style','text-decoration: none;'); - var img = document.createElement('img'); - a.appendChild(img); - img.setAttribute('src','http://go.microsoft.com/fwlink/?LinkId=108181'); - img.setAttribute('alt','Get Microsoft Silverlight'); - img.setAttribute('style','border-style: none;') - - this.addlog('Built html'); - callback(ele); -} diff --git a/embed/wrappers/template.js b/embed/wrappers/template.js deleted file mode 100644 index 73927ca2..00000000 --- a/embed/wrappers/template.js +++ /dev/null @@ -1,24 +0,0 @@ -mistplayers.myplayer = { - name: 'My video player', - version: '0.1', - mimes: ['my/mime/types'], - priority: Object.keys(mistplayers).length + 1, - isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); - }, - isBrowserSupported: function (mimetype) { - //TODO your code here - return false; - }, - player: function(){} -}; -var p = mistplayers.myplayer.player; -p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - var ele = this.element('object'); - - //TODO your code here - - this.addlog('Built html'); - callback(ele); -} diff --git a/embed/wrappers/theoplayer.js b/embed/wrappers/theoplayer.js deleted file mode 100644 index eccca492..00000000 --- a/embed/wrappers/theoplayer.js +++ /dev/null @@ -1,53 +0,0 @@ -mistplayers.theoplayer = { - name: 'TheoPlayer', - version: '0.2', - mimes: ['html5/application/vnd.apple.mpegurl','dash/video/mp4'], - priority: Object.keys(mistplayers).length + 1, - isMimeSupported: function (mimetype) { - return (this.mimes.indexOf(mimetype) == -1 ? false : true); - }, - isBrowserSupported: function (mimetype) { - //TODO like, actually check the browser or something? - if (typeof theoplayer == 'function') { - return true; - } - return false; - }, - player: function(){} -}; -var p = mistplayers.theoplayer.player; -p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { - var ele = this.getElement('video'); - - ele.src = options.src; - ele.width = options.width; - ele.height = options.height; - - if (options.controls) { - ele.setAttribute('controls',''); - } - if (options.autoplay) { - ele.setAttribute('autoplay',''); - } - if (options.loop) { - ele.setAttribute('loop',''); - } - if (options.poster) { - ele.setAttribute('poster',options.poster); - } - - this.theoplayer = theoplayer(ele); - - this.addlog('Built html'); - callback(ele); -} -p.prototype.play = function(){ return this.theoplayer.play(); }; -p.prototype.pause = function(){ return this.theoplayer.pause(); }; -p.prototype.volume = function(level){ - if (typeof level == 'undefined' ) { return this.theoplayer.volume; } - return this.theoplayer.volume = level; -}; -p.prototype.fullscreen = function(){ - return this.theoplayer.requestFullscreen(); -}; diff --git a/embed/wrappers/videojs.js b/embed/wrappers/videojs.js index 178afecc..80413376 100644 --- a/embed/wrappers/videojs.js +++ b/embed/wrappers/videojs.js @@ -1,221 +1,208 @@ mistplayers.videojs = { - name: 'VideoJS player', - version: '1.1', - mimes: ['html5/video/mp4','html5/application/vnd.apple.mpegurl','html5/video/ogg','html5/video/webm'], - priority: Object.keys(mistplayers).length + 1, + name: "VideoJS player", + mimes: ["html5/application/vnd.apple.mpegurl"], + priority: MistUtil.object.keys(mistplayers).length + 1, isMimeSupported: function (mimetype) { return (this.mimes.indexOf(mimetype) == -1 ? false : true); }, - isBrowserSupported: function (mimetype,source,options,streaminfo,logfunc) { + isBrowserSupported: function (mimetype,source,MistVideo) { - //dont use https if the player is loaded over http - if ((options.host.substr(0,7) == 'http://') && (source.url.substr(0,8) == 'https://')) { - if (logfunc) { logfunc('HTTP/HTTPS mismatch for this source'); } + //check for http/https mismatch + if (location.protocol != MistUtil.http.url.split(source.url).protocol) { + MistVideo.log("HTTP/HTTPS mismatch for this source"); return false; } - //dont use videojs if this location is loaded over file:// - if ((location.protocol == 'file:') && (mimetype == 'html5/application/vnd.apple.mpegurl')) { - if (logfunc) { logfunc('This source ('+mimetype+') won\'t work if the page is run via file://'); } + //don't use videojs if this location is loaded over file:// + if ((location.protocol == "file:") && (mimetype == "html5/application/vnd.apple")) { + MistVideo.log("This source ("+mimetype+") won't load if the page is run via file://"); return false; } - //dont use HLS if there is an MP3 audio track, unless we're on apple or edge - if ((mimetype == 'html5/application/vnd.apple.mpegurl') && (['iPad','iPhone','iPod','MacIntel'].indexOf(navigator.platform) == -1) && (navigator.userAgent.indexOf('Edge') == -1)) { - var audio = false; - var nonmp3 = false; - for (var i in streaminfo.meta.tracks) { - var t = streaminfo.meta.tracks[i]; - if (t.type == 'audio') { - audio = true; - if (t.codec != 'MP3') { - nonmp3 = true; - } - } - } - if ((audio) && (!nonmp3)) { - if (logfunc) { logfunc('This source has audio, but only MP3, and this browser can\'t play MP3 via HLS'); } - return false; - } - } - - - return ('MediaSource' in window); + return ("MediaSource" in window); }, - player: function(){this.onreadylist = [];} + player: function(){}, + scriptsrc: function(host) { return host+"/videojs.js"; } }; var p = mistplayers.videojs.player; p.prototype = new MistPlayer(); -p.prototype.build = function (options,callback) { +p.prototype.build = function (MistVideo,callback) { var me = this; //to allow nested functions to access the player class itself - function onplayerload () { - me.addlog('Building VideoJS player..'); + function onVideoJSLoad () { + if (MistVideo.destroyed) { return;} - var cont = document.createElement('div'); - cont.className = 'mistplayer'; + MistVideo.log("Building VideoJS player.."); - var ele = me.getElement('video'); - cont.appendChild(ele); - ele.className = ''; - if (options.source.type != "html5/video/ogg") { - ele.crossOrigin = 'anonymous'; //required for subtitles, but if ogg, the video won't load + var ele = document.createElement("video"); + if (MistVideo.source.type != "html5/video/ogg") { + ele.crossOrigin = "anonymous"; //required for subtitles, but if ogg, the video won"t load } - var shortmime = options.source.type.split('/'); + var shortmime = MistVideo.source.type.split("/"); shortmime.shift(); - var source = document.createElement('source'); - source.setAttribute('src',options.src); + var source = document.createElement("source"); + source.setAttribute("src",MistVideo.source.url); me.source = source; ele.appendChild(source); - source.type = shortmime.join('/'); - me.addlog('Adding '+source.type+' source @ '+options.src); - if (source.type == 'application/vnd.apple.mpegurl') { source.type = 'application/x-mpegURL'; } + source.type = shortmime.join("/"); + MistVideo.log("Adding "+source.type+" source @ "+MistVideo.source.url); + if (source.type == "application/vnd.apple.mpegurl") { source.type = "application/x-mpegURL"; } - ele.className += ' video-js'; - ele.width = options.width; - ele.height = options.height; - ele.style.width = options.width+'px'; - ele.style.height = options.height+'px'; + MistUtil.class.add(ele,"video-js"); - var vjsopts = { - preload: 'auto' - }; + var vjsopts = {}; - if (options.autoplay) { vjsopts.autoplay = true; } - if (options.loop) { + if (MistVideo.options.autoplay) { vjsopts.autoplay = true; } + if ((MistVideo.options.loop) && (MistVideo.info.type != "live")) { vjsopts.loop = true; ele.loop = true; } - if (options.poster) { vjsopts.poster = options.poster; } - if (options.controls) { - if ((options.controls == 'stock') || (!me.buildMistControls())) { - //MistControls have failed to build in the if condition - ele.setAttribute('controls',true); + if (MistVideo.options.poster) { vjsopts.poster = MistVideo.options.poster; } + if (MistVideo.options.controls == "stock") { + ele.setAttribute("controls",""); + if (!document.getElementById("videojs-css")) { + var style = document.createElement("link"); + style.rel = "stylesheet"; + style.href = MistVideo.options.host+"/skins/videojs.css"; + style.id = "videojs-css"; + document.head.appendChild(style); } } me.onready(function(){ me.videojs = videojs(ele,vjsopts,function(){ - me.addlog('Videojs initialized'); + MistVideo.log("Videojs initialized"); }); + + me.api.unload = function(){ + videojs(ele).dispose(); + }; }); - me.addlog('Built html'); + MistVideo.log("Built html"); - //forward events - ele.addEventListener('error',function(e){ - if (!e.isTrusted) { return; } //don't trigger on errors we have thrown ourselves + if (("Proxy" in window) && ("Reflect" in window)) { + var overrides = { + get: {}, + set: {} + }; - var msg; - if ('message' in e) { - msg = e.message; - } - else { - msg = 'readyState: '; - switch (me.element.readyState) { - case 0: - msg += 'HAVE_NOTHING'; - break; - case 1: - msg += 'HAVE_METADATA'; - break; - case 2: - msg += 'HAVE_CURRENT_DATA'; - break; - case 3: - msg += 'HAVE_FUTURE_DATA'; - break; - case 4: - msg += 'HAVE_ENOUGH_DATA'; - break; + MistVideo.player.api = new Proxy(ele,{ + get: function(target, key, receiver){ + if (key in overrides.get) { + return overrides.get[key].apply(target, arguments); + } + var method = target[key]; + if (typeof method === "function"){ + return function () { + return method.apply(target, arguments); + } + } + return method; + }, + set: function(target, key, value) { + if (key in overrides.set) { + return overrides.set[key].call(target,value); + } + return target[key] = value; } - msg += ' networkState: '; - switch (me.element.networkState) { - case 0: - msg += 'NETWORK_EMPTY'; - break; - case 1: - msg += 'NETWORK_IDLE'; - break; - case 2: - msg += 'NETWORK_LOADING'; - break; - case 3: - msg += 'NETWORK_NO_SOURCE'; - break; - } - } - - me.adderror(msg); - - }); - var events = ['abort','canplay','canplaythrough','durationchange','emptied','ended','interruptbegin','interruptend','loadeddata','loadedmetadata','loadstart','pause','play','playing','ratechange','seeked','seeking','stalled','volumechange','waiting','progress']; - for (var i in events) { - ele.addEventListener(events[i],function(e){ - me.addlog('Player event fired: '+e.type); }); + + if (MistVideo.info.type == "live") { + function getLastBuffer(video) { + var buffer_end = 0; + if (video.buffered.length) { + buffer_end = video.buffered.end(video.buffered.length-1) + } + return buffer_end; + } + var HLSlatency = 90; //best guess.. + + overrides.get.duration = function(){ + return (MistVideo.info.lastms + (new Date()).getTime() - MistVideo.info.updated.getTime())*1e-3; + }; + MistVideo.player.api.lastProgress = new Date(); + MistVideo.player.api.liveOffset = 0; + + MistUtil.event.addListener(ele,"progress",function(){ + MistVideo.player.api.lastProgress = new Date(); + }); + overrides.set.currentTime = function(value){ + var diff = MistVideo.player.api.currentTime - value; + var offset = value - MistVideo.player.api.duration; + //MistVideo.player.api.liveOffset = offset; + + MistVideo.log("Seeking to "+MistUtil.format.time(value)+" ("+Math.round(offset*-10)/10+"s from live)"); + MistVideo.video.currentTime -= diff; + } + overrides.get.currentTime = function(){ + return this.currentTime + MistVideo.info.lastms*1e-3 - MistVideo.player.api.liveOffset - HLSlatency; + } + } + } + else { + me.api = ele; } - callback(cont); + MistVideo.player.setSize = function(size){ + if ("videojs" in MistVideo.player) { + MistVideo.player.videojs.dimensions(size.width,size.height); + + //for some reason, the videojs' container won't be resized with the method above. + //so let's cheat and do it ourselves + ele.parentNode.style.width = size.width+"px"; + ele.parentNode.style.height = size.height+"px"; + } + this.api.style.width = size.width+"px"; + this.api.style.height = size.height+"px"; + }; + MistVideo.player.api.setSource = function(url) { + if (!MistVideo.player.videojs) { return; } + if (MistVideo.player.videojs.src() != url) { + MistVideo.player.videojs.src({ + type: MistVideo.player.videojs.currentSource().type, + src: url + }); + } + }; + MistVideo.player.api.setSubtitle = function(trackmeta) { + //remove previous subtitles + var tracks = ele.getElementsByTagName("track"); + for (var i = tracks.length - 1; i >= 0; i--) { + ele.removeChild(tracks[i]); + } + if (trackmeta) { //if the chosen track exists + //add the new one + var track = document.createElement("track"); + ele.appendChild(track); + track.kind = "subtitles"; + track.label = trackmeta.label; + track.srclang = trackmeta.lang; + track.src = trackmeta.src; + track.setAttribute("default",""); + } + }; + + callback(ele); } - if ('videojs' in window) { - onplayerload(); + if ("videojs" in window) { + onVideoJSLoad(); } else { //load the videojs player - var scripttag = document.createElement('script'); - scripttag.src = options.host+'/videojs.js'; - me.addlog('Retrieving videojs player code from '+scripttag.src); - document.head.appendChild(scripttag); - scripttag.onerror = function(){ - me.askNextCombo('Failed to load videojs.js'); - } - scripttag.onload = function(){ - onplayerload(); - } + + var scripttag = MistUtil.scripts.insert(MistVideo.urlappend(mistplayers.videojs.scriptsrc(MistVideo.options.host)),{ + onerror: function(e){ + var msg = "Failed to load videojs.js"; + if (e.message) { msg += ": "+e.message; } + MistVideo.showError(msg); + }, + onload: onVideoJSLoad + },MistVideo); + } } -p.prototype.play = function(){ return this.element.play(); }; -p.prototype.pause = function(){ return this.element.pause(); }; -p.prototype.volume = function(level){ - if (typeof level == 'undefined' ) { return this.element.volume; } - return this.element.volume = level; -}; -p.prototype.loop = function(bool){ - if (typeof bool == 'undefined') { - return this.element.loop; - } - return this.element.loop = bool; -}; -p.prototype.load = function(){ return this.element.load(); }; -if (document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) { - p.prototype.fullscreen = function(){ - if(this.element.requestFullscreen) { - return this.element.requestFullscreen(); - } else if(this.element.mozRequestFullScreen) { - return this.element.mozRequestFullScreen(); - } else if(this.element.webkitRequestFullscreen) { - return this.element.webkitRequestFullscreen(); - } else if(this.element.msRequestFullscreen) { - return this.element.msRequestFullscreen(); - } - }; -} -p.prototype.updateSrc = function(src){ - if ("videojs" in this) { - if (src == '') { - this.videojs.dispose(); - return; - } - this.videojs.src({ - src: src, - type: this.source.type - }); - return true; - } - return false; -}; diff --git a/embed/wrappers/webrtc.js b/embed/wrappers/webrtc.js new file mode 100644 index 00000000..fd54f6cc --- /dev/null +++ b/embed/wrappers/webrtc.js @@ -0,0 +1,429 @@ +mistplayers.webrtc = { + name: "WebRTC player", + mimes: ["webrtc"], + priority: MistUtil.object.keys(mistplayers).length + 1, + isMimeSupported: function (mimetype) { + return (this.mimes.indexOf(mimetype) == -1 ? false : true); + }, + isBrowserSupported: function (mimetype,source,MistVideo) { + + if ((!("WebSocket" in window)) || (!("RTCPeerConnection" in window))) { return false; } + + //check for http/https mismatch + if (location.protocol.replace(/^http/,"ws") != MistUtil.http.url.split(source.url.replace(/^http/,"ws")).protocol) { + MistVideo.log("HTTP/HTTPS mismatch for this source"); + return false; + } + + return true; + }, + player: function(){} +}; +var p = mistplayers.webrtc.player; +p.prototype = new MistPlayer(); +p.prototype.build = function (MistVideo,callback) { + var me = this; + + if ((typeof WebRTCBrowserEqualizerLoaded == "undefined") || (!WebRTCBrowserEqualizerLoaded)) { + //load it + var scripttag = document.createElement("script"); + scripttag.src = MistVideo.urlappend(MistVideo.options.host+"/webrtc.js"); + MistVideo.log("Retrieving webRTC browser equalizer code from "+scripttag.src); + document.head.appendChild(scripttag); + scripttag.onerror = function(){ + MistVideo.showError("Failed to load webrtc browser equalizer",{nextCombo:5}); + } + scripttag.onload = function(){ + me.build(MistVideo,callback); + } + return; + } + + var video = document.createElement("video"); + + //apply options + var attrs = ["autoplay","loop","poster"]; + for (var i in attrs) { + var attr = attrs[i]; + if (MistVideo.options[attr]) { + video.setAttribute(attr,(MistVideo.options[attr] === true ? "" : MistVideo.options[attr])); + } + } + if (MistVideo.info.type == "live") { + video.loop = false; + } + if (MistVideo.options.controls == "stock") { + video.setAttribute("controls",""); + } + video.setAttribute("crossorigin","anonymous"); + this.setSize = function(size){ + video.style.width = size.width+"px"; + video.style.height = size.height+"px"; + }; + MistUtil.event.addListener(video,"loadeddata",correctSubtitleSync); + MistUtil.event.addListener(video,"seeked",correctSubtitleSync); + + var seekoffset = 0; + var hasended = false; + this.listeners = { + on_connected: function() { + seekoffset = 0; + hasended = false; + this.webrtc.play(); + }, + on_disconnected: function() { + MistVideo.log("Websocket sent on_disconnect"); + /* + If a VoD file ends, we receive an on_stop, but no on_disconnect + If a live stream ends, we receive an on_disconnect, but no on_stop + If MistOutWebRTC crashes, we receive an on_stop and then an on_disconnect + */ + if (hasended) { + MistVideo.showError("Connection to media server ended unexpectedly."); + } + video.pause(); + }, + on_answer_sdp: function (ev) { + if (!ev.result) { + MistVideo.showError("Failed to open stream."); + this.on_disconnected(); + return; + } + MistVideo.log("SDP answer received"); + }, + on_time: function(ev) { + //timeupdate + var oldoffset = seekoffset; + seekoffset = ev.current*1e-3 - video.currentTime; + if (Math.abs(oldoffset - seekoffset) > 1) { correctSubtitleSync(); } + + var d = (ev.end == 0 ? Infinity : ev.end*1e-3); + if (d != duration) { + duration = d; + MistUtil.event.send("durationchange",d,video); + } + }, + on_seek: function(){ + MistUtil.event.send("seeked",seekoffset,video); + video.play(); + }, + on_stop: function(){ + MistVideo.log("Websocket sent on_stop"); + MistUtil.event.send("ended",null,video); + hasended = true; + } + }; + + + function WebRTCPlayer(){ + this.peerConn = null; + this.localOffer = null; + this.isConnected = false; + var thisWebRTCPlayer = this; + + this.on_event = function(ev) { + //if (ev.type != "on_time") { console.log(ev); } + switch (ev.type) { + case "on_connected": { + thisWebRTCPlayer.isConnected = true; + break; + } + case "on_answer_sdp": { + thisWebRTCPlayer.peerConn + .setRemoteDescription({ type: "answer", sdp: ev.answer_sdp }) + .then(function(){}, function(err) { + console.error(err); + }); + break; + } + case "on_disconnected": { + thisWebRTCPlayer.isConnected = false; + break; + } + } + if (ev.type in me.listeners) { + return me.listeners[ev.type].call(me,ev); + } + MistVideo.log("Unhandled WebRTC event "+ev.type+": "+JSON.stringify(ev)); + return false; + }; + + this.connect = function(callback){ + thisWebRTCPlayer.signaling = new WebRTCSignaling(thisWebRTCPlayer.on_event); + thisWebRTCPlayer.peerConn = new RTCPeerConnection(); + thisWebRTCPlayer.peerConn.ontrack = function(ev) { + video.srcObject = ev.streams[0]; + if (callback) { callback(); } + }; + }; + + this.play = function(){ + if (!this.isConnected) { + throw "Not connected, cannot play"; + } + + this.peerConn + .createOffer({ + offerToReceiveAudio: true, + offerToReceiveVideo: true, + }) + .then(function(offer){ + thisWebRTCPlayer.localOffer = offer; + thisWebRTCPlayer.peerConn + .setLocalDescription(offer) + .then(function(){ + thisWebRTCPlayer.signaling.sendOfferSDP(thisWebRTCPlayer.localOffer.sdp); + }, function(err){console.error(err)}); + }, function(err){ throw err; }); + }; + + this.stop = function(){ + if (!this.isConnected) { throw "Not connected, cannot stop." } + this.signaling.send({type: "stop"}); + }; + this.seek = function(seekTime){ + if (!this.isConnected) { return; } + this.signaling.send({type: "seek", "seek_time": seekTime*1e3}); + }; + this.pause = function(){ + if (!this.isConnected) { throw "Not connected, cannot pause." } + this.signaling.send({type: "pause"}); + }; + this.setTrack = function(obj){ + if (!this.isConnected) { throw "Not connected, cannot set track." } + obj.type = "tracks"; + this.signaling.send(obj); + }; + this.getStats = function(callback){ + this.peerConn.getStats().then(function(d){ + var output = {}; + var entries = Array.from(d.entries()); + for (var i in entries) { + var value = entries[i]; + if (value[1].type == "inbound-rtp") { + output[value[0]] = value[1]; + } + } + callback(output); + }); + }; + //input only + /* + this.sendVideoBitrate = function(bitrate) { + this.send({type: "video_bitrate", video_bitrate: bitrate}); + }; + */ + + this.connect(); + } + function WebRTCSignaling(onEvent){ + this.ws = null; + + this.ws = new WebSocket(MistVideo.source.url.replace(/^http/,"ws")); + + this.ws.onopen = function() { + onEvent({type: "on_connected"}); + }; + + this.ws.onmessage = function(e) { + try { + var cmd = JSON.parse(e.data); + onEvent(cmd); + } + catch (err) { + console.error("Failed to parse a response from MistServer",err,e.data); + } + }; + + /* See http://tools.ietf.org/html/rfc6455#section-7.4.1 */ + this.ws.onclose = function(ev) { + switch (ev.code) { + default: { + onEvent({type: "on_disconnected"}); + break; + } + } + } + + this.sendOfferSDP = function(sdp) { + this.send({type: "offer_sdp", offer_sdp: sdp}); + }; + this.send = function(cmd) { + if (!this.ws) { + throw "Not initialized, cannot send "+JSON.stringify(cmd); + } + this.ws.send(JSON.stringify(cmd)); + } + }; + + this.webrtc = new WebRTCPlayer(); + + this.api = {}; + + //override video duration + var duration; + Object.defineProperty(this.api,"duration",{ + get: function(){ return duration; } + }); + + //override seeking + Object.defineProperty(this.api,"currentTime",{ + get: function(){ + return seekoffset + video.currentTime; + }, + set: function(value){ + seekoffset = value - video.currentTime; + video.pause(); + me.webrtc.seek(value); + MistUtil.event.send("seeking",value,video); + } + }); + + //redirect properties + //using a function to make sure the "item" is in the correct scope + function reroute(item) { + Object.defineProperty(me.api,item,{ + get: function(){ return video[item]; }, + set: function(value){ + return video[item] = value; + } + }); + } + var list = [ + "volume" + ,"muted" + ,"loop" + ,"paused", + ,"error" + ,"textTracks" + ,"webkitDroppedFrameCount" + ,"webkitDecodedFrameCount" + ]; + for (var i in list) { + reroute(list[i]); + } + + //redirect methods + function redirect(item) { + if (item in video) { + me.api[item] = function(){ + return video[item].call(video,arguments); + }; + } + } + var list = ["load","getVideoPlaybackQuality"]; + for (var i in list) { + redirect(list[i]); + } + + //redirect play + me.api.play = function(){ + if (me.api.currentTime) { + if ((!me.webrtc.isConnected) || (me.webrtc.peerConn.iceConnectionState != "completed")) { + me.webrtc.connect(function(){ + me.webrtc.seek(me.api.currentTime); + }); + } + else { + me.webrtc.seek(me.api.currentTime); + } + } + else { + video.play(); + } + }; + + //redirect pause + me.api.pause = function(){ + video.pause(); + try { + me.webrtc.pause(); + } + catch (e) {} + MistUtil.event.send("paused",null,video); + }; + + me.api.setTracks = function(obj){ + me.webrtc.setTrack(obj); + }; + function correctSubtitleSync() { + if (!me.api.textTracks[0]) { return; } + var currentoffset = me.api.textTracks[0].currentOffset || 0; + if (Math.abs(seekoffset - currentoffset) < 1) { return; } //don't bother if the change is small + var newCues = []; + for (var i = me.api.textTracks[0].cues.length-1; i >= 0; i--) { + var cue = me.api.textTracks[0].cues[i]; + me.api.textTracks[0].removeCue(cue); + if (!("orig" in cue)) { + cue.orig = {start:cue.startTime,end:cue.endTime}; + } + cue.startTime = cue.orig.start - seekoffset; + cue.endTime = cue.orig.end - seekoffset; + newCues.push(cue); + } + for (var i in newCues) { + me.api.textTracks[0].addCue(newCues[i]); + } + me.api.textTracks[0].currentOffset = seekoffset; + } + me.api.setSubtitle = function(trackmeta) { + //remove previous subtitles + var tracks = video.getElementsByTagName("track"); + for (var i = tracks.length - 1; i >= 0; i--) { + video.removeChild(tracks[i]); + } + if (trackmeta) { //if the chosen track exists + //add the new one + var track = document.createElement("track"); + video.appendChild(track); + track.kind = "subtitles"; + track.label = trackmeta.label; + track.srclang = trackmeta.lang; + track.src = trackmeta.src; + track.setAttribute("default",""); + + //correct timesync + track.onload = correctSubtitleSync; + } + }; + + //loop + MistUtil.event.addListener(video,"ended",function(){ + if (me.api.loop) { + me.webrtc.connect(); + } + }); + + if ("decodingIssues" in MistVideo.skin.blueprints) { + //get additional dev stats + var vars = ["nackCount","pliCount","packetsLost","packetsReceived","bytesReceived"]; + for (var j in vars) { + me.api[vars[j]] = 0; + } + var f = function() { + MistVideo.timers.start(function(){ + me.webrtc.getStats(function(d){ + for (var i in d) { + for (var j in vars) { + if (vars[j] in d[i]) { + me.api[vars[j]] = d[i][vars[j]]; + } + } + break; + } + }); + f(); + },1e3); + }; + f(); + } + + me.api.unload = function(){ + try { + me.webrtc.stop(); + } catch (e) {} + }; + + callback(video); + +}; diff --git a/src/embed.js b/src/embed.js deleted file mode 100644 index 264c3e38..00000000 --- a/src/embed.js +++ /dev/null @@ -1,327 +0,0 @@ -function mistembed(streamname) { - - //find the current script - var me; - if (('currentScript' in document) && (document.currentScript)) { - me = document.currentScript; - //not supported in old browsers :( - } - else { - var scripts = document.getElementsByTagName('script'); - me = scripts[scripts.length - 1]; - //not correct if the script is inserted dynamically, but this is how it used to be - } - - - // return the current flash version - function flash_version() { - var version = 0; - - try { - // check in the mimeTypes - version = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\.])/g, '').split('.')[0]; - } catch(e){} - try { - // for our special friend IE - version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable("$version").replace(/([^0-9\,])/g, '').split(',')[0]; - } catch(e){} - - return parseInt(version, 10); - }; - - // return true if silverlight is installed - function silverlight_installed() { - var plugin; - - try { - // check in the mimeTypes - plugin = navigator.plugins["Silverlight Plug-In"]; - return !!plugin; - } catch(e){} - try { - // for our special friend IE - plugin = new ActiveXObject('AgControl.AgControl'); - return true; - } catch(e){} - - return false; - }; - - // return true if the browser thinks it can play the mimetype - function html5_video_type(type) { - var support = false; - - - if (type == 'video/mp4') { - if ((navigator.userAgent.indexOf('MSIE') > -1) && (parseInt(navigator.userAgent.split('MSIE')[1]) <= 9)) { - //IE <= 9 doesn't support MP4, Firefox seems to correctly see it now. - return false; - } - if (navigator.userAgent.indexOf('Firefox') > -1) { - //firefox claims to support MP4 but doesn't when: - // - under win xp - // - the stream is live - - if (video.type == 'live') { - return false; - } - //find "Windows NT X;" in user userAgent - //sorry, I don't like regexes.. I avoid them when I can :$ - var s = navigator.userAgent.split('Windows NT '); - if (s.length > 1) { - s = s[1].split(';'); - s = s[0]; - if (Number(s) <= 5.1) { - return false; - } - } - } - } - - - try { - var v = document.createElement('video'); - - if( v && v.canPlayType(type) != "" ) - { - support = true; // true-ish, anyway - } - } catch(e){} - - return support; - } - - //return true if rtsp is supported - function rtsp_support() { - var plugin; - - try { - // check in the mimeTypes - plugin = navigator.mimeTypes["application/x-google-vlc-plugin"]; - return !!plugin; - } catch(e){} - try { - // for our special friend IE - plugin = new ActiveXObject('VideoLAN.Vlcplugin.1'); - return true; - } catch(e){} - - return false; - } - - // parse a "type" string from the controller. Format: - // xxx/# (e.g. flash/3) or xxx/xxx/xxx (e.g. html5/application/ogg) - function parseType(type) { - var split = type.split('/'); - - if( split.length > 2 ) { - split[1] += '/' + split[2]; - } - - return split; - } - - // return true if a type is supported - function hasSupport(type) { - var typemime = parseType(type); - - switch(typemime[0]) { - case 'flash': return flash_version() >= parseInt(typemime[1], 10); break; - case 'html5': return html5_video_type(typemime[1]); break; - case 'rtsp': return rtsp_support(); break; - case 'silverlight': return silverlight_installed(); break; - default: return false; break; - } - } - - - // build HTML for certain kinds of types - function buildPlayer(src, container, videowidth, videoheight, vtype) { - // used to recalculate the width/height - var ratio; - - // get the container's width/height - var containerwidth = parseInt(container.clientWidth, 10); - var containerheight = parseInt(container.clientHeight, 10); - - if(videowidth > containerwidth && containerwidth > 0) { - ratio = videowidth / containerwidth; - - videowidth /= ratio; - videoheight /= ratio; - } - - if(videoheight > containerheight && containerheight > 0) { - ratio = videoheight / containerheight; - - videowidth /= ratio; - videoheight /= ratio; - } - - var maintype = parseType(src.type); - mistvideo[streamname].embedded = src; - - switch(maintype[0]) { - case 'flash': - // maintype[1] is already checked (i.e. user has version > maintype[1]) - var flashplayer, - url = encodeURIComponent(src.url) + '&controlBarMode=floating&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3' + (vtype == 'live' ? "&streamType=live" : "") + (autoplay ? '&autoPlay=true' : ''); - - /* - if( parseInt(maintype[1], 10) >= 10 ) { - flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf'; - } - else { - flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf'; - } - */ - flashplayer = src.player_url; - - container.innerHTML += '<object width="' + videowidth + '" height="' + videoheight + '">' + - '<param name="movie" value="' + flashplayer + '"></param>' + - '<param name="flashvars" value="src=' + url + '"></param>' + - '<param name="allowFullScreen" value="true"></param>' + - '<param name="allowscriptaccess" value="always"></param>' + - '<param name="wmode" value="direct"></param>' + - (autoplay ? '<param name="autoPlay" value="true">' : '') + - '<embed src="' + flashplayer + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + videowidth + '" height="' + videoheight + '" flashvars="src=' + url + '"></embed>' + - '</object>'; - break; - - case 'html5': - container.innerHTML += '<video width="' + videowidth + '" height="' + videoheight + '" src="' + src.url + '" controls="controls" '+(autoplay ? 'autoplay="autoplay"' : '')+'><strong>No HTML5 video support</strong></video>'; - break; - - case 'rtsp': - /*container.innerHTML += '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+videowidth+'" height="'+videoheight+'">'+ - '<param name="src" value="'+encodeURI(src.url)+'">'+ - '<param name="console" value="video1">'+ - '<param name="controls" value="All">'+ - '<param name="autostart" value="false">'+ - '<param name="loop" value="false">'+ - '<embed name="myMovie" src="'+encodeURI(src.url)+'" width="'+videowidth+'" height="'+videoheight+'" autostart="false" loop="false" nojava="true" console="video1" controls="All"></embed>'+ - '<noembed>Something went wrong.</noembed>'+ - '</object>'; //realplayer, doesnt work */ - container.innerHTML += '<embed type="application/x-google-vlc-plugin"'+ - 'pluginspage="http://www.videolan.org"'+ - 'width="'+videowidth+'"'+ - 'height="'+videoheight+'"'+ - 'target="'+encodeURI(src.url)+'"'+ - 'autoplay="'+(autoplay ? 'yes' : 'no')+'"'+ - '>'+ - '</embed>'+ - '<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab">'+ - '</object>'; //vlc, seems to work, sort of. it's trying anyway - break; - - case 'silverlight': - container.innerHTML += '<object data="data:application/x-silverlight," type="application/x-silverlight" width="' + videowidth + '" height="' + videoheight + '">'+ - '<param name="source" value="' + encodeURI(src.url) + '/player.xap"/>'+ - '<param name="onerror" value="onSilverlightError" />'+ - '<param name="autoUpgrade" value="true" />'+ - '<param name="background" value="white" />'+ - '<param name="enableHtmlAccess" value="true" />'+ - '<param name="minRuntimeVersion" value="3.0.40624.0" />'+ - '<param name="initparams" value =\'autoload=false,'+(autoplay ? 'autoplay=true' : 'autoplay=false')+',displaytimecode=false,enablecaptions=true,joinLive=true,muted=false,playlist=<playList><playListItems><playListItem title="Test" description="testing" mediaSource="' + encodeURI(src.url) + '" adaptiveStreaming="true" thumbSource="" frameRate="25.0" width="" height=""></playListItem></playListItems></playList>\' />'+ - '<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a>'+ - '</object>'; - break; - default: - container.innerHTML += '<strong>Missing embed code for output type "'+src.type+'"</strong>'; - video.error = 'Missing embed code for output type "'+src.type; - } - } - - var video = mistvideo[streamname], - container = document.createElement('div'), - forceType = false, - forceSupportCheck = false, - autoplay = true, - urlappend = false; - - if (me.parentNode.hasAttribute('data-forcetype')) { - forceType = me.parentNode.getAttribute('data-forcetype'); - } - if (me.parentNode.hasAttribute('data-forcesupportcheck')) { - forceSupportCheck = true; - } - if (me.parentNode.hasAttribute('data-noautoplay')) { - autoplay = false; - } - if (me.parentNode.hasAttribute('data-urlappend')) { - urlappend = me.parentNode.getAttribute('data-urlappend'); - } - - if (video.width == 0) { video.width = 250; } - if (video.height == 0) { video.height = 250; } - - // create the container - me.parentNode.insertBefore(container, me); - // set the class to 'mistvideo' - container.setAttribute('class', 'mistvideo'); - // remove script tag - me.parentNode.removeChild(me); - - if(video.error) { - // there was an error; display it - if (video.on_error){ - container.innerHTML = video.on_error; - }else{ - container.innerHTML = ['<strong>Error: ', video.error, '</strong>'].join(''); - } - } - else if ((typeof video.source == 'undefined') || (video.source.length < 1)) { - // no stream sources - if (video.on_error){ - container.innerHTML = video.on_error; - }else{ - container.innerHTML = '<strong>Error: no active source or compatible protocols for this stream</strong>'; - } - } - else { - // no error, and sources found. Check the video types and output the best - // available video player. - var i, - vtype = (video.type ? video.type : 'unknown'), - foundPlayer = false, - len = video.source.length; - - for (var i in video.source) { - var support = hasSupport(video.source[i].type); - video.source[i].browser_support = support; - if ((support) || (forceType)) { - if ((!forceType) || ((forceType) && (video.source[i].type.indexOf(forceType) >= 0))) { - if (foundPlayer === false) { - foundPlayer = i; - if (!forceSupportCheck) { - break; - } - } - } - } - } - if (foundPlayer === false) { - // of all the streams given, none was supported (eg. no flash and HTML5 video). Display error - container.innerHTML = '<strong>No support for any player found</strong>'; - } - else { - // we support this kind of video, so build it. - var source = video.source[foundPlayer]; - if (urlappend) { - source.url += urlappend; - source.relurl += urlappend; - } - else if (me.src.indexOf('?') != -1) { - var params = me.src.split('?'); - params.shift(); - params.join('?'); - source.url += '?'+params; - source.relurl += '?'+params; - } - buildPlayer(source, container, video.width, video.height, vtype); - } - } - - return (mistvideo[streamname].embedded ? mistvideo[streamname].embedded.type : false); - //keep empty line at end of file -} diff --git a/src/output/output_http_internal.cpp b/src/output/output_http_internal.cpp index c9aa5574..8e717a7d 100644 --- a/src/output/output_http_internal.cpp +++ b/src/output/output_http_internal.cpp @@ -114,9 +114,12 @@ namespace Mist { capa["url_match"].append("/info_$.js"); capa["url_match"].append("/json_$.js"); capa["url_match"].append("/player.js"); - capa["url_match"].append("/player.css"); capa["url_match"].append("/videojs.js"); capa["url_match"].append("/dashjs.js"); + capa["url_match"].append("/webrtc.js"); + capa["url_match"].append("/skins/default.css"); + capa["url_match"].append("/skins/dev.css"); + capa["url_match"].append("/skins/videojs.css"); capa["url_match"].append("/embed_$.js"); capa["url_match"].append("/flashplayer.swf"); capa["url_match"].append("/oldflashplayer.swf"); @@ -124,15 +127,11 @@ namespace Mist { capa["optional"]["wrappers"]["help"] = "Which players are attempted and in what order."; capa["optional"]["wrappers"]["default"] = ""; capa["optional"]["wrappers"]["type"] = "ord_multi_sel"; - /*capa["optional"]["wrappers"]["allowed"].append("theoplayer"); - capa["optional"]["wrappers"]["allowed"].append("jwplayer");*/ capa["optional"]["wrappers"]["allowed"].append("html5"); capa["optional"]["wrappers"]["allowed"].append("videojs"); capa["optional"]["wrappers"]["allowed"].append("dashjs"); - //capa["optional"]["wrappers"]["allowed"].append("polytrope"); //currently borked + capa["optional"]["wrappers"]["allowed"].append("webrtc"); capa["optional"]["wrappers"]["allowed"].append("flash_strobe"); - capa["optional"]["wrappers"]["allowed"].append("silverlight"); - capa["optional"]["wrappers"]["allowed"].append("img"); capa["optional"]["wrappers"]["option"] = "--wrappers"; capa["optional"]["wrappers"]["short"] = "w"; cfg->addConnectorOptions(8080, capa); @@ -294,6 +293,10 @@ namespace Mist { fullURL.protocol = getProtocolForPort(fullURL.getPort()); } std::string uAgent = H.GetHeader("User-Agent"); + + std::string devSkin = ""; + if (H.GetVar("dev").size()) { devSkin = ",skin:\"dev\""; } + H.Clean(); H.SetHeader("Content-Type", "text/html"); H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); @@ -307,7 +310,7 @@ namespace Mist { std::string hlsUrl = "/hls/"+streamName+"/index.m3u8"; std::string mp4Url = "/"+streamName+".mp4"; - H.SetBody("<!DOCTYPE html><html><head><title>"+streamName+"</title><style>body{color:white;background:black;}</style></head><body><div class=mistvideo id=\""+streamName+"\"><noscript><video controls autoplay><source src=\""+hlsUrl+"\" type=\"application/vnd.apple.mpegurl\"><source src=\""+mp4Url+"\" type=\"video/mp4\"><a href=\""+hlsUrl+"\">Click here to play the video [Apple]</a><br><a href=\""+mp4Url+"\">Click here to play the video [MP4]</a></video></noscript><script src=\"player.js\"></script><script>mistPlay('"+streamName+"',{host:'"+fullURL.getUrl()+"',target:document.getElementById('"+streamName+"')})</script></div></body></html>"); + H.SetBody("<!DOCTYPE html><html><head><title>"+streamName+"</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><style>html{margin:0;padding:0;display:table;width:100%;height:100%;}body{color:white;background:#0f0f0f;margin:0;padding:0;display:table-cell;vertical-align:middle;text-align:center}body>div>div{text-align:left;}</style></head><body><div class=mistvideo id=\""+streamName+"\"><noscript><video controls autoplay><source src=\""+hlsUrl+"\" type=\"application/vnd.apple.mpegurl\"><source src=\""+mp4Url+"\" type=\"video/mp4\"><a href=\""+hlsUrl+"\">Click here to play the video [Apple]</a><br><a href=\""+mp4Url+"\">Click here to play the video [MP4]</a></video></noscript><script src=\"player.js\"></script><script>mistPlay('"+streamName+"',{host:'"+fullURL.getUrl()+"',target:document.getElementById('"+streamName+"')"+devSkin+"})</script></div></body></html>"); if ((uAgent.find("iPad") != std::string::npos) || (uAgent.find("iPod") != std::string::npos) || (uAgent.find("iPhone") != std::string::npos)) { H.SetHeader("Location",hlsUrl); H.SendResponse("307", "HLS redirect", myConn); @@ -568,7 +571,7 @@ namespace Mist { return; } - if ((H.url.length() > 9 && H.url.substr(0, 6) == "/info_" && H.url.substr(H.url.length() - 3, 3) == ".js") || (H.url.length() > 10 && H.url.substr(0, 7) == "/embed_" && H.url.substr(H.url.length() - 3, 3) == ".js") || (H.url.length() > 9 && H.url.substr(0, 6) == "/json_" && H.url.substr(H.url.length() - 3, 3) == ".js")){ + if ((H.url.length() > 9 && H.url.substr(0, 6) == "/info_" && H.url.substr(H.url.length() - 3, 3) == ".js") || (H.url.length() > 9 && H.url.substr(0, 6) == "/json_" && H.url.substr(H.url.length() - 3, 3) == ".js")){ if (websocketHandler()){return;} std::string reqHost = HTTP::URL(H.GetHeader("Host")).host; std::string useragent = H.GetVar("ua"); @@ -600,24 +603,13 @@ namespace Mist { }else{ response = json_resp.toString(); } - if (rURL.substr(0, 7) == "/embed_" && !json_resp.isMember("error")){ - #include "embed.js.h" - response.append("\n("); - if (embed_js[embed_js_len - 2] == ';'){//check if we have a trailing ;\n or just \n - response.append((char*)embed_js, (size_t)embed_js_len - 2); //remove trailing ";\n" from xxd conversion - }else{ - response.append((char*)embed_js, (size_t)embed_js_len - 1); //remove trailing "\n" from xxd conversion - } - response.append("(\"" + streamName + "\"));\n"); - } H.SetBody(response); H.SendResponse("200", "OK", myConn); H.Clean(); return; } //embed code generator - - if (H.url == "/player.js"){ + if ((H.url == "/player.js") || ((H.url.substr(0, 7) == "/embed_") && (H.url.length() > 10) && (H.url.substr(H.url.length() - 3, 3) == ".js"))){ HTTP::URL fullURL(H.GetHeader("Host")); if (!fullURL.protocol.size()){ fullURL.protocol = getProtocolForPort(fullURL.getPort()); @@ -627,7 +619,7 @@ namespace Mist { H.Clean(); H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); H.setCORSHeaders(); - H.SetHeader("Content-Type", "application/javascript"); + H.SetHeader("Content-Type", "application/javascript; charset=utf-8"); if(method == "OPTIONS" || method == "HEAD"){ H.SendResponse("200", "OK", myConn); H.Clean(); @@ -635,8 +627,10 @@ namespace Mist { } response.append("if (typeof mistoptions == 'undefined') { mistoptions = {}; }\nif (!('host' in mistoptions)) { mistoptions.host = '"+fullURL.getUrl()+"'; }\n"); - #include "core.js.h" - response.append((char*)core_js, (size_t)core_js_len); + + #include "player.js.h" + response.append((char*)player_js, (size_t)player_js_len); + jsonForEach(config->getOption("wrappers",true),it){ bool used = false; if (it->asStringRef() == "html5"){ @@ -649,26 +643,6 @@ namespace Mist { response.append((char*)flash_strobe_js, (size_t)flash_strobe_js_len); used = true; } - if (it->asStringRef() == "silverlight"){ - #include "silverlight.js.h" - response.append((char*)silverlight_js, (size_t)silverlight_js_len); - used = true; - } - if (it->asStringRef() == "theoplayer"){ - #include "theoplayer.js.h" - response.append((char*)theoplayer_js, (size_t)theoplayer_js_len); - used = true; - } - if (it->asStringRef() == "jwplayer"){ - #include "jwplayer.js.h" - response.append((char*)jwplayer_js, (size_t)jwplayer_js_len); - used = true; - } - if (it->asStringRef() == "polytrope"){ - #include "polytrope.js.h" - response.append((char*)polytrope_js, (size_t)polytrope_js_len); - used = true; - } if (it->asStringRef() == "dashjs"){ #include "dashjs.js.h" response.append((char*)dash_js, (size_t)dash_js_len); @@ -679,9 +653,9 @@ namespace Mist { response.append((char*)video_js, (size_t)video_js_len); used = true; } - if (it->asStringRef() == "img"){ - #include "img.js.h" - response.append((char*)img_js, (size_t)img_js_len); + if (it->asStringRef() == "webrtc"){ + #include "webrtc.js.h" + response.append((char*)webrtc_js, (size_t)webrtc_js_len); used = true; } if (!used) { @@ -689,6 +663,10 @@ namespace Mist { } } + if ((rURL.substr(0, 7) == "/embed_") && (rURL.length() > 10) && (rURL.substr(rURL.length() - 3, 3) == ".js")){ + response.append("var container = document.createElement(\"div\");\ncontainer.id = \""+streamName+"\";\ndocument.write(container.outerHTML);\nmistPlay(\""+streamName+"\",{target:document.getElementById(\""+streamName+"\")});"); + } + H.SetBody(response); H.SendResponse("200", "OK", myConn); H.Clean(); @@ -696,8 +674,9 @@ namespace Mist { } - if (H.url == "/player.css"){ + if (H.url.substr(0, 7) == "/skins/"){ std::string response; + std::string url = H.url; H.Clean(); H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); H.setCORSHeaders(); @@ -708,8 +687,24 @@ namespace Mist { return; } - #include "mist.css.h" - response.append((char*)mist_css, (size_t)mist_css_len); + if (url == "/skins/default.css") { + #include "skin_default.css.h" + response.append((char*)skin_default_css, (size_t)skin_default_css_len); + } + else if (url == "/skins/dev.css") { + #include "skin_dev.css.h" + response.append((char*)skin_dev_css, (size_t)skin_dev_css_len); + } + else if (url == "/skins/videojs.css") { + #include "skin_videojs.css.h" + response.append((char*)skin_videojs_css, (size_t)skin_videojs_css_len); + } + else { + H.SetBody("Unknown stylesheet: "+url); + H.SendResponse("404", "Unknown stylesheet", myConn); + H.Clean(); + return; + } H.SetBody(response); H.SendResponse("200", "OK", myConn); @@ -728,10 +723,8 @@ namespace Mist { return; } - #include "playervideo.js.h" - response.append((char*)playervideo_js, (size_t)playervideo_js_len); - #include "playerhlsvideo.js.h" - response.append((char*)playerhlsvideo_js, (size_t)playerhlsvideo_js_len); + #include "player_video.js.h" + response.append((char*)player_video_js, (size_t)player_video_js_len); H.SetBody(response); H.SendResponse("200", "OK", myConn); @@ -750,10 +743,30 @@ namespace Mist { return; } - #include "playerdashlic.js.h" - response.append((char*)playerdashlic_js, (size_t)playerdashlic_js_len); - #include "playerdash.js.h" - response.append((char*)playerdash_js, (size_t)playerdash_js_len); + #include "player_dash_lic.js.h" + response.append((char*)player_dash_lic_js, (size_t)player_dash_lic_js_len); + #include "player_dash.js.h" + response.append((char*)player_dash_js, (size_t)player_dash_js_len); + + H.SetBody(response); + H.SendResponse("200", "OK", myConn); + H.Clean(); + return; + } + if (H.url == "/webrtc.js"){ + std::string response; + H.Clean(); + H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); + H.setCORSHeaders(); + H.SetHeader("Content-Type", "application/javascript"); + if (method == "OPTIONS" || method == "HEAD"){ + H.SendResponse("200", "OK", myConn); + H.Clean(); + return; + } + + #include "player_webrtc.js.h" + response.append((char*)player_webrtc_js, (size_t)player_webrtc_js_len); H.SetBody(response); H.SendResponse("200", "OK", myConn);